From d8df392da09eca9d3a9ba0efa5e9f85acdaac4a0 Mon Sep 17 00:00:00 2001 From: serjonya-trili Date: Sun, 26 May 2024 17:50:13 +0000 Subject: [PATCH] deploy: ce0f53841767b1d79102d8afc06d3c3a43eb5073 --- ...on-BcpEuM7C.js => DailyMotion-CteX4E3j.js} | 2 +- ...ebook-BS5pGh_M.js => Facebook-DXJhKi1H.js} | 2 +- ...yer-Bh28IGlb.js => FilePlayer-l0jhCgoe.js} | 2 +- ...altura-CJOVHMDM.js => Kaltura-Kwks3p2E.js} | 2 +- ...cloud-Dy1pFfJ_.js => Mixcloud-BcC5g1Wh.js} | 2 +- assets/{Mux-wTGJ9izo.js => Mux-BMhgBc2q.js} | 2 +- ...review-Dqy6JN7A.js => Preview-jzdirRGw.js} | 2 +- ...oud-CAYDm4MY.js => SoundCloud-DyFw8PPp.js} | 2 +- ...ble-Dpc5YVG-.js => Streamable-EfsHeeCs.js} | 2 +- ...{Twitch-MLiqQ3u5.js => Twitch-T6QqMvoo.js} | 2 +- ...idyard-DLcBd-dE.js => Vidyard-CsuXaKoc.js} | 2 +- .../{Vimeo-C1w4CmUB.js => Vimeo-OM6omvoU.js} | 2 +- ...{Wistia-Dh_p96TU.js => Wistia-Bl5F6sjb.js} | 2 +- ...ouTube-CxgmswCk.js => YouTube-rN4jOR1J.js} | 2 +- .../{index-aPKr3KfN.js => index-DoBafr3Z.js} | 152 +++++++++--------- index.html | 2 +- 16 files changed, 91 insertions(+), 91 deletions(-) rename assets/{DailyMotion-BcpEuM7C.js => DailyMotion-CteX4E3j.js} (97%) rename assets/{Facebook-BS5pGh_M.js => Facebook-DXJhKi1H.js} (98%) rename assets/{FilePlayer-Bh28IGlb.js => FilePlayer-l0jhCgoe.js} (99%) rename assets/{Kaltura-CJOVHMDM.js => Kaltura-Kwks3p2E.js} (97%) rename assets/{Mixcloud-Dy1pFfJ_.js => Mixcloud-BcC5g1Wh.js} (97%) rename assets/{Mux-wTGJ9izo.js => Mux-BMhgBc2q.js} (98%) rename assets/{Preview-Dqy6JN7A.js => Preview-jzdirRGw.js} (97%) rename assets/{SoundCloud-CAYDm4MY.js => SoundCloud-DyFw8PPp.js} (97%) rename assets/{Streamable-Dpc5YVG-.js => Streamable-EfsHeeCs.js} (97%) rename assets/{Twitch-MLiqQ3u5.js => Twitch-T6QqMvoo.js} (97%) rename assets/{Vidyard-DLcBd-dE.js => Vidyard-CsuXaKoc.js} (97%) rename assets/{Vimeo-C1w4CmUB.js => Vimeo-OM6omvoU.js} (98%) rename assets/{Wistia-Dh_p96TU.js => Wistia-Bl5F6sjb.js} (98%) rename assets/{YouTube-CxgmswCk.js => YouTube-rN4jOR1J.js} (98%) rename assets/{index-aPKr3KfN.js => index-DoBafr3Z.js} (73%) diff --git a/assets/DailyMotion-BcpEuM7C.js b/assets/DailyMotion-CteX4E3j.js similarity index 97% rename from assets/DailyMotion-BcpEuM7C.js rename to assets/DailyMotion-CteX4E3j.js index 711e4da11f..49b54476f8 100644 --- a/assets/DailyMotion-BcpEuM7C.js +++ b/assets/DailyMotion-CteX4E3j.js @@ -1 +1 @@ -import{g as P,r as v,u as D,p as O}from"./index-aPKr3KfN.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-DoBafr3Z.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-BS5pGh_M.js b/assets/Facebook-DXJhKi1H.js similarity index 98% rename from assets/Facebook-BS5pGh_M.js rename to assets/Facebook-DXJhKi1H.js index 3944e0917b..00b5f9f9fa 100644 --- a/assets/Facebook-BS5pGh_M.js +++ b/assets/Facebook-DXJhKi1H.js @@ -1 +1 @@ -import{g as _,r as g,u as P,p as m}from"./index-aPKr3KfN.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-DoBafr3Z.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-Bh28IGlb.js b/assets/FilePlayer-l0jhCgoe.js similarity index 99% rename from assets/FilePlayer-Bh28IGlb.js rename to assets/FilePlayer-l0jhCgoe.js index 52f258fd1b..0a6ebe5a01 100644 --- a/assets/FilePlayer-Bh28IGlb.js +++ b/assets/FilePlayer-l0jhCgoe.js @@ -1 +1 @@ -import{g as b,r as _,u as O,p as A}from"./index-aPKr3KfN.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-DoBafr3Z.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-CJOVHMDM.js b/assets/Kaltura-Kwks3p2E.js similarity index 97% rename from assets/Kaltura-CJOVHMDM.js rename to assets/Kaltura-Kwks3p2E.js index a535302106..0a8cc2e9c4 100644 --- a/assets/Kaltura-CJOVHMDM.js +++ b/assets/Kaltura-Kwks3p2E.js @@ -1 +1 @@ -import{g as y,r as f,u as _,p as m}from"./index-aPKr3KfN.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-DoBafr3Z.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-Dy1pFfJ_.js b/assets/Mixcloud-BcC5g1Wh.js similarity index 97% rename from assets/Mixcloud-Dy1pFfJ_.js rename to assets/Mixcloud-BcC5g1Wh.js index 46d2219aff..762cf12669 100644 --- a/assets/Mixcloud-Dy1pFfJ_.js +++ b/assets/Mixcloud-BcC5g1Wh.js @@ -1 +1 @@ -import{g as _,r as f,u as m,p as g}from"./index-aPKr3KfN.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-DoBafr3Z.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-wTGJ9izo.js b/assets/Mux-BMhgBc2q.js similarity index 98% rename from assets/Mux-wTGJ9izo.js rename to assets/Mux-BMhgBc2q.js index f7f5891fa7..9b1cbf02e8 100644 --- a/assets/Mux-wTGJ9izo.js +++ b/assets/Mux-BMhgBc2q.js @@ -1 +1 @@ -import{g as P,_ as E,r as g,p as _}from"./index-aPKr3KfN.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-DoBafr3Z.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-Dqy6JN7A.js b/assets/Preview-jzdirRGw.js similarity index 97% rename from assets/Preview-Dqy6JN7A.js rename to assets/Preview-jzdirRGw.js index 01d03cdd44..e3ec7c043c 100644 --- a/assets/Preview-Dqy6JN7A.js +++ b/assets/Preview-jzdirRGw.js @@ -1 +1 @@ -import{g as y,r as v}from"./index-aPKr3KfN.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-DoBafr3Z.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-CAYDm4MY.js b/assets/SoundCloud-DyFw8PPp.js similarity index 97% rename from assets/SoundCloud-CAYDm4MY.js rename to assets/SoundCloud-DyFw8PPp.js index 0c04d61013..1755fdd117 100644 --- a/assets/SoundCloud-CAYDm4MY.js +++ b/assets/SoundCloud-DyFw8PPp.js @@ -1 +1 @@ -import{g as P,r as g,u as b,p as v}from"./index-aPKr3KfN.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-DoBafr3Z.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-Dpc5YVG-.js b/assets/Streamable-EfsHeeCs.js similarity index 97% rename from assets/Streamable-Dpc5YVG-.js rename to assets/Streamable-EfsHeeCs.js index 744e17a009..8788b075a9 100644 --- a/assets/Streamable-Dpc5YVG-.js +++ b/assets/Streamable-EfsHeeCs.js @@ -1 +1 @@ -import{g as m,r as f,u as _,p as b}from"./index-aPKr3KfN.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-DoBafr3Z.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-MLiqQ3u5.js b/assets/Twitch-T6QqMvoo.js similarity index 97% rename from assets/Twitch-MLiqQ3u5.js rename to assets/Twitch-T6QqMvoo.js index 4d497f8ad3..39b0c2fc0e 100644 --- a/assets/Twitch-MLiqQ3u5.js +++ b/assets/Twitch-T6QqMvoo.js @@ -1 +1 @@ -import{g as w,r as D,u as C,p as N}from"./index-aPKr3KfN.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-DoBafr3Z.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-DLcBd-dE.js b/assets/Vidyard-CsuXaKoc.js similarity index 97% rename from assets/Vidyard-DLcBd-dE.js rename to assets/Vidyard-CsuXaKoc.js index 4c5c4536ef..ac73cf93a7 100644 --- a/assets/Vidyard-DLcBd-dE.js +++ b/assets/Vidyard-CsuXaKoc.js @@ -1 +1 @@ -import{g as m,r as v,u as b,p as O}from"./index-aPKr3KfN.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-DoBafr3Z.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-C1w4CmUB.js b/assets/Vimeo-OM6omvoU.js similarity index 98% rename from assets/Vimeo-C1w4CmUB.js rename to assets/Vimeo-OM6omvoU.js index 1e4313b3eb..2fc663bef2 100644 --- a/assets/Vimeo-C1w4CmUB.js +++ b/assets/Vimeo-OM6omvoU.js @@ -1 +1 @@ -import{g as d,r as f,u as m,p as _}from"./index-aPKr3KfN.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-DoBafr3Z.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-Dh_p96TU.js b/assets/Wistia-Bl5F6sjb.js similarity index 98% rename from assets/Wistia-Dh_p96TU.js rename to assets/Wistia-Bl5F6sjb.js index c79741193c..9aa31cf5c9 100644 --- a/assets/Wistia-Dh_p96TU.js +++ b/assets/Wistia-Bl5F6sjb.js @@ -1 +1 @@ -import{g,r as m,u as v,p as w}from"./index-aPKr3KfN.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-DoBafr3Z.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-CxgmswCk.js b/assets/YouTube-rN4jOR1J.js similarity index 98% rename from assets/YouTube-CxgmswCk.js rename to assets/YouTube-rN4jOR1J.js index ef51d9da15..3ceba77417 100644 --- a/assets/YouTube-CxgmswCk.js +++ b/assets/YouTube-rN4jOR1J.js @@ -1 +1 @@ -import{g as U,r as I,u as L,p as M}from"./index-aPKr3KfN.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-DoBafr3Z.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-aPKr3KfN.js b/assets/index-DoBafr3Z.js similarity index 73% rename from assets/index-aPKr3KfN.js rename to assets/index-DoBafr3Z.js index 8eeca69243..a6e5201951 100644 --- a/assets/index-aPKr3KfN.js +++ b/assets/index-DoBafr3Z.js @@ -1,4 +1,4 @@ -var l_=Object.defineProperty;var u_=(_,a,$)=>a in _?l_(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$;var Yr=(_,a,$)=>(u_(_,typeof a!="symbol"?a+"":a,$),$),cm=(_,a,$)=>{if(!a.has(_))throw TypeError("Cannot "+$)};var Nr=(_,a,$)=>(cm(_,a,"read from private field"),$?$.call(_):a.get(_)),Mn=(_,a,$)=>{if(a.has(_))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(_):a.set(_,$)},kn=(_,a,$,j)=>(cm(_,a,"write to private field"),j?j.call(_,$):a.set(_,$),$);var r0=(_,a,$,j)=>({set _(et){kn(_,a,et,$)},get _(){return Nr(_,a,j)}}),Zn=(_,a,$)=>(cm(_,a,"access private method"),$);function _mergeNamespaces(_,a){for(var $=0;$j[et]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const et of document.querySelectorAll('link[rel="modulepreload"]'))j(et);new MutationObserver(et=>{for(const tt of et)if(tt.type==="childList")for(const rt of tt.addedNodes)rt.tagName==="LINK"&&rt.rel==="modulepreload"&&j(rt)}).observe(document,{childList:!0,subtree:!0});function $(et){const tt={};return et.integrity&&(tt.integrity=et.integrity),et.referrerPolicy&&(tt.referrerPolicy=et.referrerPolicy),et.crossOrigin==="use-credentials"?tt.credentials="include":et.crossOrigin==="anonymous"?tt.credentials="omit":tt.credentials="same-origin",tt}function j(et){if(et.ep)return;et.ep=!0;const tt=$(et);fetch(et.href,tt)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}function getAugmentedNamespace(_){if(_.__esModule)return _;var a=_.default;if(typeof a=="function"){var $=function j(){return this instanceof j?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};$.prototype=a.prototype}else $={};return Object.defineProperty($,"__esModule",{value:!0}),Object.keys(_).forEach(function(j){var et=Object.getOwnPropertyDescriptor(_,j);Object.defineProperty($,j,et.get?et:{enumerable:!0,get:function(){return _[j]}})}),$}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** +var oE=Object.defineProperty;var cE=(_,a,$)=>a in _?oE(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$;var Yr=(_,a,$)=>(cE(_,typeof a!="symbol"?a+"":a,$),$),cm=(_,a,$)=>{if(!a.has(_))throw TypeError("Cannot "+$)};var Nr=(_,a,$)=>(cm(_,a,"read from private field"),$?$.call(_):a.get(_)),Mn=(_,a,$)=>{if(a.has(_))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(_):a.set(_,$)},In=(_,a,$,j)=>(cm(_,a,"write to private field"),j?j.call(_,$):a.set(_,$),$);var r0=(_,a,$,j)=>({set _(et){In(_,a,et,$)},get _(){return Nr(_,a,j)}}),Zn=(_,a,$)=>(cm(_,a,"access private method"),$);function _mergeNamespaces(_,a){for(var $=0;$j[et]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const et of document.querySelectorAll('link[rel="modulepreload"]'))j(et);new MutationObserver(et=>{for(const tt of et)if(tt.type==="childList")for(const rt of tt.addedNodes)rt.tagName==="LINK"&&rt.rel==="modulepreload"&&j(rt)}).observe(document,{childList:!0,subtree:!0});function $(et){const tt={};return et.integrity&&(tt.integrity=et.integrity),et.referrerPolicy&&(tt.referrerPolicy=et.referrerPolicy),et.crossOrigin==="use-credentials"?tt.credentials="include":et.crossOrigin==="anonymous"?tt.credentials="omit":tt.credentials="same-origin",tt}function j(et){if(et.ep)return;et.ep=!0;const tt=$(et);fetch(et.href,tt)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}function getAugmentedNamespace(_){if(_.__esModule)return _;var a=_.default;if(typeof a=="function"){var $=function j(){return this instanceof j?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};$.prototype=a.prototype}else $={};return Object.defineProperty($,"__esModule",{value:!0}),Object.keys(_).forEach(function(j){var et=Object.getOwnPropertyDescriptor(_,j);Object.defineProperty($,j,et.get?et:{enumerable:!0,get:function(){return _[j]}})}),$}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var l_=Object.defineProperty;var u_=(_,a,$)=>a in _?l_(_,a,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var l$2=Symbol.for("react.element"),n$4=Symbol.for("react.portal"),p$4=Symbol.for("react.fragment"),q$3=Symbol.for("react.strict_mode"),r$5=Symbol.for("react.profiler"),t$7=Symbol.for("react.provider"),u$1=Symbol.for("react.context"),v$5=Symbol.for("react.forward_ref"),w$1=Symbol.for("react.suspense"),x$1=Symbol.for("react.memo"),y$1=Symbol.for("react.lazy"),z$3=Symbol.iterator;function A$2(_){return _===null||typeof _!="object"?null:(_=z$3&&_[z$3]||_["@@iterator"],typeof _=="function"?_:null)}var B$1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$1=Object.assign,D$1={};function E$1(_,a,$){this.props=_,this.context=a,this.refs=D$1,this.updater=$||B$1}E$1.prototype.isReactComponent={};E$1.prototype.setState=function(_,a){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,a,"setState")};E$1.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function F(){}F.prototype=E$1.prototype;function G$1(_,a,$){this.props=_,this.context=a,this.refs=D$1,this.updater=$||B$1}var H$2=G$1.prototype=new F;H$2.constructor=G$1;C$1(H$2,E$1.prototype);H$2.isPureReactComponent=!0;var I$1=Array.isArray,J=Object.prototype.hasOwnProperty,K$7={current:null},L$1={key:!0,ref:!0,__self:!0,__source:!0};function M$1(_,a,$){var j,et={},tt=null,rt=null;if(a!=null)for(j in a.ref!==void 0&&(rt=a.ref),a.key!==void 0&&(tt=""+a.key),a)J.call(a,j)&&!L$1.hasOwnProperty(j)&&(et[j]=a[j]);var nt=arguments.length-2;if(nt===1)et.children=$;else if(1a in _?l_(_,a,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(_){function a(Rt,$t){var xt=Rt.length;Rt.push($t);e:for(;0>>1,wt=Rt[At];if(0>>1;Atet(nr,xt))iret(Wt,nr)?(Rt[At]=Wt,Rt[ir]=xt,At=ir):(Rt[At]=nr,Rt[tr]=xt,At=tr);else if(iret(Wt,xt))Rt[At]=Wt,Rt[ir]=xt,At=ir;else break e}}return $t}function et(Rt,$t){var xt=Rt.sortIndex-$t.sortIndex;return xt!==0?xt:Rt.id-$t.id}if(typeof performance=="object"&&typeof performance.now=="function"){var tt=performance;_.unstable_now=function(){return tt.now()}}else{var rt=Date,nt=rt.now();_.unstable_now=function(){return rt.now()-nt}}var it=[],ot=[],st=1,at=null,ut=3,ht=!1,bt=!1,Et=!1,Ct=typeof setTimeout=="function"?setTimeout:null,Pt=typeof clearTimeout=="function"?clearTimeout:null,Tt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function It(Rt){for(var $t=$(ot);$t!==null;){if($t.callback===null)j(ot);else if($t.startTime<=Rt)j(ot),$t.sortIndex=$t.expirationTime,a(it,$t);else break;$t=$(ot)}}function Lt(Rt){if(Et=!1,It(Rt),!bt)if($(it)!==null)bt=!0,vt(Nt);else{var $t=$(ot);$t!==null&&St(Lt,$t.startTime-Rt)}}function Nt(Rt,$t){bt=!1,Et&&(Et=!1,Pt(Mt),Mt=-1),ht=!0;var xt=ut;try{for(It($t),at=$(it);at!==null&&(!(at.expirationTime>$t)||Rt&&!Bt());){var At=at.callback;if(typeof At=="function"){at.callback=null,ut=at.priorityLevel;var wt=At(at.expirationTime<=$t);$t=_.unstable_now(),typeof wt=="function"?at.callback=wt:at===$(it)&&j(it),It($t)}else j(it);at=$(it)}if(at!==null)var Ot=!0;else{var tr=$(ot);tr!==null&&St(Lt,tr.startTime-$t),Ot=!1}return Ot}finally{at=null,ut=xt,ht=!1}}var Ut=!1,jt=null,Mt=-1,Dt=5,Ft=-1;function Bt(){return!(_.unstable_now()-FtRt||125At?(Rt.sortIndex=xt,a(ot,Rt),$(it)===null&&Rt===$(ot)&&(Et?(Pt(Mt),Mt=-1):Et=!0,St(Lt,xt-At))):(Rt.sortIndex=wt,a(it,Rt),bt||ht||(bt=!0,vt(Nt))),Rt},_.unstable_shouldYield=Bt,_.unstable_wrapCallback=function(Rt){var $t=ut;return function(){var xt=ut;ut=$t;try{return Rt.apply(this,arguments)}finally{ut=xt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + */(function(_){function a(Rt,$t){var Et=Rt.length;Rt.push($t);e:for(;0>>1,wt=Rt[At];if(0>>1;Atet(nr,Et))iret(Wt,nr)?(Rt[At]=Wt,Rt[ir]=Et,At=ir):(Rt[At]=nr,Rt[tr]=Et,At=tr);else if(iret(Wt,Et))Rt[At]=Wt,Rt[ir]=Et,At=ir;else break e}}return $t}function et(Rt,$t){var Et=Rt.sortIndex-$t.sortIndex;return Et!==0?Et:Rt.id-$t.id}if(typeof performance=="object"&&typeof performance.now=="function"){var tt=performance;_.unstable_now=function(){return tt.now()}}else{var rt=Date,nt=rt.now();_.unstable_now=function(){return rt.now()-nt}}var it=[],at=[],st=1,ot=null,ut=3,dt=!1,mt=!1,xt=!1,Ct=typeof setTimeout=="function"?setTimeout:null,Pt=typeof clearTimeout=="function"?clearTimeout:null,Tt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function kt(Rt){for(var $t=$(at);$t!==null;){if($t.callback===null)j(at);else if($t.startTime<=Rt)j(at),$t.sortIndex=$t.expirationTime,a(it,$t);else break;$t=$(at)}}function Lt(Rt){if(xt=!1,kt(Rt),!mt)if($(it)!==null)mt=!0,vt(Nt);else{var $t=$(at);$t!==null&&St(Lt,$t.startTime-Rt)}}function Nt(Rt,$t){mt=!1,xt&&(xt=!1,Pt(Mt),Mt=-1),dt=!0;var Et=ut;try{for(kt($t),ot=$(it);ot!==null&&(!(ot.expirationTime>$t)||Rt&&!Bt());){var At=ot.callback;if(typeof At=="function"){ot.callback=null,ut=ot.priorityLevel;var wt=At(ot.expirationTime<=$t);$t=_.unstable_now(),typeof wt=="function"?ot.callback=wt:ot===$(it)&&j(it),kt($t)}else j(it);ot=$(it)}if(ot!==null)var Ot=!0;else{var tr=$(at);tr!==null&&St(Lt,tr.startTime-$t),Ot=!1}return Ot}finally{ot=null,ut=Et,dt=!1}}var zt=!1,jt=null,Mt=-1,Dt=5,Ft=-1;function Bt(){return!(_.unstable_now()-FtRt||125At?(Rt.sortIndex=Et,a(at,Rt),$(it)===null&&Rt===$(at)&&(xt?(Pt(Mt),Mt=-1):xt=!0,St(Lt,Et-At))):(Rt.sortIndex=wt,a(it,Rt),mt||dt||(mt=!0,vt(Nt))),Rt},_.unstable_shouldYield=Bt,_.unstable_wrapCallback=function(Rt){var $t=ut;return function(){var Et=ut;ut=$t;try{return Rt.apply(this,arguments)}finally{ut=Et}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** * @license React * react-dom.production.min.js * @@ -31,20 +31,20 @@ var l_=Object.defineProperty;var u_=(_,a,$)=>a in _?l_(_,a,{enumerable:!0,config * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var aa=reactExports,ca=schedulerExports;function p$2(_){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+_,$=1;$"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la={},ma={};function oa(_){return ja.call(ma,_)?!0:ja.call(la,_)?!1:ka.test(_)?ma[_]=!0:(la[_]=!0,!1)}function pa(_,a,$,j){if($!==null&&$.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return j?!1:$!==null?!$.acceptsBooleans:(_=_.toLowerCase().slice(0,5),_!=="data-"&&_!=="aria-");default:return!1}}function qa(_,a,$,j){if(a===null||typeof a>"u"||pa(_,a,$,j))return!0;if(j)return!1;if($!==null)switch($.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function v$4(_,a,$,j,et,tt,rt){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=j,this.attributeNamespace=et,this.mustUseProperty=$,this.propertyName=_,this.type=a,this.sanitizeURL=tt,this.removeEmptyString=rt}var z$2={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(_){z$2[_]=new v$4(_,0,!1,_,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(_){var a=_[0];z$2[a]=new v$4(a,1,!1,_[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(_){z$2[_]=new v$4(_,2,!1,_.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(_){z$2[_]=new v$4(_,2,!1,_,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(_){z$2[_]=new v$4(_,3,!1,_.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(_){z$2[_]=new v$4(_,3,!0,_,null,!1,!1)});["capture","download"].forEach(function(_){z$2[_]=new v$4(_,4,!1,_,null,!1,!1)});["cols","rows","size","span"].forEach(function(_){z$2[_]=new v$4(_,6,!1,_,null,!1,!1)});["rowSpan","start"].forEach(function(_){z$2[_]=new v$4(_,5,!1,_.toLowerCase(),null,!1,!1)});var ra=/[\-:]([a-z])/g;function sa(_){return _[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(_){var a=_.replace(ra,sa);z$2[a]=new v$4(a,1,!1,_,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(_){var a=_.replace(ra,sa);z$2[a]=new v$4(a,1,!1,_,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(_){var a=_.replace(ra,sa);z$2[a]=new v$4(a,1,!1,_,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(_){z$2[_]=new v$4(_,1,!1,_.toLowerCase(),null,!1,!1)});z$2.xlinkHref=new v$4("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(_){z$2[_]=new v$4(_,1,!1,_.toLowerCase(),null,!0,!0)});function ta(_,a,$,j){var et=z$2.hasOwnProperty(a)?z$2[a]:null;(et!==null?et.type!==0:j||!(2nt||et[rt]!==tt[nt]){var it=` -`+et[rt].replace(" at new "," at ");return _.displayName&&it.includes("")&&(it=it.replace("",_.displayName)),it}while(1<=rt&&0<=nt);break}}}finally{Na=!1,Error.prepareStackTrace=$}return(_=_?_.displayName||_.name:"")?Ma(_):""}function Pa(_){switch(_.tag){case 5:return Ma(_.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return _=Oa(_.type,!1),_;case 11:return _=Oa(_.type.render,!1),_;case 1:return _=Oa(_.type,!0),_;default:return""}}function Qa(_){if(_==null)return null;if(typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case Ca:return(_.displayName||"Context")+".Consumer";case Ba:return(_._context.displayName||"Context")+".Provider";case Da:var a=_.render;return _=_.displayName,_||(_=a.displayName||a.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case Ga:return a=_.displayName||null,a!==null?a:Qa(_.type)||"Memo";case Ha:a=_._payload,_=_._init;try{return Qa(_(a))}catch{}}return null}function Ra(_){var a=_.type;switch(_.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return _=a.render,_=_.displayName||_.name||"",a.displayName||(_!==""?"ForwardRef("+_+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(a);case 8:return a===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Sa(_){switch(typeof _){case"boolean":case"number":case"string":case"undefined":return _;case"object":return _;default:return""}}function Ta(_){var a=_.type;return(_=_.nodeName)&&_.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ua(_){var a=Ta(_)?"checked":"value",$=Object.getOwnPropertyDescriptor(_.constructor.prototype,a),j=""+_[a];if(!_.hasOwnProperty(a)&&typeof $<"u"&&typeof $.get=="function"&&typeof $.set=="function"){var et=$.get,tt=$.set;return Object.defineProperty(_,a,{configurable:!0,get:function(){return et.call(this)},set:function(rt){j=""+rt,tt.call(this,rt)}}),Object.defineProperty(_,a,{enumerable:$.enumerable}),{getValue:function(){return j},setValue:function(rt){j=""+rt},stopTracking:function(){_._valueTracker=null,delete _[a]}}}}function Va(_){_._valueTracker||(_._valueTracker=Ua(_))}function Wa(_){if(!_)return!1;var a=_._valueTracker;if(!a)return!0;var $=a.getValue(),j="";return _&&(j=Ta(_)?_.checked?"true":"false":_.value),_=j,_!==$?(a.setValue(_),!0):!1}function Xa(_){if(_=_||(typeof document<"u"?document:void 0),typeof _>"u")return null;try{return _.activeElement||_.body}catch{return _.body}}function Ya(_,a){var $=a.checked;return A$1({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:$??_._wrapperState.initialChecked})}function Za(_,a){var $=a.defaultValue==null?"":a.defaultValue,j=a.checked!=null?a.checked:a.defaultChecked;$=Sa(a.value!=null?a.value:$),_._wrapperState={initialChecked:j,initialValue:$,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function ab(_,a){a=a.checked,a!=null&&ta(_,"checked",a,!1)}function bb(_,a){ab(_,a);var $=Sa(a.value),j=a.type;if($!=null)j==="number"?($===0&&_.value===""||_.value!=$)&&(_.value=""+$):_.value!==""+$&&(_.value=""+$);else if(j==="submit"||j==="reset"){_.removeAttribute("value");return}a.hasOwnProperty("value")?cb(_,a.type,$):a.hasOwnProperty("defaultValue")&&cb(_,a.type,Sa(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(_.defaultChecked=!!a.defaultChecked)}function db(_,a,$){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var j=a.type;if(!(j!=="submit"&&j!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+_._wrapperState.initialValue,$||a===_.value||(_.value=a),_.defaultValue=a}$=_.name,$!==""&&(_.name=""),_.defaultChecked=!!_._wrapperState.initialChecked,$!==""&&(_.name=$)}function cb(_,a,$){(a!=="number"||Xa(_.ownerDocument)!==_)&&($==null?_.defaultValue=""+_._wrapperState.initialValue:_.defaultValue!==""+$&&(_.defaultValue=""+$))}var eb=Array.isArray;function fb(_,a,$,j){if(_=_.options,a){a={};for(var et=0;et<$.length;et++)a["$"+$[et]]=!0;for($=0;$<_.length;$++)et=a.hasOwnProperty("$"+_[$].value),_[$].selected!==et&&(_[$].selected=et),et&&j&&(_[$].defaultSelected=!0)}else{for($=""+Sa($),a=null,et=0;et<_.length;et++){if(_[et].value===$){_[et].selected=!0,j&&(_[et].defaultSelected=!0);return}a!==null||_[et].disabled||(a=_[et])}a!==null&&(a.selected=!0)}}function gb(_,a){if(a.dangerouslySetInnerHTML!=null)throw Error(p$2(91));return A$1({},a,{value:void 0,defaultValue:void 0,children:""+_._wrapperState.initialValue})}function hb(_,a){var $=a.value;if($==null){if($=a.children,a=a.defaultValue,$!=null){if(a!=null)throw Error(p$2(92));if(eb($)){if(1<$.length)throw Error(p$2(93));$=$[0]}a=$}a==null&&(a=""),$=a}_._wrapperState={initialValue:Sa($)}}function ib(_,a){var $=Sa(a.value),j=Sa(a.defaultValue);$!=null&&($=""+$,$!==_.value&&(_.value=$),a.defaultValue==null&&_.defaultValue!==$&&(_.defaultValue=$)),j!=null&&(_.defaultValue=""+j)}function jb(_){var a=_.textContent;a===_._wrapperState.initialValue&&a!==""&&a!==null&&(_.value=a)}function kb(_){switch(_){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lb(_,a){return _==null||_==="http://www.w3.org/1999/xhtml"?kb(a):_==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":_}var mb,nb=function(_){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,$,j,et){MSApp.execUnsafeLocalFunction(function(){return _(a,$,j,et)})}:_}(function(_,a){if(_.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in _)_.innerHTML=a;else{for(mb=mb||document.createElement("div"),mb.innerHTML=""+a.valueOf().toString()+"",a=mb.firstChild;_.firstChild;)_.removeChild(_.firstChild);for(;a.firstChild;)_.appendChild(a.firstChild)}});function ob(_,a){if(a){var $=_.firstChild;if($&&$===_.lastChild&&$.nodeType===3){$.nodeValue=a;return}}_.textContent=a}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(_){qb.forEach(function(a){a=a+_.charAt(0).toUpperCase()+_.substring(1),pb[a]=pb[_]})});function rb(_,a,$){return a==null||typeof a=="boolean"||a===""?"":$||typeof a!="number"||a===0||pb.hasOwnProperty(_)&&pb[_]?(""+a).trim():a+"px"}function sb(_,a){_=_.style;for(var $ in a)if(a.hasOwnProperty($)){var j=$.indexOf("--")===0,et=rb($,a[$],j);$==="float"&&($="cssFloat"),j?_.setProperty($,et):_[$]=et}}var tb=A$1({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(_,a){if(a){if(tb[_]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(p$2(137,_));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(p$2(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(p$2(61))}if(a.style!=null&&typeof a.style!="object")throw Error(p$2(62))}}function vb(_,a){if(_.indexOf("-")===-1)return typeof a.is=="string";switch(_){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(_){return _=_.target||_.srcElement||window,_.correspondingUseElement&&(_=_.correspondingUseElement),_.nodeType===3?_.parentNode:_}var yb=null,zb=null,Ab=null;function Bb(_){if(_=Cb(_)){if(typeof yb!="function")throw Error(p$2(280));var a=_.stateNode;a&&(a=Db(a),yb(_.stateNode,_.type,a))}}function Eb(_){zb?Ab?Ab.push(_):Ab=[_]:zb=_}function Fb(){if(zb){var _=zb,a=Ab;if(Ab=zb=null,Bb(_),a)for(_=0;_>>=0,_===0?32:31-(pc(_)/qc|0)|0}var rc=64,sc=4194304;function tc(_){switch(_&-_){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return _&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return _&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return _}}function uc(_,a){var $=_.pendingLanes;if($===0)return 0;var j=0,et=_.suspendedLanes,tt=_.pingedLanes,rt=$&268435455;if(rt!==0){var nt=rt&~et;nt!==0?j=tc(nt):(tt&=rt,tt!==0&&(j=tc(tt)))}else rt=$&~et,rt!==0?j=tc(rt):tt!==0&&(j=tc(tt));if(j===0)return 0;if(a!==0&&a!==j&&!(a&et)&&(et=j&-j,tt=a&-a,et>=tt||et===16&&(tt&4194240)!==0))return a;if(j&4&&(j|=$&16),a=_.entangledLanes,a!==0)for(_=_.entanglements,a&=j;0$;$++)a.push(_);return a}function Ac(_,a,$){_.pendingLanes|=a,a!==536870912&&(_.suspendedLanes=0,_.pingedLanes=0),_=_.eventTimes,a=31-oc(a),_[a]=$}function Bc(_,a){var $=_.pendingLanes&~a;_.pendingLanes=a,_.suspendedLanes=0,_.pingedLanes=0,_.expiredLanes&=a,_.mutableReadLanes&=a,_.entangledLanes&=a,a=_.entanglements;var j=_.eventTimes;for(_=_.expirationTimes;0<$;){var et=31-oc($),tt=1<=be),ee=" ",fe=!1;function ge(_,a){switch(_){case"keyup":return $d.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(_){return _=_.detail,typeof _=="object"&&"data"in _?_.data:null}var ie=!1;function je(_,a){switch(_){case"compositionend":return he(a);case"keypress":return a.which!==32?null:(fe=!0,ee);case"textInput":return _=a.data,_===ee&&fe?null:_;default:return null}}function ke(_,a){if(ie)return _==="compositionend"||!ae&&ge(_,a)?(_=nd(),md=ld=kd=null,ie=!1,_):null;switch(_){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:$,offset:a-_};_=j}e:{for(;$;){if($.nextSibling){$=$.nextSibling;break e}$=$.parentNode}$=void 0}$=Je($)}}function Le(_,a){return _&&a?_===a?!0:_&&_.nodeType===3?!1:a&&a.nodeType===3?Le(_,a.parentNode):"contains"in _?_.contains(a):_.compareDocumentPosition?!!(_.compareDocumentPosition(a)&16):!1:!1}function Me(){for(var _=window,a=Xa();a instanceof _.HTMLIFrameElement;){try{var $=typeof a.contentWindow.location.href=="string"}catch{$=!1}if($)_=a.contentWindow;else break;a=Xa(_.document)}return a}function Ne(_){var a=_&&_.nodeName&&_.nodeName.toLowerCase();return a&&(a==="input"&&(_.type==="text"||_.type==="search"||_.type==="tel"||_.type==="url"||_.type==="password")||a==="textarea"||_.contentEditable==="true")}function Oe(_){var a=Me(),$=_.focusedElem,j=_.selectionRange;if(a!==$&&$&&$.ownerDocument&&Le($.ownerDocument.documentElement,$)){if(j!==null&&Ne($)){if(a=j.start,_=j.end,_===void 0&&(_=a),"selectionStart"in $)$.selectionStart=a,$.selectionEnd=Math.min(_,$.value.length);else if(_=(a=$.ownerDocument||document)&&a.defaultView||window,_.getSelection){_=_.getSelection();var et=$.textContent.length,tt=Math.min(j.start,et);j=j.end===void 0?tt:Math.min(j.end,et),!_.extend&&tt>j&&(et=j,j=tt,tt=et),et=Ke($,tt);var rt=Ke($,j);et&&rt&&(_.rangeCount!==1||_.anchorNode!==et.node||_.anchorOffset!==et.offset||_.focusNode!==rt.node||_.focusOffset!==rt.offset)&&(a=a.createRange(),a.setStart(et.node,et.offset),_.removeAllRanges(),tt>j?(_.addRange(a),_.extend(rt.node,rt.offset)):(a.setEnd(rt.node,rt.offset),_.addRange(a)))}}for(a=[],_=$;_=_.parentNode;)_.nodeType===1&&a.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(_,a,$){var j=$.window===$?$.document:$.nodeType===9?$:$.ownerDocument;Te||Qe==null||Qe!==Xa(j)||(j=Qe,"selectionStart"in j&&Ne(j)?j={start:j.selectionStart,end:j.selectionEnd}:(j=(j.ownerDocument&&j.ownerDocument.defaultView||window).getSelection(),j={anchorNode:j.anchorNode,anchorOffset:j.anchorOffset,focusNode:j.focusNode,focusOffset:j.focusOffset}),Se&&Ie(Se,j)||(Se=j,j=oe(Re,"onSelect"),0Tf||(_.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(_,a){Tf++,Sf[Tf]=_.current,_.current=a}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(_,a){var $=_.type.contextTypes;if(!$)return Vf;var j=_.stateNode;if(j&&j.__reactInternalMemoizedUnmaskedChildContext===a)return j.__reactInternalMemoizedMaskedChildContext;var et={},tt;for(tt in $)et[tt]=a[tt];return j&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=a,_.__reactInternalMemoizedMaskedChildContext=et),et}function Zf(_){return _=_.childContextTypes,_!=null}function $f(){E(Wf),E(H$1)}function ag(_,a,$){if(H$1.current!==Vf)throw Error(p$2(168));G(H$1,a),G(Wf,$)}function bg(_,a,$){var j=_.stateNode;if(a=a.childContextTypes,typeof j.getChildContext!="function")return $;j=j.getChildContext();for(var et in j)if(!(et in a))throw Error(p$2(108,Ra(_)||"Unknown",et));return A$1({},$,j)}function cg(_){return _=(_=_.stateNode)&&_.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G(H$1,_),G(Wf,Wf.current),!0}function dg(_,a,$){var j=_.stateNode;if(!j)throw Error(p$2(169));$?(_=bg(_,a,Xf),j.__reactInternalMemoizedMergedChildContext=_,E(Wf),E(H$1),G(H$1,_)):E(Wf),G(Wf,$)}var eg=null,fg=!1,gg=!1;function hg(_){eg===null?eg=[_]:eg.push(_)}function ig(_){fg=!0,hg(_)}function jg(){if(!gg&&eg!==null){gg=!0;var _=0,a=C;try{var $=eg;for(C=1;_<$.length;_++){var j=$[_];do j=j(!0);while(j!==null)}eg=null,fg=!1}catch(et){throw eg!==null&&(eg=eg.slice(_+1)),ac(fc,jg),et}finally{C=a,gg=!1}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(_,a){kg[lg++]=ng,kg[lg++]=mg,mg=_,ng=a}function ug(_,a,$){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=_;var j=rg;_=sg;var et=32-oc(j)-1;j&=~(1<>=rt,et-=rt,rg=1<<32-oc(a)+et|$<Mt?(Dt=jt,jt=null):Dt=jt.sibling;var Ft=ut(Pt,jt,It[Mt],Lt);if(Ft===null){jt===null&&(jt=Dt);break}_&&jt&&Ft.alternate===null&&a(Pt,jt),Tt=tt(Ft,Tt,Mt),Ut===null?Nt=Ft:Ut.sibling=Ft,Ut=Ft,jt=Dt}if(Mt===It.length)return $(Pt,jt),I&&tg(Pt,Mt),Nt;if(jt===null){for(;MtMt?(Dt=jt,jt=null):Dt=jt.sibling;var Bt=ut(Pt,jt,Ft.value,Lt);if(Bt===null){jt===null&&(jt=Dt);break}_&&jt&&Bt.alternate===null&&a(Pt,jt),Tt=tt(Bt,Tt,Mt),Ut===null?Nt=Bt:Ut.sibling=Bt,Ut=Bt,jt=Dt}if(Ft.done)return $(Pt,jt),I&&tg(Pt,Mt),Nt;if(jt===null){for(;!Ft.done;Mt++,Ft=It.next())Ft=at(Pt,Ft.value,Lt),Ft!==null&&(Tt=tt(Ft,Tt,Mt),Ut===null?Nt=Ft:Ut.sibling=Ft,Ut=Ft);return I&&tg(Pt,Mt),Nt}for(jt=j(Pt,jt);!Ft.done;Mt++,Ft=It.next())Ft=ht(jt,Pt,Mt,Ft.value,Lt),Ft!==null&&(_&&Ft.alternate!==null&&jt.delete(Ft.key===null?Mt:Ft.key),Tt=tt(Ft,Tt,Mt),Ut===null?Nt=Ft:Ut.sibling=Ft,Ut=Ft);return _&&jt.forEach(function(yt){return a(Pt,yt)}),I&&tg(Pt,Mt),Nt}function Ct(Pt,Tt,It,Lt){if(typeof It=="object"&&It!==null&&It.type===ya&&It.key===null&&(It=It.props.children),typeof It=="object"&&It!==null){switch(It.$$typeof){case va:e:{for(var Nt=It.key,Ut=Tt;Ut!==null;){if(Ut.key===Nt){if(Nt=It.type,Nt===ya){if(Ut.tag===7){$(Pt,Ut.sibling),Tt=et(Ut,It.props.children),Tt.return=Pt,Pt=Tt;break e}}else if(Ut.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===Ha&&Ng(Nt)===Ut.type){$(Pt,Ut.sibling),Tt=et(Ut,It.props),Tt.ref=Lg(Pt,Ut,It),Tt.return=Pt,Pt=Tt;break e}$(Pt,Ut);break}else a(Pt,Ut);Ut=Ut.sibling}It.type===ya?(Tt=Tg(It.props.children,Pt.mode,Lt,It.key),Tt.return=Pt,Pt=Tt):(Lt=Rg(It.type,It.key,It.props,null,Pt.mode,Lt),Lt.ref=Lg(Pt,Tt,It),Lt.return=Pt,Pt=Lt)}return rt(Pt);case wa:e:{for(Ut=It.key;Tt!==null;){if(Tt.key===Ut)if(Tt.tag===4&&Tt.stateNode.containerInfo===It.containerInfo&&Tt.stateNode.implementation===It.implementation){$(Pt,Tt.sibling),Tt=et(Tt,It.children||[]),Tt.return=Pt,Pt=Tt;break e}else{$(Pt,Tt);break}else a(Pt,Tt);Tt=Tt.sibling}Tt=Sg(It,Pt.mode,Lt),Tt.return=Pt,Pt=Tt}return rt(Pt);case Ha:return Ut=It._init,Ct(Pt,Tt,Ut(It._payload),Lt)}if(eb(It))return bt(Pt,Tt,It,Lt);if(Ka(It))return Et(Pt,Tt,It,Lt);Mg(Pt,It)}return typeof It=="string"&&It!==""||typeof It=="number"?(It=""+It,Tt!==null&&Tt.tag===6?($(Pt,Tt.sibling),Tt=et(Tt,It),Tt.return=Pt,Pt=Tt):($(Pt,Tt),Tt=Qg(It,Pt.mode,Lt),Tt.return=Pt,Pt=Tt),rt(Pt)):$(Pt,Tt)}return Ct}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(_){var a=Wg.current;E(Wg),_._currentValue=a}function bh(_,a,$){for(;_!==null;){var j=_.alternate;if((_.childLanes&a)!==a?(_.childLanes|=a,j!==null&&(j.childLanes|=a)):j!==null&&(j.childLanes&a)!==a&&(j.childLanes|=a),_===$)break;_=_.return}}function ch$1(_,a){Xg=_,Zg=Yg=null,_=_.dependencies,_!==null&&_.firstContext!==null&&(_.lanes&a&&(dh$1=!0),_.firstContext=null)}function eh(_){var a=_._currentValue;if(Zg!==_)if(_={context:_,memoizedValue:a,next:null},Yg===null){if(Xg===null)throw Error(p$2(308));Yg=_,Xg.dependencies={lanes:0,firstContext:_}}else Yg=Yg.next=_;return a}var fh=null;function gh(_){fh===null?fh=[_]:fh.push(_)}function hh(_,a,$,j){var et=a.interleaved;return et===null?($.next=$,gh(a)):($.next=et.next,et.next=$),a.interleaved=$,ih(_,j)}function ih(_,a){_.lanes|=a;var $=_.alternate;for($!==null&&($.lanes|=a),$=_,_=_.return;_!==null;)_.childLanes|=a,$=_.alternate,$!==null&&($.childLanes|=a),$=_,_=_.return;return $.tag===3?$.stateNode:null}var jh=!1;function kh(_){_.updateQueue={baseState:_.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(_,a){_=_.updateQueue,a.updateQueue===_&&(a.updateQueue={baseState:_.baseState,firstBaseUpdate:_.firstBaseUpdate,lastBaseUpdate:_.lastBaseUpdate,shared:_.shared,effects:_.effects})}function mh(_,a){return{eventTime:_,lane:a,tag:0,payload:null,callback:null,next:null}}function nh(_,a,$){var j=_.updateQueue;if(j===null)return null;if(j=j.shared,K$6&2){var et=j.pending;return et===null?a.next=a:(a.next=et.next,et.next=a),j.pending=a,ih(_,$)}return et=j.interleaved,et===null?(a.next=a,gh(j)):(a.next=et.next,et.next=a),j.interleaved=a,ih(_,$)}function oh(_,a,$){if(a=a.updateQueue,a!==null&&(a=a.shared,($&4194240)!==0)){var j=a.lanes;j&=_.pendingLanes,$|=j,a.lanes=$,Cc(_,$)}}function ph(_,a){var $=_.updateQueue,j=_.alternate;if(j!==null&&(j=j.updateQueue,$===j)){var et=null,tt=null;if($=$.firstBaseUpdate,$!==null){do{var rt={eventTime:$.eventTime,lane:$.lane,tag:$.tag,payload:$.payload,callback:$.callback,next:null};tt===null?et=tt=rt:tt=tt.next=rt,$=$.next}while($!==null);tt===null?et=tt=a:tt=tt.next=a}else et=tt=a;$={baseState:j.baseState,firstBaseUpdate:et,lastBaseUpdate:tt,shared:j.shared,effects:j.effects},_.updateQueue=$;return}_=$.lastBaseUpdate,_===null?$.firstBaseUpdate=a:_.next=a,$.lastBaseUpdate=a}function qh(_,a,$,j){var et=_.updateQueue;jh=!1;var tt=et.firstBaseUpdate,rt=et.lastBaseUpdate,nt=et.shared.pending;if(nt!==null){et.shared.pending=null;var it=nt,ot=it.next;it.next=null,rt===null?tt=ot:rt.next=ot,rt=it;var st=_.alternate;st!==null&&(st=st.updateQueue,nt=st.lastBaseUpdate,nt!==rt&&(nt===null?st.firstBaseUpdate=ot:nt.next=ot,st.lastBaseUpdate=it))}if(tt!==null){var at=et.baseState;rt=0,st=ot=it=null,nt=tt;do{var ut=nt.lane,ht=nt.eventTime;if((j&ut)===ut){st!==null&&(st=st.next={eventTime:ht,lane:0,tag:nt.tag,payload:nt.payload,callback:nt.callback,next:null});e:{var bt=_,Et=nt;switch(ut=a,ht=$,Et.tag){case 1:if(bt=Et.payload,typeof bt=="function"){at=bt.call(ht,at,ut);break e}at=bt;break e;case 3:bt.flags=bt.flags&-65537|128;case 0:if(bt=Et.payload,ut=typeof bt=="function"?bt.call(ht,at,ut):bt,ut==null)break e;at=A$1({},at,ut);break e;case 2:jh=!0}}nt.callback!==null&&nt.lane!==0&&(_.flags|=64,ut=et.effects,ut===null?et.effects=[nt]:ut.push(nt))}else ht={eventTime:ht,lane:ut,tag:nt.tag,payload:nt.payload,callback:nt.callback,next:null},st===null?(ot=st=ht,it=at):st=st.next=ht,rt|=ut;if(nt=nt.next,nt===null){if(nt=et.shared.pending,nt===null)break;ut=nt,nt=ut.next,ut.next=null,et.lastBaseUpdate=ut,et.shared.pending=null}}while(!0);if(st===null&&(it=at),et.baseState=it,et.firstBaseUpdate=ot,et.lastBaseUpdate=st,a=et.shared.interleaved,a!==null){et=a;do rt|=et.lane,et=et.next;while(et!==a)}else tt===null&&(et.shared.lanes=0);rh$1|=rt,_.lanes=rt,_.memoizedState=at}}function sh$1(_,a,$){if(_=a.effects,a.effects=null,_!==null)for(a=0;a<_.length;a++){var j=_[a],et=j.callback;if(et!==null){if(j.callback=null,j=$,typeof et!="function")throw Error(p$2(191,et));et.call(j)}}}var th={},uh=Uf(th),vh$1=Uf(th),wh=Uf(th);function xh(_){if(_===th)throw Error(p$2(174));return _}function yh(_,a){switch(G(wh,a),G(vh$1,_),G(uh,th),_=a.nodeType,_){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:lb(null,"");break;default:_=_===8?a.parentNode:a,a=_.namespaceURI||null,_=_.tagName,a=lb(a,_)}E(uh),G(uh,a)}function zh(){E(uh),E(vh$1),E(wh)}function Ah(_){xh(wh.current);var a=xh(uh.current),$=lb(a,_.type);a!==$&&(G(vh$1,_),G(uh,$))}function Bh(_){vh$1.current===_&&(E(uh),E(vh$1))}var L=Uf(0);function Ch$1(_){for(var a=_;a!==null;){if(a.tag===13){var $=a.memoizedState;if($!==null&&($=$.dehydrated,$===null||$.data==="$?"||$.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===_)break;for(;a.sibling===null;){if(a.return===null||a.return===_)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Dh=[];function Eh(){for(var _=0;_$?$:4,_(!0);var j=Gh.transition;Gh.transition={};try{_(!1),a()}finally{C=$,Gh.transition=j}}function wi(){return Uh().memoizedState}function xi(_,a,$){var j=yi(_);if($={lane:j,action:$,hasEagerState:!1,eagerState:null,next:null},zi(_))Ai(a,$);else if($=hh(_,a,$,j),$!==null){var et=R$1();gi($,_,j,et),Bi($,a,j)}}function ii(_,a,$){var j=yi(_),et={lane:j,action:$,hasEagerState:!1,eagerState:null,next:null};if(zi(_))Ai(a,et);else{var tt=_.alternate;if(_.lanes===0&&(tt===null||tt.lanes===0)&&(tt=a.lastRenderedReducer,tt!==null))try{var rt=a.lastRenderedState,nt=tt(rt,$);if(et.hasEagerState=!0,et.eagerState=nt,He(nt,rt)){var it=a.interleaved;it===null?(et.next=et,gh(a)):(et.next=it.next,it.next=et),a.interleaved=et;return}}catch{}finally{}$=hh(_,a,et,j),$!==null&&(et=R$1(),gi($,_,j,et),Bi($,a,j))}}function zi(_){var a=_.alternate;return _===M||a!==null&&a===M}function Ai(_,a){Jh=Ih=!0;var $=_.pending;$===null?a.next=a:(a.next=$.next,$.next=a),_.pending=a}function Bi(_,a,$){if($&4194240){var j=a.lanes;j&=_.pendingLanes,$|=j,a.lanes=$,Cc(_,$)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(_,a){return Th().memoizedState=[_,a===void 0?null:a],_},useContext:eh,useEffect:mi,useImperativeHandle:function(_,a,$){return $=$!=null?$.concat([_]):null,ki(4194308,4,pi.bind(null,a,_),$)},useLayoutEffect:function(_,a){return ki(4194308,4,_,a)},useInsertionEffect:function(_,a){return ki(4,2,_,a)},useMemo:function(_,a){var $=Th();return a=a===void 0?null:a,_=_(),$.memoizedState=[_,a],_},useReducer:function(_,a,$){var j=Th();return a=$!==void 0?$(a):a,j.memoizedState=j.baseState=a,_={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_,lastRenderedState:a},j.queue=_,_=_.dispatch=xi.bind(null,M,_),[j.memoizedState,_]},useRef:function(_){var a=Th();return _={current:_},a.memoizedState=_},useState:hi,useDebugValue:ri,useDeferredValue:function(_){return Th().memoizedState=_},useTransition:function(){var _=hi(!1),a=_[0];return _=vi.bind(null,_[1]),Th().memoizedState=_,[a,_]},useMutableSource:function(){},useSyncExternalStore:function(_,a,$){var j=M,et=Th();if(I){if($===void 0)throw Error(p$2(407));$=$()}else{if($=a(),Q===null)throw Error(p$2(349));Hh&30||di(j,a,$)}et.memoizedState=$;var tt={value:$,getSnapshot:a};return et.queue=tt,mi(ai.bind(null,j,tt,_),[_]),j.flags|=2048,bi(9,ci.bind(null,j,tt,$,a),void 0,null),$},useId:function(){var _=Th(),a=Q.identifierPrefix;if(I){var $=sg,j=rg;$=(j&~(1<<32-oc(j)-1)).toString(32)+$,a=":"+a+"R"+$,$=Kh$1++,0<$&&(a+="H"+$.toString(32)),a+=":"}else $=Lh++,a=":"+a+"r"+$.toString(32)+":";return _.memoizedState=a},unstable_isNewReconciler:!1},Ph={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Wh,useRef:ji,useState:function(){return Wh(Vh)},useDebugValue:ri,useDeferredValue:function(_){var a=Uh();return ui(a,N.memoizedState,_)},useTransition:function(){var _=Wh(Vh)[0],a=Uh().memoizedState;return[_,a]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1},Qh={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Xh,useRef:ji,useState:function(){return Xh(Vh)},useDebugValue:ri,useDeferredValue:function(_){var a=Uh();return N===null?a.memoizedState=_:ui(a,N.memoizedState,_)},useTransition:function(){var _=Xh(Vh)[0],a=Uh().memoizedState;return[_,a]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1};function Ci(_,a){if(_&&_.defaultProps){a=A$1({},a),_=_.defaultProps;for(var $ in _)a[$]===void 0&&(a[$]=_[$]);return a}return a}function Di(_,a,$,j){a=_.memoizedState,$=$(j,a),$=$==null?a:A$1({},a,$),_.memoizedState=$,_.lanes===0&&(_.updateQueue.baseState=$)}var Ei={isMounted:function(_){return(_=_._reactInternals)?Vb(_)===_:!1},enqueueSetState:function(_,a,$){_=_._reactInternals;var j=R$1(),et=yi(_),tt=mh(j,et);tt.payload=a,$!=null&&(tt.callback=$),a=nh(_,tt,et),a!==null&&(gi(a,_,et,j),oh(a,_,et))},enqueueReplaceState:function(_,a,$){_=_._reactInternals;var j=R$1(),et=yi(_),tt=mh(j,et);tt.tag=1,tt.payload=a,$!=null&&(tt.callback=$),a=nh(_,tt,et),a!==null&&(gi(a,_,et,j),oh(a,_,et))},enqueueForceUpdate:function(_,a){_=_._reactInternals;var $=R$1(),j=yi(_),et=mh($,j);et.tag=2,a!=null&&(et.callback=a),a=nh(_,et,j),a!==null&&(gi(a,_,j,$),oh(a,_,j))}};function Fi(_,a,$,j,et,tt,rt){return _=_.stateNode,typeof _.shouldComponentUpdate=="function"?_.shouldComponentUpdate(j,tt,rt):a.prototype&&a.prototype.isPureReactComponent?!Ie($,j)||!Ie(et,tt):!0}function Gi(_,a,$){var j=!1,et=Vf,tt=a.contextType;return typeof tt=="object"&&tt!==null?tt=eh(tt):(et=Zf(a)?Xf:H$1.current,j=a.contextTypes,tt=(j=j!=null)?Yf(_,et):Vf),a=new a($,tt),_.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ei,_.stateNode=a,a._reactInternals=_,j&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=et,_.__reactInternalMemoizedMaskedChildContext=tt),a}function Hi(_,a,$,j){_=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps($,j),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps($,j),a.state!==_&&Ei.enqueueReplaceState(a,a.state,null)}function Ii(_,a,$,j){var et=_.stateNode;et.props=$,et.state=_.memoizedState,et.refs={},kh(_);var tt=a.contextType;typeof tt=="object"&&tt!==null?et.context=eh(tt):(tt=Zf(a)?Xf:H$1.current,et.context=Yf(_,tt)),et.state=_.memoizedState,tt=a.getDerivedStateFromProps,typeof tt=="function"&&(Di(_,a,tt,$),et.state=_.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof et.getSnapshotBeforeUpdate=="function"||typeof et.UNSAFE_componentWillMount!="function"&&typeof et.componentWillMount!="function"||(a=et.state,typeof et.componentWillMount=="function"&&et.componentWillMount(),typeof et.UNSAFE_componentWillMount=="function"&&et.UNSAFE_componentWillMount(),a!==et.state&&Ei.enqueueReplaceState(et,et.state,null),qh(_,$,et,j),et.state=_.memoizedState),typeof et.componentDidMount=="function"&&(_.flags|=4194308)}function Ji(_,a){try{var $="",j=a;do $+=Pa(j),j=j.return;while(j);var et=$}catch(tt){et=` +`+et[rt].replace(" at new "," at ");return _.displayName&&it.includes("")&&(it=it.replace("",_.displayName)),it}while(1<=rt&&0<=nt);break}}}finally{Na=!1,Error.prepareStackTrace=$}return(_=_?_.displayName||_.name:"")?Ma(_):""}function Pa(_){switch(_.tag){case 5:return Ma(_.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return _=Oa(_.type,!1),_;case 11:return _=Oa(_.type.render,!1),_;case 1:return _=Oa(_.type,!0),_;default:return""}}function Qa(_){if(_==null)return null;if(typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case Ca:return(_.displayName||"Context")+".Consumer";case Ba:return(_._context.displayName||"Context")+".Provider";case Da:var a=_.render;return _=_.displayName,_||(_=a.displayName||a.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case Ga:return a=_.displayName||null,a!==null?a:Qa(_.type)||"Memo";case Ha:a=_._payload,_=_._init;try{return Qa(_(a))}catch{}}return null}function Ra(_){var a=_.type;switch(_.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return _=a.render,_=_.displayName||_.name||"",a.displayName||(_!==""?"ForwardRef("+_+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(a);case 8:return a===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Sa(_){switch(typeof _){case"boolean":case"number":case"string":case"undefined":return _;case"object":return _;default:return""}}function Ta(_){var a=_.type;return(_=_.nodeName)&&_.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ua(_){var a=Ta(_)?"checked":"value",$=Object.getOwnPropertyDescriptor(_.constructor.prototype,a),j=""+_[a];if(!_.hasOwnProperty(a)&&typeof $<"u"&&typeof $.get=="function"&&typeof $.set=="function"){var et=$.get,tt=$.set;return Object.defineProperty(_,a,{configurable:!0,get:function(){return et.call(this)},set:function(rt){j=""+rt,tt.call(this,rt)}}),Object.defineProperty(_,a,{enumerable:$.enumerable}),{getValue:function(){return j},setValue:function(rt){j=""+rt},stopTracking:function(){_._valueTracker=null,delete _[a]}}}}function Va(_){_._valueTracker||(_._valueTracker=Ua(_))}function Wa(_){if(!_)return!1;var a=_._valueTracker;if(!a)return!0;var $=a.getValue(),j="";return _&&(j=Ta(_)?_.checked?"true":"false":_.value),_=j,_!==$?(a.setValue(_),!0):!1}function Xa(_){if(_=_||(typeof document<"u"?document:void 0),typeof _>"u")return null;try{return _.activeElement||_.body}catch{return _.body}}function Ya(_,a){var $=a.checked;return A$1({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:$??_._wrapperState.initialChecked})}function Za(_,a){var $=a.defaultValue==null?"":a.defaultValue,j=a.checked!=null?a.checked:a.defaultChecked;$=Sa(a.value!=null?a.value:$),_._wrapperState={initialChecked:j,initialValue:$,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function ab(_,a){a=a.checked,a!=null&&ta(_,"checked",a,!1)}function bb(_,a){ab(_,a);var $=Sa(a.value),j=a.type;if($!=null)j==="number"?($===0&&_.value===""||_.value!=$)&&(_.value=""+$):_.value!==""+$&&(_.value=""+$);else if(j==="submit"||j==="reset"){_.removeAttribute("value");return}a.hasOwnProperty("value")?cb(_,a.type,$):a.hasOwnProperty("defaultValue")&&cb(_,a.type,Sa(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(_.defaultChecked=!!a.defaultChecked)}function db(_,a,$){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var j=a.type;if(!(j!=="submit"&&j!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+_._wrapperState.initialValue,$||a===_.value||(_.value=a),_.defaultValue=a}$=_.name,$!==""&&(_.name=""),_.defaultChecked=!!_._wrapperState.initialChecked,$!==""&&(_.name=$)}function cb(_,a,$){(a!=="number"||Xa(_.ownerDocument)!==_)&&($==null?_.defaultValue=""+_._wrapperState.initialValue:_.defaultValue!==""+$&&(_.defaultValue=""+$))}var eb=Array.isArray;function fb(_,a,$,j){if(_=_.options,a){a={};for(var et=0;et<$.length;et++)a["$"+$[et]]=!0;for($=0;$<_.length;$++)et=a.hasOwnProperty("$"+_[$].value),_[$].selected!==et&&(_[$].selected=et),et&&j&&(_[$].defaultSelected=!0)}else{for($=""+Sa($),a=null,et=0;et<_.length;et++){if(_[et].value===$){_[et].selected=!0,j&&(_[et].defaultSelected=!0);return}a!==null||_[et].disabled||(a=_[et])}a!==null&&(a.selected=!0)}}function gb(_,a){if(a.dangerouslySetInnerHTML!=null)throw Error(p$2(91));return A$1({},a,{value:void 0,defaultValue:void 0,children:""+_._wrapperState.initialValue})}function hb(_,a){var $=a.value;if($==null){if($=a.children,a=a.defaultValue,$!=null){if(a!=null)throw Error(p$2(92));if(eb($)){if(1<$.length)throw Error(p$2(93));$=$[0]}a=$}a==null&&(a=""),$=a}_._wrapperState={initialValue:Sa($)}}function ib(_,a){var $=Sa(a.value),j=Sa(a.defaultValue);$!=null&&($=""+$,$!==_.value&&(_.value=$),a.defaultValue==null&&_.defaultValue!==$&&(_.defaultValue=$)),j!=null&&(_.defaultValue=""+j)}function jb(_){var a=_.textContent;a===_._wrapperState.initialValue&&a!==""&&a!==null&&(_.value=a)}function kb(_){switch(_){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lb(_,a){return _==null||_==="http://www.w3.org/1999/xhtml"?kb(a):_==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":_}var mb,nb=function(_){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,$,j,et){MSApp.execUnsafeLocalFunction(function(){return _(a,$,j,et)})}:_}(function(_,a){if(_.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in _)_.innerHTML=a;else{for(mb=mb||document.createElement("div"),mb.innerHTML=""+a.valueOf().toString()+"",a=mb.firstChild;_.firstChild;)_.removeChild(_.firstChild);for(;a.firstChild;)_.appendChild(a.firstChild)}});function ob(_,a){if(a){var $=_.firstChild;if($&&$===_.lastChild&&$.nodeType===3){$.nodeValue=a;return}}_.textContent=a}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(_){qb.forEach(function(a){a=a+_.charAt(0).toUpperCase()+_.substring(1),pb[a]=pb[_]})});function rb(_,a,$){return a==null||typeof a=="boolean"||a===""?"":$||typeof a!="number"||a===0||pb.hasOwnProperty(_)&&pb[_]?(""+a).trim():a+"px"}function sb(_,a){_=_.style;for(var $ in a)if(a.hasOwnProperty($)){var j=$.indexOf("--")===0,et=rb($,a[$],j);$==="float"&&($="cssFloat"),j?_.setProperty($,et):_[$]=et}}var tb=A$1({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(_,a){if(a){if(tb[_]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(p$2(137,_));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(p$2(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(p$2(61))}if(a.style!=null&&typeof a.style!="object")throw Error(p$2(62))}}function vb(_,a){if(_.indexOf("-")===-1)return typeof a.is=="string";switch(_){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(_){return _=_.target||_.srcElement||window,_.correspondingUseElement&&(_=_.correspondingUseElement),_.nodeType===3?_.parentNode:_}var yb=null,zb=null,Ab=null;function Bb(_){if(_=Cb(_)){if(typeof yb!="function")throw Error(p$2(280));var a=_.stateNode;a&&(a=Db(a),yb(_.stateNode,_.type,a))}}function Eb(_){zb?Ab?Ab.push(_):Ab=[_]:zb=_}function Fb(){if(zb){var _=zb,a=Ab;if(Ab=zb=null,Bb(_),a)for(_=0;_>>=0,_===0?32:31-(pc(_)/qc|0)|0}var rc=64,sc=4194304;function tc(_){switch(_&-_){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return _&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return _&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return _}}function uc(_,a){var $=_.pendingLanes;if($===0)return 0;var j=0,et=_.suspendedLanes,tt=_.pingedLanes,rt=$&268435455;if(rt!==0){var nt=rt&~et;nt!==0?j=tc(nt):(tt&=rt,tt!==0&&(j=tc(tt)))}else rt=$&~et,rt!==0?j=tc(rt):tt!==0&&(j=tc(tt));if(j===0)return 0;if(a!==0&&a!==j&&!(a&et)&&(et=j&-j,tt=a&-a,et>=tt||et===16&&(tt&4194240)!==0))return a;if(j&4&&(j|=$&16),a=_.entangledLanes,a!==0)for(_=_.entanglements,a&=j;0$;$++)a.push(_);return a}function Ac(_,a,$){_.pendingLanes|=a,a!==536870912&&(_.suspendedLanes=0,_.pingedLanes=0),_=_.eventTimes,a=31-oc(a),_[a]=$}function Bc(_,a){var $=_.pendingLanes&~a;_.pendingLanes=a,_.suspendedLanes=0,_.pingedLanes=0,_.expiredLanes&=a,_.mutableReadLanes&=a,_.entangledLanes&=a,a=_.entanglements;var j=_.eventTimes;for(_=_.expirationTimes;0<$;){var et=31-oc($),tt=1<=be),ee=" ",fe=!1;function ge(_,a){switch(_){case"keyup":return $d.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(_){return _=_.detail,typeof _=="object"&&"data"in _?_.data:null}var ie=!1;function je(_,a){switch(_){case"compositionend":return he(a);case"keypress":return a.which!==32?null:(fe=!0,ee);case"textInput":return _=a.data,_===ee&&fe?null:_;default:return null}}function ke(_,a){if(ie)return _==="compositionend"||!ae&&ge(_,a)?(_=nd(),md=ld=kd=null,ie=!1,_):null;switch(_){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:$,offset:a-_};_=j}e:{for(;$;){if($.nextSibling){$=$.nextSibling;break e}$=$.parentNode}$=void 0}$=Je($)}}function Le(_,a){return _&&a?_===a?!0:_&&_.nodeType===3?!1:a&&a.nodeType===3?Le(_,a.parentNode):"contains"in _?_.contains(a):_.compareDocumentPosition?!!(_.compareDocumentPosition(a)&16):!1:!1}function Me(){for(var _=window,a=Xa();a instanceof _.HTMLIFrameElement;){try{var $=typeof a.contentWindow.location.href=="string"}catch{$=!1}if($)_=a.contentWindow;else break;a=Xa(_.document)}return a}function Ne(_){var a=_&&_.nodeName&&_.nodeName.toLowerCase();return a&&(a==="input"&&(_.type==="text"||_.type==="search"||_.type==="tel"||_.type==="url"||_.type==="password")||a==="textarea"||_.contentEditable==="true")}function Oe(_){var a=Me(),$=_.focusedElem,j=_.selectionRange;if(a!==$&&$&&$.ownerDocument&&Le($.ownerDocument.documentElement,$)){if(j!==null&&Ne($)){if(a=j.start,_=j.end,_===void 0&&(_=a),"selectionStart"in $)$.selectionStart=a,$.selectionEnd=Math.min(_,$.value.length);else if(_=(a=$.ownerDocument||document)&&a.defaultView||window,_.getSelection){_=_.getSelection();var et=$.textContent.length,tt=Math.min(j.start,et);j=j.end===void 0?tt:Math.min(j.end,et),!_.extend&&tt>j&&(et=j,j=tt,tt=et),et=Ke($,tt);var rt=Ke($,j);et&&rt&&(_.rangeCount!==1||_.anchorNode!==et.node||_.anchorOffset!==et.offset||_.focusNode!==rt.node||_.focusOffset!==rt.offset)&&(a=a.createRange(),a.setStart(et.node,et.offset),_.removeAllRanges(),tt>j?(_.addRange(a),_.extend(rt.node,rt.offset)):(a.setEnd(rt.node,rt.offset),_.addRange(a)))}}for(a=[],_=$;_=_.parentNode;)_.nodeType===1&&a.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(_,a,$){var j=$.window===$?$.document:$.nodeType===9?$:$.ownerDocument;Te||Qe==null||Qe!==Xa(j)||(j=Qe,"selectionStart"in j&&Ne(j)?j={start:j.selectionStart,end:j.selectionEnd}:(j=(j.ownerDocument&&j.ownerDocument.defaultView||window).getSelection(),j={anchorNode:j.anchorNode,anchorOffset:j.anchorOffset,focusNode:j.focusNode,focusOffset:j.focusOffset}),Se&&Ie(Se,j)||(Se=j,j=oe(Re,"onSelect"),0Tf||(_.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(_,a){Tf++,Sf[Tf]=_.current,_.current=a}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(_,a){var $=_.type.contextTypes;if(!$)return Vf;var j=_.stateNode;if(j&&j.__reactInternalMemoizedUnmaskedChildContext===a)return j.__reactInternalMemoizedMaskedChildContext;var et={},tt;for(tt in $)et[tt]=a[tt];return j&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=a,_.__reactInternalMemoizedMaskedChildContext=et),et}function Zf(_){return _=_.childContextTypes,_!=null}function $f(){E(Wf),E(H$1)}function ag(_,a,$){if(H$1.current!==Vf)throw Error(p$2(168));G(H$1,a),G(Wf,$)}function bg(_,a,$){var j=_.stateNode;if(a=a.childContextTypes,typeof j.getChildContext!="function")return $;j=j.getChildContext();for(var et in j)if(!(et in a))throw Error(p$2(108,Ra(_)||"Unknown",et));return A$1({},$,j)}function cg(_){return _=(_=_.stateNode)&&_.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G(H$1,_),G(Wf,Wf.current),!0}function dg(_,a,$){var j=_.stateNode;if(!j)throw Error(p$2(169));$?(_=bg(_,a,Xf),j.__reactInternalMemoizedMergedChildContext=_,E(Wf),E(H$1),G(H$1,_)):E(Wf),G(Wf,$)}var eg=null,fg=!1,gg=!1;function hg(_){eg===null?eg=[_]:eg.push(_)}function ig(_){fg=!0,hg(_)}function jg(){if(!gg&&eg!==null){gg=!0;var _=0,a=C;try{var $=eg;for(C=1;_<$.length;_++){var j=$[_];do j=j(!0);while(j!==null)}eg=null,fg=!1}catch(et){throw eg!==null&&(eg=eg.slice(_+1)),ac(fc,jg),et}finally{C=a,gg=!1}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(_,a){kg[lg++]=ng,kg[lg++]=mg,mg=_,ng=a}function ug(_,a,$){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=_;var j=rg;_=sg;var et=32-oc(j)-1;j&=~(1<>=rt,et-=rt,rg=1<<32-oc(a)+et|$<Mt?(Dt=jt,jt=null):Dt=jt.sibling;var Ft=ut(Pt,jt,kt[Mt],Lt);if(Ft===null){jt===null&&(jt=Dt);break}_&&jt&&Ft.alternate===null&&a(Pt,jt),Tt=tt(Ft,Tt,Mt),zt===null?Nt=Ft:zt.sibling=Ft,zt=Ft,jt=Dt}if(Mt===kt.length)return $(Pt,jt),I&&tg(Pt,Mt),Nt;if(jt===null){for(;MtMt?(Dt=jt,jt=null):Dt=jt.sibling;var Bt=ut(Pt,jt,Ft.value,Lt);if(Bt===null){jt===null&&(jt=Dt);break}_&&jt&&Bt.alternate===null&&a(Pt,jt),Tt=tt(Bt,Tt,Mt),zt===null?Nt=Bt:zt.sibling=Bt,zt=Bt,jt=Dt}if(Ft.done)return $(Pt,jt),I&&tg(Pt,Mt),Nt;if(jt===null){for(;!Ft.done;Mt++,Ft=kt.next())Ft=ot(Pt,Ft.value,Lt),Ft!==null&&(Tt=tt(Ft,Tt,Mt),zt===null?Nt=Ft:zt.sibling=Ft,zt=Ft);return I&&tg(Pt,Mt),Nt}for(jt=j(Pt,jt);!Ft.done;Mt++,Ft=kt.next())Ft=dt(jt,Pt,Mt,Ft.value,Lt),Ft!==null&&(_&&Ft.alternate!==null&&jt.delete(Ft.key===null?Mt:Ft.key),Tt=tt(Ft,Tt,Mt),zt===null?Nt=Ft:zt.sibling=Ft,zt=Ft);return _&&jt.forEach(function(yt){return a(Pt,yt)}),I&&tg(Pt,Mt),Nt}function Ct(Pt,Tt,kt,Lt){if(typeof kt=="object"&&kt!==null&&kt.type===ya&&kt.key===null&&(kt=kt.props.children),typeof kt=="object"&&kt!==null){switch(kt.$$typeof){case va:e:{for(var Nt=kt.key,zt=Tt;zt!==null;){if(zt.key===Nt){if(Nt=kt.type,Nt===ya){if(zt.tag===7){$(Pt,zt.sibling),Tt=et(zt,kt.props.children),Tt.return=Pt,Pt=Tt;break e}}else if(zt.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===Ha&&Ng(Nt)===zt.type){$(Pt,zt.sibling),Tt=et(zt,kt.props),Tt.ref=Lg(Pt,zt,kt),Tt.return=Pt,Pt=Tt;break e}$(Pt,zt);break}else a(Pt,zt);zt=zt.sibling}kt.type===ya?(Tt=Tg(kt.props.children,Pt.mode,Lt,kt.key),Tt.return=Pt,Pt=Tt):(Lt=Rg(kt.type,kt.key,kt.props,null,Pt.mode,Lt),Lt.ref=Lg(Pt,Tt,kt),Lt.return=Pt,Pt=Lt)}return rt(Pt);case wa:e:{for(zt=kt.key;Tt!==null;){if(Tt.key===zt)if(Tt.tag===4&&Tt.stateNode.containerInfo===kt.containerInfo&&Tt.stateNode.implementation===kt.implementation){$(Pt,Tt.sibling),Tt=et(Tt,kt.children||[]),Tt.return=Pt,Pt=Tt;break e}else{$(Pt,Tt);break}else a(Pt,Tt);Tt=Tt.sibling}Tt=Sg(kt,Pt.mode,Lt),Tt.return=Pt,Pt=Tt}return rt(Pt);case Ha:return zt=kt._init,Ct(Pt,Tt,zt(kt._payload),Lt)}if(eb(kt))return mt(Pt,Tt,kt,Lt);if(Ka(kt))return xt(Pt,Tt,kt,Lt);Mg(Pt,kt)}return typeof kt=="string"&&kt!==""||typeof kt=="number"?(kt=""+kt,Tt!==null&&Tt.tag===6?($(Pt,Tt.sibling),Tt=et(Tt,kt),Tt.return=Pt,Pt=Tt):($(Pt,Tt),Tt=Qg(kt,Pt.mode,Lt),Tt.return=Pt,Pt=Tt),rt(Pt)):$(Pt,Tt)}return Ct}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(_){var a=Wg.current;E(Wg),_._currentValue=a}function bh(_,a,$){for(;_!==null;){var j=_.alternate;if((_.childLanes&a)!==a?(_.childLanes|=a,j!==null&&(j.childLanes|=a)):j!==null&&(j.childLanes&a)!==a&&(j.childLanes|=a),_===$)break;_=_.return}}function ch$1(_,a){Xg=_,Zg=Yg=null,_=_.dependencies,_!==null&&_.firstContext!==null&&(_.lanes&a&&(dh$1=!0),_.firstContext=null)}function eh(_){var a=_._currentValue;if(Zg!==_)if(_={context:_,memoizedValue:a,next:null},Yg===null){if(Xg===null)throw Error(p$2(308));Yg=_,Xg.dependencies={lanes:0,firstContext:_}}else Yg=Yg.next=_;return a}var fh=null;function gh(_){fh===null?fh=[_]:fh.push(_)}function hh(_,a,$,j){var et=a.interleaved;return et===null?($.next=$,gh(a)):($.next=et.next,et.next=$),a.interleaved=$,ih(_,j)}function ih(_,a){_.lanes|=a;var $=_.alternate;for($!==null&&($.lanes|=a),$=_,_=_.return;_!==null;)_.childLanes|=a,$=_.alternate,$!==null&&($.childLanes|=a),$=_,_=_.return;return $.tag===3?$.stateNode:null}var jh=!1;function kh(_){_.updateQueue={baseState:_.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(_,a){_=_.updateQueue,a.updateQueue===_&&(a.updateQueue={baseState:_.baseState,firstBaseUpdate:_.firstBaseUpdate,lastBaseUpdate:_.lastBaseUpdate,shared:_.shared,effects:_.effects})}function mh(_,a){return{eventTime:_,lane:a,tag:0,payload:null,callback:null,next:null}}function nh(_,a,$){var j=_.updateQueue;if(j===null)return null;if(j=j.shared,K$6&2){var et=j.pending;return et===null?a.next=a:(a.next=et.next,et.next=a),j.pending=a,ih(_,$)}return et=j.interleaved,et===null?(a.next=a,gh(j)):(a.next=et.next,et.next=a),j.interleaved=a,ih(_,$)}function oh(_,a,$){if(a=a.updateQueue,a!==null&&(a=a.shared,($&4194240)!==0)){var j=a.lanes;j&=_.pendingLanes,$|=j,a.lanes=$,Cc(_,$)}}function ph(_,a){var $=_.updateQueue,j=_.alternate;if(j!==null&&(j=j.updateQueue,$===j)){var et=null,tt=null;if($=$.firstBaseUpdate,$!==null){do{var rt={eventTime:$.eventTime,lane:$.lane,tag:$.tag,payload:$.payload,callback:$.callback,next:null};tt===null?et=tt=rt:tt=tt.next=rt,$=$.next}while($!==null);tt===null?et=tt=a:tt=tt.next=a}else et=tt=a;$={baseState:j.baseState,firstBaseUpdate:et,lastBaseUpdate:tt,shared:j.shared,effects:j.effects},_.updateQueue=$;return}_=$.lastBaseUpdate,_===null?$.firstBaseUpdate=a:_.next=a,$.lastBaseUpdate=a}function qh(_,a,$,j){var et=_.updateQueue;jh=!1;var tt=et.firstBaseUpdate,rt=et.lastBaseUpdate,nt=et.shared.pending;if(nt!==null){et.shared.pending=null;var it=nt,at=it.next;it.next=null,rt===null?tt=at:rt.next=at,rt=it;var st=_.alternate;st!==null&&(st=st.updateQueue,nt=st.lastBaseUpdate,nt!==rt&&(nt===null?st.firstBaseUpdate=at:nt.next=at,st.lastBaseUpdate=it))}if(tt!==null){var ot=et.baseState;rt=0,st=at=it=null,nt=tt;do{var ut=nt.lane,dt=nt.eventTime;if((j&ut)===ut){st!==null&&(st=st.next={eventTime:dt,lane:0,tag:nt.tag,payload:nt.payload,callback:nt.callback,next:null});e:{var mt=_,xt=nt;switch(ut=a,dt=$,xt.tag){case 1:if(mt=xt.payload,typeof mt=="function"){ot=mt.call(dt,ot,ut);break e}ot=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=xt.payload,ut=typeof mt=="function"?mt.call(dt,ot,ut):mt,ut==null)break e;ot=A$1({},ot,ut);break e;case 2:jh=!0}}nt.callback!==null&&nt.lane!==0&&(_.flags|=64,ut=et.effects,ut===null?et.effects=[nt]:ut.push(nt))}else dt={eventTime:dt,lane:ut,tag:nt.tag,payload:nt.payload,callback:nt.callback,next:null},st===null?(at=st=dt,it=ot):st=st.next=dt,rt|=ut;if(nt=nt.next,nt===null){if(nt=et.shared.pending,nt===null)break;ut=nt,nt=ut.next,ut.next=null,et.lastBaseUpdate=ut,et.shared.pending=null}}while(!0);if(st===null&&(it=ot),et.baseState=it,et.firstBaseUpdate=at,et.lastBaseUpdate=st,a=et.shared.interleaved,a!==null){et=a;do rt|=et.lane,et=et.next;while(et!==a)}else tt===null&&(et.shared.lanes=0);rh$1|=rt,_.lanes=rt,_.memoizedState=ot}}function sh$1(_,a,$){if(_=a.effects,a.effects=null,_!==null)for(a=0;a<_.length;a++){var j=_[a],et=j.callback;if(et!==null){if(j.callback=null,j=$,typeof et!="function")throw Error(p$2(191,et));et.call(j)}}}var th={},uh=Uf(th),vh$1=Uf(th),wh=Uf(th);function xh(_){if(_===th)throw Error(p$2(174));return _}function yh(_,a){switch(G(wh,a),G(vh$1,_),G(uh,th),_=a.nodeType,_){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:lb(null,"");break;default:_=_===8?a.parentNode:a,a=_.namespaceURI||null,_=_.tagName,a=lb(a,_)}E(uh),G(uh,a)}function zh(){E(uh),E(vh$1),E(wh)}function Ah(_){xh(wh.current);var a=xh(uh.current),$=lb(a,_.type);a!==$&&(G(vh$1,_),G(uh,$))}function Bh(_){vh$1.current===_&&(E(uh),E(vh$1))}var L=Uf(0);function Ch$1(_){for(var a=_;a!==null;){if(a.tag===13){var $=a.memoizedState;if($!==null&&($=$.dehydrated,$===null||$.data==="$?"||$.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===_)break;for(;a.sibling===null;){if(a.return===null||a.return===_)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Dh=[];function Eh(){for(var _=0;_$?$:4,_(!0);var j=Gh.transition;Gh.transition={};try{_(!1),a()}finally{C=$,Gh.transition=j}}function wi(){return Uh().memoizedState}function xi(_,a,$){var j=yi(_);if($={lane:j,action:$,hasEagerState:!1,eagerState:null,next:null},zi(_))Ai(a,$);else if($=hh(_,a,$,j),$!==null){var et=R$1();gi($,_,j,et),Bi($,a,j)}}function ii(_,a,$){var j=yi(_),et={lane:j,action:$,hasEagerState:!1,eagerState:null,next:null};if(zi(_))Ai(a,et);else{var tt=_.alternate;if(_.lanes===0&&(tt===null||tt.lanes===0)&&(tt=a.lastRenderedReducer,tt!==null))try{var rt=a.lastRenderedState,nt=tt(rt,$);if(et.hasEagerState=!0,et.eagerState=nt,He(nt,rt)){var it=a.interleaved;it===null?(et.next=et,gh(a)):(et.next=it.next,it.next=et),a.interleaved=et;return}}catch{}finally{}$=hh(_,a,et,j),$!==null&&(et=R$1(),gi($,_,j,et),Bi($,a,j))}}function zi(_){var a=_.alternate;return _===M||a!==null&&a===M}function Ai(_,a){Jh=Ih=!0;var $=_.pending;$===null?a.next=a:(a.next=$.next,$.next=a),_.pending=a}function Bi(_,a,$){if($&4194240){var j=a.lanes;j&=_.pendingLanes,$|=j,a.lanes=$,Cc(_,$)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(_,a){return Th().memoizedState=[_,a===void 0?null:a],_},useContext:eh,useEffect:mi,useImperativeHandle:function(_,a,$){return $=$!=null?$.concat([_]):null,ki(4194308,4,pi.bind(null,a,_),$)},useLayoutEffect:function(_,a){return ki(4194308,4,_,a)},useInsertionEffect:function(_,a){return ki(4,2,_,a)},useMemo:function(_,a){var $=Th();return a=a===void 0?null:a,_=_(),$.memoizedState=[_,a],_},useReducer:function(_,a,$){var j=Th();return a=$!==void 0?$(a):a,j.memoizedState=j.baseState=a,_={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_,lastRenderedState:a},j.queue=_,_=_.dispatch=xi.bind(null,M,_),[j.memoizedState,_]},useRef:function(_){var a=Th();return _={current:_},a.memoizedState=_},useState:hi,useDebugValue:ri,useDeferredValue:function(_){return Th().memoizedState=_},useTransition:function(){var _=hi(!1),a=_[0];return _=vi.bind(null,_[1]),Th().memoizedState=_,[a,_]},useMutableSource:function(){},useSyncExternalStore:function(_,a,$){var j=M,et=Th();if(I){if($===void 0)throw Error(p$2(407));$=$()}else{if($=a(),Q===null)throw Error(p$2(349));Hh&30||di(j,a,$)}et.memoizedState=$;var tt={value:$,getSnapshot:a};return et.queue=tt,mi(ai.bind(null,j,tt,_),[_]),j.flags|=2048,bi(9,ci.bind(null,j,tt,$,a),void 0,null),$},useId:function(){var _=Th(),a=Q.identifierPrefix;if(I){var $=sg,j=rg;$=(j&~(1<<32-oc(j)-1)).toString(32)+$,a=":"+a+"R"+$,$=Kh$1++,0<$&&(a+="H"+$.toString(32)),a+=":"}else $=Lh++,a=":"+a+"r"+$.toString(32)+":";return _.memoizedState=a},unstable_isNewReconciler:!1},Ph={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Wh,useRef:ji,useState:function(){return Wh(Vh)},useDebugValue:ri,useDeferredValue:function(_){var a=Uh();return ui(a,N.memoizedState,_)},useTransition:function(){var _=Wh(Vh)[0],a=Uh().memoizedState;return[_,a]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1},Qh={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Xh,useRef:ji,useState:function(){return Xh(Vh)},useDebugValue:ri,useDeferredValue:function(_){var a=Uh();return N===null?a.memoizedState=_:ui(a,N.memoizedState,_)},useTransition:function(){var _=Xh(Vh)[0],a=Uh().memoizedState;return[_,a]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1};function Ci(_,a){if(_&&_.defaultProps){a=A$1({},a),_=_.defaultProps;for(var $ in _)a[$]===void 0&&(a[$]=_[$]);return a}return a}function Di(_,a,$,j){a=_.memoizedState,$=$(j,a),$=$==null?a:A$1({},a,$),_.memoizedState=$,_.lanes===0&&(_.updateQueue.baseState=$)}var Ei={isMounted:function(_){return(_=_._reactInternals)?Vb(_)===_:!1},enqueueSetState:function(_,a,$){_=_._reactInternals;var j=R$1(),et=yi(_),tt=mh(j,et);tt.payload=a,$!=null&&(tt.callback=$),a=nh(_,tt,et),a!==null&&(gi(a,_,et,j),oh(a,_,et))},enqueueReplaceState:function(_,a,$){_=_._reactInternals;var j=R$1(),et=yi(_),tt=mh(j,et);tt.tag=1,tt.payload=a,$!=null&&(tt.callback=$),a=nh(_,tt,et),a!==null&&(gi(a,_,et,j),oh(a,_,et))},enqueueForceUpdate:function(_,a){_=_._reactInternals;var $=R$1(),j=yi(_),et=mh($,j);et.tag=2,a!=null&&(et.callback=a),a=nh(_,et,j),a!==null&&(gi(a,_,j,$),oh(a,_,j))}};function Fi(_,a,$,j,et,tt,rt){return _=_.stateNode,typeof _.shouldComponentUpdate=="function"?_.shouldComponentUpdate(j,tt,rt):a.prototype&&a.prototype.isPureReactComponent?!Ie($,j)||!Ie(et,tt):!0}function Gi(_,a,$){var j=!1,et=Vf,tt=a.contextType;return typeof tt=="object"&&tt!==null?tt=eh(tt):(et=Zf(a)?Xf:H$1.current,j=a.contextTypes,tt=(j=j!=null)?Yf(_,et):Vf),a=new a($,tt),_.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ei,_.stateNode=a,a._reactInternals=_,j&&(_=_.stateNode,_.__reactInternalMemoizedUnmaskedChildContext=et,_.__reactInternalMemoizedMaskedChildContext=tt),a}function Hi(_,a,$,j){_=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps($,j),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps($,j),a.state!==_&&Ei.enqueueReplaceState(a,a.state,null)}function Ii(_,a,$,j){var et=_.stateNode;et.props=$,et.state=_.memoizedState,et.refs={},kh(_);var tt=a.contextType;typeof tt=="object"&&tt!==null?et.context=eh(tt):(tt=Zf(a)?Xf:H$1.current,et.context=Yf(_,tt)),et.state=_.memoizedState,tt=a.getDerivedStateFromProps,typeof tt=="function"&&(Di(_,a,tt,$),et.state=_.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof et.getSnapshotBeforeUpdate=="function"||typeof et.UNSAFE_componentWillMount!="function"&&typeof et.componentWillMount!="function"||(a=et.state,typeof et.componentWillMount=="function"&&et.componentWillMount(),typeof et.UNSAFE_componentWillMount=="function"&&et.UNSAFE_componentWillMount(),a!==et.state&&Ei.enqueueReplaceState(et,et.state,null),qh(_,$,et,j),et.state=_.memoizedState),typeof et.componentDidMount=="function"&&(_.flags|=4194308)}function Ji(_,a){try{var $="",j=a;do $+=Pa(j),j=j.return;while(j);var et=$}catch(tt){et=` Error generating stack: `+tt.message+` -`+tt.stack}return{value:_,source:a,stack:et,digest:null}}function Ki(_,a,$){return{value:_,source:null,stack:$??null,digest:a??null}}function Li(_,a){try{console.error(a.value)}catch($){setTimeout(function(){throw $})}}var Mi=typeof WeakMap=="function"?WeakMap:Map;function Ni(_,a,$){$=mh(-1,$),$.tag=3,$.payload={element:null};var j=a.value;return $.callback=function(){Oi||(Oi=!0,Pi=j),Li(_,a)},$}function Qi(_,a,$){$=mh(-1,$),$.tag=3;var j=_.type.getDerivedStateFromError;if(typeof j=="function"){var et=a.value;$.payload=function(){return j(et)},$.callback=function(){Li(_,a)}}var tt=_.stateNode;return tt!==null&&typeof tt.componentDidCatch=="function"&&($.callback=function(){Li(_,a),typeof j!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var rt=a.stack;this.componentDidCatch(a.value,{componentStack:rt!==null?rt:""})}),$}function Si(_,a,$){var j=_.pingCache;if(j===null){j=_.pingCache=new Mi;var et=new Set;j.set(a,et)}else et=j.get(a),et===void 0&&(et=new Set,j.set(a,et));et.has($)||(et.add($),_=Ti.bind(null,_,a,$),a.then(_,_))}function Ui(_){do{var a;if((a=_.tag===13)&&(a=_.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return _;_=_.return}while(_!==null);return null}function Vi(_,a,$,j,et){return _.mode&1?(_.flags|=65536,_.lanes=et,_):(_===a?_.flags|=65536:(_.flags|=128,$.flags|=131072,$.flags&=-52805,$.tag===1&&($.alternate===null?$.tag=17:(a=mh(-1,1),a.tag=2,nh($,a,1))),$.lanes|=1),_)}var Wi=ua.ReactCurrentOwner,dh$1=!1;function Xi(_,a,$,j){a.child=_===null?Vg(a,null,$,j):Ug(a,_.child,$,j)}function Yi(_,a,$,j,et){$=$.render;var tt=a.ref;return ch$1(a,et),j=Nh(_,a,$,j,tt,et),$=Sh(),_!==null&&!dh$1?(a.updateQueue=_.updateQueue,a.flags&=-2053,_.lanes&=~et,Zi(_,a,et)):(I&&$&&vg(a),a.flags|=1,Xi(_,a,j,et),a.child)}function $i(_,a,$,j,et){if(_===null){var tt=$.type;return typeof tt=="function"&&!aj(tt)&&tt.defaultProps===void 0&&$.compare===null&&$.defaultProps===void 0?(a.tag=15,a.type=tt,bj(_,a,tt,j,et)):(_=Rg($.type,null,j,a,a.mode,et),_.ref=a.ref,_.return=a,a.child=_)}if(tt=_.child,!(_.lanes&et)){var rt=tt.memoizedProps;if($=$.compare,$=$!==null?$:Ie,$(rt,j)&&_.ref===a.ref)return Zi(_,a,et)}return a.flags|=1,_=Pg(tt,j),_.ref=a.ref,_.return=a,a.child=_}function bj(_,a,$,j,et){if(_!==null){var tt=_.memoizedProps;if(Ie(tt,j)&&_.ref===a.ref)if(dh$1=!1,a.pendingProps=j=tt,(_.lanes&et)!==0)_.flags&131072&&(dh$1=!0);else return a.lanes=_.lanes,Zi(_,a,et)}return cj(_,a,$,j,et)}function dj(_,a,$){var j=a.pendingProps,et=j.children,tt=_!==null?_.memoizedState:null;if(j.mode==="hidden")if(!(a.mode&1))a.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(ej,fj),fj|=$;else{if(!($&1073741824))return _=tt!==null?tt.baseLanes|$:$,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:_,cachePool:null,transitions:null},a.updateQueue=null,G(ej,fj),fj|=_,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},j=tt!==null?tt.baseLanes:$,G(ej,fj),fj|=j}else tt!==null?(j=tt.baseLanes|$,a.memoizedState=null):j=$,G(ej,fj),fj|=j;return Xi(_,a,et,$),a.child}function gj(_,a){var $=a.ref;(_===null&&$!==null||_!==null&&_.ref!==$)&&(a.flags|=512,a.flags|=2097152)}function cj(_,a,$,j,et){var tt=Zf($)?Xf:H$1.current;return tt=Yf(a,tt),ch$1(a,et),$=Nh(_,a,$,j,tt,et),j=Sh(),_!==null&&!dh$1?(a.updateQueue=_.updateQueue,a.flags&=-2053,_.lanes&=~et,Zi(_,a,et)):(I&&j&&vg(a),a.flags|=1,Xi(_,a,$,et),a.child)}function hj(_,a,$,j,et){if(Zf($)){var tt=!0;cg(a)}else tt=!1;if(ch$1(a,et),a.stateNode===null)ij(_,a),Gi(a,$,j),Ii(a,$,j,et),j=!0;else if(_===null){var rt=a.stateNode,nt=a.memoizedProps;rt.props=nt;var it=rt.context,ot=$.contextType;typeof ot=="object"&&ot!==null?ot=eh(ot):(ot=Zf($)?Xf:H$1.current,ot=Yf(a,ot));var st=$.getDerivedStateFromProps,at=typeof st=="function"||typeof rt.getSnapshotBeforeUpdate=="function";at||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(nt!==j||it!==ot)&&Hi(a,rt,j,ot),jh=!1;var ut=a.memoizedState;rt.state=ut,qh(a,j,rt,et),it=a.memoizedState,nt!==j||ut!==it||Wf.current||jh?(typeof st=="function"&&(Di(a,$,st,j),it=a.memoizedState),(nt=jh||Fi(a,$,nt,j,ut,it,ot))?(at||typeof rt.UNSAFE_componentWillMount!="function"&&typeof rt.componentWillMount!="function"||(typeof rt.componentWillMount=="function"&&rt.componentWillMount(),typeof rt.UNSAFE_componentWillMount=="function"&&rt.UNSAFE_componentWillMount()),typeof rt.componentDidMount=="function"&&(a.flags|=4194308)):(typeof rt.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=j,a.memoizedState=it),rt.props=j,rt.state=it,rt.context=ot,j=nt):(typeof rt.componentDidMount=="function"&&(a.flags|=4194308),j=!1)}else{rt=a.stateNode,lh(_,a),nt=a.memoizedProps,ot=a.type===a.elementType?nt:Ci(a.type,nt),rt.props=ot,at=a.pendingProps,ut=rt.context,it=$.contextType,typeof it=="object"&&it!==null?it=eh(it):(it=Zf($)?Xf:H$1.current,it=Yf(a,it));var ht=$.getDerivedStateFromProps;(st=typeof ht=="function"||typeof rt.getSnapshotBeforeUpdate=="function")||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(nt!==at||ut!==it)&&Hi(a,rt,j,it),jh=!1,ut=a.memoizedState,rt.state=ut,qh(a,j,rt,et);var bt=a.memoizedState;nt!==at||ut!==bt||Wf.current||jh?(typeof ht=="function"&&(Di(a,$,ht,j),bt=a.memoizedState),(ot=jh||Fi(a,$,ot,j,ut,bt,it)||!1)?(st||typeof rt.UNSAFE_componentWillUpdate!="function"&&typeof rt.componentWillUpdate!="function"||(typeof rt.componentWillUpdate=="function"&&rt.componentWillUpdate(j,bt,it),typeof rt.UNSAFE_componentWillUpdate=="function"&&rt.UNSAFE_componentWillUpdate(j,bt,it)),typeof rt.componentDidUpdate=="function"&&(a.flags|=4),typeof rt.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof rt.componentDidUpdate!="function"||nt===_.memoizedProps&&ut===_.memoizedState||(a.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||nt===_.memoizedProps&&ut===_.memoizedState||(a.flags|=1024),a.memoizedProps=j,a.memoizedState=bt),rt.props=j,rt.state=bt,rt.context=it,j=ot):(typeof rt.componentDidUpdate!="function"||nt===_.memoizedProps&&ut===_.memoizedState||(a.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||nt===_.memoizedProps&&ut===_.memoizedState||(a.flags|=1024),j=!1)}return jj(_,a,$,j,tt,et)}function jj(_,a,$,j,et,tt){gj(_,a);var rt=(a.flags&128)!==0;if(!j&&!rt)return et&&dg(a,$,!1),Zi(_,a,tt);j=a.stateNode,Wi.current=a;var nt=rt&&typeof $.getDerivedStateFromError!="function"?null:j.render();return a.flags|=1,_!==null&&rt?(a.child=Ug(a,_.child,null,tt),a.child=Ug(a,null,nt,tt)):Xi(_,a,nt,tt),a.memoizedState=j.state,et&&dg(a,$,!0),a.child}function kj(_){var a=_.stateNode;a.pendingContext?ag(_,a.pendingContext,a.pendingContext!==a.context):a.context&&ag(_,a.context,!1),yh(_,a.containerInfo)}function lj(_,a,$,j,et){return Ig(),Jg(et),a.flags|=256,Xi(_,a,$,j),a.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(_){return{baseLanes:_,cachePool:null,transitions:null}}function oj(_,a,$){var j=a.pendingProps,et=L.current,tt=!1,rt=(a.flags&128)!==0,nt;if((nt=rt)||(nt=_!==null&&_.memoizedState===null?!1:(et&2)!==0),nt?(tt=!0,a.flags&=-129):(_===null||_.memoizedState!==null)&&(et|=1),G(L,et&1),_===null)return Eg(a),_=a.memoizedState,_!==null&&(_=_.dehydrated,_!==null)?(a.mode&1?_.data==="$!"?a.lanes=8:a.lanes=1073741824:a.lanes=1,null):(rt=j.children,_=j.fallback,tt?(j=a.mode,tt=a.child,rt={mode:"hidden",children:rt},!(j&1)&&tt!==null?(tt.childLanes=0,tt.pendingProps=rt):tt=pj(rt,j,0,null),_=Tg(_,j,$,null),tt.return=a,_.return=a,tt.sibling=_,a.child=tt,a.child.memoizedState=nj($),a.memoizedState=mj,_):qj(a,rt));if(et=_.memoizedState,et!==null&&(nt=et.dehydrated,nt!==null))return rj(_,a,rt,j,nt,et,$);if(tt){tt=j.fallback,rt=a.mode,et=_.child,nt=et.sibling;var it={mode:"hidden",children:j.children};return!(rt&1)&&a.child!==et?(j=a.child,j.childLanes=0,j.pendingProps=it,a.deletions=null):(j=Pg(et,it),j.subtreeFlags=et.subtreeFlags&14680064),nt!==null?tt=Pg(nt,tt):(tt=Tg(tt,rt,$,null),tt.flags|=2),tt.return=a,j.return=a,j.sibling=tt,a.child=j,j=tt,tt=a.child,rt=_.child.memoizedState,rt=rt===null?nj($):{baseLanes:rt.baseLanes|$,cachePool:null,transitions:rt.transitions},tt.memoizedState=rt,tt.childLanes=_.childLanes&~$,a.memoizedState=mj,j}return tt=_.child,_=tt.sibling,j=Pg(tt,{mode:"visible",children:j.children}),!(a.mode&1)&&(j.lanes=$),j.return=a,j.sibling=null,_!==null&&($=a.deletions,$===null?(a.deletions=[_],a.flags|=16):$.push(_)),a.child=j,a.memoizedState=null,j}function qj(_,a){return a=pj({mode:"visible",children:a},_.mode,0,null),a.return=_,_.child=a}function sj(_,a,$,j){return j!==null&&Jg(j),Ug(a,_.child,null,$),_=qj(a,a.pendingProps.children),_.flags|=2,a.memoizedState=null,_}function rj(_,a,$,j,et,tt,rt){if($)return a.flags&256?(a.flags&=-257,j=Ki(Error(p$2(422))),sj(_,a,rt,j)):a.memoizedState!==null?(a.child=_.child,a.flags|=128,null):(tt=j.fallback,et=a.mode,j=pj({mode:"visible",children:j.children},et,0,null),tt=Tg(tt,et,rt,null),tt.flags|=2,j.return=a,tt.return=a,j.sibling=tt,a.child=j,a.mode&1&&Ug(a,_.child,null,rt),a.child.memoizedState=nj(rt),a.memoizedState=mj,tt);if(!(a.mode&1))return sj(_,a,rt,null);if(et.data==="$!"){if(j=et.nextSibling&&et.nextSibling.dataset,j)var nt=j.dgst;return j=nt,tt=Error(p$2(419)),j=Ki(tt,j,void 0),sj(_,a,rt,j)}if(nt=(rt&_.childLanes)!==0,dh$1||nt){if(j=Q,j!==null){switch(rt&-rt){case 4:et=2;break;case 16:et=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:et=32;break;case 536870912:et=268435456;break;default:et=0}et=et&(j.suspendedLanes|rt)?0:et,et!==0&&et!==tt.retryLane&&(tt.retryLane=et,ih(_,et),gi(j,_,et,-1))}return tj(),j=Ki(Error(p$2(421))),sj(_,a,rt,j)}return et.data==="$?"?(a.flags|=128,a.child=_.child,a=uj.bind(null,_),et._reactRetry=a,null):(_=tt.treeContext,yg=Lf(et.nextSibling),xg=a,I=!0,zg=null,_!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=_.id,sg=_.overflow,qg=a),a=qj(a,j.children),a.flags|=4096,a)}function vj(_,a,$){_.lanes|=a;var j=_.alternate;j!==null&&(j.lanes|=a),bh(_.return,a,$)}function wj(_,a,$,j,et){var tt=_.memoizedState;tt===null?_.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:j,tail:$,tailMode:et}:(tt.isBackwards=a,tt.rendering=null,tt.renderingStartTime=0,tt.last=j,tt.tail=$,tt.tailMode=et)}function xj(_,a,$){var j=a.pendingProps,et=j.revealOrder,tt=j.tail;if(Xi(_,a,j.children,$),j=L.current,j&2)j=j&1|2,a.flags|=128;else{if(_!==null&&_.flags&128)e:for(_=a.child;_!==null;){if(_.tag===13)_.memoizedState!==null&&vj(_,$,a);else if(_.tag===19)vj(_,$,a);else if(_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)break e;for(;_.sibling===null;){if(_.return===null||_.return===a)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}j&=1}if(G(L,j),!(a.mode&1))a.memoizedState=null;else switch(et){case"forwards":for($=a.child,et=null;$!==null;)_=$.alternate,_!==null&&Ch$1(_)===null&&(et=$),$=$.sibling;$=et,$===null?(et=a.child,a.child=null):(et=$.sibling,$.sibling=null),wj(a,!1,et,$,tt);break;case"backwards":for($=null,et=a.child,a.child=null;et!==null;){if(_=et.alternate,_!==null&&Ch$1(_)===null){a.child=et;break}_=et.sibling,et.sibling=$,$=et,et=_}wj(a,!0,$,null,tt);break;case"together":wj(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function ij(_,a){!(a.mode&1)&&_!==null&&(_.alternate=null,a.alternate=null,a.flags|=2)}function Zi(_,a,$){if(_!==null&&(a.dependencies=_.dependencies),rh$1|=a.lanes,!($&a.childLanes))return null;if(_!==null&&a.child!==_.child)throw Error(p$2(153));if(a.child!==null){for(_=a.child,$=Pg(_,_.pendingProps),a.child=$,$.return=a;_.sibling!==null;)_=_.sibling,$=$.sibling=Pg(_,_.pendingProps),$.return=a;$.sibling=null}return a.child}function yj(_,a,$){switch(a.tag){case 3:kj(a),Ig();break;case 5:Ah(a);break;case 1:Zf(a.type)&&cg(a);break;case 4:yh(a,a.stateNode.containerInfo);break;case 10:var j=a.type._context,et=a.memoizedProps.value;G(Wg,j._currentValue),j._currentValue=et;break;case 13:if(j=a.memoizedState,j!==null)return j.dehydrated!==null?(G(L,L.current&1),a.flags|=128,null):$&a.child.childLanes?oj(_,a,$):(G(L,L.current&1),_=Zi(_,a,$),_!==null?_.sibling:null);G(L,L.current&1);break;case 19:if(j=($&a.childLanes)!==0,_.flags&128){if(j)return xj(_,a,$);a.flags|=128}if(et=a.memoizedState,et!==null&&(et.rendering=null,et.tail=null,et.lastEffect=null),G(L,L.current),j)break;return null;case 22:case 23:return a.lanes=0,dj(_,a,$)}return Zi(_,a,$)}var zj,Aj,Bj,Cj;zj=function(_,a){for(var $=a.child;$!==null;){if($.tag===5||$.tag===6)_.appendChild($.stateNode);else if($.tag!==4&&$.child!==null){$.child.return=$,$=$.child;continue}if($===a)break;for(;$.sibling===null;){if($.return===null||$.return===a)return;$=$.return}$.sibling.return=$.return,$=$.sibling}};Aj=function(){};Bj=function(_,a,$,j){var et=_.memoizedProps;if(et!==j){_=a.stateNode,xh(uh.current);var tt=null;switch($){case"input":et=Ya(_,et),j=Ya(_,j),tt=[];break;case"select":et=A$1({},et,{value:void 0}),j=A$1({},j,{value:void 0}),tt=[];break;case"textarea":et=gb(_,et),j=gb(_,j),tt=[];break;default:typeof et.onClick!="function"&&typeof j.onClick=="function"&&(_.onclick=Bf)}ub($,j);var rt;$=null;for(ot in et)if(!j.hasOwnProperty(ot)&&et.hasOwnProperty(ot)&&et[ot]!=null)if(ot==="style"){var nt=et[ot];for(rt in nt)nt.hasOwnProperty(rt)&&($||($={}),$[rt]="")}else ot!=="dangerouslySetInnerHTML"&&ot!=="children"&&ot!=="suppressContentEditableWarning"&&ot!=="suppressHydrationWarning"&&ot!=="autoFocus"&&(ea.hasOwnProperty(ot)?tt||(tt=[]):(tt=tt||[]).push(ot,null));for(ot in j){var it=j[ot];if(nt=et!=null?et[ot]:void 0,j.hasOwnProperty(ot)&&it!==nt&&(it!=null||nt!=null))if(ot==="style")if(nt){for(rt in nt)!nt.hasOwnProperty(rt)||it&&it.hasOwnProperty(rt)||($||($={}),$[rt]="");for(rt in it)it.hasOwnProperty(rt)&&nt[rt]!==it[rt]&&($||($={}),$[rt]=it[rt])}else $||(tt||(tt=[]),tt.push(ot,$)),$=it;else ot==="dangerouslySetInnerHTML"?(it=it?it.__html:void 0,nt=nt?nt.__html:void 0,it!=null&&nt!==it&&(tt=tt||[]).push(ot,it)):ot==="children"?typeof it!="string"&&typeof it!="number"||(tt=tt||[]).push(ot,""+it):ot!=="suppressContentEditableWarning"&&ot!=="suppressHydrationWarning"&&(ea.hasOwnProperty(ot)?(it!=null&&ot==="onScroll"&&D("scroll",_),tt||nt===it||(tt=[])):(tt=tt||[]).push(ot,it))}$&&(tt=tt||[]).push("style",$);var ot=tt;(a.updateQueue=ot)&&(a.flags|=4)}};Cj=function(_,a,$,j){$!==j&&(a.flags|=4)};function Dj(_,a){if(!I)switch(_.tailMode){case"hidden":a=_.tail;for(var $=null;a!==null;)a.alternate!==null&&($=a),a=a.sibling;$===null?_.tail=null:$.sibling=null;break;case"collapsed":$=_.tail;for(var j=null;$!==null;)$.alternate!==null&&(j=$),$=$.sibling;j===null?a||_.tail===null?_.tail=null:_.tail.sibling=null:j.sibling=null}}function S(_){var a=_.alternate!==null&&_.alternate.child===_.child,$=0,j=0;if(a)for(var et=_.child;et!==null;)$|=et.lanes|et.childLanes,j|=et.subtreeFlags&14680064,j|=et.flags&14680064,et.return=_,et=et.sibling;else for(et=_.child;et!==null;)$|=et.lanes|et.childLanes,j|=et.subtreeFlags,j|=et.flags,et.return=_,et=et.sibling;return _.subtreeFlags|=j,_.childLanes=$,a}function Ej(_,a,$){var j=a.pendingProps;switch(wg(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S(a),null;case 1:return Zf(a.type)&&$f(),S(a),null;case 3:return j=a.stateNode,zh(),E(Wf),E(H$1),Eh(),j.pendingContext&&(j.context=j.pendingContext,j.pendingContext=null),(_===null||_.child===null)&&(Gg(a)?a.flags|=4:_===null||_.memoizedState.isDehydrated&&!(a.flags&256)||(a.flags|=1024,zg!==null&&(Fj(zg),zg=null))),Aj(_,a),S(a),null;case 5:Bh(a);var et=xh(wh.current);if($=a.type,_!==null&&a.stateNode!=null)Bj(_,a,$,j,et),_.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!j){if(a.stateNode===null)throw Error(p$2(166));return S(a),null}if(_=xh(uh.current),Gg(a)){j=a.stateNode,$=a.type;var tt=a.memoizedProps;switch(j[Of]=a,j[Pf]=tt,_=(a.mode&1)!==0,$){case"dialog":D("cancel",j),D("close",j);break;case"iframe":case"object":case"embed":D("load",j);break;case"video":case"audio":for(et=0;et<\/script>",_=_.removeChild(_.firstChild)):typeof j.is=="string"?_=rt.createElement($,{is:j.is}):(_=rt.createElement($),$==="select"&&(rt=_,j.multiple?rt.multiple=!0:j.size&&(rt.size=j.size))):_=rt.createElementNS(_,$),_[Of]=a,_[Pf]=j,zj(_,a,!1,!1),a.stateNode=_;e:{switch(rt=vb($,j),$){case"dialog":D("cancel",_),D("close",_),et=j;break;case"iframe":case"object":case"embed":D("load",_),et=j;break;case"video":case"audio":for(et=0;etGj&&(a.flags|=128,j=!0,Dj(tt,!1),a.lanes=4194304)}else{if(!j)if(_=Ch$1(rt),_!==null){if(a.flags|=128,j=!0,$=_.updateQueue,$!==null&&(a.updateQueue=$,a.flags|=4),Dj(tt,!0),tt.tail===null&&tt.tailMode==="hidden"&&!rt.alternate&&!I)return S(a),null}else 2*B()-tt.renderingStartTime>Gj&&$!==1073741824&&(a.flags|=128,j=!0,Dj(tt,!1),a.lanes=4194304);tt.isBackwards?(rt.sibling=a.child,a.child=rt):($=tt.last,$!==null?$.sibling=rt:a.child=rt,tt.last=rt)}return tt.tail!==null?(a=tt.tail,tt.rendering=a,tt.tail=a.sibling,tt.renderingStartTime=B(),a.sibling=null,$=L.current,G(L,j?$&1|2:$&1),a):(S(a),null);case 22:case 23:return Hj(),j=a.memoizedState!==null,_!==null&&_.memoizedState!==null!==j&&(a.flags|=8192),j&&a.mode&1?fj&1073741824&&(S(a),a.subtreeFlags&6&&(a.flags|=8192)):S(a),null;case 24:return null;case 25:return null}throw Error(p$2(156,a.tag))}function Ij(_,a){switch(wg(a),a.tag){case 1:return Zf(a.type)&&$f(),_=a.flags,_&65536?(a.flags=_&-65537|128,a):null;case 3:return zh(),E(Wf),E(H$1),Eh(),_=a.flags,_&65536&&!(_&128)?(a.flags=_&-65537|128,a):null;case 5:return Bh(a),null;case 13:if(E(L),_=a.memoizedState,_!==null&&_.dehydrated!==null){if(a.alternate===null)throw Error(p$2(340));Ig()}return _=a.flags,_&65536?(a.flags=_&-65537|128,a):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(a.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Lj(_,a){var $=_.ref;if($!==null)if(typeof $=="function")try{$(null)}catch(j){W$6(_,a,j)}else $.current=null}function Mj(_,a,$){try{$()}catch(j){W$6(_,a,j)}}var Nj=!1;function Oj(_,a){if(Cf=dd,_=Me(),Ne(_)){if("selectionStart"in _)var $={start:_.selectionStart,end:_.selectionEnd};else e:{$=($=_.ownerDocument)&&$.defaultView||window;var j=$.getSelection&&$.getSelection();if(j&&j.rangeCount!==0){$=j.anchorNode;var et=j.anchorOffset,tt=j.focusNode;j=j.focusOffset;try{$.nodeType,tt.nodeType}catch{$=null;break e}var rt=0,nt=-1,it=-1,ot=0,st=0,at=_,ut=null;t:for(;;){for(var ht;at!==$||et!==0&&at.nodeType!==3||(nt=rt+et),at!==tt||j!==0&&at.nodeType!==3||(it=rt+j),at.nodeType===3&&(rt+=at.nodeValue.length),(ht=at.firstChild)!==null;)ut=at,at=ht;for(;;){if(at===_)break t;if(ut===$&&++ot===et&&(nt=rt),ut===tt&&++st===j&&(it=rt),(ht=at.nextSibling)!==null)break;at=ut,ut=at.parentNode}at=ht}$=nt===-1||it===-1?null:{start:nt,end:it}}else $=null}$=$||{start:0,end:0}}else $=null;for(Df={focusedElem:_,selectionRange:$},dd=!1,V=a;V!==null;)if(a=V,_=a.child,(a.subtreeFlags&1028)!==0&&_!==null)_.return=a,V=_;else for(;V!==null;){a=V;try{var bt=a.alternate;if(a.flags&1024)switch(a.tag){case 0:case 11:case 15:break;case 1:if(bt!==null){var Et=bt.memoizedProps,Ct=bt.memoizedState,Pt=a.stateNode,Tt=Pt.getSnapshotBeforeUpdate(a.elementType===a.type?Et:Ci(a.type,Et),Ct);Pt.__reactInternalSnapshotBeforeUpdate=Tt}break;case 3:var It=a.stateNode.containerInfo;It.nodeType===1?It.textContent="":It.nodeType===9&&It.documentElement&&It.removeChild(It.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$2(163))}}catch(Lt){W$6(a,a.return,Lt)}if(_=a.sibling,_!==null){_.return=a.return,V=_;break}V=a.return}return bt=Nj,Nj=!1,bt}function Pj(_,a,$){var j=a.updateQueue;if(j=j!==null?j.lastEffect:null,j!==null){var et=j=j.next;do{if((et.tag&_)===_){var tt=et.destroy;et.destroy=void 0,tt!==void 0&&Mj(a,$,tt)}et=et.next}while(et!==j)}}function Qj(_,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var $=a=a.next;do{if(($.tag&_)===_){var j=$.create;$.destroy=j()}$=$.next}while($!==a)}}function Rj(_){var a=_.ref;if(a!==null){var $=_.stateNode;switch(_.tag){case 5:_=$;break;default:_=$}typeof a=="function"?a(_):a.current=_}}function Sj(_){var a=_.alternate;a!==null&&(_.alternate=null,Sj(a)),_.child=null,_.deletions=null,_.sibling=null,_.tag===5&&(a=_.stateNode,a!==null&&(delete a[Of],delete a[Pf],delete a[of$1],delete a[Qf],delete a[Rf])),_.stateNode=null,_.return=null,_.dependencies=null,_.memoizedProps=null,_.memoizedState=null,_.pendingProps=null,_.stateNode=null,_.updateQueue=null}function Tj(_){return _.tag===5||_.tag===3||_.tag===4}function Uj(_){e:for(;;){for(;_.sibling===null;){if(_.return===null||Tj(_.return))return null;_=_.return}for(_.sibling.return=_.return,_=_.sibling;_.tag!==5&&_.tag!==6&&_.tag!==18;){if(_.flags&2||_.child===null||_.tag===4)continue e;_.child.return=_,_=_.child}if(!(_.flags&2))return _.stateNode}}function Vj(_,a,$){var j=_.tag;if(j===5||j===6)_=_.stateNode,a?$.nodeType===8?$.parentNode.insertBefore(_,a):$.insertBefore(_,a):($.nodeType===8?(a=$.parentNode,a.insertBefore(_,$)):(a=$,a.appendChild(_)),$=$._reactRootContainer,$!=null||a.onclick!==null||(a.onclick=Bf));else if(j!==4&&(_=_.child,_!==null))for(Vj(_,a,$),_=_.sibling;_!==null;)Vj(_,a,$),_=_.sibling}function Wj(_,a,$){var j=_.tag;if(j===5||j===6)_=_.stateNode,a?$.insertBefore(_,a):$.appendChild(_);else if(j!==4&&(_=_.child,_!==null))for(Wj(_,a,$),_=_.sibling;_!==null;)Wj(_,a,$),_=_.sibling}var X=null,Xj=!1;function Yj(_,a,$){for($=$.child;$!==null;)Zj(_,a,$),$=$.sibling}function Zj(_,a,$){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,$)}catch{}switch($.tag){case 5:U||Lj($,a);case 6:var j=X,et=Xj;X=null,Yj(_,a,$),X=j,Xj=et,X!==null&&(Xj?(_=X,$=$.stateNode,_.nodeType===8?_.parentNode.removeChild($):_.removeChild($)):X.removeChild($.stateNode));break;case 18:X!==null&&(Xj?(_=X,$=$.stateNode,_.nodeType===8?Kf(_.parentNode,$):_.nodeType===1&&Kf(_,$),bd(_)):Kf(X,$.stateNode));break;case 4:j=X,et=Xj,X=$.stateNode.containerInfo,Xj=!0,Yj(_,a,$),X=j,Xj=et;break;case 0:case 11:case 14:case 15:if(!U&&(j=$.updateQueue,j!==null&&(j=j.lastEffect,j!==null))){et=j=j.next;do{var tt=et,rt=tt.destroy;tt=tt.tag,rt!==void 0&&(tt&2||tt&4)&&Mj($,a,rt),et=et.next}while(et!==j)}Yj(_,a,$);break;case 1:if(!U&&(Lj($,a),j=$.stateNode,typeof j.componentWillUnmount=="function"))try{j.props=$.memoizedProps,j.state=$.memoizedState,j.componentWillUnmount()}catch(nt){W$6($,a,nt)}Yj(_,a,$);break;case 21:Yj(_,a,$);break;case 22:$.mode&1?(U=(j=U)||$.memoizedState!==null,Yj(_,a,$),U=j):Yj(_,a,$);break;default:Yj(_,a,$)}}function ak(_){var a=_.updateQueue;if(a!==null){_.updateQueue=null;var $=_.stateNode;$===null&&($=_.stateNode=new Kj),a.forEach(function(j){var et=bk.bind(null,_,j);$.has(j)||($.add(j),j.then(et,et))})}}function ck(_,a){var $=a.deletions;if($!==null)for(var j=0;j<$.length;j++){var et=$[j];try{var tt=_,rt=a,nt=rt;e:for(;nt!==null;){switch(nt.tag){case 5:X=nt.stateNode,Xj=!1;break e;case 3:X=nt.stateNode.containerInfo,Xj=!0;break e;case 4:X=nt.stateNode.containerInfo,Xj=!0;break e}nt=nt.return}if(X===null)throw Error(p$2(160));Zj(tt,rt,et),X=null,Xj=!1;var it=et.alternate;it!==null&&(it.return=null),et.return=null}catch(ot){W$6(et,a,ot)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)dk(a,_),a=a.sibling}function dk(_,a){var $=_.alternate,j=_.flags;switch(_.tag){case 0:case 11:case 14:case 15:if(ck(a,_),ek(_),j&4){try{Pj(3,_,_.return),Qj(3,_)}catch(Et){W$6(_,_.return,Et)}try{Pj(5,_,_.return)}catch(Et){W$6(_,_.return,Et)}}break;case 1:ck(a,_),ek(_),j&512&&$!==null&&Lj($,$.return);break;case 5:if(ck(a,_),ek(_),j&512&&$!==null&&Lj($,$.return),_.flags&32){var et=_.stateNode;try{ob(et,"")}catch(Et){W$6(_,_.return,Et)}}if(j&4&&(et=_.stateNode,et!=null)){var tt=_.memoizedProps,rt=$!==null?$.memoizedProps:tt,nt=_.type,it=_.updateQueue;if(_.updateQueue=null,it!==null)try{nt==="input"&&tt.type==="radio"&&tt.name!=null&&ab(et,tt),vb(nt,rt);var ot=vb(nt,tt);for(rt=0;rtet&&(et=rt),j&=~tt}if(j=et,j=B()-j,j=(120>j?120:480>j?480:1080>j?1080:1920>j?1920:3e3>j?3e3:4320>j?4320:1960*lk(j/1960))-j,10_?16:_,wk===null)var j=!1;else{if(_=wk,wk=null,xk=0,K$6&6)throw Error(p$2(331));var et=K$6;for(K$6|=4,V=_.current;V!==null;){var tt=V,rt=tt.child;if(V.flags&16){var nt=tt.deletions;if(nt!==null){for(var it=0;itB()-fk?Kk(_,0):rk|=$),Dk(_,a)}function Yk(_,a){a===0&&(_.mode&1?(a=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):a=1);var $=R$1();_=ih(_,a),_!==null&&(Ac(_,a,$),Dk(_,$))}function uj(_){var a=_.memoizedState,$=0;a!==null&&($=a.retryLane),Yk(_,$)}function bk(_,a){var $=0;switch(_.tag){case 13:var j=_.stateNode,et=_.memoizedState;et!==null&&($=et.retryLane);break;case 19:j=_.stateNode;break;default:throw Error(p$2(314))}j!==null&&j.delete(a),Yk(_,$)}var Vk;Vk=function(_,a,$){if(_!==null)if(_.memoizedProps!==a.pendingProps||Wf.current)dh$1=!0;else{if(!(_.lanes&$)&&!(a.flags&128))return dh$1=!1,yj(_,a,$);dh$1=!!(_.flags&131072)}else dh$1=!1,I&&a.flags&1048576&&ug(a,ng,a.index);switch(a.lanes=0,a.tag){case 2:var j=a.type;ij(_,a),_=a.pendingProps;var et=Yf(a,H$1.current);ch$1(a,$),et=Nh(null,a,j,_,et,$);var tt=Sh();return a.flags|=1,typeof et=="object"&&et!==null&&typeof et.render=="function"&&et.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Zf(j)?(tt=!0,cg(a)):tt=!1,a.memoizedState=et.state!==null&&et.state!==void 0?et.state:null,kh(a),et.updater=Ei,a.stateNode=et,et._reactInternals=a,Ii(a,j,_,$),a=jj(null,a,j,!0,tt,$)):(a.tag=0,I&&tt&&vg(a),Xi(null,a,et,$),a=a.child),a;case 16:j=a.elementType;e:{switch(ij(_,a),_=a.pendingProps,et=j._init,j=et(j._payload),a.type=j,et=a.tag=Zk(j),_=Ci(j,_),et){case 0:a=cj(null,a,j,_,$);break e;case 1:a=hj(null,a,j,_,$);break e;case 11:a=Yi(null,a,j,_,$);break e;case 14:a=$i(null,a,j,Ci(j.type,_),$);break e}throw Error(p$2(306,j,""))}return a;case 0:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),cj(_,a,j,et,$);case 1:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),hj(_,a,j,et,$);case 3:e:{if(kj(a),_===null)throw Error(p$2(387));j=a.pendingProps,tt=a.memoizedState,et=tt.element,lh(_,a),qh(a,j,null,$);var rt=a.memoizedState;if(j=rt.element,tt.isDehydrated)if(tt={element:j,isDehydrated:!1,cache:rt.cache,pendingSuspenseBoundaries:rt.pendingSuspenseBoundaries,transitions:rt.transitions},a.updateQueue.baseState=tt,a.memoizedState=tt,a.flags&256){et=Ji(Error(p$2(423)),a),a=lj(_,a,j,$,et);break e}else if(j!==et){et=Ji(Error(p$2(424)),a),a=lj(_,a,j,$,et);break e}else for(yg=Lf(a.stateNode.containerInfo.firstChild),xg=a,I=!0,zg=null,$=Vg(a,null,j,$),a.child=$;$;)$.flags=$.flags&-3|4096,$=$.sibling;else{if(Ig(),j===et){a=Zi(_,a,$);break e}Xi(_,a,j,$)}a=a.child}return a;case 5:return Ah(a),_===null&&Eg(a),j=a.type,et=a.pendingProps,tt=_!==null?_.memoizedProps:null,rt=et.children,Ef(j,et)?rt=null:tt!==null&&Ef(j,tt)&&(a.flags|=32),gj(_,a),Xi(_,a,rt,$),a.child;case 6:return _===null&&Eg(a),null;case 13:return oj(_,a,$);case 4:return yh(a,a.stateNode.containerInfo),j=a.pendingProps,_===null?a.child=Ug(a,null,j,$):Xi(_,a,j,$),a.child;case 11:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),Yi(_,a,j,et,$);case 7:return Xi(_,a,a.pendingProps,$),a.child;case 8:return Xi(_,a,a.pendingProps.children,$),a.child;case 12:return Xi(_,a,a.pendingProps.children,$),a.child;case 10:e:{if(j=a.type._context,et=a.pendingProps,tt=a.memoizedProps,rt=et.value,G(Wg,j._currentValue),j._currentValue=rt,tt!==null)if(He(tt.value,rt)){if(tt.children===et.children&&!Wf.current){a=Zi(_,a,$);break e}}else for(tt=a.child,tt!==null&&(tt.return=a);tt!==null;){var nt=tt.dependencies;if(nt!==null){rt=tt.child;for(var it=nt.firstContext;it!==null;){if(it.context===j){if(tt.tag===1){it=mh(-1,$&-$),it.tag=2;var ot=tt.updateQueue;if(ot!==null){ot=ot.shared;var st=ot.pending;st===null?it.next=it:(it.next=st.next,st.next=it),ot.pending=it}}tt.lanes|=$,it=tt.alternate,it!==null&&(it.lanes|=$),bh(tt.return,$,a),nt.lanes|=$;break}it=it.next}}else if(tt.tag===10)rt=tt.type===a.type?null:tt.child;else if(tt.tag===18){if(rt=tt.return,rt===null)throw Error(p$2(341));rt.lanes|=$,nt=rt.alternate,nt!==null&&(nt.lanes|=$),bh(rt,$,a),rt=tt.sibling}else rt=tt.child;if(rt!==null)rt.return=tt;else for(rt=tt;rt!==null;){if(rt===a){rt=null;break}if(tt=rt.sibling,tt!==null){tt.return=rt.return,rt=tt;break}rt=rt.return}tt=rt}Xi(_,a,et.children,$),a=a.child}return a;case 9:return et=a.type,j=a.pendingProps.children,ch$1(a,$),et=eh(et),j=j(et),a.flags|=1,Xi(_,a,j,$),a.child;case 14:return j=a.type,et=Ci(j,a.pendingProps),et=Ci(j.type,et),$i(_,a,j,et,$);case 15:return bj(_,a,a.type,a.pendingProps,$);case 17:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),ij(_,a),a.tag=1,Zf(j)?(_=!0,cg(a)):_=!1,ch$1(a,$),Gi(a,j,et),Ii(a,j,et,$),jj(null,a,j,!0,_,$);case 19:return xj(_,a,$);case 22:return dj(_,a,$)}throw Error(p$2(156,a.tag))};function Fk(_,a){return ac(_,a)}function $k(_,a,$,j){this.tag=_,this.key=$,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(_,a,$,j){return new $k(_,a,$,j)}function aj(_){return _=_.prototype,!(!_||!_.isReactComponent)}function Zk(_){if(typeof _=="function")return aj(_)?1:0;if(_!=null){if(_=_.$$typeof,_===Da)return 11;if(_===Ga)return 14}return 2}function Pg(_,a){var $=_.alternate;return $===null?($=Bg(_.tag,a,_.key,_.mode),$.elementType=_.elementType,$.type=_.type,$.stateNode=_.stateNode,$.alternate=_,_.alternate=$):($.pendingProps=a,$.type=_.type,$.flags=0,$.subtreeFlags=0,$.deletions=null),$.flags=_.flags&14680064,$.childLanes=_.childLanes,$.lanes=_.lanes,$.child=_.child,$.memoizedProps=_.memoizedProps,$.memoizedState=_.memoizedState,$.updateQueue=_.updateQueue,a=_.dependencies,$.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},$.sibling=_.sibling,$.index=_.index,$.ref=_.ref,$}function Rg(_,a,$,j,et,tt){var rt=2;if(j=_,typeof _=="function")aj(_)&&(rt=1);else if(typeof _=="string")rt=5;else e:switch(_){case ya:return Tg($.children,et,tt,a);case za:rt=8,et|=8;break;case Aa:return _=Bg(12,$,a,et|2),_.elementType=Aa,_.lanes=tt,_;case Ea:return _=Bg(13,$,a,et),_.elementType=Ea,_.lanes=tt,_;case Fa:return _=Bg(19,$,a,et),_.elementType=Fa,_.lanes=tt,_;case Ia:return pj($,et,tt,a);default:if(typeof _=="object"&&_!==null)switch(_.$$typeof){case Ba:rt=10;break e;case Ca:rt=9;break e;case Da:rt=11;break e;case Ga:rt=14;break e;case Ha:rt=16,j=null;break e}throw Error(p$2(130,_==null?_:typeof _,""))}return a=Bg(rt,$,a,et),a.elementType=_,a.type=j,a.lanes=tt,a}function Tg(_,a,$,j){return _=Bg(7,_,j,a),_.lanes=$,_}function pj(_,a,$,j){return _=Bg(22,_,j,a),_.elementType=Ia,_.lanes=$,_.stateNode={isHidden:!1},_}function Qg(_,a,$){return _=Bg(6,_,null,a),_.lanes=$,_}function Sg(_,a,$){return a=Bg(4,_.children!==null?_.children:[],_.key,a),a.lanes=$,a.stateNode={containerInfo:_.containerInfo,pendingChildren:null,implementation:_.implementation},a}function al(_,a,$,j,et){this.tag=a,this.containerInfo=_,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=j,this.onRecoverableError=et,this.mutableSourceEagerHydrationData=null}function bl(_,a,$,j,et,tt,rt,nt,it){return _=new al(_,a,$,nt,it),a===1?(a=1,tt===!0&&(a|=8)):a=0,tt=Bg(3,null,null,a),_.current=tt,tt.stateNode=_,tt.memoizedState={element:j,isDehydrated:$,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(tt),_}function cl(_,a,$){var j=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(_){console.error(_)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,m$3=reactDomExports;client.createRoot=m$3.createRoot,client.hydrateRoot=m$3.hydrateRoot;const ErrorBoundaryContext=reactExports.createContext(null),initialState$c={didCatch:!1,error:null};class ErrorBoundary extends reactExports.Component{constructor(a){super(a),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState$c}static getDerivedStateFromError(a){return{didCatch:!0,error:a}}resetErrorBoundary(){const{error:a}=this.state;if(a!==null){for(var $,j,et=arguments.length,tt=new Array(et),rt=0;rt0&&arguments[0]!==void 0?arguments[0]:[],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return _.length!==a.length||_.some(($,j)=>!Object.is($,a[j]))}function _typeof$7(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$7=function($){return typeof $}:_typeof$7=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$7(_)}function _classCallCheck$2(_,a){if(!(_ instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(_,a){for(var $=0;$0?charat(characters,--position$1):0,column--,character===10&&(column=1,line--),character}function next(){return character=position$12||token(character)>3?"":" "}function escaping(_,a){for(;--a&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$5(_,caret()+(a<6&&peek$2()==32&&next()==32))}function delimiter(_){for(;next();)switch(character){case _:return position$1;case 34:case 39:_!==34&&_!==39&&delimiter(character);break;case 40:_===41&&delimiter(_);break;case 92:next();break}return position$1}function commenter(_,a){for(;next()&&_+character!==57;)if(_+character===84&&peek$2()===47)break;return"/*"+slice$5(a,position$1-1)+"*"+from$1(_===47?_:next())}function identifier(_){for(;!token(peek$2());)next();return slice$5(_,position$1)}function compile(_){return dealloc(parse$c("",null,null,null,[""],_=alloc(_),0,[0],_))}function parse$c(_,a,$,j,et,tt,rt,nt,it){for(var ot=0,st=0,at=rt,ut=0,ht=0,bt=0,Et=1,Ct=1,Pt=1,Tt=0,It="",Lt=et,Nt=tt,Ut=j,jt=It;Ct;)switch(bt=Tt,Tt=next()){case 40:if(bt!=108&&charat(jt,at-1)==58){indexof(jt+=replace(delimit(Tt),"&","&\f"),"&\f")!=-1&&(Pt=-1);break}case 34:case 39:case 91:jt+=delimit(Tt);break;case 9:case 10:case 13:case 32:jt+=whitespace(bt);break;case 92:jt+=escaping(caret()-1,7);continue;case 47:switch(peek$2()){case 42:case 47:append(comment(commenter(next(),caret()),a,$),it);break;default:jt+="/"}break;case 123*Et:nt[ot++]=strlen(jt)*Pt;case 125*Et:case 59:case 0:switch(Tt){case 0:case 125:Ct=0;case 59+st:Pt==-1&&(jt=replace(jt,/\f/g,"")),ht>0&&strlen(jt)-at&&append(ht>32?declaration(jt+";",j,$,at-1):declaration(replace(jt," ","")+";",j,$,at-2),it);break;case 59:jt+=";";default:if(append(Ut=ruleset(jt,a,$,ot,st,et,nt,It,Lt=[],Nt=[],at),tt),Tt===123)if(st===0)parse$c(jt,a,Ut,Ut,Lt,tt,at,nt,Nt);else switch(ut===99&&charat(jt,3)===110?100:ut){case 100:case 108:case 109:case 115:parse$c(_,Ut,Ut,j&&append(ruleset(_,Ut,Ut,0,0,et,nt,It,et,Lt=[],at),Nt),et,Nt,at,nt,j?Lt:Nt);break;default:parse$c(jt,Ut,Ut,Ut,[""],Nt,0,nt,Nt)}}ot=st=ht=0,Et=Pt=1,It=jt="",at=rt;break;case 58:at=1+strlen(jt),ht=bt;default:if(Et<1){if(Tt==123)--Et;else if(Tt==125&&Et++==0&&prev$1()==125)continue}switch(jt+=from$1(Tt),Tt*Et){case 38:Pt=st>0?1:(jt+="\f",-1);break;case 44:nt[ot++]=(strlen(jt)-1)*Pt,Pt=1;break;case 64:peek$2()===45&&(jt+=delimit(next())),ut=peek$2(),st=at=strlen(It=jt+=identifier(caret())),Tt++;break;case 45:bt===45&&strlen(jt)==2&&(Et=0)}}return tt}function ruleset(_,a,$,j,et,tt,rt,nt,it,ot,st){for(var at=et-1,ut=et===0?tt:[""],ht=sizeof(ut),bt=0,Et=0,Ct=0;bt0?ut[Pt]+" "+Tt:replace(Tt,/&\f/g,ut[Pt])))&&(it[Ct++]=It);return node$3(_,a,$,et===0?RULESET:nt,it,ot,st)}function comment(_,a,$){return node$3(_,a,$,COMMENT,from$1(char()),substr(_,2,-2),0)}function declaration(_,a,$,j){return node$3(_,a,$,DECLARATION,substr(_,0,j),substr(_,j+1,-1),j)}function serialize(_,a){for(var $="",j=sizeof(_),et=0;et6)switch(charat(_,a+1)){case 109:if(charat(_,a+4)!==45)break;case 102:return replace(_,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(_,a+3)==108?"$3":"$2-$3"))+_;case 115:return~indexof(_,"stretch")?prefix$1(replace(_,"stretch","fill-available"),a)+_:_}break;case 4949:if(charat(_,a+1)!==115)break;case 6444:switch(charat(_,strlen(_)-3-(~indexof(_,"!important")&&10))){case 107:return replace(_,":",":"+WEBKIT)+_;case 101:return replace(_,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(_,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+_}break;case 5936:switch(charat(_,a+11)){case 114:return WEBKIT+_+MS+replace(_,/[svh]\w+-[tblr]{2}/,"tb")+_;case 108:return WEBKIT+_+MS+replace(_,/[svh]\w+-[tblr]{2}/,"tb-rl")+_;case 45:return WEBKIT+_+MS+replace(_,/[svh]\w+-[tblr]{2}/,"lr")+_}return WEBKIT+_+MS+_+_}return _}var prefixer=function(a,$,j,et){if(a.length>-1&&!a.return)switch(a.type){case DECLARATION:a.return=prefix$1(a.value,a.length);break;case KEYFRAMES:return serialize([copy(a,{value:replace(a.value,"@","@"+WEBKIT)})],et);case RULESET:if(a.length)return combine(a.props,function(tt){switch(match$1(tt,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(a,{props:[replace(tt,/:(read-\w+)/,":"+MOZ+"$1")]})],et);case"::placeholder":return serialize([copy(a,{props:[replace(tt,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy(a,{props:[replace(tt,/:(plac\w+)/,":"+MOZ+"$1")]}),copy(a,{props:[replace(tt,/:(plac\w+)/,MS+"input-$1")]})],et)}return""})}},defaultStylisPlugins=[prefixer],createCache=function(a){var $=a.key;if($==="css"){var j=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(j,function(Et){var Ct=Et.getAttribute("data-emotion");Ct.indexOf(" ")!==-1&&(document.head.appendChild(Et),Et.setAttribute("data-s",""))})}var et=a.stylisPlugins||defaultStylisPlugins,tt={},rt,nt=[];rt=a.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+$+' "]'),function(Et){for(var Ct=Et.getAttribute("data-emotion").split(" "),Pt=1;Pt<\/script>",_=_.removeChild(_.firstChild)):typeof j.is=="string"?_=rt.createElement($,{is:j.is}):(_=rt.createElement($),$==="select"&&(rt=_,j.multiple?rt.multiple=!0:j.size&&(rt.size=j.size))):_=rt.createElementNS(_,$),_[Of]=a,_[Pf]=j,zj(_,a,!1,!1),a.stateNode=_;e:{switch(rt=vb($,j),$){case"dialog":D("cancel",_),D("close",_),et=j;break;case"iframe":case"object":case"embed":D("load",_),et=j;break;case"video":case"audio":for(et=0;etGj&&(a.flags|=128,j=!0,Dj(tt,!1),a.lanes=4194304)}else{if(!j)if(_=Ch$1(rt),_!==null){if(a.flags|=128,j=!0,$=_.updateQueue,$!==null&&(a.updateQueue=$,a.flags|=4),Dj(tt,!0),tt.tail===null&&tt.tailMode==="hidden"&&!rt.alternate&&!I)return S(a),null}else 2*B()-tt.renderingStartTime>Gj&&$!==1073741824&&(a.flags|=128,j=!0,Dj(tt,!1),a.lanes=4194304);tt.isBackwards?(rt.sibling=a.child,a.child=rt):($=tt.last,$!==null?$.sibling=rt:a.child=rt,tt.last=rt)}return tt.tail!==null?(a=tt.tail,tt.rendering=a,tt.tail=a.sibling,tt.renderingStartTime=B(),a.sibling=null,$=L.current,G(L,j?$&1|2:$&1),a):(S(a),null);case 22:case 23:return Hj(),j=a.memoizedState!==null,_!==null&&_.memoizedState!==null!==j&&(a.flags|=8192),j&&a.mode&1?fj&1073741824&&(S(a),a.subtreeFlags&6&&(a.flags|=8192)):S(a),null;case 24:return null;case 25:return null}throw Error(p$2(156,a.tag))}function Ij(_,a){switch(wg(a),a.tag){case 1:return Zf(a.type)&&$f(),_=a.flags,_&65536?(a.flags=_&-65537|128,a):null;case 3:return zh(),E(Wf),E(H$1),Eh(),_=a.flags,_&65536&&!(_&128)?(a.flags=_&-65537|128,a):null;case 5:return Bh(a),null;case 13:if(E(L),_=a.memoizedState,_!==null&&_.dehydrated!==null){if(a.alternate===null)throw Error(p$2(340));Ig()}return _=a.flags,_&65536?(a.flags=_&-65537|128,a):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(a.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Lj(_,a){var $=_.ref;if($!==null)if(typeof $=="function")try{$(null)}catch(j){W$6(_,a,j)}else $.current=null}function Mj(_,a,$){try{$()}catch(j){W$6(_,a,j)}}var Nj=!1;function Oj(_,a){if(Cf=dd,_=Me(),Ne(_)){if("selectionStart"in _)var $={start:_.selectionStart,end:_.selectionEnd};else e:{$=($=_.ownerDocument)&&$.defaultView||window;var j=$.getSelection&&$.getSelection();if(j&&j.rangeCount!==0){$=j.anchorNode;var et=j.anchorOffset,tt=j.focusNode;j=j.focusOffset;try{$.nodeType,tt.nodeType}catch{$=null;break e}var rt=0,nt=-1,it=-1,at=0,st=0,ot=_,ut=null;t:for(;;){for(var dt;ot!==$||et!==0&&ot.nodeType!==3||(nt=rt+et),ot!==tt||j!==0&&ot.nodeType!==3||(it=rt+j),ot.nodeType===3&&(rt+=ot.nodeValue.length),(dt=ot.firstChild)!==null;)ut=ot,ot=dt;for(;;){if(ot===_)break t;if(ut===$&&++at===et&&(nt=rt),ut===tt&&++st===j&&(it=rt),(dt=ot.nextSibling)!==null)break;ot=ut,ut=ot.parentNode}ot=dt}$=nt===-1||it===-1?null:{start:nt,end:it}}else $=null}$=$||{start:0,end:0}}else $=null;for(Df={focusedElem:_,selectionRange:$},dd=!1,V=a;V!==null;)if(a=V,_=a.child,(a.subtreeFlags&1028)!==0&&_!==null)_.return=a,V=_;else for(;V!==null;){a=V;try{var mt=a.alternate;if(a.flags&1024)switch(a.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var xt=mt.memoizedProps,Ct=mt.memoizedState,Pt=a.stateNode,Tt=Pt.getSnapshotBeforeUpdate(a.elementType===a.type?xt:Ci(a.type,xt),Ct);Pt.__reactInternalSnapshotBeforeUpdate=Tt}break;case 3:var kt=a.stateNode.containerInfo;kt.nodeType===1?kt.textContent="":kt.nodeType===9&&kt.documentElement&&kt.removeChild(kt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$2(163))}}catch(Lt){W$6(a,a.return,Lt)}if(_=a.sibling,_!==null){_.return=a.return,V=_;break}V=a.return}return mt=Nj,Nj=!1,mt}function Pj(_,a,$){var j=a.updateQueue;if(j=j!==null?j.lastEffect:null,j!==null){var et=j=j.next;do{if((et.tag&_)===_){var tt=et.destroy;et.destroy=void 0,tt!==void 0&&Mj(a,$,tt)}et=et.next}while(et!==j)}}function Qj(_,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var $=a=a.next;do{if(($.tag&_)===_){var j=$.create;$.destroy=j()}$=$.next}while($!==a)}}function Rj(_){var a=_.ref;if(a!==null){var $=_.stateNode;switch(_.tag){case 5:_=$;break;default:_=$}typeof a=="function"?a(_):a.current=_}}function Sj(_){var a=_.alternate;a!==null&&(_.alternate=null,Sj(a)),_.child=null,_.deletions=null,_.sibling=null,_.tag===5&&(a=_.stateNode,a!==null&&(delete a[Of],delete a[Pf],delete a[of$1],delete a[Qf],delete a[Rf])),_.stateNode=null,_.return=null,_.dependencies=null,_.memoizedProps=null,_.memoizedState=null,_.pendingProps=null,_.stateNode=null,_.updateQueue=null}function Tj(_){return _.tag===5||_.tag===3||_.tag===4}function Uj(_){e:for(;;){for(;_.sibling===null;){if(_.return===null||Tj(_.return))return null;_=_.return}for(_.sibling.return=_.return,_=_.sibling;_.tag!==5&&_.tag!==6&&_.tag!==18;){if(_.flags&2||_.child===null||_.tag===4)continue e;_.child.return=_,_=_.child}if(!(_.flags&2))return _.stateNode}}function Vj(_,a,$){var j=_.tag;if(j===5||j===6)_=_.stateNode,a?$.nodeType===8?$.parentNode.insertBefore(_,a):$.insertBefore(_,a):($.nodeType===8?(a=$.parentNode,a.insertBefore(_,$)):(a=$,a.appendChild(_)),$=$._reactRootContainer,$!=null||a.onclick!==null||(a.onclick=Bf));else if(j!==4&&(_=_.child,_!==null))for(Vj(_,a,$),_=_.sibling;_!==null;)Vj(_,a,$),_=_.sibling}function Wj(_,a,$){var j=_.tag;if(j===5||j===6)_=_.stateNode,a?$.insertBefore(_,a):$.appendChild(_);else if(j!==4&&(_=_.child,_!==null))for(Wj(_,a,$),_=_.sibling;_!==null;)Wj(_,a,$),_=_.sibling}var X=null,Xj=!1;function Yj(_,a,$){for($=$.child;$!==null;)Zj(_,a,$),$=$.sibling}function Zj(_,a,$){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,$)}catch{}switch($.tag){case 5:U||Lj($,a);case 6:var j=X,et=Xj;X=null,Yj(_,a,$),X=j,Xj=et,X!==null&&(Xj?(_=X,$=$.stateNode,_.nodeType===8?_.parentNode.removeChild($):_.removeChild($)):X.removeChild($.stateNode));break;case 18:X!==null&&(Xj?(_=X,$=$.stateNode,_.nodeType===8?Kf(_.parentNode,$):_.nodeType===1&&Kf(_,$),bd(_)):Kf(X,$.stateNode));break;case 4:j=X,et=Xj,X=$.stateNode.containerInfo,Xj=!0,Yj(_,a,$),X=j,Xj=et;break;case 0:case 11:case 14:case 15:if(!U&&(j=$.updateQueue,j!==null&&(j=j.lastEffect,j!==null))){et=j=j.next;do{var tt=et,rt=tt.destroy;tt=tt.tag,rt!==void 0&&(tt&2||tt&4)&&Mj($,a,rt),et=et.next}while(et!==j)}Yj(_,a,$);break;case 1:if(!U&&(Lj($,a),j=$.stateNode,typeof j.componentWillUnmount=="function"))try{j.props=$.memoizedProps,j.state=$.memoizedState,j.componentWillUnmount()}catch(nt){W$6($,a,nt)}Yj(_,a,$);break;case 21:Yj(_,a,$);break;case 22:$.mode&1?(U=(j=U)||$.memoizedState!==null,Yj(_,a,$),U=j):Yj(_,a,$);break;default:Yj(_,a,$)}}function ak(_){var a=_.updateQueue;if(a!==null){_.updateQueue=null;var $=_.stateNode;$===null&&($=_.stateNode=new Kj),a.forEach(function(j){var et=bk.bind(null,_,j);$.has(j)||($.add(j),j.then(et,et))})}}function ck(_,a){var $=a.deletions;if($!==null)for(var j=0;j<$.length;j++){var et=$[j];try{var tt=_,rt=a,nt=rt;e:for(;nt!==null;){switch(nt.tag){case 5:X=nt.stateNode,Xj=!1;break e;case 3:X=nt.stateNode.containerInfo,Xj=!0;break e;case 4:X=nt.stateNode.containerInfo,Xj=!0;break e}nt=nt.return}if(X===null)throw Error(p$2(160));Zj(tt,rt,et),X=null,Xj=!1;var it=et.alternate;it!==null&&(it.return=null),et.return=null}catch(at){W$6(et,a,at)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)dk(a,_),a=a.sibling}function dk(_,a){var $=_.alternate,j=_.flags;switch(_.tag){case 0:case 11:case 14:case 15:if(ck(a,_),ek(_),j&4){try{Pj(3,_,_.return),Qj(3,_)}catch(xt){W$6(_,_.return,xt)}try{Pj(5,_,_.return)}catch(xt){W$6(_,_.return,xt)}}break;case 1:ck(a,_),ek(_),j&512&&$!==null&&Lj($,$.return);break;case 5:if(ck(a,_),ek(_),j&512&&$!==null&&Lj($,$.return),_.flags&32){var et=_.stateNode;try{ob(et,"")}catch(xt){W$6(_,_.return,xt)}}if(j&4&&(et=_.stateNode,et!=null)){var tt=_.memoizedProps,rt=$!==null?$.memoizedProps:tt,nt=_.type,it=_.updateQueue;if(_.updateQueue=null,it!==null)try{nt==="input"&&tt.type==="radio"&&tt.name!=null&&ab(et,tt),vb(nt,rt);var at=vb(nt,tt);for(rt=0;rtet&&(et=rt),j&=~tt}if(j=et,j=B()-j,j=(120>j?120:480>j?480:1080>j?1080:1920>j?1920:3e3>j?3e3:4320>j?4320:1960*lk(j/1960))-j,10_?16:_,wk===null)var j=!1;else{if(_=wk,wk=null,xk=0,K$6&6)throw Error(p$2(331));var et=K$6;for(K$6|=4,V=_.current;V!==null;){var tt=V,rt=tt.child;if(V.flags&16){var nt=tt.deletions;if(nt!==null){for(var it=0;itB()-fk?Kk(_,0):rk|=$),Dk(_,a)}function Yk(_,a){a===0&&(_.mode&1?(a=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):a=1);var $=R$1();_=ih(_,a),_!==null&&(Ac(_,a,$),Dk(_,$))}function uj(_){var a=_.memoizedState,$=0;a!==null&&($=a.retryLane),Yk(_,$)}function bk(_,a){var $=0;switch(_.tag){case 13:var j=_.stateNode,et=_.memoizedState;et!==null&&($=et.retryLane);break;case 19:j=_.stateNode;break;default:throw Error(p$2(314))}j!==null&&j.delete(a),Yk(_,$)}var Vk;Vk=function(_,a,$){if(_!==null)if(_.memoizedProps!==a.pendingProps||Wf.current)dh$1=!0;else{if(!(_.lanes&$)&&!(a.flags&128))return dh$1=!1,yj(_,a,$);dh$1=!!(_.flags&131072)}else dh$1=!1,I&&a.flags&1048576&&ug(a,ng,a.index);switch(a.lanes=0,a.tag){case 2:var j=a.type;ij(_,a),_=a.pendingProps;var et=Yf(a,H$1.current);ch$1(a,$),et=Nh(null,a,j,_,et,$);var tt=Sh();return a.flags|=1,typeof et=="object"&&et!==null&&typeof et.render=="function"&&et.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Zf(j)?(tt=!0,cg(a)):tt=!1,a.memoizedState=et.state!==null&&et.state!==void 0?et.state:null,kh(a),et.updater=Ei,a.stateNode=et,et._reactInternals=a,Ii(a,j,_,$),a=jj(null,a,j,!0,tt,$)):(a.tag=0,I&&tt&&vg(a),Xi(null,a,et,$),a=a.child),a;case 16:j=a.elementType;e:{switch(ij(_,a),_=a.pendingProps,et=j._init,j=et(j._payload),a.type=j,et=a.tag=Zk(j),_=Ci(j,_),et){case 0:a=cj(null,a,j,_,$);break e;case 1:a=hj(null,a,j,_,$);break e;case 11:a=Yi(null,a,j,_,$);break e;case 14:a=$i(null,a,j,Ci(j.type,_),$);break e}throw Error(p$2(306,j,""))}return a;case 0:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),cj(_,a,j,et,$);case 1:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),hj(_,a,j,et,$);case 3:e:{if(kj(a),_===null)throw Error(p$2(387));j=a.pendingProps,tt=a.memoizedState,et=tt.element,lh(_,a),qh(a,j,null,$);var rt=a.memoizedState;if(j=rt.element,tt.isDehydrated)if(tt={element:j,isDehydrated:!1,cache:rt.cache,pendingSuspenseBoundaries:rt.pendingSuspenseBoundaries,transitions:rt.transitions},a.updateQueue.baseState=tt,a.memoizedState=tt,a.flags&256){et=Ji(Error(p$2(423)),a),a=lj(_,a,j,$,et);break e}else if(j!==et){et=Ji(Error(p$2(424)),a),a=lj(_,a,j,$,et);break e}else for(yg=Lf(a.stateNode.containerInfo.firstChild),xg=a,I=!0,zg=null,$=Vg(a,null,j,$),a.child=$;$;)$.flags=$.flags&-3|4096,$=$.sibling;else{if(Ig(),j===et){a=Zi(_,a,$);break e}Xi(_,a,j,$)}a=a.child}return a;case 5:return Ah(a),_===null&&Eg(a),j=a.type,et=a.pendingProps,tt=_!==null?_.memoizedProps:null,rt=et.children,Ef(j,et)?rt=null:tt!==null&&Ef(j,tt)&&(a.flags|=32),gj(_,a),Xi(_,a,rt,$),a.child;case 6:return _===null&&Eg(a),null;case 13:return oj(_,a,$);case 4:return yh(a,a.stateNode.containerInfo),j=a.pendingProps,_===null?a.child=Ug(a,null,j,$):Xi(_,a,j,$),a.child;case 11:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),Yi(_,a,j,et,$);case 7:return Xi(_,a,a.pendingProps,$),a.child;case 8:return Xi(_,a,a.pendingProps.children,$),a.child;case 12:return Xi(_,a,a.pendingProps.children,$),a.child;case 10:e:{if(j=a.type._context,et=a.pendingProps,tt=a.memoizedProps,rt=et.value,G(Wg,j._currentValue),j._currentValue=rt,tt!==null)if(He(tt.value,rt)){if(tt.children===et.children&&!Wf.current){a=Zi(_,a,$);break e}}else for(tt=a.child,tt!==null&&(tt.return=a);tt!==null;){var nt=tt.dependencies;if(nt!==null){rt=tt.child;for(var it=nt.firstContext;it!==null;){if(it.context===j){if(tt.tag===1){it=mh(-1,$&-$),it.tag=2;var at=tt.updateQueue;if(at!==null){at=at.shared;var st=at.pending;st===null?it.next=it:(it.next=st.next,st.next=it),at.pending=it}}tt.lanes|=$,it=tt.alternate,it!==null&&(it.lanes|=$),bh(tt.return,$,a),nt.lanes|=$;break}it=it.next}}else if(tt.tag===10)rt=tt.type===a.type?null:tt.child;else if(tt.tag===18){if(rt=tt.return,rt===null)throw Error(p$2(341));rt.lanes|=$,nt=rt.alternate,nt!==null&&(nt.lanes|=$),bh(rt,$,a),rt=tt.sibling}else rt=tt.child;if(rt!==null)rt.return=tt;else for(rt=tt;rt!==null;){if(rt===a){rt=null;break}if(tt=rt.sibling,tt!==null){tt.return=rt.return,rt=tt;break}rt=rt.return}tt=rt}Xi(_,a,et.children,$),a=a.child}return a;case 9:return et=a.type,j=a.pendingProps.children,ch$1(a,$),et=eh(et),j=j(et),a.flags|=1,Xi(_,a,j,$),a.child;case 14:return j=a.type,et=Ci(j,a.pendingProps),et=Ci(j.type,et),$i(_,a,j,et,$);case 15:return bj(_,a,a.type,a.pendingProps,$);case 17:return j=a.type,et=a.pendingProps,et=a.elementType===j?et:Ci(j,et),ij(_,a),a.tag=1,Zf(j)?(_=!0,cg(a)):_=!1,ch$1(a,$),Gi(a,j,et),Ii(a,j,et,$),jj(null,a,j,!0,_,$);case 19:return xj(_,a,$);case 22:return dj(_,a,$)}throw Error(p$2(156,a.tag))};function Fk(_,a){return ac(_,a)}function $k(_,a,$,j){this.tag=_,this.key=$,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(_,a,$,j){return new $k(_,a,$,j)}function aj(_){return _=_.prototype,!(!_||!_.isReactComponent)}function Zk(_){if(typeof _=="function")return aj(_)?1:0;if(_!=null){if(_=_.$$typeof,_===Da)return 11;if(_===Ga)return 14}return 2}function Pg(_,a){var $=_.alternate;return $===null?($=Bg(_.tag,a,_.key,_.mode),$.elementType=_.elementType,$.type=_.type,$.stateNode=_.stateNode,$.alternate=_,_.alternate=$):($.pendingProps=a,$.type=_.type,$.flags=0,$.subtreeFlags=0,$.deletions=null),$.flags=_.flags&14680064,$.childLanes=_.childLanes,$.lanes=_.lanes,$.child=_.child,$.memoizedProps=_.memoizedProps,$.memoizedState=_.memoizedState,$.updateQueue=_.updateQueue,a=_.dependencies,$.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},$.sibling=_.sibling,$.index=_.index,$.ref=_.ref,$}function Rg(_,a,$,j,et,tt){var rt=2;if(j=_,typeof _=="function")aj(_)&&(rt=1);else if(typeof _=="string")rt=5;else e:switch(_){case ya:return Tg($.children,et,tt,a);case za:rt=8,et|=8;break;case Aa:return _=Bg(12,$,a,et|2),_.elementType=Aa,_.lanes=tt,_;case Ea:return _=Bg(13,$,a,et),_.elementType=Ea,_.lanes=tt,_;case Fa:return _=Bg(19,$,a,et),_.elementType=Fa,_.lanes=tt,_;case Ia:return pj($,et,tt,a);default:if(typeof _=="object"&&_!==null)switch(_.$$typeof){case Ba:rt=10;break e;case Ca:rt=9;break e;case Da:rt=11;break e;case Ga:rt=14;break e;case Ha:rt=16,j=null;break e}throw Error(p$2(130,_==null?_:typeof _,""))}return a=Bg(rt,$,a,et),a.elementType=_,a.type=j,a.lanes=tt,a}function Tg(_,a,$,j){return _=Bg(7,_,j,a),_.lanes=$,_}function pj(_,a,$,j){return _=Bg(22,_,j,a),_.elementType=Ia,_.lanes=$,_.stateNode={isHidden:!1},_}function Qg(_,a,$){return _=Bg(6,_,null,a),_.lanes=$,_}function Sg(_,a,$){return a=Bg(4,_.children!==null?_.children:[],_.key,a),a.lanes=$,a.stateNode={containerInfo:_.containerInfo,pendingChildren:null,implementation:_.implementation},a}function al(_,a,$,j,et){this.tag=a,this.containerInfo=_,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=j,this.onRecoverableError=et,this.mutableSourceEagerHydrationData=null}function bl(_,a,$,j,et,tt,rt,nt,it){return _=new al(_,a,$,nt,it),a===1?(a=1,tt===!0&&(a|=8)):a=0,tt=Bg(3,null,null,a),_.current=tt,tt.stateNode=_,tt.memoizedState={element:j,isDehydrated:$,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(tt),_}function cl(_,a,$){var j=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(_){console.error(_)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,m$3=reactDomExports;client.createRoot=m$3.createRoot,client.hydrateRoot=m$3.hydrateRoot;const ErrorBoundaryContext=reactExports.createContext(null),initialState$c={didCatch:!1,error:null};class ErrorBoundary extends reactExports.Component{constructor(a){super(a),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState$c}static getDerivedStateFromError(a){return{didCatch:!0,error:a}}resetErrorBoundary(){const{error:a}=this.state;if(a!==null){for(var $,j,et=arguments.length,tt=new Array(et),rt=0;rt0&&arguments[0]!==void 0?arguments[0]:[],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return _.length!==a.length||_.some(($,j)=>!Object.is($,a[j]))}function _typeof$7(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$7=function($){return typeof $}:_typeof$7=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$7(_)}function _classCallCheck$2(_,a){if(!(_ instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(_,a){for(var $=0;$0?charat(characters,--position$1):0,column--,character===10&&(column=1,line--),character}function next(){return character=position$12||token(character)>3?"":" "}function escaping(_,a){for(;--a&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$5(_,caret()+(a<6&&peek$2()==32&&next()==32))}function delimiter(_){for(;next();)switch(character){case _:return position$1;case 34:case 39:_!==34&&_!==39&&delimiter(character);break;case 40:_===41&&delimiter(_);break;case 92:next();break}return position$1}function commenter(_,a){for(;next()&&_+character!==57;)if(_+character===84&&peek$2()===47)break;return"/*"+slice$5(a,position$1-1)+"*"+from$1(_===47?_:next())}function identifier(_){for(;!token(peek$2());)next();return slice$5(_,position$1)}function compile(_){return dealloc(parse$c("",null,null,null,[""],_=alloc(_),0,[0],_))}function parse$c(_,a,$,j,et,tt,rt,nt,it){for(var at=0,st=0,ot=rt,ut=0,dt=0,mt=0,xt=1,Ct=1,Pt=1,Tt=0,kt="",Lt=et,Nt=tt,zt=j,jt=kt;Ct;)switch(mt=Tt,Tt=next()){case 40:if(mt!=108&&charat(jt,ot-1)==58){indexof(jt+=replace(delimit(Tt),"&","&\f"),"&\f")!=-1&&(Pt=-1);break}case 34:case 39:case 91:jt+=delimit(Tt);break;case 9:case 10:case 13:case 32:jt+=whitespace(mt);break;case 92:jt+=escaping(caret()-1,7);continue;case 47:switch(peek$2()){case 42:case 47:append(comment(commenter(next(),caret()),a,$),it);break;default:jt+="/"}break;case 123*xt:nt[at++]=strlen(jt)*Pt;case 125*xt:case 59:case 0:switch(Tt){case 0:case 125:Ct=0;case 59+st:Pt==-1&&(jt=replace(jt,/\f/g,"")),dt>0&&strlen(jt)-ot&&append(dt>32?declaration(jt+";",j,$,ot-1):declaration(replace(jt," ","")+";",j,$,ot-2),it);break;case 59:jt+=";";default:if(append(zt=ruleset(jt,a,$,at,st,et,nt,kt,Lt=[],Nt=[],ot),tt),Tt===123)if(st===0)parse$c(jt,a,zt,zt,Lt,tt,ot,nt,Nt);else switch(ut===99&&charat(jt,3)===110?100:ut){case 100:case 108:case 109:case 115:parse$c(_,zt,zt,j&&append(ruleset(_,zt,zt,0,0,et,nt,kt,et,Lt=[],ot),Nt),et,Nt,ot,nt,j?Lt:Nt);break;default:parse$c(jt,zt,zt,zt,[""],Nt,0,nt,Nt)}}at=st=dt=0,xt=Pt=1,kt=jt="",ot=rt;break;case 58:ot=1+strlen(jt),dt=mt;default:if(xt<1){if(Tt==123)--xt;else if(Tt==125&&xt++==0&&prev$1()==125)continue}switch(jt+=from$1(Tt),Tt*xt){case 38:Pt=st>0?1:(jt+="\f",-1);break;case 44:nt[at++]=(strlen(jt)-1)*Pt,Pt=1;break;case 64:peek$2()===45&&(jt+=delimit(next())),ut=peek$2(),st=ot=strlen(kt=jt+=identifier(caret())),Tt++;break;case 45:mt===45&&strlen(jt)==2&&(xt=0)}}return tt}function ruleset(_,a,$,j,et,tt,rt,nt,it,at,st){for(var ot=et-1,ut=et===0?tt:[""],dt=sizeof(ut),mt=0,xt=0,Ct=0;mt0?ut[Pt]+" "+Tt:replace(Tt,/&\f/g,ut[Pt])))&&(it[Ct++]=kt);return node$3(_,a,$,et===0?RULESET:nt,it,at,st)}function comment(_,a,$){return node$3(_,a,$,COMMENT,from$1(char()),substr(_,2,-2),0)}function declaration(_,a,$,j){return node$3(_,a,$,DECLARATION,substr(_,0,j),substr(_,j+1,-1),j)}function serialize(_,a){for(var $="",j=sizeof(_),et=0;et6)switch(charat(_,a+1)){case 109:if(charat(_,a+4)!==45)break;case 102:return replace(_,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(_,a+3)==108?"$3":"$2-$3"))+_;case 115:return~indexof(_,"stretch")?prefix$1(replace(_,"stretch","fill-available"),a)+_:_}break;case 4949:if(charat(_,a+1)!==115)break;case 6444:switch(charat(_,strlen(_)-3-(~indexof(_,"!important")&&10))){case 107:return replace(_,":",":"+WEBKIT)+_;case 101:return replace(_,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(_,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+_}break;case 5936:switch(charat(_,a+11)){case 114:return WEBKIT+_+MS+replace(_,/[svh]\w+-[tblr]{2}/,"tb")+_;case 108:return WEBKIT+_+MS+replace(_,/[svh]\w+-[tblr]{2}/,"tb-rl")+_;case 45:return WEBKIT+_+MS+replace(_,/[svh]\w+-[tblr]{2}/,"lr")+_}return WEBKIT+_+MS+_+_}return _}var prefixer=function(a,$,j,et){if(a.length>-1&&!a.return)switch(a.type){case DECLARATION:a.return=prefix$1(a.value,a.length);break;case KEYFRAMES:return serialize([copy(a,{value:replace(a.value,"@","@"+WEBKIT)})],et);case RULESET:if(a.length)return combine(a.props,function(tt){switch(match$1(tt,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(a,{props:[replace(tt,/:(read-\w+)/,":"+MOZ+"$1")]})],et);case"::placeholder":return serialize([copy(a,{props:[replace(tt,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy(a,{props:[replace(tt,/:(plac\w+)/,":"+MOZ+"$1")]}),copy(a,{props:[replace(tt,/:(plac\w+)/,MS+"input-$1")]})],et)}return""})}},defaultStylisPlugins=[prefixer],createCache=function(a){var $=a.key;if($==="css"){var j=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(j,function(xt){var Ct=xt.getAttribute("data-emotion");Ct.indexOf(" ")!==-1&&(document.head.appendChild(xt),xt.setAttribute("data-s",""))})}var et=a.stylisPlugins||defaultStylisPlugins,tt={},rt,nt=[];rt=a.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+$+' "]'),function(xt){for(var Ct=xt.getAttribute("data-emotion").split(" "),Pt=1;Pt=4;++j,et-=4)$=_.charCodeAt(j)&255|(_.charCodeAt(++j)&255)<<8|(_.charCodeAt(++j)&255)<<16|(_.charCodeAt(++j)&255)<<24,$=($&65535)*1540483477+(($>>>16)*59797<<16),$^=$>>>24,a=($&65535)*1540483477+(($>>>16)*59797<<16)^(a&65535)*1540483477+((a>>>16)*59797<<16);switch(et){case 3:a^=(_.charCodeAt(j+2)&255)<<16;case 2:a^=(_.charCodeAt(j+1)&255)<<8;case 1:a^=_.charCodeAt(j)&255,a=(a&65535)*1540483477+((a>>>16)*59797<<16)}return a^=a>>>13,a=(a&65535)*1540483477+((a>>>16)*59797<<16),((a^a>>>15)>>>0).toString(36)}var unitlessKeys={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},hyphenateRegex$1=/[A-Z]|^ms/g,animationRegex$1=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty$1=function(a){return a.charCodeAt(1)===45},isProcessableValue$1=function(a){return a!=null&&typeof a!="boolean"},processStyleName$1=memoize$2(function(_){return isCustomProperty$1(_)?_:_.replace(hyphenateRegex$1,"-$&").toLowerCase()}),processStyleValue$1=function(a,$){switch(a){case"animation":case"animationName":if(typeof $=="string")return $.replace(animationRegex$1,function(j,et,tt){return cursor$1={name:et,styles:tt,next:cursor$1},et})}return unitlessKeys[a]!==1&&!isCustomProperty$1(a)&&typeof $=="number"&&$!==0?$+"px":$},noComponentSelectorMessage$1="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function handleInterpolation$1(_,a,$){if($==null)return"";if($.__emotion_styles!==void 0)return $;switch(typeof $){case"boolean":return"";case"object":{if($.anim===1)return cursor$1={name:$.name,styles:$.styles,next:cursor$1},$.name;if($.styles!==void 0){var j=$.next;if(j!==void 0)for(;j!==void 0;)cursor$1={name:j.name,styles:j.styles,next:cursor$1},j=j.next;var et=$.styles+";";return et}return createStringFromObject$1(_,a,$)}case"function":{if(_!==void 0){var tt=cursor$1,rt=$(_);return cursor$1=tt,handleInterpolation$1(_,a,rt)}break}}return $}function createStringFromObject$1(_,a,$){var j="";if(Array.isArray($))for(var et=0;et<$.length;et++)j+=handleInterpolation$1(_,a,$[et])+";";else for(var tt in $){var rt=$[tt];if(typeof rt!="object")isProcessableValue$1(rt)&&(j+=processStyleName$1(tt)+":"+processStyleValue$1(tt,rt)+";");else if(Array.isArray(rt)&&typeof rt[0]=="string"&&a==null)for(var nt=0;nt=4;++j,et-=4)$=_.charCodeAt(j)&255|(_.charCodeAt(++j)&255)<<8|(_.charCodeAt(++j)&255)<<16|(_.charCodeAt(++j)&255)<<24,$=($&65535)*1540483477+(($>>>16)*59797<<16),$^=$>>>24,a=($&65535)*1540483477+(($>>>16)*59797<<16)^(a&65535)*1540483477+((a>>>16)*59797<<16);switch(et){case 3:a^=(_.charCodeAt(j+2)&255)<<16;case 2:a^=(_.charCodeAt(j+1)&255)<<8;case 1:a^=_.charCodeAt(j)&255,a=(a&65535)*1540483477+((a>>>16)*59797<<16)}return a^=a>>>13,a=(a&65535)*1540483477+((a>>>16)*59797<<16),((a^a>>>15)>>>0).toString(36)}var unitlessKeys={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},hyphenateRegex$1=/[A-Z]|^ms/g,animationRegex$1=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty$1=function(a){return a.charCodeAt(1)===45},isProcessableValue$1=function(a){return a!=null&&typeof a!="boolean"},processStyleName$1=memoize$2(function(_){return isCustomProperty$1(_)?_:_.replace(hyphenateRegex$1,"-$&").toLowerCase()}),processStyleValue$1=function(a,$){switch(a){case"animation":case"animationName":if(typeof $=="string")return $.replace(animationRegex$1,function(j,et,tt){return cursor$1={name:et,styles:tt,next:cursor$1},et})}return unitlessKeys[a]!==1&&!isCustomProperty$1(a)&&typeof $=="number"&&$!==0?$+"px":$},noComponentSelectorMessage$1="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function handleInterpolation$1(_,a,$){if($==null)return"";if($.__emotion_styles!==void 0)return $;switch(typeof $){case"boolean":return"";case"object":{if($.anim===1)return cursor$1={name:$.name,styles:$.styles,next:cursor$1},$.name;if($.styles!==void 0){var j=$.next;if(j!==void 0)for(;j!==void 0;)cursor$1={name:j.name,styles:j.styles,next:cursor$1},j=j.next;var et=$.styles+";";return et}return createStringFromObject$1(_,a,$)}case"function":{if(_!==void 0){var tt=cursor$1,rt=$(_);return cursor$1=tt,handleInterpolation$1(_,a,rt)}break}}return $}function createStringFromObject$1(_,a,$){var j="";if(Array.isArray($))for(var et=0;et<$.length;et++)j+=handleInterpolation$1(_,a,$[et])+";";else for(var tt in $){var rt=$[tt];if(typeof rt!="object")isProcessableValue$1(rt)&&(j+=processStyleName$1(tt)+":"+processStyleValue$1(tt,rt)+";");else if(Array.isArray(rt)&&typeof rt[0]=="string"&&a==null)for(var nt=0;ntjsxRuntimeExports.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:_.zIndex,top:0,left:0,right:0},children:_.children}),DefaultPortal=_=>{const{appendToParentPortal:a,children:$}=_,[j,et]=reactExports.useState(null),tt=reactExports.useRef(null),[,rt]=reactExports.useState({});reactExports.useEffect(()=>rt({}),[]);const nt=usePortalContext(),it=usePortalManager();useSafeLayoutEffect$2(()=>{if(!j)return;const st=j.ownerDocument,at=a?nt??st.body:st.body;if(!at)return;tt.current=st.createElement("div"),tt.current.className=PORTAL_CLASSNAME,at.appendChild(tt.current),rt({});const ut=tt.current;return()=>{at.contains(ut)&&at.removeChild(ut)}},[j]);const ot=it!=null&&it.zIndex?jsxRuntimeExports.jsx(Container,{zIndex:it==null?void 0:it.zIndex,children:$}):$;return tt.current?reactDomExports.createPortal(jsxRuntimeExports.jsx(PortalContextProvider,{value:tt.current,children:ot}),tt.current):jsxRuntimeExports.jsx("span",{ref:st=>{st&&et(st)}})},ContainerPortal=_=>{const{children:a,containerRef:$,appendToParentPortal:j}=_,et=$.current,tt=et??(typeof window<"u"?document.body:void 0),rt=reactExports.useMemo(()=>{const it=et==null?void 0:et.ownerDocument.createElement("div");return it&&(it.className=PORTAL_CLASSNAME),it},[et]),[,nt]=reactExports.useState({});return useSafeLayoutEffect$2(()=>nt({}),[]),useSafeLayoutEffect$2(()=>{if(!(!rt||!tt))return tt.appendChild(rt),()=>{tt.removeChild(rt)}},[rt,tt]),tt&&rt?reactDomExports.createPortal(jsxRuntimeExports.jsx(PortalContextProvider,{value:j?rt:null,children:a}),rt):null};function Portal(_){const a={appendToParentPortal:!0,..._},{containerRef:$,...j}=a;return $?jsxRuntimeExports.jsx(ContainerPortal,{containerRef:$,...j}):jsxRuntimeExports.jsx(DefaultPortal,{...j})}Portal.className=PORTAL_CLASSNAME;Portal.selector=PORTAL_SELECTOR;Portal.displayName="Portal";function useTheme(){const _=reactExports.useContext(ThemeContext);if(!_)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return _}var ColorModeContext=reactExports.createContext({});ColorModeContext.displayName="ColorModeContext";function useColorMode(){const _=reactExports.useContext(ColorModeContext);if(_===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return _}var classNames={light:"chakra-ui-light",dark:"chakra-ui-dark"};function getColorModeUtils(_={}){const{preventTransition:a=!0}=_,$={setDataset:j=>{const et=a?$.preventTransition():void 0;document.documentElement.dataset.theme=j,document.documentElement.style.colorScheme=j,et==null||et()},setClassName(j){document.body.classList.add(j?classNames.dark:classNames.light),document.body.classList.remove(j?classNames.light:classNames.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(j){var et;return((et=$.query().matches)!=null?et:j==="dark")?"dark":"light"},addListener(j){const et=$.query(),tt=rt=>{j(rt.matches?"dark":"light")};return typeof et.addListener=="function"?et.addListener(tt):et.addEventListener("change",tt),()=>{typeof et.removeListener=="function"?et.removeListener(tt):et.removeEventListener("change",tt)}},preventTransition(){const j=document.createElement("style");return j.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(j),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(j)})})}}};return $}var STORAGE_KEY="chakra-ui-color-mode";function createLocalStorageManager(_){return{ssr:!1,type:"localStorage",get(a){if(!(globalThis!=null&&globalThis.document))return a;let $;try{$=localStorage.getItem(_)||a}catch{}return $||a},set(a){try{localStorage.setItem(_,a)}catch{}}}}var localStorageManager=createLocalStorageManager(STORAGE_KEY),noop$c=()=>{};function getTheme(_,a){return _.type==="cookie"&&_.ssr?_.get(a):a}function ColorModeProvider(_){const{value:a,children:$,options:{useSystemColorMode:j,initialColorMode:et,disableTransitionOnChange:tt}={},colorModeManager:rt=localStorageManager}=_,nt=et==="dark"?"dark":"light",[it,ot]=reactExports.useState(()=>getTheme(rt,nt)),[st,at]=reactExports.useState(()=>getTheme(rt)),{getSystemTheme:ut,setClassName:ht,setDataset:bt,addListener:Et}=reactExports.useMemo(()=>getColorModeUtils({preventTransition:tt}),[tt]),Ct=et==="system"&&!it?st:it,Pt=reactExports.useCallback(Lt=>{const Nt=Lt==="system"?ut():Lt;ot(Nt),ht(Nt==="dark"),bt(Nt),rt.set(Nt)},[rt,ut,ht,bt]);useSafeLayoutEffect$2(()=>{et==="system"&&at(ut())},[]),reactExports.useEffect(()=>{const Lt=rt.get();if(Lt){Pt(Lt);return}if(et==="system"){Pt("system");return}Pt(nt)},[rt,nt,et,Pt]);const Tt=reactExports.useCallback(()=>{Pt(Ct==="dark"?"light":"dark")},[Ct,Pt]);reactExports.useEffect(()=>{if(j)return Et(Pt)},[j,Et,Pt]);const It=reactExports.useMemo(()=>({colorMode:a??Ct,toggleColorMode:a?noop$c:Tt,setColorMode:a?noop$c:Pt,forced:a!==void 0}),[Ct,Tt,Pt,a]);return jsxRuntimeExports.jsx(ColorModeContext.Provider,{value:It,children:$})}ColorModeProvider.displayName="ColorModeProvider";var VALID_VALUES=new Set(["dark","light","system"]);function normalize$2(_){let a=_;return VALID_VALUES.has(a)||(a="light"),a}function getScriptSrc(_={}){const{initialColorMode:a="light",type:$="localStorage",storageKey:j="chakra-ui-color-mode"}=_,et=normalize$2(a),tt=$==="cookie",rt=`(function(){try{var a=function(o){var l="(prefers-color-scheme: dark)",v=window.matchMedia(l).matches?"dark":"light",e=o==="system"?v:o,d=document.documentElement,m=document.body,i="chakra-ui-light",n="chakra-ui-dark",s=e==="dark";return m.classList.add(s?n:i),m.classList.remove(s?i:n),d.style.colorScheme=e,d.dataset.theme=e,e},u=a,h="${et}",r="${j}",t=document.cookie.match(new RegExp("(^| )".concat(r,"=([^;]+)"))),c=t?t[2]:null;c?a(c):document.cookie="".concat(r,"=").concat(a(h),"; max-age=31536000; path=/")}catch(a){}})(); + `});function getErrorMessage(_,a){return`${_} returned \`undefined\`. Seems you forgot to wrap component within ${a}`}function createContext$1(_={}){const{name:a,strict:$=!0,hookName:j="useContext",providerName:et="Provider",errorMessage:tt,defaultValue:rt}=_,nt=reactExports.createContext(rt);nt.displayName=a;function it(){var at;const st=reactExports.useContext(nt);if(!st&&$){const ot=new Error(tt??getErrorMessage(j,et));throw ot.name="ContextError",(at=Error.captureStackTrace)==null||at.call(Error,ot,it),ot}return st}return[nt.Provider,it,nt]}var[PortalManagerContextProvider,usePortalManager]=createContext$1({strict:!1,name:"PortalManagerContext"});function PortalManager(_){const{children:a,zIndex:$}=_;return jsxRuntimeExports.jsx(PortalManagerContextProvider,{value:{zIndex:$},children:a})}PortalManager.displayName="PortalManager";var useSafeLayoutEffect$2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:reactExports.useEffect,[PortalContextProvider,usePortalContext]=createContext$1({strict:!1,name:"PortalContext"}),PORTAL_CLASSNAME="chakra-portal",PORTAL_SELECTOR=".chakra-portal",Container=_=>jsxRuntimeExports.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:_.zIndex,top:0,left:0,right:0},children:_.children}),DefaultPortal=_=>{const{appendToParentPortal:a,children:$}=_,[j,et]=reactExports.useState(null),tt=reactExports.useRef(null),[,rt]=reactExports.useState({});reactExports.useEffect(()=>rt({}),[]);const nt=usePortalContext(),it=usePortalManager();useSafeLayoutEffect$2(()=>{if(!j)return;const st=j.ownerDocument,ot=a?nt??st.body:st.body;if(!ot)return;tt.current=st.createElement("div"),tt.current.className=PORTAL_CLASSNAME,ot.appendChild(tt.current),rt({});const ut=tt.current;return()=>{ot.contains(ut)&&ot.removeChild(ut)}},[j]);const at=it!=null&&it.zIndex?jsxRuntimeExports.jsx(Container,{zIndex:it==null?void 0:it.zIndex,children:$}):$;return tt.current?reactDomExports.createPortal(jsxRuntimeExports.jsx(PortalContextProvider,{value:tt.current,children:at}),tt.current):jsxRuntimeExports.jsx("span",{ref:st=>{st&&et(st)}})},ContainerPortal=_=>{const{children:a,containerRef:$,appendToParentPortal:j}=_,et=$.current,tt=et??(typeof window<"u"?document.body:void 0),rt=reactExports.useMemo(()=>{const it=et==null?void 0:et.ownerDocument.createElement("div");return it&&(it.className=PORTAL_CLASSNAME),it},[et]),[,nt]=reactExports.useState({});return useSafeLayoutEffect$2(()=>nt({}),[]),useSafeLayoutEffect$2(()=>{if(!(!rt||!tt))return tt.appendChild(rt),()=>{tt.removeChild(rt)}},[rt,tt]),tt&&rt?reactDomExports.createPortal(jsxRuntimeExports.jsx(PortalContextProvider,{value:j?rt:null,children:a}),rt):null};function Portal(_){const a={appendToParentPortal:!0,..._},{containerRef:$,...j}=a;return $?jsxRuntimeExports.jsx(ContainerPortal,{containerRef:$,...j}):jsxRuntimeExports.jsx(DefaultPortal,{...j})}Portal.className=PORTAL_CLASSNAME;Portal.selector=PORTAL_SELECTOR;Portal.displayName="Portal";function useTheme(){const _=reactExports.useContext(ThemeContext);if(!_)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return _}var ColorModeContext=reactExports.createContext({});ColorModeContext.displayName="ColorModeContext";function useColorMode(){const _=reactExports.useContext(ColorModeContext);if(_===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return _}var classNames={light:"chakra-ui-light",dark:"chakra-ui-dark"};function getColorModeUtils(_={}){const{preventTransition:a=!0}=_,$={setDataset:j=>{const et=a?$.preventTransition():void 0;document.documentElement.dataset.theme=j,document.documentElement.style.colorScheme=j,et==null||et()},setClassName(j){document.body.classList.add(j?classNames.dark:classNames.light),document.body.classList.remove(j?classNames.light:classNames.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(j){var et;return((et=$.query().matches)!=null?et:j==="dark")?"dark":"light"},addListener(j){const et=$.query(),tt=rt=>{j(rt.matches?"dark":"light")};return typeof et.addListener=="function"?et.addListener(tt):et.addEventListener("change",tt),()=>{typeof et.removeListener=="function"?et.removeListener(tt):et.removeEventListener("change",tt)}},preventTransition(){const j=document.createElement("style");return j.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(j),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(j)})})}}};return $}var STORAGE_KEY="chakra-ui-color-mode";function createLocalStorageManager(_){return{ssr:!1,type:"localStorage",get(a){if(!(globalThis!=null&&globalThis.document))return a;let $;try{$=localStorage.getItem(_)||a}catch{}return $||a},set(a){try{localStorage.setItem(_,a)}catch{}}}}var localStorageManager=createLocalStorageManager(STORAGE_KEY),noop$c=()=>{};function getTheme(_,a){return _.type==="cookie"&&_.ssr?_.get(a):a}function ColorModeProvider(_){const{value:a,children:$,options:{useSystemColorMode:j,initialColorMode:et,disableTransitionOnChange:tt}={},colorModeManager:rt=localStorageManager}=_,nt=et==="dark"?"dark":"light",[it,at]=reactExports.useState(()=>getTheme(rt,nt)),[st,ot]=reactExports.useState(()=>getTheme(rt)),{getSystemTheme:ut,setClassName:dt,setDataset:mt,addListener:xt}=reactExports.useMemo(()=>getColorModeUtils({preventTransition:tt}),[tt]),Ct=et==="system"&&!it?st:it,Pt=reactExports.useCallback(Lt=>{const Nt=Lt==="system"?ut():Lt;at(Nt),dt(Nt==="dark"),mt(Nt),rt.set(Nt)},[rt,ut,dt,mt]);useSafeLayoutEffect$2(()=>{et==="system"&&ot(ut())},[]),reactExports.useEffect(()=>{const Lt=rt.get();if(Lt){Pt(Lt);return}if(et==="system"){Pt("system");return}Pt(nt)},[rt,nt,et,Pt]);const Tt=reactExports.useCallback(()=>{Pt(Ct==="dark"?"light":"dark")},[Ct,Pt]);reactExports.useEffect(()=>{if(j)return xt(Pt)},[j,xt,Pt]);const kt=reactExports.useMemo(()=>({colorMode:a??Ct,toggleColorMode:a?noop$c:Tt,setColorMode:a?noop$c:Pt,forced:a!==void 0}),[Ct,Tt,Pt,a]);return jsxRuntimeExports.jsx(ColorModeContext.Provider,{value:kt,children:$})}ColorModeProvider.displayName="ColorModeProvider";var VALID_VALUES=new Set(["dark","light","system"]);function normalize$2(_){let a=_;return VALID_VALUES.has(a)||(a="light"),a}function getScriptSrc(_={}){const{initialColorMode:a="light",type:$="localStorage",storageKey:j="chakra-ui-color-mode"}=_,et=normalize$2(a),tt=$==="cookie",rt=`(function(){try{var a=function(o){var l="(prefers-color-scheme: dark)",v=window.matchMedia(l).matches?"dark":"light",e=o==="system"?v:o,d=document.documentElement,m=document.body,i="chakra-ui-light",n="chakra-ui-dark",s=e==="dark";return m.classList.add(s?n:i),m.classList.remove(s?i:n),d.style.colorScheme=e,d.dataset.theme=e,e},u=a,h="${et}",r="${j}",t=document.cookie.match(new RegExp("(^| )".concat(r,"=([^;]+)"))),c=t?t[2]:null;c?a(c):document.cookie="".concat(r,"=").concat(a(h),"; max-age=31536000; path=/")}catch(a){}})(); `,nt=`(function(){try{var a=function(c){var v="(prefers-color-scheme: dark)",h=window.matchMedia(v).matches?"dark":"light",r=c==="system"?h:c,o=document.documentElement,s=document.body,l="chakra-ui-light",d="chakra-ui-dark",i=r==="dark";return s.classList.add(i?d:l),s.classList.remove(i?l:d),o.style.colorScheme=r,o.dataset.theme=r,r},n=a,m="${et}",e="${j}",t=localStorage.getItem(e);t?a(t):localStorage.setItem(e,a(m))}catch(a){}})(); - `;return`!${tt?rt:nt}`.trim()}function ColorModeScript(_={}){const{nonce:a}=_;return jsxRuntimeExports.jsx("script",{id:"chakra-script",nonce:a,dangerouslySetInnerHTML:{__html:getScriptSrc(_)}})}function useChakra(){const _=useColorMode(),a=useTheme();return{..._,theme:a}}function getTokenValue(_,a,$){var j,et;if(a==null)return a;const tt=rt=>{var nt,it;return(it=(nt=_.__cssMap)==null?void 0:nt[rt])==null?void 0:it.value};return(et=(j=tt(a))!=null?j:tt($))!=null?et:$}function getToken(_,a,$){const j=Array.isArray(a)?a:[a],et=Array.isArray($)?$:[$];return tt=>{const rt=et.filter(Boolean),nt=j.map((it,ot)=>{var st;const at=`${_}.${it}`;return getTokenValue(tt,at,(st=rt[ot])!=null?st:it)});return Array.isArray(a)?nt:nt[0]}}var cx=(..._)=>_.filter(Boolean).join(" ");function isDev(){return!1}function isObject$5(_){const a=typeof _;return _!=null&&(a==="object"||a==="function")&&!Array.isArray(_)}var warn=_=>{const{condition:a,message:$}=_;a&&isDev()&&console.warn($)};function runIfFn$2(_,...a){return isFunction$8(_)?_(...a):_}var isFunction$8=_=>typeof _=="function",dataAttr=_=>_?"":void 0,ariaAttr=_=>_?!0:void 0;function callAllHandlers$1(..._){return function($){_.some(j=>(j==null||j($),$==null?void 0:$.defaultPrevented))}}function callAll(..._){return function($){_.forEach(j=>{j==null||j($)})}}var lodash_mergewith={exports:{}};lodash_mergewith.exports;(function(_,a){var $=200,j="__lodash_hash_undefined__",et=800,tt=16,rt=9007199254740991,nt="[object Arguments]",it="[object Array]",ot="[object AsyncFunction]",st="[object Boolean]",at="[object Date]",ut="[object Error]",ht="[object Function]",bt="[object GeneratorFunction]",Et="[object Map]",Ct="[object Number]",Pt="[object Null]",Tt="[object Object]",It="[object Proxy]",Lt="[object RegExp]",Nt="[object Set]",Ut="[object String]",jt="[object Undefined]",Mt="[object WeakMap]",Dt="[object ArrayBuffer]",Ft="[object DataView]",Bt="[object Float32Array]",yt="[object Float64Array]",mt="[object Int8Array]",ct="[object Int16Array]",dt="[object Int32Array]",vt="[object Uint8Array]",St="[object Uint8ClampedArray]",Rt="[object Uint16Array]",$t="[object Uint32Array]",xt=/[\\^$.*+?()[\]{}|]/g,At=/^\[object .+?Constructor\]$/,wt=/^(?:0|[1-9]\d*)$/,Ot={};Ot[Bt]=Ot[yt]=Ot[mt]=Ot[ct]=Ot[dt]=Ot[vt]=Ot[St]=Ot[Rt]=Ot[$t]=!0,Ot[nt]=Ot[it]=Ot[Dt]=Ot[st]=Ot[Ft]=Ot[at]=Ot[ut]=Ot[ht]=Ot[Et]=Ot[Ct]=Ot[Tt]=Ot[Lt]=Ot[Nt]=Ot[Ut]=Ot[Mt]=!1;var tr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,nr=typeof self=="object"&&self&&self.Object===Object&&self,ir=tr||nr||Function("return this")(),Wt=a&&!a.nodeType&&a,Kt=Wt&&!0&&_&&!_.nodeType&&_,Jt=Kt&&Kt.exports===Wt,Ht=Jt&&tr.process,qt=function(){try{var Xt=Kt&&Kt.require&&Kt.require("util").types;return Xt||Ht&&Ht.binding&&Ht.binding("util")}catch{}}(),Qt=qt&&qt.isTypedArray;function dr(Xt,cr,gr){switch(gr.length){case 0:return Xt.call(cr);case 1:return Xt.call(cr,gr[0]);case 2:return Xt.call(cr,gr[0],gr[1]);case 3:return Xt.call(cr,gr[0],gr[1],gr[2])}return Xt.apply(cr,gr)}function xr(Xt,cr){for(var gr=-1,Dr=Array(Xt);++gr-1}function Gr(Xt,cr){var gr=this.__data__,Dr=Jn(gr,Xt);return Dr<0?(++this.size,gr.push([Xt,cr])):gr[Dr][1]=cr,this}hn.prototype.clear=fn,hn.prototype.delete=Kr,hn.prototype.get=$n,hn.prototype.has=dn,hn.prototype.set=Gr;function gn(Xt){var cr=-1,gr=Xt==null?0:Xt.length;for(this.clear();++cr1?gr[rn-1]:void 0,Pn=rn>2?gr[2]:void 0;for(xn=Xt.length>3&&typeof xn=="function"?(rn--,xn):void 0,Pn&&Yl(gr[0],gr[1],Pn)&&(xn=rn<3?void 0:xn,rn=1),cr=Object(cr);++Dr-1&&Xt%1==0&&Xt0){if(++cr>=et)return arguments[0]}else cr=0;return Xt.apply(void 0,arguments)}}function Al(Xt){if(Xt!=null){try{return Pr.call(Xt)}catch{}try{return Xt+""}catch{}}return""}function Xs(Xt,cr){return Xt===cr||Xt!==Xt&&cr!==cr}var Ro=es(function(){return arguments}())?es:function(Xt){return Ms(Xt)&&Rr.call(Xt,"callee")&&!ar.call(Xt,"callee")},Ls=Array.isArray;function uo(Xt){return Xt!=null&&Po(Xt.length)&&!Ao(Xt)}function Pl(Xt){return Ms(Xt)&&uo(Xt)}var fo=Wr||_r;function Ao(Xt){if(!Ts(Xt))return!1;var cr=Qn(Xt);return cr==ht||cr==bt||cr==ot||cr==It}function Po(Xt){return typeof Xt=="number"&&Xt>-1&&Xt%1==0&&Xt<=rt}function Ts(Xt){var cr=typeof Xt;return Xt!=null&&(cr=="object"||cr=="function")}function Ms(Xt){return Xt!=null&&typeof Xt=="object"}function Tl(Xt){if(!Ms(Xt)||Qn(Xt)!=Tt)return!1;var cr=Vt(Xt);if(cr===null)return!0;var gr=Rr.call(cr,"constructor")&&cr.constructor;return typeof gr=="function"&&gr instanceof gr&&Pr.call(gr)==Lr}var Bo=Qt?pr(Qt):us;function To(Xt){return _o(Xt,No(Xt))}function No(Xt){return uo(Xt)?ps(Xt):Wn(Xt)}var Xl=Go(function(Xt,cr,gr,Dr){as(Xt,cr,gr,Dr)});function rs(Xt){return function(){return Xt}}function Xn(Xt){return Xt}function _r(){return!1}_.exports=Xl})(lodash_mergewith,lodash_mergewith.exports);var lodash_mergewithExports=lodash_mergewith.exports;const mergeWith=getDefaultExportFromCjs$1(lodash_mergewithExports);var isImportant=_=>/!(important)?$/.test(_),withoutImportant=_=>typeof _=="string"?_.replace(/!(important)?$/,"").trim():_,tokenToCSSVar=(_,a)=>$=>{const j=String(a),et=isImportant(j),tt=withoutImportant(j),rt=_?`${_}.${tt}`:tt;let nt=isObject$5($.__cssMap)&&rt in $.__cssMap?$.__cssMap[rt].varRef:a;return nt=withoutImportant(nt),et?`${nt} !important`:nt};function createTransform(_){const{scale:a,transform:$,compose:j}=_;return(tt,rt)=>{var nt;const it=tokenToCSSVar(a,tt)(rt);let ot=(nt=$==null?void 0:$(it,rt))!=null?nt:it;return j&&(ot=j(ot,rt)),ot}}var pipe$3=(..._)=>a=>_.reduce(($,j)=>j($),a);function toConfig(_,a){return $=>{const j={property:$,scale:_};return j.transform=createTransform({scale:_,transform:a}),j}}var getRtl=({rtl:_,ltr:a})=>$=>$.direction==="rtl"?_:a;function logical(_){const{property:a,scale:$,transform:j}=_;return{scale:$,property:getRtl(a),transform:$?createTransform({scale:$,compose:j}):j}}var transformTemplate=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function getTransformTemplate(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...transformTemplate].join(" ")}function getTransformGpuTemplate(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...transformTemplate].join(" ")}var filterTemplate={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},backdropFilterTemplate={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function getRingTemplate(_){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":_,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var flexDirectionTemplate={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},directionMap={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},valueSet=new Set(Object.values(directionMap)),globalSet=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),trimSpace=_=>_.trim();function parseGradient(_,a){if(_==null||globalSet.has(_))return _;if(!(isCSSFunction(_)||globalSet.has(_)))return`url('${_}')`;const et=/(^[a-z-A-Z]+)\((.*)\)/g.exec(_),tt=et==null?void 0:et[1],rt=et==null?void 0:et[2];if(!tt||!rt)return _;const nt=tt.includes("-gradient")?tt:`${tt}-gradient`,[it,...ot]=rt.split(",").map(trimSpace).filter(Boolean);if((ot==null?void 0:ot.length)===0)return _;const st=it in directionMap?directionMap[it]:it;ot.unshift(st);const at=ot.map(ut=>{if(valueSet.has(ut))return ut;const ht=ut.indexOf(" "),[bt,Et]=ht!==-1?[ut.substr(0,ht),ut.substr(ht+1)]:[ut],Ct=isCSSFunction(Et)?Et:Et&&Et.split(" "),Pt=`colors.${bt}`,Tt=Pt in a.__cssMap?a.__cssMap[Pt].varRef:bt;return Ct?[Tt,...Array.isArray(Ct)?Ct:[Ct]].join(" "):Tt});return`${nt}(${at.join(", ")})`}var isCSSFunction=_=>typeof _=="string"&&_.includes("(")&&_.includes(")"),gradientTransform=(_,a)=>parseGradient(_,a??{});function isCssVar(_){return/^var\(--.+\)$/.test(_)}var analyzeCSSValue=_=>{const a=parseFloat(_.toString()),$=_.toString().replace(String(a),"");return{unitless:!$,value:a,unit:$}},wrap=_=>a=>`${_}(${a})`,transformFunctions={filter(_){return _!=="auto"?_:filterTemplate},backdropFilter(_){return _!=="auto"?_:backdropFilterTemplate},ring(_){return getRingTemplate(transformFunctions.px(_))},bgClip(_){return _==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:_}},transform(_){return _==="auto"?getTransformTemplate():_==="auto-gpu"?getTransformGpuTemplate():_},vh(_){return _==="$100vh"?"var(--chakra-vh)":_},px(_){if(_==null)return _;const{unitless:a}=analyzeCSSValue(_);return a||typeof _=="number"?`${_}px`:_},fraction(_){return typeof _!="number"||_>1?_:`${_*100}%`},float(_,a){const $={left:"right",right:"left"};return a.direction==="rtl"?$[_]:_},degree(_){if(isCssVar(_)||_==null)return _;const a=typeof _=="string"&&!_.endsWith("deg");return typeof _=="number"||a?`${_}deg`:_},gradient:gradientTransform,blur:wrap("blur"),opacity:wrap("opacity"),brightness:wrap("brightness"),contrast:wrap("contrast"),dropShadow:wrap("drop-shadow"),grayscale:wrap("grayscale"),hueRotate:_=>wrap("hue-rotate")(transformFunctions.degree(_)),invert:wrap("invert"),saturate:wrap("saturate"),sepia:wrap("sepia"),bgImage(_){return _==null||isCSSFunction(_)||globalSet.has(_)?_:`url(${_})`},outline(_){const a=String(_)==="0"||String(_)==="none";return _!==null&&a?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:_}},flexDirection(_){var a;const{space:$,divide:j}=(a=flexDirectionTemplate[_])!=null?a:{},et={flexDirection:_};return $&&(et[$]=1),j&&(et[j]=1),et}},t$5={borderWidths:toConfig("borderWidths"),borderStyles:toConfig("borderStyles"),colors:toConfig("colors"),borders:toConfig("borders"),gradients:toConfig("gradients",transformFunctions.gradient),radii:toConfig("radii",transformFunctions.px),space:toConfig("space",pipe$3(transformFunctions.vh,transformFunctions.px)),spaceT:toConfig("space",pipe$3(transformFunctions.vh,transformFunctions.px)),degreeT(_){return{property:_,transform:transformFunctions.degree}},prop(_,a,$){return{property:_,scale:a,...a&&{transform:createTransform({scale:a,transform:$})}}},propT(_,a){return{property:_,transform:a}},sizes:toConfig("sizes",pipe$3(transformFunctions.vh,transformFunctions.px)),sizesT:toConfig("sizes",pipe$3(transformFunctions.vh,transformFunctions.fraction)),shadows:toConfig("shadows"),logical,blur:toConfig("blur",transformFunctions.blur)},background={background:t$5.colors("background"),backgroundColor:t$5.colors("backgroundColor"),backgroundImage:t$5.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:transformFunctions.bgClip},bgSize:t$5.prop("backgroundSize"),bgPosition:t$5.prop("backgroundPosition"),bg:t$5.colors("background"),bgColor:t$5.colors("backgroundColor"),bgPos:t$5.prop("backgroundPosition"),bgRepeat:t$5.prop("backgroundRepeat"),bgAttachment:t$5.prop("backgroundAttachment"),bgGradient:t$5.gradients("backgroundImage"),bgClip:{transform:transformFunctions.bgClip}};Object.assign(background,{bgImage:background.backgroundImage,bgImg:background.backgroundImage});var border={border:t$5.borders("border"),borderWidth:t$5.borderWidths("borderWidth"),borderStyle:t$5.borderStyles("borderStyle"),borderColor:t$5.colors("borderColor"),borderRadius:t$5.radii("borderRadius"),borderTop:t$5.borders("borderTop"),borderBlockStart:t$5.borders("borderBlockStart"),borderTopLeftRadius:t$5.radii("borderTopLeftRadius"),borderStartStartRadius:t$5.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:t$5.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:t$5.radii("borderTopRightRadius"),borderStartEndRadius:t$5.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:t$5.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:t$5.borders("borderRight"),borderInlineEnd:t$5.borders("borderInlineEnd"),borderBottom:t$5.borders("borderBottom"),borderBlockEnd:t$5.borders("borderBlockEnd"),borderBottomLeftRadius:t$5.radii("borderBottomLeftRadius"),borderBottomRightRadius:t$5.radii("borderBottomRightRadius"),borderLeft:t$5.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:t$5.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:t$5.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:t$5.borders(["borderLeft","borderRight"]),borderInline:t$5.borders("borderInline"),borderY:t$5.borders(["borderTop","borderBottom"]),borderBlock:t$5.borders("borderBlock"),borderTopWidth:t$5.borderWidths("borderTopWidth"),borderBlockStartWidth:t$5.borderWidths("borderBlockStartWidth"),borderTopColor:t$5.colors("borderTopColor"),borderBlockStartColor:t$5.colors("borderBlockStartColor"),borderTopStyle:t$5.borderStyles("borderTopStyle"),borderBlockStartStyle:t$5.borderStyles("borderBlockStartStyle"),borderBottomWidth:t$5.borderWidths("borderBottomWidth"),borderBlockEndWidth:t$5.borderWidths("borderBlockEndWidth"),borderBottomColor:t$5.colors("borderBottomColor"),borderBlockEndColor:t$5.colors("borderBlockEndColor"),borderBottomStyle:t$5.borderStyles("borderBottomStyle"),borderBlockEndStyle:t$5.borderStyles("borderBlockEndStyle"),borderLeftWidth:t$5.borderWidths("borderLeftWidth"),borderInlineStartWidth:t$5.borderWidths("borderInlineStartWidth"),borderLeftColor:t$5.colors("borderLeftColor"),borderInlineStartColor:t$5.colors("borderInlineStartColor"),borderLeftStyle:t$5.borderStyles("borderLeftStyle"),borderInlineStartStyle:t$5.borderStyles("borderInlineStartStyle"),borderRightWidth:t$5.borderWidths("borderRightWidth"),borderInlineEndWidth:t$5.borderWidths("borderInlineEndWidth"),borderRightColor:t$5.colors("borderRightColor"),borderInlineEndColor:t$5.colors("borderInlineEndColor"),borderRightStyle:t$5.borderStyles("borderRightStyle"),borderInlineEndStyle:t$5.borderStyles("borderInlineEndStyle"),borderTopRadius:t$5.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:t$5.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:t$5.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:t$5.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(border,{rounded:border.borderRadius,roundedTop:border.borderTopRadius,roundedTopLeft:border.borderTopLeftRadius,roundedTopRight:border.borderTopRightRadius,roundedTopStart:border.borderStartStartRadius,roundedTopEnd:border.borderStartEndRadius,roundedBottom:border.borderBottomRadius,roundedBottomLeft:border.borderBottomLeftRadius,roundedBottomRight:border.borderBottomRightRadius,roundedBottomStart:border.borderEndStartRadius,roundedBottomEnd:border.borderEndEndRadius,roundedLeft:border.borderLeftRadius,roundedRight:border.borderRightRadius,roundedStart:border.borderInlineStartRadius,roundedEnd:border.borderInlineEndRadius,borderStart:border.borderInlineStart,borderEnd:border.borderInlineEnd,borderTopStartRadius:border.borderStartStartRadius,borderTopEndRadius:border.borderStartEndRadius,borderBottomStartRadius:border.borderEndStartRadius,borderBottomEndRadius:border.borderEndEndRadius,borderStartRadius:border.borderInlineStartRadius,borderEndRadius:border.borderInlineEndRadius,borderStartWidth:border.borderInlineStartWidth,borderEndWidth:border.borderInlineEndWidth,borderStartColor:border.borderInlineStartColor,borderEndColor:border.borderInlineEndColor,borderStartStyle:border.borderInlineStartStyle,borderEndStyle:border.borderInlineEndStyle});var color$2={color:t$5.colors("color"),textColor:t$5.colors("color"),fill:t$5.colors("fill"),stroke:t$5.colors("stroke")},effect$3={boxShadow:t$5.shadows("boxShadow"),mixBlendMode:!0,blendMode:t$5.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:t$5.prop("backgroundBlendMode"),opacity:!0};Object.assign(effect$3,{shadow:effect$3.boxShadow});var filter$2={filter:{transform:transformFunctions.filter},blur:t$5.blur("--chakra-blur"),brightness:t$5.propT("--chakra-brightness",transformFunctions.brightness),contrast:t$5.propT("--chakra-contrast",transformFunctions.contrast),hueRotate:t$5.propT("--chakra-hue-rotate",transformFunctions.hueRotate),invert:t$5.propT("--chakra-invert",transformFunctions.invert),saturate:t$5.propT("--chakra-saturate",transformFunctions.saturate),dropShadow:t$5.propT("--chakra-drop-shadow",transformFunctions.dropShadow),backdropFilter:{transform:transformFunctions.backdropFilter},backdropBlur:t$5.blur("--chakra-backdrop-blur"),backdropBrightness:t$5.propT("--chakra-backdrop-brightness",transformFunctions.brightness),backdropContrast:t$5.propT("--chakra-backdrop-contrast",transformFunctions.contrast),backdropHueRotate:t$5.propT("--chakra-backdrop-hue-rotate",transformFunctions.hueRotate),backdropInvert:t$5.propT("--chakra-backdrop-invert",transformFunctions.invert),backdropSaturate:t$5.propT("--chakra-backdrop-saturate",transformFunctions.saturate)},flexbox={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:transformFunctions.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:t$5.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:t$5.space("gap"),rowGap:t$5.space("rowGap"),columnGap:t$5.space("columnGap")};Object.assign(flexbox,{flexDir:flexbox.flexDirection});var grid={gridGap:t$5.space("gridGap"),gridColumnGap:t$5.space("gridColumnGap"),gridRowGap:t$5.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},interactivity={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:transformFunctions.outline},outlineOffset:!0,outlineColor:t$5.colors("outlineColor")},layout$1={width:t$5.sizesT("width"),inlineSize:t$5.sizesT("inlineSize"),height:t$5.sizes("height"),blockSize:t$5.sizes("blockSize"),boxSize:t$5.sizes(["width","height"]),minWidth:t$5.sizes("minWidth"),minInlineSize:t$5.sizes("minInlineSize"),minHeight:t$5.sizes("minHeight"),minBlockSize:t$5.sizes("minBlockSize"),maxWidth:t$5.sizes("maxWidth"),maxInlineSize:t$5.sizes("maxInlineSize"),maxHeight:t$5.sizes("maxHeight"),maxBlockSize:t$5.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(_,a)=>{var $,j,et;return{[`@media screen and (min-width: ${(et=(j=($=a.__breakpoints)==null?void 0:$.get(_))==null?void 0:j.minW)!=null?et:_})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(_,a)=>{var $,j,et;return{[`@media screen and (max-width: ${(et=(j=($=a.__breakpoints)==null?void 0:$.get(_))==null?void 0:j._minW)!=null?et:_})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:t$5.propT("float",transformFunctions.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(layout$1,{w:layout$1.width,h:layout$1.height,minW:layout$1.minWidth,maxW:layout$1.maxWidth,minH:layout$1.minHeight,maxH:layout$1.maxHeight,overscroll:layout$1.overscrollBehavior,overscrollX:layout$1.overscrollBehaviorX,overscrollY:layout$1.overscrollBehaviorY});var list={listStyleType:!0,listStylePosition:!0,listStylePos:t$5.prop("listStylePosition"),listStyleImage:!0,listStyleImg:t$5.prop("listStyleImage")};function get$6(_,a,$,j){const et=typeof a=="string"?a.split("."):[a];for(j=0;j{const a=new WeakMap;return(j,et,tt,rt)=>{if(typeof j>"u")return _(j,et,tt);a.has(j)||a.set(j,new Map);const nt=a.get(j);if(nt.has(et))return nt.get(et);const it=_(j,et,tt,rt);return nt.set(et,it),it}},memoizedGet$1=memoize$1(get$6),srOnly={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},srFocusable={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},getWithPriority=(_,a,$)=>{const j={},et=memoizedGet$1(_,a,{});for(const tt in et)tt in $&&$[tt]!=null||(j[tt]=et[tt]);return j},others={srOnly:{transform(_){return _===!0?srOnly:_==="focusable"?srFocusable:{}}},layerStyle:{processResult:!0,transform:(_,a,$)=>getWithPriority(a,`layerStyles.${_}`,$)},textStyle:{processResult:!0,transform:(_,a,$)=>getWithPriority(a,`textStyles.${_}`,$)},apply:{processResult:!0,transform:(_,a,$)=>getWithPriority(a,_,$)}},position={position:!0,pos:t$5.prop("position"),zIndex:t$5.prop("zIndex","zIndices"),inset:t$5.spaceT("inset"),insetX:t$5.spaceT(["left","right"]),insetInline:t$5.spaceT("insetInline"),insetY:t$5.spaceT(["top","bottom"]),insetBlock:t$5.spaceT("insetBlock"),top:t$5.spaceT("top"),insetBlockStart:t$5.spaceT("insetBlockStart"),bottom:t$5.spaceT("bottom"),insetBlockEnd:t$5.spaceT("insetBlockEnd"),left:t$5.spaceT("left"),insetInlineStart:t$5.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:t$5.spaceT("right"),insetInlineEnd:t$5.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(position,{insetStart:position.insetInlineStart,insetEnd:position.insetInlineEnd});var ring={ring:{transform:transformFunctions.ring},ringColor:t$5.colors("--chakra-ring-color"),ringOffset:t$5.prop("--chakra-ring-offset-width"),ringOffsetColor:t$5.colors("--chakra-ring-offset-color"),ringInset:t$5.prop("--chakra-ring-inset")},space={margin:t$5.spaceT("margin"),marginTop:t$5.spaceT("marginTop"),marginBlockStart:t$5.spaceT("marginBlockStart"),marginRight:t$5.spaceT("marginRight"),marginInlineEnd:t$5.spaceT("marginInlineEnd"),marginBottom:t$5.spaceT("marginBottom"),marginBlockEnd:t$5.spaceT("marginBlockEnd"),marginLeft:t$5.spaceT("marginLeft"),marginInlineStart:t$5.spaceT("marginInlineStart"),marginX:t$5.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:t$5.spaceT("marginInline"),marginY:t$5.spaceT(["marginTop","marginBottom"]),marginBlock:t$5.spaceT("marginBlock"),padding:t$5.space("padding"),paddingTop:t$5.space("paddingTop"),paddingBlockStart:t$5.space("paddingBlockStart"),paddingRight:t$5.space("paddingRight"),paddingBottom:t$5.space("paddingBottom"),paddingBlockEnd:t$5.space("paddingBlockEnd"),paddingLeft:t$5.space("paddingLeft"),paddingInlineStart:t$5.space("paddingInlineStart"),paddingInlineEnd:t$5.space("paddingInlineEnd"),paddingX:t$5.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:t$5.space("paddingInline"),paddingY:t$5.space(["paddingTop","paddingBottom"]),paddingBlock:t$5.space("paddingBlock")};Object.assign(space,{m:space.margin,mt:space.marginTop,mr:space.marginRight,me:space.marginInlineEnd,marginEnd:space.marginInlineEnd,mb:space.marginBottom,ml:space.marginLeft,ms:space.marginInlineStart,marginStart:space.marginInlineStart,mx:space.marginX,my:space.marginY,p:space.padding,pt:space.paddingTop,py:space.paddingY,px:space.paddingX,pb:space.paddingBottom,pl:space.paddingLeft,ps:space.paddingInlineStart,paddingStart:space.paddingInlineStart,pr:space.paddingRight,pe:space.paddingInlineEnd,paddingEnd:space.paddingInlineEnd});var textDecoration={textDecorationColor:t$5.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:t$5.shadows("textShadow")},transform={clipPath:!0,transform:t$5.propT("transform",transformFunctions.transform),transformOrigin:!0,translateX:t$5.spaceT("--chakra-translate-x"),translateY:t$5.spaceT("--chakra-translate-y"),skewX:t$5.degreeT("--chakra-skew-x"),skewY:t$5.degreeT("--chakra-skew-y"),scaleX:t$5.prop("--chakra-scale-x"),scaleY:t$5.prop("--chakra-scale-y"),scale:t$5.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:t$5.degreeT("--chakra-rotate")},transition$1={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:t$5.prop("transitionDuration","transition.duration"),transitionProperty:t$5.prop("transitionProperty","transition.property"),transitionTimingFunction:t$5.prop("transitionTimingFunction","transition.easing")},typography$1={fontFamily:t$5.prop("fontFamily","fonts"),fontSize:t$5.prop("fontSize","fontSizes",transformFunctions.px),fontWeight:t$5.prop("fontWeight","fontWeights"),lineHeight:t$5.prop("lineHeight","lineHeights"),letterSpacing:t$5.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(_){if(_===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},scroll={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:t$5.spaceT("scrollMargin"),scrollMarginTop:t$5.spaceT("scrollMarginTop"),scrollMarginBottom:t$5.spaceT("scrollMarginBottom"),scrollMarginLeft:t$5.spaceT("scrollMarginLeft"),scrollMarginRight:t$5.spaceT("scrollMarginRight"),scrollMarginX:t$5.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:t$5.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:t$5.spaceT("scrollPadding"),scrollPaddingTop:t$5.spaceT("scrollPaddingTop"),scrollPaddingBottom:t$5.spaceT("scrollPaddingBottom"),scrollPaddingLeft:t$5.spaceT("scrollPaddingLeft"),scrollPaddingRight:t$5.spaceT("scrollPaddingRight"),scrollPaddingX:t$5.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:t$5.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function resolveReference(_){return isObject$5(_)&&_.reference?_.reference:String(_)}var toExpression=(_,...a)=>a.map(resolveReference).join(` ${_} `).replace(/calc/g,""),add$1=(..._)=>`calc(${toExpression("+",..._)})`,subtract$1=(..._)=>`calc(${toExpression("-",..._)})`,multiply$1=(..._)=>`calc(${toExpression("*",..._)})`,divide$1=(..._)=>`calc(${toExpression("/",..._)})`,negate$1=_=>{const a=resolveReference(_);return a!=null&&!Number.isNaN(parseFloat(a))?String(a).startsWith("-")?String(a).slice(1):`-${a}`:multiply$1(a,-1)},calc$1=Object.assign(_=>({add:(...a)=>calc$1(add$1(_,...a)),subtract:(...a)=>calc$1(subtract$1(_,...a)),multiply:(...a)=>calc$1(multiply$1(_,...a)),divide:(...a)=>calc$1(divide$1(_,...a)),negate:()=>calc$1(negate$1(_)),toString:()=>_.toString()}),{add:add$1,subtract:subtract$1,multiply:multiply$1,divide:divide$1,negate:negate$1});function replaceWhiteSpace$1(_,a="-"){return _.replace(/\s+/g,a)}function escape$2(_){const a=replaceWhiteSpace$1(_.toString());return escapeSymbol(escapeDot(a))}function escapeDot(_){return _.includes("\\.")?_:!Number.isInteger(parseFloat(_.toString()))?_.replace(".","\\."):_}function escapeSymbol(_){return _.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function addPrefix$1(_,a=""){return[a,_].filter(Boolean).join("-")}function toVarReference(_,a){return`var(${_}${a?`, ${a}`:""})`}function toVarDefinition(_,a=""){return escape$2(`--${addPrefix$1(_,a)}`)}function cssVar$1(_,a,$){const j=toVarDefinition(_,$);return{variable:j,reference:toVarReference(j,a)}}function defineCssVars(_,a){const $={};for(const j of a){if(Array.isArray(j)){const[et,tt]=j;$[et]=cssVar$1(`${_}-${et}`,tt);continue}$[j]=cssVar$1(`${_}-${j}`)}return $}function getLastItem(_){const a=_==null?0:_.length;return a?_[a-1]:void 0}function analyzeCSSValue2(_){const a=parseFloat(_.toString()),$=_.toString().replace(String(a),"");return{unitless:!$,value:a,unit:$}}function px$1(_){if(_==null)return _;const{unitless:a}=analyzeCSSValue2(_);return a||typeof _=="number"?`${_}px`:_}var sortByBreakpointValue=(_,a)=>parseInt(_[1],10)>parseInt(a[1],10)?1:-1,sortBps=_=>Object.fromEntries(Object.entries(_).sort(sortByBreakpointValue));function normalize$1(_){const a=sortBps(_);return Object.assign(Object.values(a),a)}function keys$1(_){const a=Object.keys(sortBps(_));return new Set(a)}function subtract2(_){var a;if(!_)return _;_=(a=px$1(_))!=null?a:_;const $=-.02;return typeof _=="number"?`${_+$}`:_.replace(/(\d+\.?\d*)/u,j=>`${parseFloat(j)+$}`)}function toMediaQueryString(_,a){const $=["@media screen"];return _&&$.push("and",`(min-width: ${px$1(_)})`),a&&$.push("and",`(max-width: ${px$1(a)})`),$.join(" ")}function analyzeBreakpoints(_){var a;if(!_)return null;_.base=(a=_.base)!=null?a:"0px";const $=normalize$1(_),j=Object.entries(_).sort(sortByBreakpointValue).map(([rt,nt],it,ot)=>{var st;let[,at]=(st=ot[it+1])!=null?st:[];return at=parseFloat(at)>0?subtract2(at):void 0,{_minW:subtract2(nt),breakpoint:rt,minW:nt,maxW:at,maxWQuery:toMediaQueryString(null,at),minWQuery:toMediaQueryString(nt),minMaxQuery:toMediaQueryString(nt,at)}}),et=keys$1(_),tt=Array.from(et.values());return{keys:et,normalized:$,isResponsive(rt){const nt=Object.keys(rt);return nt.length>0&&nt.every(it=>et.has(it))},asObject:sortBps(_),asArray:normalize$1(_),details:j,get(rt){return j.find(nt=>nt.breakpoint===rt)},media:[null,...$.map(rt=>toMediaQueryString(rt)).slice(1)],toArrayValue(rt){if(!isObject$5(rt))throw new Error("toArrayValue: value must be an object");const nt=tt.map(it=>{var ot;return(ot=rt[it])!=null?ot:null});for(;getLastItem(nt)===null;)nt.pop();return nt},toObjectValue(rt){if(!Array.isArray(rt))throw new Error("toObjectValue: value must be an array");return rt.reduce((nt,it,ot)=>{const st=tt[ot];return st!=null&&it!=null&&(nt[st]=it),nt},{})}}}var state$1={hover:(_,a)=>`${_}:hover ${a}, ${_}[data-hover] ${a}`,focus:(_,a)=>`${_}:focus ${a}, ${_}[data-focus] ${a}`,focusVisible:(_,a)=>`${_}:focus-visible ${a}`,focusWithin:(_,a)=>`${_}:focus-within ${a}`,active:(_,a)=>`${_}:active ${a}, ${_}[data-active] ${a}`,disabled:(_,a)=>`${_}:disabled ${a}, ${_}[data-disabled] ${a}`,invalid:(_,a)=>`${_}:invalid ${a}, ${_}[data-invalid] ${a}`,checked:(_,a)=>`${_}:checked ${a}, ${_}[data-checked] ${a}`,indeterminate:(_,a)=>`${_}:indeterminate ${a}, ${_}[aria-checked=mixed] ${a}, ${_}[data-indeterminate] ${a}`,readOnly:(_,a)=>`${_}:read-only ${a}, ${_}[readonly] ${a}, ${_}[data-read-only] ${a}`,expanded:(_,a)=>`${_}:read-only ${a}, ${_}[aria-expanded=true] ${a}, ${_}[data-expanded] ${a}`,placeholderShown:(_,a)=>`${_}:placeholder-shown ${a}`},toGroup=_=>merge$2(a=>_(a,"&"),"[role=group]","[data-group]",".group"),toPeer=_=>merge$2(a=>_(a,"~ &"),"[data-peer]",".peer"),merge$2=(_,...a)=>a.map(_).join(", "),pseudoSelectors={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:toGroup(state$1.hover),_peerHover:toPeer(state$1.hover),_groupFocus:toGroup(state$1.focus),_peerFocus:toPeer(state$1.focus),_groupFocusVisible:toGroup(state$1.focusVisible),_peerFocusVisible:toPeer(state$1.focusVisible),_groupActive:toGroup(state$1.active),_peerActive:toPeer(state$1.active),_groupDisabled:toGroup(state$1.disabled),_peerDisabled:toPeer(state$1.disabled),_groupInvalid:toGroup(state$1.invalid),_peerInvalid:toPeer(state$1.invalid),_groupChecked:toGroup(state$1.checked),_peerChecked:toPeer(state$1.checked),_groupFocusWithin:toGroup(state$1.focusWithin),_peerFocusWithin:toPeer(state$1.focusWithin),_peerPlaceholderShown:toPeer(state$1.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},pseudoPropNames=Object.keys(pseudoSelectors);function tokenToCssVar(_,a){return cssVar$1(String(_).replace(/\./g,"-"),void 0,a)}function createThemeVars(_,a){let $={};const j={};for(const[et,tt]of Object.entries(_)){const{isSemantic:rt,value:nt}=tt,{variable:it,reference:ot}=tokenToCssVar(et,a==null?void 0:a.cssVarPrefix);if(!rt){if(et.startsWith("space")){const ut=et.split("."),[ht,...bt]=ut,Et=`${ht}.-${bt.join(".")}`,Ct=calc$1.negate(nt),Pt=calc$1.negate(ot);j[Et]={value:Ct,var:it,varRef:Pt}}$[it]=nt,j[et]={value:nt,var:it,varRef:ot};continue}const st=ut=>{const bt=[String(et).split(".")[0],ut].join(".");if(!_[bt])return ut;const{reference:Ct}=tokenToCssVar(bt,a==null?void 0:a.cssVarPrefix);return Ct},at=isObject$5(nt)?nt:{default:nt};$=mergeWith($,Object.entries(at).reduce((ut,[ht,bt])=>{var Et,Ct;if(!bt)return ut;const Pt=st(`${bt}`);if(ht==="default")return ut[it]=Pt,ut;const Tt=(Ct=(Et=pseudoSelectors)==null?void 0:Et[ht])!=null?Ct:ht;return ut[Tt]={[it]:Pt},ut},{})),j[et]={value:ot,var:it,varRef:ot}}return{cssVars:$,cssMap:j}}function omit$6(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}function pick$2(_,a){const $={};for(const j of a)j in _&&($[j]=_[j]);return $}function isObject5(_){return typeof _=="object"&&_!=null&&!Array.isArray(_)}function walkObject(_,a,$={}){const{stop:j,getKey:et}=$;function tt(rt,nt=[]){var it;if(isObject5(rt)||Array.isArray(rt)){const ot={};for(const[st,at]of Object.entries(rt)){const ut=(it=et==null?void 0:et(st))!=null?it:st,ht=[...nt,ut];if(j!=null&&j(rt,ht))return a(rt,nt);ot[ut]=tt(at,ht)}return ot}return a(rt,nt)}return tt(_)}var tokens$1=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function extractTokens(_){return pick$2(_,tokens$1)}function extractSemanticTokens(_){return _.semanticTokens}function omitVars(_){const{__cssMap:a,__cssVars:$,__breakpoints:j,...et}=_;return et}var isSemanticCondition=_=>pseudoPropNames.includes(_)||_==="default";function flattenTokens({tokens:_,semanticTokens:a}){const $={};return walkObject(_,(j,et)=>{j!=null&&($[et.join(".")]={isSemantic:!1,value:j})}),walkObject(a,(j,et)=>{j!=null&&($[et.join(".")]={isSemantic:!0,value:j})},{stop:j=>Object.keys(j).every(isSemanticCondition)}),$}function toCSSVar(_){var a;const $=omitVars(_),j=extractTokens($),et=extractSemanticTokens($),tt=flattenTokens({tokens:j,semanticTokens:et}),rt=(a=$.config)==null?void 0:a.cssVarPrefix,{cssMap:nt,cssVars:it}=createThemeVars(tt,{cssVarPrefix:rt});return Object.assign($,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...it},__cssMap:nt,__breakpoints:analyzeBreakpoints($.breakpoints)}),$}var systemProps=mergeWith({},background,border,color$2,flexbox,layout$1,filter$2,ring,interactivity,grid,others,position,effect$3,space,scroll,typography$1,textDecoration,transform,list,transition$1),layoutSystem=Object.assign({},space,layout$1,flexbox,grid,position),layoutPropNames=Object.keys(layoutSystem),propNames=[...Object.keys(systemProps),...pseudoPropNames],styleProps={...systemProps,...pseudoSelectors},isStyleProp=_=>_ in styleProps,expandResponsive=_=>a=>{if(!a.__breakpoints)return _;const{isResponsive:$,toArrayValue:j,media:et}=a.__breakpoints,tt={};for(const rt in _){let nt=runIfFn$2(_[rt],a);if(nt==null)continue;if(nt=isObject$5(nt)&&$(nt)?j(nt):nt,!Array.isArray(nt)){tt[rt]=nt;continue}const it=nt.slice(0,et.length).length;for(let ot=0;ot_.startsWith("--")&&typeof a=="string"&&!isCssVar2(a),resolveTokenValue=(_,a)=>{var $,j;if(a==null)return a;const et=it=>{var ot,st;return(st=(ot=_.__cssMap)==null?void 0:ot[it])==null?void 0:st.varRef},tt=it=>{var ot;return(ot=et(it))!=null?ot:it},[rt,nt]=splitByComma(a);return a=(j=($=et(rt))!=null?$:tt(nt))!=null?j:tt(a),a};function getCss(_){const{configs:a={},pseudos:$={},theme:j}=_,et=(tt,rt=!1)=>{var nt,it,ot;const st=runIfFn$2(tt,j),at=expandResponsive(st)(j);let ut={};for(let ht in at){const bt=at[ht];let Et=runIfFn$2(bt,j);ht in $&&(ht=$[ht]),isCSSVariableTokenValue(ht,Et)&&(Et=resolveTokenValue(j,Et));let Ct=a[ht];if(Ct===!0&&(Ct={property:ht}),isObject$5(Et)){ut[ht]=(nt=ut[ht])!=null?nt:{},ut[ht]=mergeWith({},ut[ht],et(Et,!0));continue}let Pt=(ot=(it=Ct==null?void 0:Ct.transform)==null?void 0:it.call(Ct,Et,j,st))!=null?ot:Et;Pt=Ct!=null&&Ct.processResult?et(Pt,!0):Pt;const Tt=runIfFn$2(Ct==null?void 0:Ct.property,j);if(!rt&&(Ct!=null&&Ct.static)){const It=runIfFn$2(Ct.static,j);ut=mergeWith({},ut,It)}if(Tt&&Array.isArray(Tt)){for(const It of Tt)ut[It]=Pt;continue}if(Tt){Tt==="&"&&isObject$5(Pt)?ut=mergeWith({},ut,Pt):ut[Tt]=Pt;continue}if(isObject$5(Pt)){ut=mergeWith({},ut,Pt);continue}ut[ht]=Pt}return ut};return et}var css=_=>a=>getCss({theme:a,pseudos:pseudoSelectors,configs:systemProps})(_);function defineStyle(_){return _}function defineStyleConfig(_){return _}function createMultiStyleConfigHelpers(_){return{definePartsStyle(a){return a},defineMultiStyleConfig(a){return{parts:_,...a}}}}function normalize2(_,a){if(Array.isArray(_))return _;if(isObject$5(_))return a(_);if(_!=null)return[_]}function getNextIndex$1(_,a){for(let $=a+1;$<_.length;$++)if(_[$]!=null)return $;return-1}function createResolver(_){const a=_.__breakpoints;return function(j,et,tt,rt){var nt,it;if(!a)return;const ot={},st=normalize2(tt,a.toArrayValue);if(!st)return ot;const at=st.length,ut=at===1,ht=!!j.parts;for(let bt=0;bt{mergeWith(ot,{[It]:ut?Tt[It]:{[Pt]:Tt[It]}})});continue}if(!ht){ut?mergeWith(ot,Tt):ot[Pt]=Tt;continue}ot[Pt]=Tt}}return ot}}function resolveStyleConfig(_){return a=>{var $;const{variant:j,size:et,theme:tt}=a,rt=createResolver(tt);return mergeWith({},runIfFn$2(($=_.baseStyle)!=null?$:{},a),rt(_,"sizes",et,a),rt(_,"variants",j,a))}}function getCSSVar(_,a,$){var j,et,tt;return(tt=(et=(j=_.__cssMap)==null?void 0:j[`${a}.${$}`])==null?void 0:et.varRef)!=null?tt:$}function omitThemingProps(_){return omit$6(_,["styleConfig","size","variant","colorScheme"])}var requiredChakraThemeKeys=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function isChakraTheme(_){return isObject$5(_)?requiredChakraThemeKeys.every(a=>Object.prototype.hasOwnProperty.call(_,a)):!1}var transitionProperty={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},transitionTimingFunction={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},transitionDuration={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},transition={property:transitionProperty,easing:transitionTimingFunction,duration:transitionDuration},transition_default=transition,zIndices={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},z_index_default=zIndices,borders$1={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},borders_default=borders$1,breakpoints={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},breakpoints_default=breakpoints,colors$1={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},colors_default=colors$1,radii={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},radius_default=radii,shadows={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},shadows_default=shadows,blur={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},blur_default=blur,typography={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},typography_default=typography,spacing={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},largeSizes={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},container={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},sizes$o={...spacing,...largeSizes,container},sizes_default=sizes$o,foundations={breakpoints:breakpoints_default,zIndices:z_index_default,radii:radius_default,blur:blur_default,colors:colors_default,...typography_default,sizes:sizes_default,shadows:shadows_default,space:spacing,borders:borders_default,transition:transition_default},{defineMultiStyleConfig:defineMultiStyleConfig$w,definePartsStyle:definePartsStyle$w}=createMultiStyleConfigHelpers(["stepper","step","title","description","indicator","separator","icon","number"]),$size$4=cssVar$1("stepper-indicator-size"),$iconSize=cssVar$1("stepper-icon-size"),$titleFontSize=cssVar$1("stepper-title-font-size"),$descFontSize=cssVar$1("stepper-description-font-size"),$accentColor=cssVar$1("stepper-accent-color"),baseStyle$J=definePartsStyle$w(({colorScheme:_})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[$accentColor.variable]:`colors.${_}.500`,_dark:{[$accentColor.variable]:`colors.${_}.200`}},title:{fontSize:$titleFontSize.reference,fontWeight:"medium"},description:{fontSize:$descFontSize.reference,color:"chakra-subtle-text"},number:{fontSize:$titleFontSize.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:$iconSize.reference,height:$iconSize.reference},indicator:{flexShrink:0,borderRadius:"full",width:$size$4.reference,height:$size$4.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:$accentColor.reference},"&[data-status=complete]":{bg:$accentColor.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:$accentColor.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${$size$4.reference} - 8px)`,top:`calc(${$size$4.reference} + 4px)`,insetStart:`calc(${$size$4.reference} / 2 - 1px)`}}})),stepperTheme=defineMultiStyleConfig$w({baseStyle:baseStyle$J,sizes:{xs:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.4",[$iconSize.variable]:"sizes.3",[$titleFontSize.variable]:"fontSizes.xs",[$descFontSize.variable]:"fontSizes.xs"}}),sm:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.6",[$iconSize.variable]:"sizes.4",[$titleFontSize.variable]:"fontSizes.sm",[$descFontSize.variable]:"fontSizes.xs"}}),md:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.8",[$iconSize.variable]:"sizes.5",[$titleFontSize.variable]:"fontSizes.md",[$descFontSize.variable]:"fontSizes.sm"}}),lg:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.10",[$iconSize.variable]:"sizes.6",[$titleFontSize.variable]:"fontSizes.lg",[$descFontSize.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function anatomy(_,a={}){let $=!1;function j(){if(!$){$=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function et(...st){j();for(const at of st)a[at]=it(at);return anatomy(_,a)}function tt(...st){for(const at of st)at in a||(a[at]=it(at));return anatomy(_,a)}function rt(){return Object.fromEntries(Object.entries(a).map(([at,ut])=>[at,ut.selector]))}function nt(){return Object.fromEntries(Object.entries(a).map(([at,ut])=>[at,ut.className]))}function it(st){const ht=`chakra-${(["container","root"].includes(st??"")?[_]:[_,st]).filter(Boolean).join("__")}`;return{className:ht,selector:`.${ht}`,toString:()=>st}}return{parts:et,toPart:it,extend:tt,selectors:rt,classnames:nt,get keys(){return Object.keys(a)},__type:{}}}var accordionAnatomy=anatomy("accordion").parts("root","container","button","panel").extend("icon"),alertAnatomy=anatomy("alert").parts("title","description","container").extend("icon","spinner"),avatarAnatomy=anatomy("avatar").parts("label","badge","container").extend("excessLabel","group"),breadcrumbAnatomy=anatomy("breadcrumb").parts("link","item","container").extend("separator");anatomy("button").parts();var checkboxAnatomy=anatomy("checkbox").parts("control","icon","container").extend("label");anatomy("progress").parts("track","filledTrack").extend("label");var drawerAnatomy=anatomy("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),editableAnatomy=anatomy("editable").parts("preview","input","textarea"),formAnatomy=anatomy("form").parts("container","requiredIndicator","helperText"),formErrorAnatomy=anatomy("formError").parts("text","icon"),inputAnatomy=anatomy("input").parts("addon","field","element","group"),listAnatomy=anatomy("list").parts("container","item","icon"),menuAnatomy=anatomy("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),modalAnatomy=anatomy("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),numberInputAnatomy=anatomy("numberinput").parts("root","field","stepperGroup","stepper");anatomy("pininput").parts("field");var popoverAnatomy=anatomy("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),progressAnatomy=anatomy("progress").parts("label","filledTrack","track"),radioAnatomy=anatomy("radio").parts("container","control","label"),selectAnatomy=anatomy("select").parts("field","icon"),sliderAnatomy=anatomy("slider").parts("container","track","thumb","filledTrack","mark"),statAnatomy=anatomy("stat").parts("container","label","helpText","number","icon"),switchAnatomy=anatomy("switch").parts("container","track","thumb","label"),tableAnatomy=anatomy("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),tabsAnatomy=anatomy("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),tagAnatomy=anatomy("tag").parts("container","label","closeButton"),cardAnatomy=anatomy("card").parts("container","header","body","footer");anatomy("stepper").parts("stepper","step","title","description","indicator","separator","icon","number");function guard(_,a,$){return Math.min(Math.max(_,$),a)}class ColorError extends Error{constructor(a){super(`Failed to parse color: "${a}"`)}}var ColorError$1=ColorError;function parseToRgba(_){if(typeof _!="string")throw new ColorError$1(_);if(_.trim().toLowerCase()==="transparent")return[0,0,0,0];let a=_.trim();a=namedColorRegex.test(_)?nameToHex(_):_;const $=reducedHexRegex.exec(a);if($){const rt=Array.from($).slice(1);return[...rt.slice(0,3).map(nt=>parseInt(r$3(nt,2),16)),parseInt(r$3(rt[3]||"f",2),16)/255]}const j=hexRegex.exec(a);if(j){const rt=Array.from(j).slice(1);return[...rt.slice(0,3).map(nt=>parseInt(nt,16)),parseInt(rt[3]||"ff",16)/255]}const et=rgbaRegex.exec(a);if(et){const rt=Array.from(et).slice(1);return[...rt.slice(0,3).map(nt=>parseInt(nt,10)),parseFloat(rt[3]||"1")]}const tt=hslaRegex.exec(a);if(tt){const[rt,nt,it,ot]=Array.from(tt).slice(1).map(parseFloat);if(guard(0,100,nt)!==nt)throw new ColorError$1(_);if(guard(0,100,it)!==it)throw new ColorError$1(_);return[...hslToRgb(rt,nt,it),Number.isNaN(ot)?1:ot]}throw new ColorError$1(_)}function hash$b(_){let a=5381,$=_.length;for(;$;)a=a*33^_.charCodeAt(--$);return(a>>>0)%2341}const colorToInt=_=>parseInt(_.replace(/_/g,""),36),compressedColorMap="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((_,a)=>{const $=colorToInt(a.substring(0,3)),j=colorToInt(a.substring(3)).toString(16);let et="";for(let tt=0;tt<6-j.length;tt++)et+="0";return _[$]=`${et}${j}`,_},{});function nameToHex(_){const a=_.toLowerCase().trim(),$=compressedColorMap[hash$b(a)];if(!$)throw new ColorError$1(_);return`#${$}`}const r$3=(_,a)=>Array.from(Array(a)).map(()=>_).join(""),reducedHexRegex=new RegExp(`^#${r$3("([a-f0-9])",3)}([a-f0-9])?$`,"i"),hexRegex=new RegExp(`^#${r$3("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),rgbaRegex=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r$3(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),hslaRegex=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,namedColorRegex=/^[a-z]+$/i,roundColor=_=>Math.round(_*255),hslToRgb=(_,a,$)=>{let j=$/100;if(a===0)return[j,j,j].map(roundColor);const et=(_%360+360)%360/60,tt=(1-Math.abs(2*j-1))*(a/100),rt=tt*(1-Math.abs(et%2-1));let nt=0,it=0,ot=0;et>=0&&et<1?(nt=tt,it=rt):et>=1&&et<2?(nt=rt,it=tt):et>=2&&et<3?(it=tt,ot=rt):et>=3&&et<4?(it=rt,ot=tt):et>=4&&et<5?(nt=rt,ot=tt):et>=5&&et<6&&(nt=tt,ot=rt);const st=j-tt/2,at=nt+st,ut=it+st,ht=ot+st;return[at,ut,ht].map(roundColor)};function rgba$1(_,a,$,j){return`rgba(${guard(0,255,_).toFixed()}, ${guard(0,255,a).toFixed()}, ${guard(0,255,$).toFixed()}, ${parseFloat(guard(0,1,j).toFixed(3))})`}function transparentize$1(_,a){const[$,j,et,tt]=parseToRgba(_);return rgba$1($,j,et,tt-a)}function toHex$3(_){const[a,$,j,et]=parseToRgba(_);let tt=rt=>{const nt=guard(0,255,rt).toString(16);return nt.length===1?`0${nt}`:nt};return`#${tt(a)}${tt($)}${tt(j)}${et<1?tt(Math.round(et*255)):""}`}function dlv_es_default(_,a,$,j,et){for(a=a.split?a.split("."):a,j=0;jObject.keys(_).length===0,getColor=(_,a,$)=>{const j=dlv_es_default(_,`colors.${a}`,a);try{return toHex$3(j),j}catch{return $??"#000000"}},getBrightness=_=>{const[a,$,j]=parseToRgba(_);return(a*299+$*587+j*114)/1e3},tone=_=>a=>{const $=getColor(a,_);return getBrightness($)<128?"dark":"light"},isDark=_=>a=>tone(_)(a)==="dark",transparentize=(_,a)=>$=>{const j=getColor($,_);return transparentize$1(j,1-a)};function generateStripe(_="1rem",a="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + `;return`!${tt?rt:nt}`.trim()}function ColorModeScript(_={}){const{nonce:a}=_;return jsxRuntimeExports.jsx("script",{id:"chakra-script",nonce:a,dangerouslySetInnerHTML:{__html:getScriptSrc(_)}})}function useChakra(){const _=useColorMode(),a=useTheme();return{..._,theme:a}}function getTokenValue(_,a,$){var j,et;if(a==null)return a;const tt=rt=>{var nt,it;return(it=(nt=_.__cssMap)==null?void 0:nt[rt])==null?void 0:it.value};return(et=(j=tt(a))!=null?j:tt($))!=null?et:$}function getToken(_,a,$){const j=Array.isArray(a)?a:[a],et=Array.isArray($)?$:[$];return tt=>{const rt=et.filter(Boolean),nt=j.map((it,at)=>{var st;const ot=`${_}.${it}`;return getTokenValue(tt,ot,(st=rt[at])!=null?st:it)});return Array.isArray(a)?nt:nt[0]}}var cx=(..._)=>_.filter(Boolean).join(" ");function isDev(){return!1}function isObject$5(_){const a=typeof _;return _!=null&&(a==="object"||a==="function")&&!Array.isArray(_)}var warn=_=>{const{condition:a,message:$}=_;a&&isDev()&&console.warn($)};function runIfFn$2(_,...a){return isFunction$8(_)?_(...a):_}var isFunction$8=_=>typeof _=="function",dataAttr=_=>_?"":void 0,ariaAttr=_=>_?!0:void 0;function callAllHandlers$1(..._){return function($){_.some(j=>(j==null||j($),$==null?void 0:$.defaultPrevented))}}function callAll(..._){return function($){_.forEach(j=>{j==null||j($)})}}var lodash_mergewith={exports:{}};lodash_mergewith.exports;(function(_,a){var $=200,j="__lodash_hash_undefined__",et=800,tt=16,rt=9007199254740991,nt="[object Arguments]",it="[object Array]",at="[object AsyncFunction]",st="[object Boolean]",ot="[object Date]",ut="[object Error]",dt="[object Function]",mt="[object GeneratorFunction]",xt="[object Map]",Ct="[object Number]",Pt="[object Null]",Tt="[object Object]",kt="[object Proxy]",Lt="[object RegExp]",Nt="[object Set]",zt="[object String]",jt="[object Undefined]",Mt="[object WeakMap]",Dt="[object ArrayBuffer]",Ft="[object DataView]",Bt="[object Float32Array]",yt="[object Float64Array]",bt="[object Int8Array]",ct="[object Int16Array]",ht="[object Int32Array]",vt="[object Uint8Array]",St="[object Uint8ClampedArray]",Rt="[object Uint16Array]",$t="[object Uint32Array]",Et=/[\\^$.*+?()[\]{}|]/g,At=/^\[object .+?Constructor\]$/,wt=/^(?:0|[1-9]\d*)$/,Ot={};Ot[Bt]=Ot[yt]=Ot[bt]=Ot[ct]=Ot[ht]=Ot[vt]=Ot[St]=Ot[Rt]=Ot[$t]=!0,Ot[nt]=Ot[it]=Ot[Dt]=Ot[st]=Ot[Ft]=Ot[ot]=Ot[ut]=Ot[dt]=Ot[xt]=Ot[Ct]=Ot[Tt]=Ot[Lt]=Ot[Nt]=Ot[zt]=Ot[Mt]=!1;var tr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,nr=typeof self=="object"&&self&&self.Object===Object&&self,ir=tr||nr||Function("return this")(),Wt=a&&!a.nodeType&&a,Kt=Wt&&!0&&_&&!_.nodeType&&_,Jt=Kt&&Kt.exports===Wt,Ht=Jt&&tr.process,Vt=function(){try{var Xt=Kt&&Kt.require&&Kt.require("util").types;return Xt||Ht&&Ht.binding&&Ht.binding("util")}catch{}}(),Qt=Vt&&Vt.isTypedArray;function dr(Xt,cr,gr){switch(gr.length){case 0:return Xt.call(cr);case 1:return Xt.call(cr,gr[0]);case 2:return Xt.call(cr,gr[0],gr[1]);case 3:return Xt.call(cr,gr[0],gr[1],gr[2])}return Xt.apply(cr,gr)}function xr(Xt,cr){for(var gr=-1,Dr=Array(Xt);++gr-1}function Gr(Xt,cr){var gr=this.__data__,Dr=Jn(gr,Xt);return Dr<0?(++this.size,gr.push([Xt,cr])):gr[Dr][1]=cr,this}hn.prototype.clear=fn,hn.prototype.delete=Kr,hn.prototype.get=$n,hn.prototype.has=dn,hn.prototype.set=Gr;function gn(Xt){var cr=-1,gr=Xt==null?0:Xt.length;for(this.clear();++cr1?gr[rn-1]:void 0,Pn=rn>2?gr[2]:void 0;for(xn=Xt.length>3&&typeof xn=="function"?(rn--,xn):void 0,Pn&&Yl(gr[0],gr[1],Pn)&&(xn=rn<3?void 0:xn,rn=1),cr=Object(cr);++Dr-1&&Xt%1==0&&Xt0){if(++cr>=et)return arguments[0]}else cr=0;return Xt.apply(void 0,arguments)}}function Al(Xt){if(Xt!=null){try{return Pr.call(Xt)}catch{}try{return Xt+""}catch{}}return""}function Xs(Xt,cr){return Xt===cr||Xt!==Xt&&cr!==cr}var Eo=es(function(){return arguments}())?es:function(Xt){return Ms(Xt)&&Rr.call(Xt,"callee")&&!or.call(Xt,"callee")},Ls=Array.isArray;function so(Xt){return Xt!=null&&_o(Xt.length)&&!wo(Xt)}function Pl(Xt){return Ms(Xt)&&so(Xt)}var ao=Wr||_r;function wo(Xt){if(!Ts(Xt))return!1;var cr=Qn(Xt);return cr==dt||cr==mt||cr==at||cr==kt}function _o(Xt){return typeof Xt=="number"&&Xt>-1&&Xt%1==0&&Xt<=rt}function Ts(Xt){var cr=typeof Xt;return Xt!=null&&(cr=="object"||cr=="function")}function Ms(Xt){return Xt!=null&&typeof Xt=="object"}function Tl(Xt){if(!Ms(Xt)||Qn(Xt)!=Tt)return!1;var cr=qt(Xt);if(cr===null)return!0;var gr=Rr.call(cr,"constructor")&&cr.constructor;return typeof gr=="function"&&gr instanceof gr&&Pr.call(gr)==Lr}var Io=Qt?pr(Qt):us;function So(Xt){return vo(Xt,ko(Xt))}function ko(Xt){return so(Xt)?ps(Xt):Wn(Xt)}var Xl=Ho(function(Xt,cr,gr,Dr){os(Xt,cr,gr,Dr)});function rs(Xt){return function(){return Xt}}function Xn(Xt){return Xt}function _r(){return!1}_.exports=Xl})(lodash_mergewith,lodash_mergewith.exports);var lodash_mergewithExports=lodash_mergewith.exports;const mergeWith=getDefaultExportFromCjs$1(lodash_mergewithExports);var isImportant=_=>/!(important)?$/.test(_),withoutImportant=_=>typeof _=="string"?_.replace(/!(important)?$/,"").trim():_,tokenToCSSVar=(_,a)=>$=>{const j=String(a),et=isImportant(j),tt=withoutImportant(j),rt=_?`${_}.${tt}`:tt;let nt=isObject$5($.__cssMap)&&rt in $.__cssMap?$.__cssMap[rt].varRef:a;return nt=withoutImportant(nt),et?`${nt} !important`:nt};function createTransform(_){const{scale:a,transform:$,compose:j}=_;return(tt,rt)=>{var nt;const it=tokenToCSSVar(a,tt)(rt);let at=(nt=$==null?void 0:$(it,rt))!=null?nt:it;return j&&(at=j(at,rt)),at}}var pipe$3=(..._)=>a=>_.reduce(($,j)=>j($),a);function toConfig(_,a){return $=>{const j={property:$,scale:_};return j.transform=createTransform({scale:_,transform:a}),j}}var getRtl=({rtl:_,ltr:a})=>$=>$.direction==="rtl"?_:a;function logical(_){const{property:a,scale:$,transform:j}=_;return{scale:$,property:getRtl(a),transform:$?createTransform({scale:$,compose:j}):j}}var transformTemplate=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function getTransformTemplate(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...transformTemplate].join(" ")}function getTransformGpuTemplate(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...transformTemplate].join(" ")}var filterTemplate={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},backdropFilterTemplate={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function getRingTemplate(_){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":_,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var flexDirectionTemplate={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},directionMap={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},valueSet=new Set(Object.values(directionMap)),globalSet=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),trimSpace=_=>_.trim();function parseGradient(_,a){if(_==null||globalSet.has(_))return _;if(!(isCSSFunction(_)||globalSet.has(_)))return`url('${_}')`;const et=/(^[a-z-A-Z]+)\((.*)\)/g.exec(_),tt=et==null?void 0:et[1],rt=et==null?void 0:et[2];if(!tt||!rt)return _;const nt=tt.includes("-gradient")?tt:`${tt}-gradient`,[it,...at]=rt.split(",").map(trimSpace).filter(Boolean);if((at==null?void 0:at.length)===0)return _;const st=it in directionMap?directionMap[it]:it;at.unshift(st);const ot=at.map(ut=>{if(valueSet.has(ut))return ut;const dt=ut.indexOf(" "),[mt,xt]=dt!==-1?[ut.substr(0,dt),ut.substr(dt+1)]:[ut],Ct=isCSSFunction(xt)?xt:xt&&xt.split(" "),Pt=`colors.${mt}`,Tt=Pt in a.__cssMap?a.__cssMap[Pt].varRef:mt;return Ct?[Tt,...Array.isArray(Ct)?Ct:[Ct]].join(" "):Tt});return`${nt}(${ot.join(", ")})`}var isCSSFunction=_=>typeof _=="string"&&_.includes("(")&&_.includes(")"),gradientTransform=(_,a)=>parseGradient(_,a??{});function isCssVar(_){return/^var\(--.+\)$/.test(_)}var analyzeCSSValue=_=>{const a=parseFloat(_.toString()),$=_.toString().replace(String(a),"");return{unitless:!$,value:a,unit:$}},wrap=_=>a=>`${_}(${a})`,transformFunctions={filter(_){return _!=="auto"?_:filterTemplate},backdropFilter(_){return _!=="auto"?_:backdropFilterTemplate},ring(_){return getRingTemplate(transformFunctions.px(_))},bgClip(_){return _==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:_}},transform(_){return _==="auto"?getTransformTemplate():_==="auto-gpu"?getTransformGpuTemplate():_},vh(_){return _==="$100vh"?"var(--chakra-vh)":_},px(_){if(_==null)return _;const{unitless:a}=analyzeCSSValue(_);return a||typeof _=="number"?`${_}px`:_},fraction(_){return typeof _!="number"||_>1?_:`${_*100}%`},float(_,a){const $={left:"right",right:"left"};return a.direction==="rtl"?$[_]:_},degree(_){if(isCssVar(_)||_==null)return _;const a=typeof _=="string"&&!_.endsWith("deg");return typeof _=="number"||a?`${_}deg`:_},gradient:gradientTransform,blur:wrap("blur"),opacity:wrap("opacity"),brightness:wrap("brightness"),contrast:wrap("contrast"),dropShadow:wrap("drop-shadow"),grayscale:wrap("grayscale"),hueRotate:_=>wrap("hue-rotate")(transformFunctions.degree(_)),invert:wrap("invert"),saturate:wrap("saturate"),sepia:wrap("sepia"),bgImage(_){return _==null||isCSSFunction(_)||globalSet.has(_)?_:`url(${_})`},outline(_){const a=String(_)==="0"||String(_)==="none";return _!==null&&a?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:_}},flexDirection(_){var a;const{space:$,divide:j}=(a=flexDirectionTemplate[_])!=null?a:{},et={flexDirection:_};return $&&(et[$]=1),j&&(et[j]=1),et}},t$5={borderWidths:toConfig("borderWidths"),borderStyles:toConfig("borderStyles"),colors:toConfig("colors"),borders:toConfig("borders"),gradients:toConfig("gradients",transformFunctions.gradient),radii:toConfig("radii",transformFunctions.px),space:toConfig("space",pipe$3(transformFunctions.vh,transformFunctions.px)),spaceT:toConfig("space",pipe$3(transformFunctions.vh,transformFunctions.px)),degreeT(_){return{property:_,transform:transformFunctions.degree}},prop(_,a,$){return{property:_,scale:a,...a&&{transform:createTransform({scale:a,transform:$})}}},propT(_,a){return{property:_,transform:a}},sizes:toConfig("sizes",pipe$3(transformFunctions.vh,transformFunctions.px)),sizesT:toConfig("sizes",pipe$3(transformFunctions.vh,transformFunctions.fraction)),shadows:toConfig("shadows"),logical,blur:toConfig("blur",transformFunctions.blur)},background={background:t$5.colors("background"),backgroundColor:t$5.colors("backgroundColor"),backgroundImage:t$5.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:transformFunctions.bgClip},bgSize:t$5.prop("backgroundSize"),bgPosition:t$5.prop("backgroundPosition"),bg:t$5.colors("background"),bgColor:t$5.colors("backgroundColor"),bgPos:t$5.prop("backgroundPosition"),bgRepeat:t$5.prop("backgroundRepeat"),bgAttachment:t$5.prop("backgroundAttachment"),bgGradient:t$5.gradients("backgroundImage"),bgClip:{transform:transformFunctions.bgClip}};Object.assign(background,{bgImage:background.backgroundImage,bgImg:background.backgroundImage});var border={border:t$5.borders("border"),borderWidth:t$5.borderWidths("borderWidth"),borderStyle:t$5.borderStyles("borderStyle"),borderColor:t$5.colors("borderColor"),borderRadius:t$5.radii("borderRadius"),borderTop:t$5.borders("borderTop"),borderBlockStart:t$5.borders("borderBlockStart"),borderTopLeftRadius:t$5.radii("borderTopLeftRadius"),borderStartStartRadius:t$5.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:t$5.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:t$5.radii("borderTopRightRadius"),borderStartEndRadius:t$5.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:t$5.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:t$5.borders("borderRight"),borderInlineEnd:t$5.borders("borderInlineEnd"),borderBottom:t$5.borders("borderBottom"),borderBlockEnd:t$5.borders("borderBlockEnd"),borderBottomLeftRadius:t$5.radii("borderBottomLeftRadius"),borderBottomRightRadius:t$5.radii("borderBottomRightRadius"),borderLeft:t$5.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:t$5.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:t$5.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:t$5.borders(["borderLeft","borderRight"]),borderInline:t$5.borders("borderInline"),borderY:t$5.borders(["borderTop","borderBottom"]),borderBlock:t$5.borders("borderBlock"),borderTopWidth:t$5.borderWidths("borderTopWidth"),borderBlockStartWidth:t$5.borderWidths("borderBlockStartWidth"),borderTopColor:t$5.colors("borderTopColor"),borderBlockStartColor:t$5.colors("borderBlockStartColor"),borderTopStyle:t$5.borderStyles("borderTopStyle"),borderBlockStartStyle:t$5.borderStyles("borderBlockStartStyle"),borderBottomWidth:t$5.borderWidths("borderBottomWidth"),borderBlockEndWidth:t$5.borderWidths("borderBlockEndWidth"),borderBottomColor:t$5.colors("borderBottomColor"),borderBlockEndColor:t$5.colors("borderBlockEndColor"),borderBottomStyle:t$5.borderStyles("borderBottomStyle"),borderBlockEndStyle:t$5.borderStyles("borderBlockEndStyle"),borderLeftWidth:t$5.borderWidths("borderLeftWidth"),borderInlineStartWidth:t$5.borderWidths("borderInlineStartWidth"),borderLeftColor:t$5.colors("borderLeftColor"),borderInlineStartColor:t$5.colors("borderInlineStartColor"),borderLeftStyle:t$5.borderStyles("borderLeftStyle"),borderInlineStartStyle:t$5.borderStyles("borderInlineStartStyle"),borderRightWidth:t$5.borderWidths("borderRightWidth"),borderInlineEndWidth:t$5.borderWidths("borderInlineEndWidth"),borderRightColor:t$5.colors("borderRightColor"),borderInlineEndColor:t$5.colors("borderInlineEndColor"),borderRightStyle:t$5.borderStyles("borderRightStyle"),borderInlineEndStyle:t$5.borderStyles("borderInlineEndStyle"),borderTopRadius:t$5.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:t$5.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:t$5.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:t$5.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(border,{rounded:border.borderRadius,roundedTop:border.borderTopRadius,roundedTopLeft:border.borderTopLeftRadius,roundedTopRight:border.borderTopRightRadius,roundedTopStart:border.borderStartStartRadius,roundedTopEnd:border.borderStartEndRadius,roundedBottom:border.borderBottomRadius,roundedBottomLeft:border.borderBottomLeftRadius,roundedBottomRight:border.borderBottomRightRadius,roundedBottomStart:border.borderEndStartRadius,roundedBottomEnd:border.borderEndEndRadius,roundedLeft:border.borderLeftRadius,roundedRight:border.borderRightRadius,roundedStart:border.borderInlineStartRadius,roundedEnd:border.borderInlineEndRadius,borderStart:border.borderInlineStart,borderEnd:border.borderInlineEnd,borderTopStartRadius:border.borderStartStartRadius,borderTopEndRadius:border.borderStartEndRadius,borderBottomStartRadius:border.borderEndStartRadius,borderBottomEndRadius:border.borderEndEndRadius,borderStartRadius:border.borderInlineStartRadius,borderEndRadius:border.borderInlineEndRadius,borderStartWidth:border.borderInlineStartWidth,borderEndWidth:border.borderInlineEndWidth,borderStartColor:border.borderInlineStartColor,borderEndColor:border.borderInlineEndColor,borderStartStyle:border.borderInlineStartStyle,borderEndStyle:border.borderInlineEndStyle});var color$2={color:t$5.colors("color"),textColor:t$5.colors("color"),fill:t$5.colors("fill"),stroke:t$5.colors("stroke")},effect$3={boxShadow:t$5.shadows("boxShadow"),mixBlendMode:!0,blendMode:t$5.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:t$5.prop("backgroundBlendMode"),opacity:!0};Object.assign(effect$3,{shadow:effect$3.boxShadow});var filter$2={filter:{transform:transformFunctions.filter},blur:t$5.blur("--chakra-blur"),brightness:t$5.propT("--chakra-brightness",transformFunctions.brightness),contrast:t$5.propT("--chakra-contrast",transformFunctions.contrast),hueRotate:t$5.propT("--chakra-hue-rotate",transformFunctions.hueRotate),invert:t$5.propT("--chakra-invert",transformFunctions.invert),saturate:t$5.propT("--chakra-saturate",transformFunctions.saturate),dropShadow:t$5.propT("--chakra-drop-shadow",transformFunctions.dropShadow),backdropFilter:{transform:transformFunctions.backdropFilter},backdropBlur:t$5.blur("--chakra-backdrop-blur"),backdropBrightness:t$5.propT("--chakra-backdrop-brightness",transformFunctions.brightness),backdropContrast:t$5.propT("--chakra-backdrop-contrast",transformFunctions.contrast),backdropHueRotate:t$5.propT("--chakra-backdrop-hue-rotate",transformFunctions.hueRotate),backdropInvert:t$5.propT("--chakra-backdrop-invert",transformFunctions.invert),backdropSaturate:t$5.propT("--chakra-backdrop-saturate",transformFunctions.saturate)},flexbox={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:transformFunctions.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:t$5.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:t$5.space("gap"),rowGap:t$5.space("rowGap"),columnGap:t$5.space("columnGap")};Object.assign(flexbox,{flexDir:flexbox.flexDirection});var grid={gridGap:t$5.space("gridGap"),gridColumnGap:t$5.space("gridColumnGap"),gridRowGap:t$5.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},interactivity={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:transformFunctions.outline},outlineOffset:!0,outlineColor:t$5.colors("outlineColor")},layout$1={width:t$5.sizesT("width"),inlineSize:t$5.sizesT("inlineSize"),height:t$5.sizes("height"),blockSize:t$5.sizes("blockSize"),boxSize:t$5.sizes(["width","height"]),minWidth:t$5.sizes("minWidth"),minInlineSize:t$5.sizes("minInlineSize"),minHeight:t$5.sizes("minHeight"),minBlockSize:t$5.sizes("minBlockSize"),maxWidth:t$5.sizes("maxWidth"),maxInlineSize:t$5.sizes("maxInlineSize"),maxHeight:t$5.sizes("maxHeight"),maxBlockSize:t$5.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(_,a)=>{var $,j,et;return{[`@media screen and (min-width: ${(et=(j=($=a.__breakpoints)==null?void 0:$.get(_))==null?void 0:j.minW)!=null?et:_})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(_,a)=>{var $,j,et;return{[`@media screen and (max-width: ${(et=(j=($=a.__breakpoints)==null?void 0:$.get(_))==null?void 0:j._minW)!=null?et:_})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:t$5.propT("float",transformFunctions.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(layout$1,{w:layout$1.width,h:layout$1.height,minW:layout$1.minWidth,maxW:layout$1.maxWidth,minH:layout$1.minHeight,maxH:layout$1.maxHeight,overscroll:layout$1.overscrollBehavior,overscrollX:layout$1.overscrollBehaviorX,overscrollY:layout$1.overscrollBehaviorY});var list={listStyleType:!0,listStylePosition:!0,listStylePos:t$5.prop("listStylePosition"),listStyleImage:!0,listStyleImg:t$5.prop("listStyleImage")};function get$6(_,a,$,j){const et=typeof a=="string"?a.split("."):[a];for(j=0;j{const a=new WeakMap;return(j,et,tt,rt)=>{if(typeof j>"u")return _(j,et,tt);a.has(j)||a.set(j,new Map);const nt=a.get(j);if(nt.has(et))return nt.get(et);const it=_(j,et,tt,rt);return nt.set(et,it),it}},memoizedGet$1=memoize$1(get$6),srOnly={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},srFocusable={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},getWithPriority=(_,a,$)=>{const j={},et=memoizedGet$1(_,a,{});for(const tt in et)tt in $&&$[tt]!=null||(j[tt]=et[tt]);return j},others={srOnly:{transform(_){return _===!0?srOnly:_==="focusable"?srFocusable:{}}},layerStyle:{processResult:!0,transform:(_,a,$)=>getWithPriority(a,`layerStyles.${_}`,$)},textStyle:{processResult:!0,transform:(_,a,$)=>getWithPriority(a,`textStyles.${_}`,$)},apply:{processResult:!0,transform:(_,a,$)=>getWithPriority(a,_,$)}},position={position:!0,pos:t$5.prop("position"),zIndex:t$5.prop("zIndex","zIndices"),inset:t$5.spaceT("inset"),insetX:t$5.spaceT(["left","right"]),insetInline:t$5.spaceT("insetInline"),insetY:t$5.spaceT(["top","bottom"]),insetBlock:t$5.spaceT("insetBlock"),top:t$5.spaceT("top"),insetBlockStart:t$5.spaceT("insetBlockStart"),bottom:t$5.spaceT("bottom"),insetBlockEnd:t$5.spaceT("insetBlockEnd"),left:t$5.spaceT("left"),insetInlineStart:t$5.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:t$5.spaceT("right"),insetInlineEnd:t$5.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(position,{insetStart:position.insetInlineStart,insetEnd:position.insetInlineEnd});var ring={ring:{transform:transformFunctions.ring},ringColor:t$5.colors("--chakra-ring-color"),ringOffset:t$5.prop("--chakra-ring-offset-width"),ringOffsetColor:t$5.colors("--chakra-ring-offset-color"),ringInset:t$5.prop("--chakra-ring-inset")},space={margin:t$5.spaceT("margin"),marginTop:t$5.spaceT("marginTop"),marginBlockStart:t$5.spaceT("marginBlockStart"),marginRight:t$5.spaceT("marginRight"),marginInlineEnd:t$5.spaceT("marginInlineEnd"),marginBottom:t$5.spaceT("marginBottom"),marginBlockEnd:t$5.spaceT("marginBlockEnd"),marginLeft:t$5.spaceT("marginLeft"),marginInlineStart:t$5.spaceT("marginInlineStart"),marginX:t$5.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:t$5.spaceT("marginInline"),marginY:t$5.spaceT(["marginTop","marginBottom"]),marginBlock:t$5.spaceT("marginBlock"),padding:t$5.space("padding"),paddingTop:t$5.space("paddingTop"),paddingBlockStart:t$5.space("paddingBlockStart"),paddingRight:t$5.space("paddingRight"),paddingBottom:t$5.space("paddingBottom"),paddingBlockEnd:t$5.space("paddingBlockEnd"),paddingLeft:t$5.space("paddingLeft"),paddingInlineStart:t$5.space("paddingInlineStart"),paddingInlineEnd:t$5.space("paddingInlineEnd"),paddingX:t$5.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:t$5.space("paddingInline"),paddingY:t$5.space(["paddingTop","paddingBottom"]),paddingBlock:t$5.space("paddingBlock")};Object.assign(space,{m:space.margin,mt:space.marginTop,mr:space.marginRight,me:space.marginInlineEnd,marginEnd:space.marginInlineEnd,mb:space.marginBottom,ml:space.marginLeft,ms:space.marginInlineStart,marginStart:space.marginInlineStart,mx:space.marginX,my:space.marginY,p:space.padding,pt:space.paddingTop,py:space.paddingY,px:space.paddingX,pb:space.paddingBottom,pl:space.paddingLeft,ps:space.paddingInlineStart,paddingStart:space.paddingInlineStart,pr:space.paddingRight,pe:space.paddingInlineEnd,paddingEnd:space.paddingInlineEnd});var textDecoration={textDecorationColor:t$5.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:t$5.shadows("textShadow")},transform={clipPath:!0,transform:t$5.propT("transform",transformFunctions.transform),transformOrigin:!0,translateX:t$5.spaceT("--chakra-translate-x"),translateY:t$5.spaceT("--chakra-translate-y"),skewX:t$5.degreeT("--chakra-skew-x"),skewY:t$5.degreeT("--chakra-skew-y"),scaleX:t$5.prop("--chakra-scale-x"),scaleY:t$5.prop("--chakra-scale-y"),scale:t$5.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:t$5.degreeT("--chakra-rotate")},transition$1={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:t$5.prop("transitionDuration","transition.duration"),transitionProperty:t$5.prop("transitionProperty","transition.property"),transitionTimingFunction:t$5.prop("transitionTimingFunction","transition.easing")},typography$1={fontFamily:t$5.prop("fontFamily","fonts"),fontSize:t$5.prop("fontSize","fontSizes",transformFunctions.px),fontWeight:t$5.prop("fontWeight","fontWeights"),lineHeight:t$5.prop("lineHeight","lineHeights"),letterSpacing:t$5.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(_){if(_===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},scroll={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:t$5.spaceT("scrollMargin"),scrollMarginTop:t$5.spaceT("scrollMarginTop"),scrollMarginBottom:t$5.spaceT("scrollMarginBottom"),scrollMarginLeft:t$5.spaceT("scrollMarginLeft"),scrollMarginRight:t$5.spaceT("scrollMarginRight"),scrollMarginX:t$5.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:t$5.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:t$5.spaceT("scrollPadding"),scrollPaddingTop:t$5.spaceT("scrollPaddingTop"),scrollPaddingBottom:t$5.spaceT("scrollPaddingBottom"),scrollPaddingLeft:t$5.spaceT("scrollPaddingLeft"),scrollPaddingRight:t$5.spaceT("scrollPaddingRight"),scrollPaddingX:t$5.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:t$5.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function resolveReference(_){return isObject$5(_)&&_.reference?_.reference:String(_)}var toExpression=(_,...a)=>a.map(resolveReference).join(` ${_} `).replace(/calc/g,""),add$1=(..._)=>`calc(${toExpression("+",..._)})`,subtract$1=(..._)=>`calc(${toExpression("-",..._)})`,multiply$1=(..._)=>`calc(${toExpression("*",..._)})`,divide$1=(..._)=>`calc(${toExpression("/",..._)})`,negate$1=_=>{const a=resolveReference(_);return a!=null&&!Number.isNaN(parseFloat(a))?String(a).startsWith("-")?String(a).slice(1):`-${a}`:multiply$1(a,-1)},calc$1=Object.assign(_=>({add:(...a)=>calc$1(add$1(_,...a)),subtract:(...a)=>calc$1(subtract$1(_,...a)),multiply:(...a)=>calc$1(multiply$1(_,...a)),divide:(...a)=>calc$1(divide$1(_,...a)),negate:()=>calc$1(negate$1(_)),toString:()=>_.toString()}),{add:add$1,subtract:subtract$1,multiply:multiply$1,divide:divide$1,negate:negate$1});function replaceWhiteSpace$1(_,a="-"){return _.replace(/\s+/g,a)}function escape$2(_){const a=replaceWhiteSpace$1(_.toString());return escapeSymbol(escapeDot(a))}function escapeDot(_){return _.includes("\\.")?_:!Number.isInteger(parseFloat(_.toString()))?_.replace(".","\\."):_}function escapeSymbol(_){return _.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function addPrefix$1(_,a=""){return[a,_].filter(Boolean).join("-")}function toVarReference(_,a){return`var(${_}${a?`, ${a}`:""})`}function toVarDefinition(_,a=""){return escape$2(`--${addPrefix$1(_,a)}`)}function cssVar$1(_,a,$){const j=toVarDefinition(_,$);return{variable:j,reference:toVarReference(j,a)}}function defineCssVars(_,a){const $={};for(const j of a){if(Array.isArray(j)){const[et,tt]=j;$[et]=cssVar$1(`${_}-${et}`,tt);continue}$[j]=cssVar$1(`${_}-${j}`)}return $}function getLastItem(_){const a=_==null?0:_.length;return a?_[a-1]:void 0}function analyzeCSSValue2(_){const a=parseFloat(_.toString()),$=_.toString().replace(String(a),"");return{unitless:!$,value:a,unit:$}}function px$1(_){if(_==null)return _;const{unitless:a}=analyzeCSSValue2(_);return a||typeof _=="number"?`${_}px`:_}var sortByBreakpointValue=(_,a)=>parseInt(_[1],10)>parseInt(a[1],10)?1:-1,sortBps=_=>Object.fromEntries(Object.entries(_).sort(sortByBreakpointValue));function normalize$1(_){const a=sortBps(_);return Object.assign(Object.values(a),a)}function keys$1(_){const a=Object.keys(sortBps(_));return new Set(a)}function subtract2(_){var a;if(!_)return _;_=(a=px$1(_))!=null?a:_;const $=-.02;return typeof _=="number"?`${_+$}`:_.replace(/(\d+\.?\d*)/u,j=>`${parseFloat(j)+$}`)}function toMediaQueryString(_,a){const $=["@media screen"];return _&&$.push("and",`(min-width: ${px$1(_)})`),a&&$.push("and",`(max-width: ${px$1(a)})`),$.join(" ")}function analyzeBreakpoints(_){var a;if(!_)return null;_.base=(a=_.base)!=null?a:"0px";const $=normalize$1(_),j=Object.entries(_).sort(sortByBreakpointValue).map(([rt,nt],it,at)=>{var st;let[,ot]=(st=at[it+1])!=null?st:[];return ot=parseFloat(ot)>0?subtract2(ot):void 0,{_minW:subtract2(nt),breakpoint:rt,minW:nt,maxW:ot,maxWQuery:toMediaQueryString(null,ot),minWQuery:toMediaQueryString(nt),minMaxQuery:toMediaQueryString(nt,ot)}}),et=keys$1(_),tt=Array.from(et.values());return{keys:et,normalized:$,isResponsive(rt){const nt=Object.keys(rt);return nt.length>0&&nt.every(it=>et.has(it))},asObject:sortBps(_),asArray:normalize$1(_),details:j,get(rt){return j.find(nt=>nt.breakpoint===rt)},media:[null,...$.map(rt=>toMediaQueryString(rt)).slice(1)],toArrayValue(rt){if(!isObject$5(rt))throw new Error("toArrayValue: value must be an object");const nt=tt.map(it=>{var at;return(at=rt[it])!=null?at:null});for(;getLastItem(nt)===null;)nt.pop();return nt},toObjectValue(rt){if(!Array.isArray(rt))throw new Error("toObjectValue: value must be an array");return rt.reduce((nt,it,at)=>{const st=tt[at];return st!=null&&it!=null&&(nt[st]=it),nt},{})}}}var state$1={hover:(_,a)=>`${_}:hover ${a}, ${_}[data-hover] ${a}`,focus:(_,a)=>`${_}:focus ${a}, ${_}[data-focus] ${a}`,focusVisible:(_,a)=>`${_}:focus-visible ${a}`,focusWithin:(_,a)=>`${_}:focus-within ${a}`,active:(_,a)=>`${_}:active ${a}, ${_}[data-active] ${a}`,disabled:(_,a)=>`${_}:disabled ${a}, ${_}[data-disabled] ${a}`,invalid:(_,a)=>`${_}:invalid ${a}, ${_}[data-invalid] ${a}`,checked:(_,a)=>`${_}:checked ${a}, ${_}[data-checked] ${a}`,indeterminate:(_,a)=>`${_}:indeterminate ${a}, ${_}[aria-checked=mixed] ${a}, ${_}[data-indeterminate] ${a}`,readOnly:(_,a)=>`${_}:read-only ${a}, ${_}[readonly] ${a}, ${_}[data-read-only] ${a}`,expanded:(_,a)=>`${_}:read-only ${a}, ${_}[aria-expanded=true] ${a}, ${_}[data-expanded] ${a}`,placeholderShown:(_,a)=>`${_}:placeholder-shown ${a}`},toGroup=_=>merge$2(a=>_(a,"&"),"[role=group]","[data-group]",".group"),toPeer=_=>merge$2(a=>_(a,"~ &"),"[data-peer]",".peer"),merge$2=(_,...a)=>a.map(_).join(", "),pseudoSelectors={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:toGroup(state$1.hover),_peerHover:toPeer(state$1.hover),_groupFocus:toGroup(state$1.focus),_peerFocus:toPeer(state$1.focus),_groupFocusVisible:toGroup(state$1.focusVisible),_peerFocusVisible:toPeer(state$1.focusVisible),_groupActive:toGroup(state$1.active),_peerActive:toPeer(state$1.active),_groupDisabled:toGroup(state$1.disabled),_peerDisabled:toPeer(state$1.disabled),_groupInvalid:toGroup(state$1.invalid),_peerInvalid:toPeer(state$1.invalid),_groupChecked:toGroup(state$1.checked),_peerChecked:toPeer(state$1.checked),_groupFocusWithin:toGroup(state$1.focusWithin),_peerFocusWithin:toPeer(state$1.focusWithin),_peerPlaceholderShown:toPeer(state$1.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},pseudoPropNames=Object.keys(pseudoSelectors);function tokenToCssVar(_,a){return cssVar$1(String(_).replace(/\./g,"-"),void 0,a)}function createThemeVars(_,a){let $={};const j={};for(const[et,tt]of Object.entries(_)){const{isSemantic:rt,value:nt}=tt,{variable:it,reference:at}=tokenToCssVar(et,a==null?void 0:a.cssVarPrefix);if(!rt){if(et.startsWith("space")){const ut=et.split("."),[dt,...mt]=ut,xt=`${dt}.-${mt.join(".")}`,Ct=calc$1.negate(nt),Pt=calc$1.negate(at);j[xt]={value:Ct,var:it,varRef:Pt}}$[it]=nt,j[et]={value:nt,var:it,varRef:at};continue}const st=ut=>{const mt=[String(et).split(".")[0],ut].join(".");if(!_[mt])return ut;const{reference:Ct}=tokenToCssVar(mt,a==null?void 0:a.cssVarPrefix);return Ct},ot=isObject$5(nt)?nt:{default:nt};$=mergeWith($,Object.entries(ot).reduce((ut,[dt,mt])=>{var xt,Ct;if(!mt)return ut;const Pt=st(`${mt}`);if(dt==="default")return ut[it]=Pt,ut;const Tt=(Ct=(xt=pseudoSelectors)==null?void 0:xt[dt])!=null?Ct:dt;return ut[Tt]={[it]:Pt},ut},{})),j[et]={value:at,var:it,varRef:at}}return{cssVars:$,cssMap:j}}function omit$6(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}function pick$2(_,a){const $={};for(const j of a)j in _&&($[j]=_[j]);return $}function isObject5(_){return typeof _=="object"&&_!=null&&!Array.isArray(_)}function walkObject(_,a,$={}){const{stop:j,getKey:et}=$;function tt(rt,nt=[]){var it;if(isObject5(rt)||Array.isArray(rt)){const at={};for(const[st,ot]of Object.entries(rt)){const ut=(it=et==null?void 0:et(st))!=null?it:st,dt=[...nt,ut];if(j!=null&&j(rt,dt))return a(rt,nt);at[ut]=tt(ot,dt)}return at}return a(rt,nt)}return tt(_)}var tokens$1=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function extractTokens(_){return pick$2(_,tokens$1)}function extractSemanticTokens(_){return _.semanticTokens}function omitVars(_){const{__cssMap:a,__cssVars:$,__breakpoints:j,...et}=_;return et}var isSemanticCondition=_=>pseudoPropNames.includes(_)||_==="default";function flattenTokens({tokens:_,semanticTokens:a}){const $={};return walkObject(_,(j,et)=>{j!=null&&($[et.join(".")]={isSemantic:!1,value:j})}),walkObject(a,(j,et)=>{j!=null&&($[et.join(".")]={isSemantic:!0,value:j})},{stop:j=>Object.keys(j).every(isSemanticCondition)}),$}function toCSSVar(_){var a;const $=omitVars(_),j=extractTokens($),et=extractSemanticTokens($),tt=flattenTokens({tokens:j,semanticTokens:et}),rt=(a=$.config)==null?void 0:a.cssVarPrefix,{cssMap:nt,cssVars:it}=createThemeVars(tt,{cssVarPrefix:rt});return Object.assign($,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...it},__cssMap:nt,__breakpoints:analyzeBreakpoints($.breakpoints)}),$}var systemProps=mergeWith({},background,border,color$2,flexbox,layout$1,filter$2,ring,interactivity,grid,others,position,effect$3,space,scroll,typography$1,textDecoration,transform,list,transition$1),layoutSystem=Object.assign({},space,layout$1,flexbox,grid,position),layoutPropNames=Object.keys(layoutSystem),propNames=[...Object.keys(systemProps),...pseudoPropNames],styleProps={...systemProps,...pseudoSelectors},isStyleProp=_=>_ in styleProps,expandResponsive=_=>a=>{if(!a.__breakpoints)return _;const{isResponsive:$,toArrayValue:j,media:et}=a.__breakpoints,tt={};for(const rt in _){let nt=runIfFn$2(_[rt],a);if(nt==null)continue;if(nt=isObject$5(nt)&&$(nt)?j(nt):nt,!Array.isArray(nt)){tt[rt]=nt;continue}const it=nt.slice(0,et.length).length;for(let at=0;at_.startsWith("--")&&typeof a=="string"&&!isCssVar2(a),resolveTokenValue=(_,a)=>{var $,j;if(a==null)return a;const et=it=>{var at,st;return(st=(at=_.__cssMap)==null?void 0:at[it])==null?void 0:st.varRef},tt=it=>{var at;return(at=et(it))!=null?at:it},[rt,nt]=splitByComma(a);return a=(j=($=et(rt))!=null?$:tt(nt))!=null?j:tt(a),a};function getCss(_){const{configs:a={},pseudos:$={},theme:j}=_,et=(tt,rt=!1)=>{var nt,it,at;const st=runIfFn$2(tt,j),ot=expandResponsive(st)(j);let ut={};for(let dt in ot){const mt=ot[dt];let xt=runIfFn$2(mt,j);dt in $&&(dt=$[dt]),isCSSVariableTokenValue(dt,xt)&&(xt=resolveTokenValue(j,xt));let Ct=a[dt];if(Ct===!0&&(Ct={property:dt}),isObject$5(xt)){ut[dt]=(nt=ut[dt])!=null?nt:{},ut[dt]=mergeWith({},ut[dt],et(xt,!0));continue}let Pt=(at=(it=Ct==null?void 0:Ct.transform)==null?void 0:it.call(Ct,xt,j,st))!=null?at:xt;Pt=Ct!=null&&Ct.processResult?et(Pt,!0):Pt;const Tt=runIfFn$2(Ct==null?void 0:Ct.property,j);if(!rt&&(Ct!=null&&Ct.static)){const kt=runIfFn$2(Ct.static,j);ut=mergeWith({},ut,kt)}if(Tt&&Array.isArray(Tt)){for(const kt of Tt)ut[kt]=Pt;continue}if(Tt){Tt==="&"&&isObject$5(Pt)?ut=mergeWith({},ut,Pt):ut[Tt]=Pt;continue}if(isObject$5(Pt)){ut=mergeWith({},ut,Pt);continue}ut[dt]=Pt}return ut};return et}var css=_=>a=>getCss({theme:a,pseudos:pseudoSelectors,configs:systemProps})(_);function defineStyle(_){return _}function defineStyleConfig(_){return _}function createMultiStyleConfigHelpers(_){return{definePartsStyle(a){return a},defineMultiStyleConfig(a){return{parts:_,...a}}}}function normalize2(_,a){if(Array.isArray(_))return _;if(isObject$5(_))return a(_);if(_!=null)return[_]}function getNextIndex$1(_,a){for(let $=a+1;$<_.length;$++)if(_[$]!=null)return $;return-1}function createResolver(_){const a=_.__breakpoints;return function(j,et,tt,rt){var nt,it;if(!a)return;const at={},st=normalize2(tt,a.toArrayValue);if(!st)return at;const ot=st.length,ut=ot===1,dt=!!j.parts;for(let mt=0;mt{mergeWith(at,{[kt]:ut?Tt[kt]:{[Pt]:Tt[kt]}})});continue}if(!dt){ut?mergeWith(at,Tt):at[Pt]=Tt;continue}at[Pt]=Tt}}return at}}function resolveStyleConfig(_){return a=>{var $;const{variant:j,size:et,theme:tt}=a,rt=createResolver(tt);return mergeWith({},runIfFn$2(($=_.baseStyle)!=null?$:{},a),rt(_,"sizes",et,a),rt(_,"variants",j,a))}}function getCSSVar(_,a,$){var j,et,tt;return(tt=(et=(j=_.__cssMap)==null?void 0:j[`${a}.${$}`])==null?void 0:et.varRef)!=null?tt:$}function omitThemingProps(_){return omit$6(_,["styleConfig","size","variant","colorScheme"])}var requiredChakraThemeKeys=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function isChakraTheme(_){return isObject$5(_)?requiredChakraThemeKeys.every(a=>Object.prototype.hasOwnProperty.call(_,a)):!1}var transitionProperty={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},transitionTimingFunction={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},transitionDuration={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},transition={property:transitionProperty,easing:transitionTimingFunction,duration:transitionDuration},transition_default=transition,zIndices={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},z_index_default=zIndices,borders$1={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},borders_default=borders$1,breakpoints={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},breakpoints_default=breakpoints,colors$1={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},colors_default=colors$1,radii={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},radius_default=radii,shadows={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},shadows_default=shadows,blur={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},blur_default=blur,typography={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},typography_default=typography,spacing={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},largeSizes={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},container={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},sizes$o={...spacing,...largeSizes,container},sizes_default=sizes$o,foundations={breakpoints:breakpoints_default,zIndices:z_index_default,radii:radius_default,blur:blur_default,colors:colors_default,...typography_default,sizes:sizes_default,shadows:shadows_default,space:spacing,borders:borders_default,transition:transition_default},{defineMultiStyleConfig:defineMultiStyleConfig$w,definePartsStyle:definePartsStyle$w}=createMultiStyleConfigHelpers(["stepper","step","title","description","indicator","separator","icon","number"]),$size$4=cssVar$1("stepper-indicator-size"),$iconSize=cssVar$1("stepper-icon-size"),$titleFontSize=cssVar$1("stepper-title-font-size"),$descFontSize=cssVar$1("stepper-description-font-size"),$accentColor=cssVar$1("stepper-accent-color"),baseStyle$J=definePartsStyle$w(({colorScheme:_})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[$accentColor.variable]:`colors.${_}.500`,_dark:{[$accentColor.variable]:`colors.${_}.200`}},title:{fontSize:$titleFontSize.reference,fontWeight:"medium"},description:{fontSize:$descFontSize.reference,color:"chakra-subtle-text"},number:{fontSize:$titleFontSize.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:$iconSize.reference,height:$iconSize.reference},indicator:{flexShrink:0,borderRadius:"full",width:$size$4.reference,height:$size$4.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:$accentColor.reference},"&[data-status=complete]":{bg:$accentColor.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:$accentColor.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${$size$4.reference} - 8px)`,top:`calc(${$size$4.reference} + 4px)`,insetStart:`calc(${$size$4.reference} / 2 - 1px)`}}})),stepperTheme=defineMultiStyleConfig$w({baseStyle:baseStyle$J,sizes:{xs:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.4",[$iconSize.variable]:"sizes.3",[$titleFontSize.variable]:"fontSizes.xs",[$descFontSize.variable]:"fontSizes.xs"}}),sm:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.6",[$iconSize.variable]:"sizes.4",[$titleFontSize.variable]:"fontSizes.sm",[$descFontSize.variable]:"fontSizes.xs"}}),md:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.8",[$iconSize.variable]:"sizes.5",[$titleFontSize.variable]:"fontSizes.md",[$descFontSize.variable]:"fontSizes.sm"}}),lg:definePartsStyle$w({stepper:{[$size$4.variable]:"sizes.10",[$iconSize.variable]:"sizes.6",[$titleFontSize.variable]:"fontSizes.lg",[$descFontSize.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function anatomy(_,a={}){let $=!1;function j(){if(!$){$=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function et(...st){j();for(const ot of st)a[ot]=it(ot);return anatomy(_,a)}function tt(...st){for(const ot of st)ot in a||(a[ot]=it(ot));return anatomy(_,a)}function rt(){return Object.fromEntries(Object.entries(a).map(([ot,ut])=>[ot,ut.selector]))}function nt(){return Object.fromEntries(Object.entries(a).map(([ot,ut])=>[ot,ut.className]))}function it(st){const dt=`chakra-${(["container","root"].includes(st??"")?[_]:[_,st]).filter(Boolean).join("__")}`;return{className:dt,selector:`.${dt}`,toString:()=>st}}return{parts:et,toPart:it,extend:tt,selectors:rt,classnames:nt,get keys(){return Object.keys(a)},__type:{}}}var accordionAnatomy=anatomy("accordion").parts("root","container","button","panel").extend("icon"),alertAnatomy=anatomy("alert").parts("title","description","container").extend("icon","spinner"),avatarAnatomy=anatomy("avatar").parts("label","badge","container").extend("excessLabel","group"),breadcrumbAnatomy=anatomy("breadcrumb").parts("link","item","container").extend("separator");anatomy("button").parts();var checkboxAnatomy=anatomy("checkbox").parts("control","icon","container").extend("label");anatomy("progress").parts("track","filledTrack").extend("label");var drawerAnatomy=anatomy("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),editableAnatomy=anatomy("editable").parts("preview","input","textarea"),formAnatomy=anatomy("form").parts("container","requiredIndicator","helperText"),formErrorAnatomy=anatomy("formError").parts("text","icon"),inputAnatomy=anatomy("input").parts("addon","field","element","group"),listAnatomy=anatomy("list").parts("container","item","icon"),menuAnatomy=anatomy("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),modalAnatomy=anatomy("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),numberInputAnatomy=anatomy("numberinput").parts("root","field","stepperGroup","stepper");anatomy("pininput").parts("field");var popoverAnatomy=anatomy("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),progressAnatomy=anatomy("progress").parts("label","filledTrack","track"),radioAnatomy=anatomy("radio").parts("container","control","label"),selectAnatomy=anatomy("select").parts("field","icon"),sliderAnatomy=anatomy("slider").parts("container","track","thumb","filledTrack","mark"),statAnatomy=anatomy("stat").parts("container","label","helpText","number","icon"),switchAnatomy=anatomy("switch").parts("container","track","thumb","label"),tableAnatomy=anatomy("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),tabsAnatomy=anatomy("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),tagAnatomy=anatomy("tag").parts("container","label","closeButton"),cardAnatomy=anatomy("card").parts("container","header","body","footer");anatomy("stepper").parts("stepper","step","title","description","indicator","separator","icon","number");function guard(_,a,$){return Math.min(Math.max(_,$),a)}class ColorError extends Error{constructor(a){super(`Failed to parse color: "${a}"`)}}var ColorError$1=ColorError;function parseToRgba(_){if(typeof _!="string")throw new ColorError$1(_);if(_.trim().toLowerCase()==="transparent")return[0,0,0,0];let a=_.trim();a=namedColorRegex.test(_)?nameToHex(_):_;const $=reducedHexRegex.exec(a);if($){const rt=Array.from($).slice(1);return[...rt.slice(0,3).map(nt=>parseInt(r$3(nt,2),16)),parseInt(r$3(rt[3]||"f",2),16)/255]}const j=hexRegex.exec(a);if(j){const rt=Array.from(j).slice(1);return[...rt.slice(0,3).map(nt=>parseInt(nt,16)),parseInt(rt[3]||"ff",16)/255]}const et=rgbaRegex.exec(a);if(et){const rt=Array.from(et).slice(1);return[...rt.slice(0,3).map(nt=>parseInt(nt,10)),parseFloat(rt[3]||"1")]}const tt=hslaRegex.exec(a);if(tt){const[rt,nt,it,at]=Array.from(tt).slice(1).map(parseFloat);if(guard(0,100,nt)!==nt)throw new ColorError$1(_);if(guard(0,100,it)!==it)throw new ColorError$1(_);return[...hslToRgb(rt,nt,it),Number.isNaN(at)?1:at]}throw new ColorError$1(_)}function hash$c(_){let a=5381,$=_.length;for(;$;)a=a*33^_.charCodeAt(--$);return(a>>>0)%2341}const colorToInt=_=>parseInt(_.replace(/_/g,""),36),compressedColorMap="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((_,a)=>{const $=colorToInt(a.substring(0,3)),j=colorToInt(a.substring(3)).toString(16);let et="";for(let tt=0;tt<6-j.length;tt++)et+="0";return _[$]=`${et}${j}`,_},{});function nameToHex(_){const a=_.toLowerCase().trim(),$=compressedColorMap[hash$c(a)];if(!$)throw new ColorError$1(_);return`#${$}`}const r$3=(_,a)=>Array.from(Array(a)).map(()=>_).join(""),reducedHexRegex=new RegExp(`^#${r$3("([a-f0-9])",3)}([a-f0-9])?$`,"i"),hexRegex=new RegExp(`^#${r$3("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),rgbaRegex=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r$3(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),hslaRegex=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,namedColorRegex=/^[a-z]+$/i,roundColor=_=>Math.round(_*255),hslToRgb=(_,a,$)=>{let j=$/100;if(a===0)return[j,j,j].map(roundColor);const et=(_%360+360)%360/60,tt=(1-Math.abs(2*j-1))*(a/100),rt=tt*(1-Math.abs(et%2-1));let nt=0,it=0,at=0;et>=0&&et<1?(nt=tt,it=rt):et>=1&&et<2?(nt=rt,it=tt):et>=2&&et<3?(it=tt,at=rt):et>=3&&et<4?(it=rt,at=tt):et>=4&&et<5?(nt=rt,at=tt):et>=5&&et<6&&(nt=tt,at=rt);const st=j-tt/2,ot=nt+st,ut=it+st,dt=at+st;return[ot,ut,dt].map(roundColor)};function rgba$1(_,a,$,j){return`rgba(${guard(0,255,_).toFixed()}, ${guard(0,255,a).toFixed()}, ${guard(0,255,$).toFixed()}, ${parseFloat(guard(0,1,j).toFixed(3))})`}function transparentize$1(_,a){const[$,j,et,tt]=parseToRgba(_);return rgba$1($,j,et,tt-a)}function toHex$3(_){const[a,$,j,et]=parseToRgba(_);let tt=rt=>{const nt=guard(0,255,rt).toString(16);return nt.length===1?`0${nt}`:nt};return`#${tt(a)}${tt($)}${tt(j)}${et<1?tt(Math.round(et*255)):""}`}function dlv_es_default(_,a,$,j,et){for(a=a.split?a.split("."):a,j=0;jObject.keys(_).length===0,getColor=(_,a,$)=>{const j=dlv_es_default(_,`colors.${a}`,a);try{return toHex$3(j),j}catch{return $??"#000000"}},getBrightness=_=>{const[a,$,j]=parseToRgba(_);return(a*299+$*587+j*114)/1e3},tone=_=>a=>{const $=getColor(a,_);return getBrightness($)<128?"dark":"light"},isDark=_=>a=>tone(_)(a)==="dark",transparentize=(_,a)=>$=>{const j=getColor($,_);return transparentize$1(j,1-a)};function generateStripe(_="1rem",a="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( 45deg, ${a} 25%, transparent 25%, @@ -339,16 +339,16 @@ Error generating stack: `+tt.message+` transparent 0%, ${getColor($,rt)} 50%, transparent 100% - )`;return{...!j&&et&&tt,...j?{bgImage:nt}:{bgColor:rt}}},baseStyleLabel$3={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},baseStyleTrack$1=_=>({bg:mode("gray.100","whiteAlpha.300")(_)}),baseStyleFilledTrack$1=_=>({transitionProperty:"common",transitionDuration:"slow",...filledStyle(_)}),baseStyle$A=definePartsStyle$q(_=>({label:baseStyleLabel$3,filledTrack:baseStyleFilledTrack$1(_),track:baseStyleTrack$1(_)})),sizes$h={xs:definePartsStyle$q({track:{h:"1"}}),sm:definePartsStyle$q({track:{h:"2"}}),md:definePartsStyle$q({track:{h:"3"}}),lg:definePartsStyle$q({track:{h:"4"}})},progressTheme=defineMultiStyleConfig$q({sizes:sizes$h,baseStyle:baseStyle$A,defaultProps:{size:"md",colorScheme:"blue"}}),isFunction$7=_=>typeof _=="function";function runIfFn$1(_,...a){return isFunction$7(_)?_(...a):_}var{definePartsStyle:definePartsStyle$p,defineMultiStyleConfig:defineMultiStyleConfig$p}=createMultiStyleConfigHelpers(checkboxAnatomy.keys),$size$3=cssVar$1("checkbox-size"),baseStyleControl$1=_=>{const{colorScheme:a}=_;return{w:$size$3.reference,h:$size$3.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:mode(`${a}.500`,`${a}.200`)(_),borderColor:mode(`${a}.500`,`${a}.200`)(_),color:mode("white","gray.900")(_),_hover:{bg:mode(`${a}.600`,`${a}.300`)(_),borderColor:mode(`${a}.600`,`${a}.300`)(_)},_disabled:{borderColor:mode("gray.200","transparent")(_),bg:mode("gray.200","whiteAlpha.300")(_),color:mode("gray.500","whiteAlpha.500")(_)}},_indeterminate:{bg:mode(`${a}.500`,`${a}.200`)(_),borderColor:mode(`${a}.500`,`${a}.200`)(_),color:mode("white","gray.900")(_)},_disabled:{bg:mode("gray.100","whiteAlpha.100")(_),borderColor:mode("gray.100","transparent")(_)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:mode("red.500","red.300")(_)}}},baseStyleContainer$3={_disabled:{cursor:"not-allowed"}},baseStyleLabel$2={userSelect:"none",_disabled:{opacity:.4}},baseStyleIcon$6={transitionProperty:"transform",transitionDuration:"normal"},baseStyle$z=definePartsStyle$p(_=>({icon:baseStyleIcon$6,container:baseStyleContainer$3,control:runIfFn$1(baseStyleControl$1,_),label:baseStyleLabel$2})),sizes$g={sm:definePartsStyle$p({control:{[$size$3.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:definePartsStyle$p({control:{[$size$3.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:definePartsStyle$p({control:{[$size$3.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},checkboxTheme$1=defineMultiStyleConfig$p({baseStyle:baseStyle$z,sizes:sizes$g,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:defineMultiStyleConfig$o,definePartsStyle:definePartsStyle$o}=createMultiStyleConfigHelpers(radioAnatomy.keys),baseStyleControl=_=>{var a;const $=(a=runIfFn$1(checkboxTheme$1.baseStyle,_))==null?void 0:a.control;return{...$,borderRadius:"full",_checked:{...$==null?void 0:$._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},baseStyle$y=definePartsStyle$o(_=>{var a,$,j,et;return{label:($=(a=checkboxTheme$1).baseStyle)==null?void 0:$.call(a,_).label,container:(et=(j=checkboxTheme$1).baseStyle)==null?void 0:et.call(j,_).container,control:baseStyleControl(_)}}),sizes$f={md:definePartsStyle$o({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:definePartsStyle$o({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:definePartsStyle$o({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},radioTheme$1=defineMultiStyleConfig$o({baseStyle:baseStyle$y,sizes:sizes$f,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:defineMultiStyleConfig$n,definePartsStyle:definePartsStyle$n}=createMultiStyleConfigHelpers(selectAnatomy.keys),$bg$b=cssVar$1("select-bg"),_a$6,baseStyleField$1={...(_a$6=inputTheme.baseStyle)==null?void 0:_a$6.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:$bg$b.reference,[$bg$b.variable]:"colors.white",_dark:{[$bg$b.variable]:"colors.gray.700"},"> option, > optgroup":{bg:$bg$b.reference}},baseStyleIcon$5={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},baseStyle$x=definePartsStyle$n({field:baseStyleField$1,icon:baseStyleIcon$5}),iconSpacing={paddingInlineEnd:"8"},_a2$1,_b$1,_c,_d,_e,_f,_g,_h,sizes$e={lg:{...(_a2$1=inputTheme.sizes)==null?void 0:_a2$1.lg,field:{...(_b$1=inputTheme.sizes)==null?void 0:_b$1.lg.field,...iconSpacing}},md:{...(_c=inputTheme.sizes)==null?void 0:_c.md,field:{...(_d=inputTheme.sizes)==null?void 0:_d.md.field,...iconSpacing}},sm:{...(_e=inputTheme.sizes)==null?void 0:_e.sm,field:{...(_f=inputTheme.sizes)==null?void 0:_f.sm.field,...iconSpacing}},xs:{...(_g=inputTheme.sizes)==null?void 0:_g.xs,field:{...(_h=inputTheme.sizes)==null?void 0:_h.xs.field,...iconSpacing},icon:{insetEnd:"1"}}},selectTheme=defineMultiStyleConfig$n({baseStyle:baseStyle$x,sizes:sizes$e,variants:inputTheme.variants,defaultProps:inputTheme.defaultProps}),$startColor=cssVar$1("skeleton-start-color"),$endColor=cssVar$1("skeleton-end-color"),baseStyle$w={[$startColor.variable]:"colors.gray.100",[$endColor.variable]:"colors.gray.400",_dark:{[$startColor.variable]:"colors.gray.800",[$endColor.variable]:"colors.gray.600"},background:$startColor.reference,borderColor:$endColor.reference,opacity:.7,borderRadius:"sm"},skeletonTheme={baseStyle:baseStyle$w},$bg$a=cssVar$1("skip-link-bg"),baseStyle$v={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[$bg$a.variable]:"colors.white",_dark:{[$bg$a.variable]:"colors.gray.700"},bg:$bg$a.reference}},skipLinkTheme={baseStyle:baseStyle$v},{defineMultiStyleConfig:defineMultiStyleConfig$m,definePartsStyle:definePartsStyle$m}=createMultiStyleConfigHelpers(sliderAnatomy.keys),$thumbSize=cssVar$1("slider-thumb-size"),$trackSize=cssVar$1("slider-track-size"),$bg$9=cssVar$1("slider-bg"),baseStyleContainer$2=_=>{const{orientation:a}=_;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...orient({orientation:a,vertical:{h:"100%"},horizontal:{w:"100%"}})}},baseStyleTrack=_=>({...orient({orientation:_.orientation,horizontal:{h:$trackSize.reference},vertical:{w:$trackSize.reference}}),overflow:"hidden",borderRadius:"sm",[$bg$9.variable]:"colors.gray.200",_dark:{[$bg$9.variable]:"colors.whiteAlpha.200"},_disabled:{[$bg$9.variable]:"colors.gray.300",_dark:{[$bg$9.variable]:"colors.whiteAlpha.300"}},bg:$bg$9.reference}),baseStyleThumb=_=>{const{orientation:a}=_;return{...orient({orientation:a,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:$thumbSize.reference,h:$thumbSize.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},baseStyleFilledTrack=_=>{const{colorScheme:a}=_;return{width:"inherit",height:"inherit",[$bg$9.variable]:`colors.${a}.500`,_dark:{[$bg$9.variable]:`colors.${a}.200`},bg:$bg$9.reference}},baseStyle$u=definePartsStyle$m(_=>({container:baseStyleContainer$2(_),track:baseStyleTrack(_),thumb:baseStyleThumb(_),filledTrack:baseStyleFilledTrack(_)})),sizeLg=definePartsStyle$m({container:{[$thumbSize.variable]:"sizes.4",[$trackSize.variable]:"sizes.1"}}),sizeMd=definePartsStyle$m({container:{[$thumbSize.variable]:"sizes.3.5",[$trackSize.variable]:"sizes.1"}}),sizeSm=definePartsStyle$m({container:{[$thumbSize.variable]:"sizes.2.5",[$trackSize.variable]:"sizes.0.5"}}),sizes$d={lg:sizeLg,md:sizeMd,sm:sizeSm},sliderTheme=defineMultiStyleConfig$m({baseStyle:baseStyle$u,sizes:sizes$d,defaultProps:{size:"md",colorScheme:"blue"}}),$size$2=cssVar("spinner-size"),baseStyle$t={width:[$size$2.reference],height:[$size$2.reference]},sizes$c={xs:{[$size$2.variable]:"sizes.3"},sm:{[$size$2.variable]:"sizes.4"},md:{[$size$2.variable]:"sizes.6"},lg:{[$size$2.variable]:"sizes.8"},xl:{[$size$2.variable]:"sizes.12"}},spinnerTheme={baseStyle:baseStyle$t,sizes:sizes$c,defaultProps:{size:"md"}},{defineMultiStyleConfig:defineMultiStyleConfig$l,definePartsStyle:definePartsStyle$l}=createMultiStyleConfigHelpers(statAnatomy.keys),baseStyleLabel$1={fontWeight:"medium"},baseStyleHelpText={opacity:.8,marginBottom:"2"},baseStyleNumber={verticalAlign:"baseline",fontWeight:"semibold"},baseStyleIcon$4={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},baseStyle$s=definePartsStyle$l({container:{},label:baseStyleLabel$1,helpText:baseStyleHelpText,number:baseStyleNumber,icon:baseStyleIcon$4}),sizes$b={md:definePartsStyle$l({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},statTheme=defineMultiStyleConfig$l({baseStyle:baseStyle$s,sizes:sizes$b,defaultProps:{size:"md"}}),$bg$8=cssVar$1("kbd-bg"),baseStyle$r={[$bg$8.variable]:"colors.gray.100",_dark:{[$bg$8.variable]:"colors.whiteAlpha.100"},bg:$bg$8.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},kbdTheme={baseStyle:baseStyle$r},baseStyle$q={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},linkTheme={baseStyle:baseStyle$q},{defineMultiStyleConfig:defineMultiStyleConfig$k,definePartsStyle:definePartsStyle$k}=createMultiStyleConfigHelpers(listAnatomy.keys),baseStyleIcon$3={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},baseStyle$p=definePartsStyle$k({icon:baseStyleIcon$3}),listTheme$1=defineMultiStyleConfig$k({baseStyle:baseStyle$p}),{defineMultiStyleConfig:defineMultiStyleConfig$j,definePartsStyle:definePartsStyle$j}=createMultiStyleConfigHelpers(menuAnatomy.keys),$bg$7=cssVar$1("menu-bg"),$shadow$2=cssVar$1("menu-shadow"),baseStyleList={[$bg$7.variable]:"#fff",[$shadow$2.variable]:"shadows.sm",_dark:{[$bg$7.variable]:"colors.gray.700",[$shadow$2.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:$bg$7.reference,boxShadow:$shadow$2.reference},baseStyleItem={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[$bg$7.variable]:"colors.gray.100",_dark:{[$bg$7.variable]:"colors.whiteAlpha.100"}},_active:{[$bg$7.variable]:"colors.gray.200",_dark:{[$bg$7.variable]:"colors.whiteAlpha.200"}},_expanded:{[$bg$7.variable]:"colors.gray.100",_dark:{[$bg$7.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:$bg$7.reference},baseStyleGroupTitle={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},baseStyleIcon$2={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},baseStyleCommand={opacity:.6},baseStyleDivider={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},baseStyleButton$1={transitionProperty:"common",transitionDuration:"normal"},baseStyle$o=definePartsStyle$j({button:baseStyleButton$1,list:baseStyleList,item:baseStyleItem,groupTitle:baseStyleGroupTitle,icon:baseStyleIcon$2,command:baseStyleCommand,divider:baseStyleDivider}),menuTheme=defineMultiStyleConfig$j({baseStyle:baseStyle$o}),{defineMultiStyleConfig:defineMultiStyleConfig$i,definePartsStyle:definePartsStyle$i}=createMultiStyleConfigHelpers(modalAnatomy.keys),$bg$6=cssVar$1("modal-bg"),$shadow$1=cssVar$1("modal-shadow"),baseStyleOverlay$1={bg:"blackAlpha.600",zIndex:"modal"},baseStyleDialogContainer$1=_=>{const{isCentered:a,scrollBehavior:$}=_;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:a?"center":"flex-start",overflow:$==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},baseStyleDialog$1=_=>{const{isCentered:a,scrollBehavior:$}=_;return{borderRadius:"md",color:"inherit",my:a?"auto":"16",mx:a?"auto":void 0,zIndex:"modal",maxH:$==="inside"?"calc(100% - 7.5rem)":void 0,[$bg$6.variable]:"colors.white",[$shadow$1.variable]:"shadows.lg",_dark:{[$bg$6.variable]:"colors.gray.700",[$shadow$1.variable]:"shadows.dark-lg"},bg:$bg$6.reference,boxShadow:$shadow$1.reference}},baseStyleHeader$2={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},baseStyleCloseButton$2={position:"absolute",top:"2",insetEnd:"3"},baseStyleBody$2=_=>{const{scrollBehavior:a}=_;return{px:"6",py:"2",flex:"1",overflow:a==="inside"?"auto":void 0}},baseStyleFooter$2={px:"6",py:"4"},baseStyle$n=definePartsStyle$i(_=>({overlay:baseStyleOverlay$1,dialogContainer:runIfFn$1(baseStyleDialogContainer$1,_),dialog:runIfFn$1(baseStyleDialog$1,_),header:baseStyleHeader$2,closeButton:baseStyleCloseButton$2,body:runIfFn$1(baseStyleBody$2,_),footer:baseStyleFooter$2}));function getSize$3(_){return definePartsStyle$i(_==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:_}})}var sizes$a={xs:getSize$3("xs"),sm:getSize$3("sm"),md:getSize$3("md"),lg:getSize$3("lg"),xl:getSize$3("xl"),"2xl":getSize$3("2xl"),"3xl":getSize$3("3xl"),"4xl":getSize$3("4xl"),"5xl":getSize$3("5xl"),"6xl":getSize$3("6xl"),full:getSize$3("full")},modalTheme$1=defineMultiStyleConfig$i({baseStyle:baseStyle$n,sizes:sizes$a,defaultProps:{size:"md"}}),{defineMultiStyleConfig:defineMultiStyleConfig$h,definePartsStyle:definePartsStyle$h}=createMultiStyleConfigHelpers(numberInputAnatomy.keys),$stepperWidth=cssVar("number-input-stepper-width"),$inputPadding=cssVar("number-input-input-padding"),inputPaddingValue=calc($stepperWidth).add("0.5rem").toString(),$bg$5=cssVar("number-input-bg"),$fg$3=cssVar("number-input-color"),$border$2=cssVar("number-input-border-color"),baseStyleRoot={[$stepperWidth.variable]:"sizes.6",[$inputPadding.variable]:inputPaddingValue},baseStyleField=_=>{var a,$;return($=(a=runIfFn$1(inputTheme.baseStyle,_))==null?void 0:a.field)!=null?$:{}},baseStyleStepperGroup={width:$stepperWidth.reference},baseStyleStepper={borderStart:"1px solid",borderStartColor:$border$2.reference,color:$fg$3.reference,bg:$bg$5.reference,[$fg$3.variable]:"colors.chakra-body-text",[$border$2.variable]:"colors.chakra-border-color",_dark:{[$fg$3.variable]:"colors.whiteAlpha.800",[$border$2.variable]:"colors.whiteAlpha.300"},_active:{[$bg$5.variable]:"colors.gray.200",_dark:{[$bg$5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},baseStyle$m=definePartsStyle$h(_=>{var a;return{root:baseStyleRoot,field:(a=runIfFn$1(baseStyleField,_))!=null?a:{},stepperGroup:baseStyleStepperGroup,stepper:baseStyleStepper}});function getSize$2(_){var a,$,j;const et=(a=inputTheme.sizes)==null?void 0:a[_],tt={lg:"md",md:"md",sm:"sm",xs:"sm"},rt=(j=($=et.field)==null?void 0:$.fontSize)!=null?j:"md",nt=typography_default.fontSizes[rt];return definePartsStyle$h({field:{...et.field,paddingInlineEnd:$inputPadding.reference,verticalAlign:"top"},stepper:{fontSize:calc(nt).multiply(.75).toString(),_first:{borderTopEndRadius:tt[_]},_last:{borderBottomEndRadius:tt[_],mt:"-1px",borderTopWidth:1}}})}var sizes$9={xs:getSize$2("xs"),sm:getSize$2("sm"),md:getSize$2("md"),lg:getSize$2("lg")},numberInputTheme=defineMultiStyleConfig$h({baseStyle:baseStyle$m,sizes:sizes$9,variants:inputTheme.variants,defaultProps:inputTheme.defaultProps}),_a$5,baseStyle$l={...(_a$5=inputTheme.baseStyle)==null?void 0:_a$5.field,textAlign:"center"},sizes$8={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},_a2,_b,variants$a={outline:_=>{var a,$,j;return(j=($=runIfFn$1((a=inputTheme.variants)==null?void 0:a.outline,_))==null?void 0:$.field)!=null?j:{}},flushed:_=>{var a,$,j;return(j=($=runIfFn$1((a=inputTheme.variants)==null?void 0:a.flushed,_))==null?void 0:$.field)!=null?j:{}},filled:_=>{var a,$,j;return(j=($=runIfFn$1((a=inputTheme.variants)==null?void 0:a.filled,_))==null?void 0:$.field)!=null?j:{}},unstyled:(_b=(_a2=inputTheme.variants)==null?void 0:_a2.unstyled.field)!=null?_b:{}},pinInputTheme={baseStyle:baseStyle$l,sizes:sizes$8,variants:variants$a,defaultProps:inputTheme.defaultProps},{defineMultiStyleConfig:defineMultiStyleConfig$g,definePartsStyle:definePartsStyle$g}=createMultiStyleConfigHelpers(popoverAnatomy.keys),$popperBg=cssVar("popper-bg"),$arrowBg=cssVar("popper-arrow-bg"),$arrowShadowColor=cssVar("popper-arrow-shadow-color"),baseStylePopper={zIndex:10},baseStyleContent={[$popperBg.variable]:"colors.white",bg:$popperBg.reference,[$arrowBg.variable]:$popperBg.reference,[$arrowShadowColor.variable]:"colors.gray.200",_dark:{[$popperBg.variable]:"colors.gray.700",[$arrowShadowColor.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},baseStyleHeader$1={px:3,py:2,borderBottomWidth:"1px"},baseStyleBody$1={px:3,py:2},baseStyleFooter$1={px:3,py:2,borderTopWidth:"1px"},baseStyleCloseButton$1={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},baseStyle$k=definePartsStyle$g({popper:baseStylePopper,content:baseStyleContent,header:baseStyleHeader$1,body:baseStyleBody$1,footer:baseStyleFooter$1,closeButton:baseStyleCloseButton$1}),popoverTheme=defineMultiStyleConfig$g({baseStyle:baseStyle$k}),{definePartsStyle:definePartsStyle$f,defineMultiStyleConfig:defineMultiStyleConfig$f}=createMultiStyleConfigHelpers(drawerAnatomy.keys),$bg$4=cssVar$1("drawer-bg"),$bs=cssVar$1("drawer-box-shadow");function getSize$1(_){return definePartsStyle$f(_==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:_}})}var baseStyleOverlay={bg:"blackAlpha.600",zIndex:"modal"},baseStyleDialogContainer={display:"flex",zIndex:"modal",justifyContent:"center"},baseStyleDialog=_=>{const{isFullHeight:a}=_;return{...a&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[$bg$4.variable]:"colors.white",[$bs.variable]:"shadows.lg",_dark:{[$bg$4.variable]:"colors.gray.700",[$bs.variable]:"shadows.dark-lg"},bg:$bg$4.reference,boxShadow:$bs.reference}},baseStyleHeader={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},baseStyleCloseButton={position:"absolute",top:"2",insetEnd:"3"},baseStyleBody={px:"6",py:"2",flex:"1",overflow:"auto"},baseStyleFooter={px:"6",py:"4"},baseStyle$j=definePartsStyle$f(_=>({overlay:baseStyleOverlay,dialogContainer:baseStyleDialogContainer,dialog:runIfFn$1(baseStyleDialog,_),header:baseStyleHeader,closeButton:baseStyleCloseButton,body:baseStyleBody,footer:baseStyleFooter})),sizes$7={xs:getSize$1("xs"),sm:getSize$1("md"),md:getSize$1("lg"),lg:getSize$1("2xl"),xl:getSize$1("4xl"),full:getSize$1("full")},drawerTheme$1=defineMultiStyleConfig$f({baseStyle:baseStyle$j,sizes:sizes$7,defaultProps:{size:"xs"}}),{definePartsStyle:definePartsStyle$e,defineMultiStyleConfig:defineMultiStyleConfig$e}=createMultiStyleConfigHelpers(editableAnatomy.keys),baseStylePreview={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},baseStyleInput={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},baseStyleTextarea={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},baseStyle$i=definePartsStyle$e({preview:baseStylePreview,input:baseStyleInput,textarea:baseStyleTextarea}),editableTheme=defineMultiStyleConfig$e({baseStyle:baseStyle$i}),{definePartsStyle:definePartsStyle$d,defineMultiStyleConfig:defineMultiStyleConfig$d}=createMultiStyleConfigHelpers(formAnatomy.keys),$fg$2=cssVar$1("form-control-color"),baseStyleRequiredIndicator={marginStart:"1",[$fg$2.variable]:"colors.red.500",_dark:{[$fg$2.variable]:"colors.red.300"},color:$fg$2.reference},baseStyleHelperText={mt:"2",[$fg$2.variable]:"colors.gray.600",_dark:{[$fg$2.variable]:"colors.whiteAlpha.600"},color:$fg$2.reference,lineHeight:"normal",fontSize:"sm"},baseStyle$h=definePartsStyle$d({container:{width:"100%",position:"relative"},requiredIndicator:baseStyleRequiredIndicator,helperText:baseStyleHelperText}),formTheme=defineMultiStyleConfig$d({baseStyle:baseStyle$h}),{definePartsStyle:definePartsStyle$c,defineMultiStyleConfig:defineMultiStyleConfig$c}=createMultiStyleConfigHelpers(formErrorAnatomy.keys),$fg$1=cssVar$1("form-error-color"),baseStyleText={[$fg$1.variable]:"colors.red.500",_dark:{[$fg$1.variable]:"colors.red.300"},color:$fg$1.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},baseStyleIcon$1={marginEnd:"0.5em",[$fg$1.variable]:"colors.red.500",_dark:{[$fg$1.variable]:"colors.red.300"},color:$fg$1.reference},baseStyle$g=definePartsStyle$c({text:baseStyleText,icon:baseStyleIcon$1}),formErrorTheme=defineMultiStyleConfig$c({baseStyle:baseStyle$g}),baseStyle$f={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},formLabelTheme={baseStyle:baseStyle$f},baseStyle$e={fontFamily:"heading",fontWeight:"bold"},sizes$6={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},headingTheme={baseStyle:baseStyle$e,sizes:sizes$6,defaultProps:{size:"xl"}},{defineMultiStyleConfig:defineMultiStyleConfig$b,definePartsStyle:definePartsStyle$b}=createMultiStyleConfigHelpers(breadcrumbAnatomy.keys),$decor=cssVar$1("breadcrumb-link-decor"),baseStyleLink={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:$decor.reference,[$decor.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[$decor.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},baseStyle$d=definePartsStyle$b({link:baseStyleLink}),breadcrumbTheme=defineMultiStyleConfig$b({baseStyle:baseStyle$d}),baseStyle$c={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},variantGhost=_=>{const{colorScheme:a,theme:$}=_;if(a==="gray")return{color:mode("gray.800","whiteAlpha.900")(_),_hover:{bg:mode("gray.100","whiteAlpha.200")(_)},_active:{bg:mode("gray.200","whiteAlpha.300")(_)}};const j=transparentize(`${a}.200`,.12)($),et=transparentize(`${a}.200`,.24)($);return{color:mode(`${a}.600`,`${a}.200`)(_),bg:"transparent",_hover:{bg:mode(`${a}.50`,j)(_)},_active:{bg:mode(`${a}.100`,et)(_)}}},variantOutline=_=>{const{colorScheme:a}=_,$=mode("gray.200","whiteAlpha.300")(_);return{border:"1px solid",borderColor:a==="gray"?$:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...runIfFn$1(variantGhost,_)}},accessibleColorMap={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},variantSolid$2=_=>{var a;const{colorScheme:$}=_;if($==="gray"){const it=mode("gray.100","whiteAlpha.200")(_);return{bg:it,color:mode("gray.800","whiteAlpha.900")(_),_hover:{bg:mode("gray.200","whiteAlpha.300")(_),_disabled:{bg:it}},_active:{bg:mode("gray.300","whiteAlpha.400")(_)}}}const{bg:j=`${$}.500`,color:et="white",hoverBg:tt=`${$}.600`,activeBg:rt=`${$}.700`}=(a=accessibleColorMap[$])!=null?a:{},nt=mode(j,`${$}.200`)(_);return{bg:nt,color:mode(et,"gray.800")(_),_hover:{bg:mode(tt,`${$}.300`)(_),_disabled:{bg:nt}},_active:{bg:mode(rt,`${$}.400`)(_)}}},variantLink=_=>{const{colorScheme:a}=_;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:mode(`${a}.500`,`${a}.200`)(_),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:mode(`${a}.700`,`${a}.500`)(_)}}},variantUnstyled={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},variants$9={ghost:variantGhost,outline:variantOutline,solid:variantSolid$2,link:variantLink,unstyled:variantUnstyled},sizes$5={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},buttonTheme$1={baseStyle:baseStyle$c,variants:variants$9,sizes:sizes$5,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:definePartsStyle$a,defineMultiStyleConfig:defineMultiStyleConfig$a}=createMultiStyleConfigHelpers(cardAnatomy.keys),$bg$3=cssVar$1("card-bg"),$padding=cssVar$1("card-padding"),$shadow=cssVar$1("card-shadow"),$radius=cssVar$1("card-radius"),$border$1=cssVar$1("card-border-width","0"),$borderColor=cssVar$1("card-border-color"),baseStyle$b=definePartsStyle$a({container:{[$bg$3.variable]:"colors.chakra-body-bg",backgroundColor:$bg$3.reference,boxShadow:$shadow.reference,borderRadius:$radius.reference,color:"chakra-body-text",borderWidth:$border$1.reference,borderColor:$borderColor.reference},body:{padding:$padding.reference,flex:"1 1 0%"},header:{padding:$padding.reference},footer:{padding:$padding.reference}}),sizes$4={sm:definePartsStyle$a({container:{[$radius.variable]:"radii.base",[$padding.variable]:"space.3"}}),md:definePartsStyle$a({container:{[$radius.variable]:"radii.md",[$padding.variable]:"space.5"}}),lg:definePartsStyle$a({container:{[$radius.variable]:"radii.xl",[$padding.variable]:"space.7"}})},variants$8={elevated:definePartsStyle$a({container:{[$shadow.variable]:"shadows.base",_dark:{[$bg$3.variable]:"colors.gray.700"}}}),outline:definePartsStyle$a({container:{[$border$1.variable]:"1px",[$borderColor.variable]:"colors.chakra-border-color"}}),filled:definePartsStyle$a({container:{[$bg$3.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[$padding.variable]:0},header:{[$padding.variable]:0},footer:{[$padding.variable]:0}}},cardTheme=defineMultiStyleConfig$a({baseStyle:baseStyle$b,variants:variants$8,sizes:sizes$4,defaultProps:{variant:"elevated",size:"md"}}),$size$1=cssVar("close-button-size"),$bg$2=cssVar("close-button-bg"),baseStyle$a={w:[$size$1.reference],h:[$size$1.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[$bg$2.variable]:"colors.blackAlpha.100",_dark:{[$bg$2.variable]:"colors.whiteAlpha.100"}},_active:{[$bg$2.variable]:"colors.blackAlpha.200",_dark:{[$bg$2.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:$bg$2.reference},sizes$3={lg:{[$size$1.variable]:"sizes.10",fontSize:"md"},md:{[$size$1.variable]:"sizes.8",fontSize:"xs"},sm:{[$size$1.variable]:"sizes.6",fontSize:"2xs"}},closeButtonTheme={baseStyle:baseStyle$a,sizes:sizes$3,defaultProps:{size:"md"}},{variants:variants$7,defaultProps:defaultProps$1}=badgeTheme,baseStyle$9={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:vars.bg.reference,color:vars.color.reference,boxShadow:vars.shadow.reference},codeTheme={baseStyle:baseStyle$9,variants:variants$7,defaultProps:defaultProps$1},baseStyle$8={w:"100%",mx:"auto",maxW:"prose",px:"4"},containerTheme={baseStyle:baseStyle$8},baseStyle$7={opacity:.6,borderColor:"inherit"},variantSolid$1={borderStyle:"solid"},variantDashed={borderStyle:"dashed"},variants$6={solid:variantSolid$1,dashed:variantDashed},dividerTheme={baseStyle:baseStyle$7,variants:variants$6,defaultProps:{variant:"solid"}},{definePartsStyle:definePartsStyle$9,defineMultiStyleConfig:defineMultiStyleConfig$9}=createMultiStyleConfigHelpers(accordionAnatomy.keys),baseStyleContainer$1={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},baseStyleButton={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},baseStylePanel={pt:"2",px:"4",pb:"5"},baseStyleIcon={fontSize:"1.25em"},baseStyle$6=definePartsStyle$9({container:baseStyleContainer$1,button:baseStyleButton,panel:baseStylePanel,icon:baseStyleIcon}),accordionTheme=defineMultiStyleConfig$9({baseStyle:baseStyle$6}),{definePartsStyle:definePartsStyle$8,defineMultiStyleConfig:defineMultiStyleConfig$8}=createMultiStyleConfigHelpers(alertAnatomy.keys),$fg=cssVar$1("alert-fg"),$bg$1=cssVar$1("alert-bg"),baseStyle$5=definePartsStyle$8({container:{bg:$bg$1.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:$fg.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:$fg.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function getBg(_){const{theme:a,colorScheme:$}=_,j=transparentize(`${$}.200`,.16)(a);return{light:`colors.${$}.100`,dark:j}}var variantSubtle=definePartsStyle$8(_=>{const{colorScheme:a}=_,$=getBg(_);return{container:{[$fg.variable]:`colors.${a}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${a}.200`,[$bg$1.variable]:$.dark}}}}),variantLeftAccent=definePartsStyle$8(_=>{const{colorScheme:a}=_,$=getBg(_);return{container:{[$fg.variable]:`colors.${a}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${a}.200`,[$bg$1.variable]:$.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:$fg.reference}}}),variantTopAccent=definePartsStyle$8(_=>{const{colorScheme:a}=_,$=getBg(_);return{container:{[$fg.variable]:`colors.${a}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${a}.200`,[$bg$1.variable]:$.dark},pt:"2",borderTopWidth:"4px",borderTopColor:$fg.reference}}}),variantSolid=definePartsStyle$8(_=>{const{colorScheme:a}=_;return{container:{[$fg.variable]:"colors.white",[$bg$1.variable]:`colors.${a}.600`,_dark:{[$fg.variable]:"colors.gray.900",[$bg$1.variable]:`colors.${a}.200`},color:$fg.reference}}}),variants$5={subtle:variantSubtle,"left-accent":variantLeftAccent,"top-accent":variantTopAccent,solid:variantSolid},alertTheme=defineMultiStyleConfig$8({baseStyle:baseStyle$5,variants:variants$5,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:definePartsStyle$7,defineMultiStyleConfig:defineMultiStyleConfig$7}=createMultiStyleConfigHelpers(avatarAnatomy.keys),$border=cssVar$1("avatar-border-color"),$bg=cssVar$1("avatar-bg"),$fs=cssVar$1("avatar-font-size"),$size=cssVar$1("avatar-size"),baseStyleBadge={borderRadius:"full",border:"0.2em solid",borderColor:$border.reference,[$border.variable]:"white",_dark:{[$border.variable]:"colors.gray.800"}},baseStyleExcessLabel={bg:$bg.reference,fontSize:$fs.reference,width:$size.reference,height:$size.reference,lineHeight:"1",[$bg.variable]:"colors.gray.200",_dark:{[$bg.variable]:"colors.whiteAlpha.400"}},baseStyleContainer=_=>{const{name:a,theme:$}=_,j=a?randomColor({string:a}):"colors.gray.400",et=isDark(j)($);let tt="white";return et||(tt="gray.800"),{bg:$bg.reference,fontSize:$fs.reference,color:tt,borderColor:$border.reference,verticalAlign:"top",width:$size.reference,height:$size.reference,"&:not([data-loaded])":{[$bg.variable]:j},[$border.variable]:"colors.white",_dark:{[$border.variable]:"colors.gray.800"}}},baseStyleLabel={fontSize:$fs.reference,lineHeight:"1"},baseStyle$4=definePartsStyle$7(_=>({badge:runIfFn$1(baseStyleBadge,_),excessLabel:runIfFn$1(baseStyleExcessLabel,_),container:runIfFn$1(baseStyleContainer,_),label:baseStyleLabel}));function getSize(_){const a=_!=="100%"?sizes_default[_]:void 0;return definePartsStyle$7({container:{[$size.variable]:a??_,[$fs.variable]:`calc(${a??_} / 2.5)`},excessLabel:{[$size.variable]:a??_,[$fs.variable]:`calc(${a??_} / 2.5)`}})}var sizes$2={"2xs":getSize(4),xs:getSize(6),sm:getSize(8),md:getSize(12),lg:getSize(16),xl:getSize(24),"2xl":getSize(32),full:getSize("100%")},avatarTheme=defineMultiStyleConfig$7({baseStyle:baseStyle$4,sizes:sizes$2,defaultProps:{size:"md"}}),components={Accordion:accordionTheme,Alert:alertTheme,Avatar:avatarTheme,Badge:badgeTheme,Breadcrumb:breadcrumbTheme,Button:buttonTheme$1,Checkbox:checkboxTheme$1,CloseButton:closeButtonTheme,Code:codeTheme,Container:containerTheme,Divider:dividerTheme,Drawer:drawerTheme$1,Editable:editableTheme,Form:formTheme,FormError:formErrorTheme,FormLabel:formLabelTheme,Heading:headingTheme,Input:inputTheme,Kbd:kbdTheme,Link:linkTheme,List:listTheme$1,Menu:menuTheme,Modal:modalTheme$1,NumberInput:numberInputTheme,PinInput:pinInputTheme,Popover:popoverTheme,Progress:progressTheme,Radio:radioTheme$1,Select:selectTheme,Skeleton:skeletonTheme,SkipLink:skipLinkTheme,Slider:sliderTheme,Spinner:spinnerTheme,Stat:statTheme,Switch:switchTheme$1,Table:tableTheme,Tabs:tabsTheme$1,Tag:tagTheme,Textarea:textareaTheme,Tooltip:tooltipTheme,Card:cardTheme,Stepper:stepperTheme},semanticTokens={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},styles={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},direction="ltr",config$4={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},theme$1={semanticTokens,direction,...foundations,components,styles,config:config$4};function isFunction$6(_){return typeof _=="function"}function pipe$2(..._){return a=>_.reduce(($,j)=>j($),a)}var createExtendTheme=_=>function(...$){let j=[...$],et=$[$.length-1];return isChakraTheme(et)&&j.length>1?j=j.slice(0,j.length-1):et=_,pipe$2(...j.map(tt=>rt=>isFunction$6(tt)?tt(rt):mergeThemeOverride(rt,tt)))(et)},extendTheme=createExtendTheme(theme$1);function mergeThemeOverride(..._){return mergeWith({},..._,mergeThemeCustomizer)}function mergeThemeCustomizer(_,a,$,j){if((isFunction$6(_)||isFunction$6(a))&&Object.prototype.hasOwnProperty.call(j,$))return(...et)=>{const tt=isFunction$6(_)?_(...et):_,rt=isFunction$6(a)?a(...et):a;return mergeWith({},tt,rt,mergeThemeCustomizer)}}function isElement$4(_){return _!=null&&typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE}function getOwnerDocument$3(_){var a;return isElement$4(_)&&(a=_.ownerDocument)!=null?a:document}function canUseDOM$1(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var isBrowser$2=canUseDOM$1();function omit$5(_,a){const $={};return Object.keys(_).forEach(j=>{a.includes(j)||($[j]=_[j])}),$}function get$5(_,a,$,j){const et=typeof a=="string"?a.split("."):[a];for(j=0;j{const a=new WeakMap;return(j,et,tt,rt)=>{if(typeof j>"u")return _(j,et,tt);a.has(j)||a.set(j,new Map);const nt=a.get(j);if(nt.has(et))return nt.get(et);const it=_(j,et,tt,rt);return nt.set(et,it),it}},memoizedGet=memoize(get$5);function objectFilter(_,a){const $={};return Object.keys(_).forEach(j=>{const et=_[j];a(et,j,_)&&($[j]=et)}),$}var filterUndefined=_=>objectFilter(_,a=>a!=null);function isFunction$5(_){return typeof _=="function"}function runIfFn(_,...a){return isFunction$5(_)?_(...a):_}function callAllHandlers(..._){return function($){_.some(j=>(j==null||j($),$==null?void 0:$.defaultPrevented))}}var hasElementType=typeof Element<"u",hasMap=typeof Map=="function",hasSet=typeof Set=="function",hasArrayBuffer=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function equal$1(_,a){if(_===a)return!0;if(_&&a&&typeof _=="object"&&typeof a=="object"){if(_.constructor!==a.constructor)return!1;var $,j,et;if(Array.isArray(_)){if($=_.length,$!=a.length)return!1;for(j=$;j--!==0;)if(!equal$1(_[j],a[j]))return!1;return!0}var tt;if(hasMap&&_ instanceof Map&&a instanceof Map){if(_.size!==a.size)return!1;for(tt=_.entries();!(j=tt.next()).done;)if(!a.has(j.value[0]))return!1;for(tt=_.entries();!(j=tt.next()).done;)if(!equal$1(j.value[1],a.get(j.value[0])))return!1;return!0}if(hasSet&&_ instanceof Set&&a instanceof Set){if(_.size!==a.size)return!1;for(tt=_.entries();!(j=tt.next()).done;)if(!a.has(j.value[0]))return!1;return!0}if(hasArrayBuffer&&ArrayBuffer.isView(_)&&ArrayBuffer.isView(a)){if($=_.length,$!=a.length)return!1;for(j=$;j--!==0;)if(_[j]!==a[j])return!1;return!0}if(_.constructor===RegExp)return _.source===a.source&&_.flags===a.flags;if(_.valueOf!==Object.prototype.valueOf&&typeof _.valueOf=="function"&&typeof a.valueOf=="function")return _.valueOf()===a.valueOf();if(_.toString!==Object.prototype.toString&&typeof _.toString=="function"&&typeof a.toString=="function")return _.toString()===a.toString();if(et=Object.keys(_),$=et.length,$!==Object.keys(a).length)return!1;for(j=$;j--!==0;)if(!Object.prototype.hasOwnProperty.call(a,et[j]))return!1;if(hasElementType&&_ instanceof Element)return!1;for(j=$;j--!==0;)if(!((et[j]==="_owner"||et[j]==="__v"||et[j]==="__o")&&_.$$typeof)&&!equal$1(_[et[j]],a[et[j]]))return!1;return!0}return _!==_&&a!==a}var reactFastCompare=function(a,$){try{return equal$1(a,$)}catch(j){if((j.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw j}};const isEqual$2=getDefaultExportFromCjs$1(reactFastCompare);function useStyleConfigImpl(_,a={}){var $;const{styleConfig:j,...et}=a,{theme:tt,colorMode:rt}=useChakra(),nt=_?memoizedGet(tt,`components.${_}`):void 0,it=j||nt,ot=mergeWith({theme:tt,colorMode:rt},($=it==null?void 0:it.defaultProps)!=null?$:{},filterUndefined(omit$5(et,["children"]))),st=reactExports.useRef({});if(it){const ut=resolveStyleConfig(it)(ot);isEqual$2(st.current,ut)||(st.current=ut)}return st.current}function useStyleConfig(_,a={}){return useStyleConfigImpl(_,a)}function useMultiStyleConfig(_,a={}){return useStyleConfigImpl(_,a)}var allPropNames=new Set([...propNames,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),validHTMLProps=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function shouldForwardProp(_){return validHTMLProps.has(_)||!allPropNames.has(_)}function assignAfter(_,...a){if(_==null)throw new TypeError("Cannot convert undefined or null to object");const $={..._};for(const j of a)if(j!=null)for(const et in j)Object.prototype.hasOwnProperty.call(j,et)&&(et in $&&delete $[et],$[et]=j[et]);return $}function compact$1(_){const a=Object.assign({},_);for(let $ in a)a[$]===void 0&&delete a[$];return a}function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(_){for(var a=1;a96?testOmitPropsOnStringTag:testOmitPropsOnComponent},composeShouldForwardProps=function(a,$,j){var et;if($){var tt=$.shouldForwardProp;et=a.__emotion_forwardProp&&tt?function(rt){return a.__emotion_forwardProp(rt)&&tt(rt)}:tt}return typeof et!="function"&&j&&(et=a.__emotion_forwardProp),et},Insertion=function(a){var $=a.cache,j=a.serialized,et=a.isStringTag;return registerStyles($,j,et),useInsertionEffectAlwaysWithSyncFallback(function(){return insertStyles($,j,et)}),null},createStyled=function _(a,$){var j=a.__emotion_real===a,et=j&&a.__emotion_base||a,tt,rt;$!==void 0&&(tt=$.label,rt=$.target);var nt=composeShouldForwardProps(a,$,j),it=nt||getDefaultShouldForwardProp(et),ot=!it("as");return function(){var st=arguments,at=j&&a.__emotion_styles!==void 0?a.__emotion_styles.slice(0):[];if(tt!==void 0&&at.push("label:"+tt+";"),st[0]==null||st[0].raw===void 0)at.push.apply(at,st);else{at.push(st[0][0]);for(var ut=st.length,ht=1;hta=>{const{theme:$,css:j,__css:et,sx:tt,...rt}=a,nt=objectFilter(rt,(at,ut)=>isStyleProp(ut)),it=runIfFn(_,a),ot=assignAfter({},et,it,filterUndefined(nt),tt),st=css(ot)(a.theme);return j?[st,j]:st};function styled(_,a){const{baseStyle:$,...j}=a??{};j.shouldForwardProp||(j.shouldForwardProp=shouldForwardProp);const et=toCSSObject({baseStyle:$}),tt=emotion_styled(_,j)(et);return React$2.forwardRef(function(it,ot){const{colorMode:st,forced:at}=useColorMode();return React$2.createElement(tt,{ref:ot,"data-theme":at?st:void 0,...it})})}function factory(){const _=new Map;return new Proxy(styled,{apply(a,$,j){return styled(...j)},get(a,$){return _.has($)||_.set($,styled($)),_.get($)}})}var chakra=factory();function forwardRef(_){return reactExports.forwardRef(_)}function createContext(_={}){const{strict:a=!0,errorMessage:$="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:j}=_,et=reactExports.createContext(void 0);et.displayName=j;function tt(){var rt;const nt=reactExports.useContext(et);if(!nt&&a){const it=new Error($);throw it.name="ContextError",(rt=Error.captureStackTrace)==null||rt.call(Error,it,tt),it}return nt}return[et.Provider,tt,et]}function ThemeProvider(_){const{cssVarsRoot:a,theme:$,children:j}=_,et=reactExports.useMemo(()=>toCSSVar($),[$]);return jsxRuntimeExports.jsxs(ThemeProvider$1,{theme:et,children:[jsxRuntimeExports.jsx(CSSVars,{root:a}),j]})}function CSSVars({root:_=":host, :root"}){const a=[_,"[data-theme]"].join(",");return jsxRuntimeExports.jsx(Global,{styles:$=>({[a]:$.__cssVars})})}createContext({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function createStylesContext(_){return createContext({name:`${_}StylesContext`,errorMessage:`useStyles: "styles" is undefined. Seems you forgot to wrap the components in "<${_} />" `})}function GlobalStyle(){const{colorMode:_}=useColorMode();return jsxRuntimeExports.jsx(Global,{styles:a=>{const $=memoizedGet(a,"styles.global"),j=runIfFn($,{theme:a,colorMode:_});return j?css(j)(a):void 0}})}var EnvironmentContext=reactExports.createContext({getDocument(){return document},getWindow(){return window}});EnvironmentContext.displayName="EnvironmentContext";function useEnvironment({defer:_}={}){const[,a]=reactExports.useReducer($=>$+1,0);return useSafeLayoutEffect$2(()=>{_&&a()},[_]),reactExports.useContext(EnvironmentContext)}function EnvironmentProvider(_){const{children:a,environment:$,disabled:j}=_,et=reactExports.useRef(null),tt=reactExports.useMemo(()=>$||{getDocument:()=>{var nt,it;return(it=(nt=et.current)==null?void 0:nt.ownerDocument)!=null?it:document},getWindow:()=>{var nt,it;return(it=(nt=et.current)==null?void 0:nt.ownerDocument.defaultView)!=null?it:window}},[$]),rt=!j||!$;return jsxRuntimeExports.jsxs(EnvironmentContext.Provider,{value:tt,children:[a,rt&&jsxRuntimeExports.jsx("span",{id:"__chakra_env",hidden:!0,ref:et})]})}EnvironmentProvider.displayName="EnvironmentProvider";var ChakraProvider$1=_=>{const{children:a,colorModeManager:$,portalZIndex:j,resetScope:et,resetCSS:tt=!0,theme:rt={},environment:nt,cssVarsRoot:it,disableEnvironment:ot,disableGlobalStyle:st}=_,at=jsxRuntimeExports.jsx(EnvironmentProvider,{environment:nt,disabled:ot,children:a});return jsxRuntimeExports.jsx(ThemeProvider,{theme:rt,cssVarsRoot:it,children:jsxRuntimeExports.jsxs(ColorModeProvider,{colorModeManager:$,options:rt.config,children:[tt?jsxRuntimeExports.jsx(CSSReset,{scope:et}):jsxRuntimeExports.jsx(CSSPolyfill,{}),!st&&jsxRuntimeExports.jsx(GlobalStyle,{}),j?jsxRuntimeExports.jsx(PortalManager,{zIndex:j,children:at}):at]})})},findById=(_,a)=>_.find($=>$.id===a);function findToast(_,a){const $=getToastPosition(_,a),j=$?_[$].findIndex(et=>et.id===a):-1;return{position:$,index:j}}function getToastPosition(_,a){for(const[$,j]of Object.entries(_))if(findById(j,a))return $}function getToastStyle(_){const a=_.includes("right"),$=_.includes("left");let j="center";return a&&(j="flex-end"),$&&(j="flex-start"),{display:"flex",flexDirection:"column",alignItems:j}}function getToastListStyle(_){const $=_==="top"||_==="bottom"?"0 auto":void 0,j=_.includes("top")?"env(safe-area-inset-top, 0px)":void 0,et=_.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,tt=_.includes("left")?void 0:"env(safe-area-inset-right, 0px)",rt=_.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:$,top:j,bottom:et,right:tt,left:rt}}function useCallbackRef$2(_,a=[]){const $=reactExports.useRef(_);return reactExports.useEffect(()=>{$.current=_}),reactExports.useCallback((...j)=>{var et;return(et=$.current)==null?void 0:et.call($,...j)},a)}function useTimeout(_,a){const $=useCallbackRef$2(_);reactExports.useEffect(()=>{if(a==null)return;let j=null;return j=window.setTimeout(()=>{$()},a),()=>{j&&window.clearTimeout(j)}},[a,$])}function useUpdateEffect(_,a){const $=reactExports.useRef(!1),j=reactExports.useRef(!1);reactExports.useEffect(()=>{if($.current&&j.current)return _();j.current=!0},a),reactExports.useEffect(()=>($.current=!0,()=>{$.current=!1}),[])}const MotionConfigContext=reactExports.createContext({transformPagePoint:_=>_,isStatic:!1,reducedMotion:"never"}),MotionContext=reactExports.createContext({}),PresenceContext=reactExports.createContext(null),isBrowser$1=typeof document<"u",useIsomorphicLayoutEffect$2=isBrowser$1?reactExports.useLayoutEffect:reactExports.useEffect,LazyContext=reactExports.createContext({strict:!1}),camelToDash=_=>_.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),MotionGlobalConfig={skipAnimations:!1,useManualTiming:!1};class Queue{constructor(){this.order=[],this.scheduled=new Set}add(a){if(!this.scheduled.has(a))return this.scheduled.add(a),this.order.push(a),!0}remove(a){const $=this.order.indexOf(a);$!==-1&&(this.order.splice($,1),this.scheduled.delete(a))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(_){let a=new Queue,$=new Queue,j=0,et=!1,tt=!1;const rt=new WeakSet,nt={schedule:(it,ot=!1,st=!1)=>{const at=st&&et,ut=at?a:$;return ot&&rt.add(it),ut.add(it)&&at&&et&&(j=a.order.length),it},cancel:it=>{$.remove(it),rt.delete(it)},process:it=>{if(et){tt=!0;return}if(et=!0,[a,$]=[$,a],$.clear(),j=a.order.length,j)for(let ot=0;ot(at[ut]=createRenderStep(()=>$=!0),at),{}),rt=at=>{tt[at].process(et)},nt=()=>{const at=performance.now();$=!1,et.delta=j?1e3/60:Math.max(Math.min(at-et.timestamp,maxElapsed),1),et.timestamp=at,et.isProcessing=!0,stepsOrder.forEach(rt),et.isProcessing=!1,$&&a&&(j=!1,_(nt))},it=()=>{$=!0,j=!0,et.isProcessing||_(nt)};return{schedule:stepsOrder.reduce((at,ut)=>{const ht=tt[ut];return at[ut]=(bt,Et=!1,Ct=!1)=>($||it(),ht.schedule(bt,Et,Ct)),at},{}),cancel:at=>stepsOrder.forEach(ut=>tt[ut].cancel(at)),state:et,steps:tt}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(_,a,$,j){const{visualElement:et}=reactExports.useContext(MotionContext),tt=reactExports.useContext(LazyContext),rt=reactExports.useContext(PresenceContext),nt=reactExports.useContext(MotionConfigContext).reducedMotion,it=reactExports.useRef();j=j||tt.renderer,!it.current&&j&&(it.current=j(_,{visualState:a,parent:et,props:$,presenceContext:rt,blockInitialAnimation:rt?rt.initial===!1:!1,reducedMotionConfig:nt}));const ot=it.current;reactExports.useInsertionEffect(()=>{ot&&ot.update($,rt)});const st=reactExports.useRef(!!($[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$2(()=>{ot&&(microtask.render(ot.render),st.current&&ot.animationState&&ot.animationState.animateChanges())}),reactExports.useEffect(()=>{ot&&(ot.updateFeatures(),!st.current&&ot.animationState&&ot.animationState.animateChanges(),st.current&&(st.current=!1,window.HandoffComplete=!0))}),ot}function isRefObject$2(_){return _&&typeof _=="object"&&Object.prototype.hasOwnProperty.call(_,"current")}function useMotionRef(_,a,$){return reactExports.useCallback(j=>{j&&_.mount&&_.mount(j),a&&(j?a.mount(j):a.unmount()),$&&(typeof $=="function"?$(j):isRefObject$2($)&&($.current=j))},[a])}function isVariantLabel(_){return typeof _=="string"||Array.isArray(_)}function isAnimationControls(_){return _!==null&&typeof _=="object"&&typeof _.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(_){return isAnimationControls(_.animate)||variantProps.some(a=>isVariantLabel(_[a]))}function isVariantNode(_){return!!(isControllingVariants(_)||_.variants)}function getCurrentTreeVariants(_,a){if(isControllingVariants(_)){const{initial:$,animate:j}=_;return{initial:$===!1||isVariantLabel($)?$:void 0,animate:isVariantLabel(j)?j:void 0}}return _.inherit!==!1?a:{}}function useCreateMotionContext(_){const{initial:a,animate:$}=getCurrentTreeVariants(_,reactExports.useContext(MotionContext));return reactExports.useMemo(()=>({initial:a,animate:$}),[variantLabelsAsDependency(a),variantLabelsAsDependency($)])}function variantLabelsAsDependency(_){return Array.isArray(_)?_.join(" "):_}const featureProps={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},featureDefinitions={};for(const _ in featureProps)featureDefinitions[_]={isEnabled:a=>featureProps[_].some($=>!!a[$])};function loadFeatures(_){for(const a in _)featureDefinitions[a]={...featureDefinitions[a],..._[a]}}const LayoutGroupContext=reactExports.createContext({}),SwitchLayoutGroupContext=reactExports.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:_,createVisualElement:a,useRender:$,useVisualState:j,Component:et}){_&&loadFeatures(_);function tt(nt,it){let ot;const st={...reactExports.useContext(MotionConfigContext),...nt,layoutId:useLayoutId(nt)},{isStatic:at}=st,ut=useCreateMotionContext(nt),ht=j(nt,at);if(!at&&isBrowser$1){ut.visualElement=useVisualElement(et,ht,st,a);const bt=reactExports.useContext(SwitchLayoutGroupContext),Et=reactExports.useContext(LazyContext).strict;ut.visualElement&&(ot=ut.visualElement.loadFeatures(st,Et,_,bt))}return jsxRuntimeExports.jsxs(MotionContext.Provider,{value:ut,children:[ot&&ut.visualElement?jsxRuntimeExports.jsx(ot,{visualElement:ut.visualElement,...st}):null,$(et,nt,useMotionRef(ht,ut.visualElement,it),ht,at,ut.visualElement)]})}const rt=reactExports.forwardRef(tt);return rt[motionComponentSymbol]=et,rt}function useLayoutId({layoutId:_}){const a=reactExports.useContext(LayoutGroupContext).id;return a&&_!==void 0?a+"-"+_:_}function createMotionProxy(_){function a(j,et={}){return createMotionComponent(_(j,et))}if(typeof Proxy>"u")return a;const $=new Map;return new Proxy(a,{get:(j,et)=>($.has(et)||$.set(et,a(et)),$.get(et))})}const lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(_){return typeof _!="string"||_.includes("-")?!1:!!(lowercaseSVGElements.indexOf(_)>-1||/[A-Z]/u.test(_))}const scaleCorrectors={};function addScaleCorrector(_){Object.assign(scaleCorrectors,_)}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder);function isForcedMotionValue(_,{layout:a,layoutId:$}){return transformProps.has(_)||_.startsWith("origin")||(a||$!==void 0)&&(!!scaleCorrectors[_]||_==="opacity")}const isMotionValue=_=>!!(_&&_.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(_,{enableHardwareAcceleration:a=!0,allowTransformNone:$=!0},j,et){let tt="";for(let rt=0;rta=>typeof a=="string"&&a.startsWith(_),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=_=>startsAsVariableToken(_)?singleCssVariableRegex.test(_.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(_,a)=>a&&typeof _=="number"?a.transform(_):_,clamp=(_,a,$)=>$>a?a:$<_?_:$,number$4={test:_=>typeof _=="number",parse:parseFloat,transform:_=>_},alpha={...number$4,transform:_=>clamp(0,1,_)},scale$1={...number$4,default:1},sanitize=_=>Math.round(_*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function isString$4(_){return typeof _=="string"}const createUnitType=_=>({test:a=>isString$4(a)&&a.endsWith(_)&&a.split(" ").length===1,parse:parseFloat,transform:a=>`${a}${_}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:_=>percent.parse(_)/100,transform:_=>percent.transform(_*100)},int$1={...number$4,transform:Math.round},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale:scale$1,scaleX:scale$1,scaleY:scale$1,scaleZ:scale$1,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int$1,backgroundPositionX:px,backgroundPositionY:px,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int$1};function buildHTMLStyles(_,a,$,j){const{style:et,vars:tt,transform:rt,transformOrigin:nt}=_;let it=!1,ot=!1,st=!0;for(const at in a){const ut=a[at];if(isCSSVariableName(at)){tt[at]=ut;continue}const ht=numberValueTypes[at],bt=getValueAsType(ut,ht);if(transformProps.has(at)){if(it=!0,rt[at]=bt,!st)continue;ut!==(ht.default||0)&&(st=!1)}else at.startsWith("origin")?(ot=!0,nt[at]=bt):et[at]=bt}if(a.transform||(it||j?et.transform=buildTransform(_.transform,$,st,j):et.transform&&(et.transform="none")),ot){const{originX:at="50%",originY:ut="50%",originZ:ht=0}=nt;et.transformOrigin=`${at} ${ut} ${ht}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(_,a,$){for(const j in a)!isMotionValue(a[j])&&!isForcedMotionValue(j,$)&&(_[j]=a[j])}function useInitialMotionValues({transformTemplate:_},a,$){return reactExports.useMemo(()=>{const j=createHtmlRenderState();return buildHTMLStyles(j,a,{enableHardwareAcceleration:!$},_),Object.assign({},j.vars,j.style)},[a])}function useStyle(_,a,$){const j=_.style||{},et={};return copyRawValuesOnly(et,j,_),Object.assign(et,useInitialMotionValues(_,a,$)),et}function useHTMLProps(_,a,$){const j={},et=useStyle(_,a,$);return _.drag&&_.dragListener!==!1&&(j.draggable=!1,et.userSelect=et.WebkitUserSelect=et.WebkitTouchCallout="none",et.touchAction=_.drag===!0?"none":`pan-${_.drag==="x"?"y":"x"}`),_.tabIndex===void 0&&(_.onTap||_.onTapStart||_.whileTap)&&(j.tabIndex=0),j.style=et,j}const validMotionProps=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function isValidMotionProp(_){return _.startsWith("while")||_.startsWith("drag")&&_!=="draggable"||_.startsWith("layout")||_.startsWith("onTap")||_.startsWith("onPan")||_.startsWith("onLayout")||validMotionProps.has(_)}let shouldForward=_=>!isValidMotionProp(_);function loadExternalIsValidProp(_){_&&(shouldForward=a=>a.startsWith("on")?!isValidMotionProp(a):_(a))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(_,a,$){const j={};for(const et in _)et==="values"&&typeof _.values=="object"||(shouldForward(et)||$===!0&&isValidMotionProp(et)||!a&&!isValidMotionProp(et)||_.draggable&&et.startsWith("onDrag"))&&(j[et]=_[et]);return j}function calcOrigin$1(_,a,$){return typeof _=="string"?_:px.transform(a+$*_)}function calcSVGTransformOrigin(_,a,$){const j=calcOrigin$1(a,_.x,_.width),et=calcOrigin$1($,_.y,_.height);return`${j} ${et}`}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(_,a,$=1,j=0,et=!0){_.pathLength=1;const tt=et?dashKeys:camelKeys;_[tt.offset]=px.transform(-j);const rt=px.transform(a),nt=px.transform($);_[tt.array]=`${rt} ${nt}`}function buildSVGAttrs(_,{attrX:a,attrY:$,attrScale:j,originX:et,originY:tt,pathLength:rt,pathSpacing:nt=1,pathOffset:it=0,...ot},st,at,ut){if(buildHTMLStyles(_,ot,st,ut),at){_.style.viewBox&&(_.attrs.viewBox=_.style.viewBox);return}_.attrs=_.style,_.style={};const{attrs:ht,style:bt,dimensions:Et}=_;ht.transform&&(Et&&(bt.transform=ht.transform),delete ht.transform),Et&&(et!==void 0||tt!==void 0||bt.transform)&&(bt.transformOrigin=calcSVGTransformOrigin(Et,et!==void 0?et:.5,tt!==void 0?tt:.5)),a!==void 0&&(ht.x=a),$!==void 0&&(ht.y=$),j!==void 0&&(ht.scale=j),rt!==void 0&&buildSVGPath(ht,rt,nt,it,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=_=>typeof _=="string"&&_.toLowerCase()==="svg";function useSVGProps(_,a,$,j){const et=reactExports.useMemo(()=>{const tt=createSvgRenderState();return buildSVGAttrs(tt,a,{enableHardwareAcceleration:!1},isSVGTag(j),_.transformTemplate),{...tt.attrs,style:{...tt.style}}},[a]);if(_.style){const tt={};copyRawValuesOnly(tt,_.style,_),et.style={...tt,...et.style}}return et}function createUseRender(_=!1){return($,j,et,{latestValues:tt},rt)=>{const it=(isSVGComponent($)?useSVGProps:useHTMLProps)(j,tt,rt,$),ot=filterProps(j,typeof $=="string",_),st=$!==reactExports.Fragment?{...ot,...it,ref:et}:{},{children:at}=j,ut=reactExports.useMemo(()=>isMotionValue(at)?at.get():at,[at]);return reactExports.createElement($,{...st,children:ut})}}function renderHTML(_,{style:a,vars:$},j,et){Object.assign(_.style,a,et&&et.getProjectionStyles(j));for(const tt in $)_.style.setProperty(tt,$[tt])}const camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(_,a,$,j){renderHTML(_,a,void 0,j);for(const et in a.attrs)_.setAttribute(camelCaseAttributes.has(et)?et:camelToDash(et),a.attrs[et])}function scrapeMotionValuesFromProps$1(_,a,$){var j;const{style:et}=_,tt={};for(const rt in et)(isMotionValue(et[rt])||a.style&&isMotionValue(a.style[rt])||isForcedMotionValue(rt,_)||((j=$==null?void 0:$.getValue(rt))===null||j===void 0?void 0:j.liveStyle)!==void 0)&&(tt[rt]=et[rt]);return tt}function scrapeMotionValuesFromProps(_,a,$){const j=scrapeMotionValuesFromProps$1(_,a,$);for(const et in _)if(isMotionValue(_[et])||isMotionValue(a[et])){const tt=transformPropOrder.indexOf(et)!==-1?"attr"+et.charAt(0).toUpperCase()+et.substring(1):et;j[tt]=_[et]}return j}function getValueState(_){const a=[{},{}];return _==null||_.values.forEach(($,j)=>{a[0][j]=$.get(),a[1][j]=$.getVelocity()}),a}function resolveVariantFromProps(_,a,$,j){if(typeof a=="function"){const[et,tt]=getValueState(j);a=a($!==void 0?$:_.custom,et,tt)}if(typeof a=="string"&&(a=_.variants&&_.variants[a]),typeof a=="function"){const[et,tt]=getValueState(j);a=a($!==void 0?$:_.custom,et,tt)}return a}function useConstant(_){const a=reactExports.useRef(null);return a.current===null&&(a.current=_()),a.current}const isKeyframesTarget=_=>Array.isArray(_),isCustomValue=_=>!!(_&&typeof _=="object"&&_.mix&&_.toValue),resolveFinalValueInKeyframes=_=>isKeyframesTarget(_)?_[_.length-1]||0:_;function resolveMotionValue(_){const a=isMotionValue(_)?_.get():_;return isCustomValue(a)?a.toValue():a}function makeState({scrapeMotionValuesFromProps:_,createRenderState:a,onMount:$},j,et,tt){const rt={latestValues:makeLatestValues(j,et,tt,_),renderState:a()};return $&&(rt.mount=nt=>$(j,nt,rt)),rt}const makeUseVisualState=_=>(a,$)=>{const j=reactExports.useContext(MotionContext),et=reactExports.useContext(PresenceContext),tt=()=>makeState(_,a,j,et);return $?tt():useConstant(tt)};function makeLatestValues(_,a,$,j){const et={},tt=j(_,{});for(const ut in tt)et[ut]=resolveMotionValue(tt[ut]);let{initial:rt,animate:nt}=_;const it=isControllingVariants(_),ot=isVariantNode(_);a&&ot&&!it&&_.inherit!==!1&&(rt===void 0&&(rt=a.initial),nt===void 0&&(nt=a.animate));let st=$?$.initial===!1:!1;st=st||rt===!1;const at=st?nt:rt;return at&&typeof at!="boolean"&&!isAnimationControls(at)&&(Array.isArray(at)?at:[at]).forEach(ht=>{const bt=resolveVariantFromProps(_,ht);if(!bt)return;const{transitionEnd:Et,transition:Ct,...Pt}=bt;for(const Tt in Pt){let It=Pt[Tt];if(Array.isArray(It)){const Lt=st?It.length-1:0;It=It[Lt]}It!==null&&(et[Tt]=It)}for(const Tt in Et)et[Tt]=Et[Tt]}),et}const noop$b=_=>_,{schedule:frame,cancel:cancelFrame,state:frameData,steps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop$b,!0),svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(_,a,{renderState:$,latestValues:j})=>{frame.read(()=>{try{$.dimensions=typeof a.getBBox=="function"?a.getBBox():a.getBoundingClientRect()}catch{$.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs($,j,{enableHardwareAcceleration:!1},isSVGTag(a.tagName),_.transformTemplate),renderSVG(a,$)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(_,{forwardMotionProps:a=!1},$,j){return{...isSVGComponent(_)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:$,useRender:createUseRender(a),createVisualElement:j,Component:_}}function addDomEvent(_,a,$,j={passive:!0}){return _.addEventListener(a,$,j),()=>_.removeEventListener(a,$)}const isPrimaryPointer=_=>_.pointerType==="mouse"?typeof _.button!="number"||_.button<=0:_.isPrimary!==!1;function extractEventInfo(_,a="page"){return{point:{x:_[`${a}X`],y:_[`${a}Y`]}}}const addPointerInfo=_=>a=>isPrimaryPointer(a)&&_(a,extractEventInfo(a));function addPointerEvent(_,a,$,j){return addDomEvent(_,a,addPointerInfo($),j)}const combineFunctions=(_,a)=>$=>a(_($)),pipe$1=(..._)=>_.reduce(combineFunctions);function createLock(_){let a=null;return()=>{const $=()=>{a=null};return a===null?(a=_,$):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(_){let a=!1;if(_==="y")a=globalVerticalLock();else if(_==="x")a=globalHorizontalLock();else{const $=globalHorizontalLock(),j=globalVerticalLock();$&&j?a=()=>{$(),j()}:($&&$(),j&&j())}return a}function isDragActive(){const _=getGlobalLock(!0);return _?(_(),!1):!0}class Feature{constructor(a){this.isMounted=!1,this.node=a}update(){}}function addHoverEvent(_,a){const $=a?"pointerenter":"pointerleave",j=a?"onHoverStart":"onHoverEnd",et=(tt,rt)=>{if(tt.pointerType==="touch"||isDragActive())return;const nt=_.getProps();_.animationState&&nt.whileHover&&_.animationState.setActive("whileHover",a);const it=nt[j];it&&frame.postRender(()=>it(tt,rt))};return addPointerEvent(_.current,$,et,{passive:!_.getProps()[j]})}class HoverGesture extends Feature{mount(){this.unmount=pipe$1(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch{a=!0}!a||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe$1(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const isNodeOrChild=(_,a)=>a?_===a?!0:isNodeOrChild(_,a.parentElement):!1;function fireSyntheticPointerEvent(_,a){if(!a)return;const $=new PointerEvent("pointer"+_);a($,extractEventInfo($))}class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=noop$b,this.removeEndListeners=noop$b,this.removeAccessibleListeners=noop$b,this.startPointerPress=(a,$)=>{if(this.isPressing)return;this.removeEndListeners();const j=this.node.getProps(),tt=addPointerEvent(window,"pointerup",(nt,it)=>{if(!this.checkPressEnd())return;const{onTap:ot,onTapCancel:st,globalTapTarget:at}=this.node.getProps(),ut=!at&&!isNodeOrChild(this.node.current,nt.target)?st:ot;ut&&frame.update(()=>ut(nt,it))},{passive:!(j.onTap||j.onPointerUp)}),rt=addPointerEvent(window,"pointercancel",(nt,it)=>this.cancelPress(nt,it),{passive:!(j.onTapCancel||j.onPointerCancel)});this.removeEndListeners=pipe$1(tt,rt),this.startPress(a,$)},this.startAccessiblePress=()=>{const a=tt=>{if(tt.key!=="Enter"||this.isPressing)return;const rt=nt=>{nt.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(it,ot)=>{const{onTap:st}=this.node.getProps();st&&frame.postRender(()=>st(it,ot))})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",rt),fireSyntheticPointerEvent("down",(nt,it)=>{this.startPress(nt,it)})},$=addDomEvent(this.node.current,"keydown",a),j=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(tt,rt)=>this.cancelPress(tt,rt))},et=addDomEvent(this.node.current,"blur",j);this.removeAccessibleListeners=pipe$1($,et)}}startPress(a,$){this.isPressing=!0;const{onTapStart:j,whileTap:et}=this.node.getProps();et&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),j&&frame.postRender(()=>j(a,$))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(a,$){if(!this.checkPressEnd())return;const{onTapCancel:j}=this.node.getProps();j&&frame.postRender(()=>j(a,$))}mount(){const a=this.node.getProps(),$=addPointerEvent(a.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(a.onTapStart||a.onPointerStart)}),j=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe$1($,j)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=_=>{const a=observerCallbacks.get(_.target);a&&a(_)},fireAllObserverCallbacks=_=>{_.forEach(fireObserverCallback)};function initIntersectionObserver({root:_,...a}){const $=_||document;observers.has($)||observers.set($,{});const j=observers.get($),et=JSON.stringify(a);return j[et]||(j[et]=new IntersectionObserver(fireAllObserverCallbacks,{root:_,...a})),j[et]}function observeIntersection(_,a,$){const j=initIntersectionObserver(a);return observerCallbacks.set(_,$),j.observe(_),()=>{observerCallbacks.delete(_),j.unobserve(_)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:a={}}=this.node.getProps(),{root:$,margin:j,amount:et="some",once:tt}=a,rt={root:$?$.current:void 0,rootMargin:j,threshold:typeof et=="number"?et:thresholdNames[et]},nt=it=>{const{isIntersecting:ot}=it;if(this.isInView===ot||(this.isInView=ot,tt&&!ot&&this.hasEnteredView))return;ot&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",ot);const{onViewportEnter:st,onViewportLeave:at}=this.node.getProps(),ut=ot?st:at;ut&&ut(it)};return observeIntersection(this.node.current,rt,nt)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:a,prevProps:$}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(a,$))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:_={}},{viewport:a={}}={}){return $=>_[$]!==a[$]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(_,a){if(!Array.isArray(a))return!1;const $=a.length;if($!==_.length)return!1;for(let j=0;j<$;j++)if(a[j]!==_[j])return!1;return!0}function resolveVariant(_,a,$){const j=_.getProps();return resolveVariantFromProps(j,a,$!==void 0?$:j.custom,_)}const secondsToMilliseconds$1=_=>_*1e3,millisecondsToSeconds=_=>_/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=_=>({type:"spring",stiffness:550,damping:_===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(_,{keyframes:a})=>a.length>2?keyframesTransition:transformProps.has(_)?_.startsWith("scale")?criticallyDampedSpring(a[1]):underDampedSpring:ease;function isTransitionDefined({when:_,delay:a,delayChildren:$,staggerChildren:j,staggerDirection:et,repeat:tt,repeatType:rt,repeatDelay:nt,from:it,elapsed:ot,...st}){return!!Object.keys(st).length}function getValueTransition(_,a){return _[a]||_.default||_}const isNotNull=_=>_!==null;function getFinalKeyframe(_,{repeat:a,repeatType:$="loop"},j){const et=_.filter(isNotNull),tt=a&&$!=="loop"&&a%2===1?0:et.length-1;return!tt||j===void 0?et[tt]:j}let now$1;function clearTime(){now$1=void 0}const time={now:()=>(now$1===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now$1),set:_=>{now$1=_,queueMicrotask(clearTime)}},isZeroValueString=_=>/^0[^.\s]+$/u.test(_);function isNone(_){return typeof _=="number"?_===0:_!==null?_==="none"||_==="0"||isZeroValueString(_):!0}let invariant$1=noop$b;const isNumericalString=_=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(_),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(_){const a=splitCSSVariableRegex.exec(_);if(!a)return[,];const[,$,j,et]=a;return[`--${$??j}`,et]}function getVariableValue(_,a,$=1){const[j,et]=parseCSSVariable(_);if(!j)return;const tt=window.getComputedStyle(a).getPropertyValue(j);if(tt){const rt=tt.trim();return isNumericalString(rt)?parseFloat(rt):rt}return isCSSVariableToken(et)?getVariableValue(et,a,$+1):et}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=_=>_===number$4||_===px,getPosFromMatrix=(_,a)=>parseFloat(_.split(", ")[a]),getTranslateFromMatrix=(_,a)=>($,{transform:j})=>{if(j==="none"||!j)return 0;const et=j.match(/^matrix3d\((.+)\)$/u);if(et)return getPosFromMatrix(et[1],a);{const tt=j.match(/^matrix\((.+)\)$/u);return tt?getPosFromMatrix(tt[1],_):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(_=>!transformKeys.has(_));function removeNonTranslationalTransform(_){const a=[];return nonTranslationalTransformKeys.forEach($=>{const j=_.getValue($);j!==void 0&&(a.push([$,j.get()]),j.set($.startsWith("scale")?1:0))}),a}const positionalValues={width:({x:_},{paddingLeft:a="0",paddingRight:$="0"})=>_.max-_.min-parseFloat(a)-parseFloat($),height:({y:_},{paddingTop:a="0",paddingBottom:$="0"})=>_.max-_.min-parseFloat(a)-parseFloat($),top:(_,{top:a})=>parseFloat(a),left:(_,{left:a})=>parseFloat(a),bottom:({y:_},{top:a})=>parseFloat(a)+(_.max-_.min),right:({x:_},{left:a})=>parseFloat(a)+(_.max-_.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x;positionalValues.translateY=positionalValues.y;const testValueType=_=>a=>a.test(_),auto$1={test:_=>_==="auto",parse:_=>_},dimensionValueTypes=[number$4,px,percent,degrees,vw,vh,auto$1],findDimensionValueType=_=>dimensionValueTypes.find(testValueType(_)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const _=Array.from(toResolve).filter(j=>j.needsMeasurement),a=new Set(_.map(j=>j.element)),$=new Map;a.forEach(j=>{const et=removeNonTranslationalTransform(j);et.length&&($.set(j,et),j.render())}),_.forEach(j=>j.measureInitialState()),a.forEach(j=>{j.render();const et=$.get(j);et&&et.forEach(([tt,rt])=>{var nt;(nt=j.getValue(tt))===null||nt===void 0||nt.set(rt)})}),_.forEach(j=>j.measureEndState()),_.forEach(j=>{j.suspendedScrollY!==void 0&&window.scrollTo(0,j.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(_=>_.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(_=>{_.readKeyframes(),_.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(a,$,j,et,tt,rt=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...a],this.onComplete=$,this.name=j,this.motionValue=et,this.element=tt,this.isAsync=rt}scheduleResolve(){this.isScheduled=!0,this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:a,name:$,element:j,motionValue:et}=this;for(let tt=0;tt$=>!!(isString$4($)&&singleColorRegex.test($)&&$.startsWith(_)||a&&Object.prototype.hasOwnProperty.call($,a)),splitColor=(_,a,$)=>j=>{if(!isString$4(j))return j;const[et,tt,rt,nt]=j.match(floatRegex);return{[_]:parseFloat(et),[a]:parseFloat(tt),[$]:parseFloat(rt),alpha:nt!==void 0?parseFloat(nt):1}},clampRgbUnit=_=>clamp(0,255,_),rgbUnit={...number$4,transform:_=>Math.round(clampRgbUnit(_))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:_,green:a,blue:$,alpha:j=1})=>"rgba("+rgbUnit.transform(_)+", "+rgbUnit.transform(a)+", "+rgbUnit.transform($)+", "+sanitize(alpha.transform(j))+")"};function parseHex$1(_){let a="",$="",j="",et="";return _.length>5?(a=_.substring(1,3),$=_.substring(3,5),j=_.substring(5,7),et=_.substring(7,9)):(a=_.substring(1,2),$=_.substring(2,3),j=_.substring(3,4),et=_.substring(4,5),a+=a,$+=$,j+=j,et+=et),{red:parseInt(a,16),green:parseInt($,16),blue:parseInt(j,16),alpha:et?parseInt(et,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex$1,transform:rgba.transform},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:_,saturation:a,lightness:$,alpha:j=1})=>"hsla("+Math.round(_)+", "+percent.transform(sanitize(a))+", "+percent.transform(sanitize($))+", "+sanitize(alpha.transform(j))+")"},color$1={test:_=>rgba.test(_)||hex.test(_)||hsla.test(_),parse:_=>rgba.test(_)?rgba.parse(_):hsla.test(_)?hsla.parse(_):hex.parse(_),transform:_=>isString$4(_)?_:_.hasOwnProperty("red")?rgba.transform(_):hsla.transform(_)};function test$1(_){var a,$;return isNaN(_)&&isString$4(_)&&(((a=_.match(floatRegex))===null||a===void 0?void 0:a.length)||0)+((($=_.match(colorRegex))===null||$===void 0?void 0:$.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function analyseComplexValue(_){const a=_.toString(),$=[],j={color:[],number:[],var:[]},et=[];let tt=0;const nt=a.replace(complexRegex,it=>(color$1.test(it)?(j.color.push(tt),et.push(COLOR_TOKEN),$.push(color$1.parse(it))):it.startsWith(VAR_FUNCTION_TOKEN)?(j.var.push(tt),et.push(VAR_TOKEN),$.push(it)):(j.number.push(tt),et.push(NUMBER_TOKEN),$.push(parseFloat(it))),++tt,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:$,split:nt,indexes:j,types:et}}function parseComplexValue(_){return analyseComplexValue(_).values}function createTransformer(_){const{split:a,types:$}=analyseComplexValue(_),j=a.length;return et=>{let tt="";for(let rt=0;rttypeof _=="number"?0:_;function getAnimatableNone$1(_){const a=parseComplexValue(_);return createTransformer(_)(a.map(convertNumbersToZero))}const complex={test:test$1,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(_){const[a,$]=_.slice(0,-1).split("(");if(a==="drop-shadow")return _;const[j]=$.match(floatRegex)||[];if(!j)return _;const et=$.replace(j,"");let tt=maxDefaults.has(a)?1:0;return j!==$&&(tt*=100),a+"("+tt+et+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter$1={...complex,getAnimatableNone:_=>{const a=_.match(functionRegex);return a?a.map(applyDefaultFilter).join(" "):_}},defaultValueTypes={...numberValueTypes,color:color$1,backgroundColor:color$1,outlineColor:color$1,fill:color$1,stroke:color$1,borderColor:color$1,borderTopColor:color$1,borderRightColor:color$1,borderBottomColor:color$1,borderLeftColor:color$1,filter:filter$1,WebkitFilter:filter$1},getDefaultValueType=_=>defaultValueTypes[_];function getAnimatableNone(_,a){let $=getDefaultValueType(_);return $!==filter$1&&($=complex),$.getAnimatableNone?$.getAnimatableNone(a):void 0}const invalidTemplates=new Set(["auto","none","0"]);function makeNoneKeyframesAnimatable(_,a,$){let j=0,et;for(;j<_.length&&!et;){const tt=_[j];typeof tt=="string"&&!invalidTemplates.has(tt)&&analyseComplexValue(tt).values.length&&(et=_[j]),j++}if(et&&$)for(const tt of a)_[tt]=getAnimatableNone($,et)}class DOMKeyframesResolver extends KeyframeResolver{constructor(a,$,j,et){super(a,$,j,et,et==null?void 0:et.owner,!0)}readKeyframes(){const{unresolvedKeyframes:a,element:$,name:j}=this;if(!$.current)return;super.readKeyframes();for(let it=0;it{$.getValue(it).set(ot)}),this.resolveNoneKeyframes()}}function memo(_){let a;return()=>(a===void 0&&(a=_()),a)}const isAnimatable=(_,a)=>a==="zIndex"?!1:!!(typeof _=="number"||Array.isArray(_)||typeof _=="string"&&(complex.test(_)||_==="0")&&!_.startsWith("url("));function hasKeyframesChanged(_){const a=_[0];if(_.length===1)return!0;for(let $=0;$<_.length;$++)if(_[$]!==a)return!0}function canAnimate(_,a,$,j){const et=_[0];if(et===null)return!1;if(a==="display"||a==="visibility")return!0;const tt=_[_.length-1],rt=isAnimatable(et,a),nt=isAnimatable(tt,a);return!rt||!nt?!1:hasKeyframesChanged(_)||$==="spring"&&j}class BaseAnimation{constructor({autoplay:a=!0,delay:$=0,type:j="keyframes",repeat:et=0,repeatDelay:tt=0,repeatType:rt="loop",...nt}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:a,delay:$,type:j,repeat:et,repeatDelay:tt,repeatType:rt,...nt},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(a,$){this.hasAttemptedResolve=!0;const{name:j,type:et,velocity:tt,delay:rt,onComplete:nt,onUpdate:it,isGenerator:ot}=this.options;if(!ot&&!canAnimate(a,j,et,tt))if(rt)this.options.duration=0;else{it==null||it(getFinalKeyframe(a,this.options,$)),nt==null||nt(),this.resolveFinishedPromise();return}const st=this.initPlayback(a,$);st!==!1&&(this._resolved={keyframes:a,finalKeyframe:$,...st},this.onPostResolved())}onPostResolved(){}then(a,$){return this.currentFinishedPromise.then(a,$)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(a=>{this.resolveFinishedPromise=a})}}function velocityPerSecond(_,a){return a?_*(1e3/a):0}const velocitySampleDuration=5;function calcGeneratorVelocity(_,a,$){const j=Math.max(a-velocitySampleDuration,0);return velocityPerSecond($-_(j),a-j)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:_=800,bounce:a=.25,velocity:$=0,mass:j=1}){let et,tt,rt=1-a;rt=clamp(minDamping,maxDamping,rt),_=clamp(minDuration,maxDuration$1,millisecondsToSeconds(_)),rt<1?(et=ot=>{const st=ot*rt,at=st*_,ut=st-$,ht=calcAngularFreq(ot,rt),bt=Math.exp(-at);return safeMin-ut/ht*bt},tt=ot=>{const at=ot*rt*_,ut=at*$+$,ht=Math.pow(rt,2)*Math.pow(ot,2)*_,bt=Math.exp(-at),Et=calcAngularFreq(Math.pow(ot,2),rt);return(-et(ot)+safeMin>0?-1:1)*((ut-ht)*bt)/Et}):(et=ot=>{const st=Math.exp(-ot*_),at=(ot-$)*_+1;return-safeMin+st*at},tt=ot=>{const st=Math.exp(-ot*_),at=($-ot)*(_*_);return st*at});const nt=5/_,it=approximateRoot(et,tt,nt);if(_=secondsToMilliseconds$1(_),isNaN(it))return{stiffness:100,damping:10,duration:_};{const ot=Math.pow(it,2)*j;return{stiffness:ot,damping:rt*2*Math.sqrt(j*ot),duration:_}}}const rootIterations=12;function approximateRoot(_,a,$){let j=$;for(let et=1;et_[$]!==void 0)}function getSpringOptions(_){let a={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,..._};if(!isSpringType(_,physicsKeys)&&isSpringType(_,durationKeys)){const $=findSpring(_);a={...a,...$,mass:1},a.isResolvedFromDuration=!0}return a}function spring({keyframes:_,restDelta:a,restSpeed:$,...j}){const et=_[0],tt=_[_.length-1],rt={done:!1,value:et},{stiffness:nt,damping:it,mass:ot,duration:st,velocity:at,isResolvedFromDuration:ut}=getSpringOptions({...j,velocity:-millisecondsToSeconds(j.velocity||0)}),ht=at||0,bt=it/(2*Math.sqrt(nt*ot)),Et=tt-et,Ct=millisecondsToSeconds(Math.sqrt(nt/ot)),Pt=Math.abs(Et)<5;$||($=Pt?.01:2),a||(a=Pt?.005:.5);let Tt;if(bt<1){const It=calcAngularFreq(Ct,bt);Tt=Lt=>{const Nt=Math.exp(-bt*Ct*Lt);return tt-Nt*((ht+bt*Ct*Et)/It*Math.sin(It*Lt)+Et*Math.cos(It*Lt))}}else if(bt===1)Tt=It=>tt-Math.exp(-Ct*It)*(Et+(ht+Ct*Et)*It);else{const It=Ct*Math.sqrt(bt*bt-1);Tt=Lt=>{const Nt=Math.exp(-bt*Ct*Lt),Ut=Math.min(It*Lt,300);return tt-Nt*((ht+bt*Ct*Et)*Math.sinh(Ut)+It*Et*Math.cosh(Ut))/It}}return{calculatedDuration:ut&&st||null,next:It=>{const Lt=Tt(It);if(ut)rt.done=It>=st;else{let Nt=ht;It!==0&&(bt<1?Nt=calcGeneratorVelocity(Tt,It,Lt):Nt=0);const Ut=Math.abs(Nt)<=$,jt=Math.abs(tt-Lt)<=a;rt.done=Ut&&jt}return rt.value=rt.done?tt:Lt,rt}}}function inertia({keyframes:_,velocity:a=0,power:$=.8,timeConstant:j=325,bounceDamping:et=10,bounceStiffness:tt=500,modifyTarget:rt,min:nt,max:it,restDelta:ot=.5,restSpeed:st}){const at=_[0],ut={done:!1,value:at},ht=Mt=>nt!==void 0&&Mtit,bt=Mt=>nt===void 0?it:it===void 0||Math.abs(nt-Mt)-Et*Math.exp(-Mt/j),It=Mt=>Pt+Tt(Mt),Lt=Mt=>{const Dt=Tt(Mt),Ft=It(Mt);ut.done=Math.abs(Dt)<=ot,ut.value=ut.done?Pt:Ft};let Nt,Ut;const jt=Mt=>{ht(ut.value)&&(Nt=Mt,Ut=spring({keyframes:[ut.value,bt(ut.value)],velocity:calcGeneratorVelocity(It,Mt,ut.value),damping:et,stiffness:tt,restDelta:ot,restSpeed:st}))};return jt(0),{calculatedDuration:null,next:Mt=>{let Dt=!1;return!Ut&&Nt===void 0&&(Dt=!0,Lt(Mt),jt(Mt)),Nt!==void 0&&Mt>=Nt?Ut.next(Mt-Nt):(!Dt&&Lt(Mt),ut)}}}const calcBezier=(_,a,$)=>(((1-3*$+3*a)*_+(3*$-6*a))*_+3*a)*_,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(_,a,$,j,et){let tt,rt,nt=0;do rt=a+($-a)/2,tt=calcBezier(rt,j,et)-_,tt>0?$=rt:a=rt;while(Math.abs(tt)>subdivisionPrecision&&++ntbinarySubdivide(tt,0,1,_,$);return tt=>tt===0||tt===1?tt:calcBezier(et(tt),a,j)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=_=>Array.isArray(_)&&typeof _[0]!="number",mirrorEasing=_=>a=>a<=.5?_(2*a)/2:(2-_(2*(1-a)))/2,reverseEasing=_=>a=>1-_(1-a),circIn=_=>1-Math.sin(Math.acos(_)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=_=>(_*=2)<1?.5*backIn(_):.5*(2-Math.pow(2,-10*(_-1))),easingLookup={linear:noop$b,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=_=>{if(Array.isArray(_)){invariant$1(_.length===4);const[a,$,j,et]=_;return cubicBezier(a,$,j,et)}else if(typeof _=="string")return invariant$1(easingLookup[_]!==void 0),easingLookup[_];return _},progress=(_,a,$)=>{const j=a-_;return j===0?1:($-_)/j},mixNumber$1=(_,a,$)=>_+(a-_)*$;function hueToRgb(_,a,$){return $<0&&($+=1),$>1&&($-=1),$<1/6?_+(a-_)*6*$:$<1/2?a:$<2/3?_+(a-_)*(2/3-$)*6:_}function hslaToRgba({hue:_,saturation:a,lightness:$,alpha:j}){_/=360,a/=100,$/=100;let et=0,tt=0,rt=0;if(!a)et=tt=rt=$;else{const nt=$<.5?$*(1+a):$+a-$*a,it=2*$-nt;et=hueToRgb(it,nt,_+1/3),tt=hueToRgb(it,nt,_),rt=hueToRgb(it,nt,_-1/3)}return{red:Math.round(et*255),green:Math.round(tt*255),blue:Math.round(rt*255),alpha:j}}const mixLinearColor=(_,a,$)=>{const j=_*_,et=$*(a*a-j)+j;return et<0?0:Math.sqrt(et)},colorTypes=[hex,rgba,hsla],getColorType=_=>colorTypes.find(a=>a.test(_));function asRGBA(_){const a=getColorType(_);let $=a.parse(_);return a===hsla&&($=hslaToRgba($)),$}const mixColor=(_,a)=>{const $=asRGBA(_),j=asRGBA(a),et={...$};return tt=>(et.red=mixLinearColor($.red,j.red,tt),et.green=mixLinearColor($.green,j.green,tt),et.blue=mixLinearColor($.blue,j.blue,tt),et.alpha=mixNumber$1($.alpha,j.alpha,tt),rgba.transform(et))},invisibleValues=new Set(["none","hidden"]);function mixVisibility(_,a){return invisibleValues.has(_)?$=>$<=0?_:a:$=>$>=1?a:_}function mixImmediate(_,a){return $=>$>0?a:_}function mixNumber(_,a){return $=>mixNumber$1(_,a,$)}function getMixer(_){return typeof _=="number"?mixNumber:typeof _=="string"?isCSSVariableToken(_)?mixImmediate:color$1.test(_)?mixColor:mixComplex:Array.isArray(_)?mixArray:typeof _=="object"?color$1.test(_)?mixColor:mixObject:mixImmediate}function mixArray(_,a){const $=[..._],j=$.length,et=_.map((tt,rt)=>getMixer(tt)(tt,a[rt]));return tt=>{for(let rt=0;rt{for(const tt in j)$[tt]=j[tt](et);return $}}function matchOrder(_,a){var $;const j=[],et={color:0,var:0,number:0};for(let tt=0;tt{const $=complex.createTransformer(a),j=analyseComplexValue(_),et=analyseComplexValue(a);return j.indexes.var.length===et.indexes.var.length&&j.indexes.color.length===et.indexes.color.length&&j.indexes.number.length>=et.indexes.number.length?invisibleValues.has(_)&&!et.values.length||invisibleValues.has(a)&&!j.values.length?mixVisibility(_,a):pipe$1(mixArray(matchOrder(j,et),et.values),$):mixImmediate(_,a)};function mix(_,a,$){return typeof _=="number"&&typeof a=="number"&&typeof $=="number"?mixNumber$1(_,a,$):getMixer(_)(_,a)}function createMixers(_,a,$){const j=[],et=$||mix,tt=_.length-1;for(let rt=0;rta[0];if(tt===2&&_[0]===_[1])return()=>a[1];_[0]>_[tt-1]&&(_=[..._].reverse(),a=[...a].reverse());const rt=createMixers(a,j,et),nt=rt.length,it=ot=>{let st=0;if(nt>1)for(;st<_.length-2&&!(ot<_[st+1]);st++);const at=progress(_[st],_[st+1],ot);return rt[st](at)};return $?ot=>it(clamp(_[0],_[tt-1],ot)):it}function fillOffset(_,a){const $=_[_.length-1];for(let j=1;j<=a;j++){const et=progress(0,a,j);_.push(mixNumber$1($,1,et))}}function defaultOffset(_){const a=[0];return fillOffset(a,_.length-1),a}function convertOffsetToTimes(_,a){return _.map($=>$*a)}function defaultEasing(_,a){return _.map(()=>a||easeInOut).splice(0,_.length-1)}function keyframes({duration:_=300,keyframes:a,times:$,ease:j="easeInOut"}){const et=isEasingArray(j)?j.map(easingDefinitionToFunction):easingDefinitionToFunction(j),tt={done:!1,value:a[0]},rt=convertOffsetToTimes($&&$.length===a.length?$:defaultOffset(a),_),nt=interpolate(rt,a,{ease:Array.isArray(et)?et:defaultEasing(a,et)});return{calculatedDuration:_,next:it=>(tt.value=nt(it),tt.done=it>=_,tt)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(_){let a=0;const $=50;let j=_.next(a);for(;!j.done&&a=maxGeneratorDuration?1/0:a}const frameloopDriver=_=>{const a=({timestamp:$})=>_($);return{start:()=>frame.update(a,!0),stop:()=>cancelFrame(a),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=_=>_/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:a=KeyframeResolver,...$}){super($),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:nt}=this.options;nt&&nt()};const{name:j,motionValue:et,keyframes:tt}=this.options,rt=(nt,it)=>this.onKeyframesResolved(nt,it);j&&et&&et.owner?this.resolver=et.owner.resolveKeyframes(tt,rt,j,et):this.resolver=new a(tt,rt,j,et),this.resolver.scheduleResolve()}initPlayback(a){const{type:$="keyframes",repeat:j=0,repeatDelay:et=0,repeatType:tt,velocity:rt=0}=this.options,nt=generators[$]||keyframes;let it,ot;nt!==keyframes&&typeof a[0]!="number"&&(it=pipe$1(percentToProgress,mix(a[0],a[1])),a=[0,100]);const st=nt({...this.options,keyframes:a});tt==="mirror"&&(ot=nt({...this.options,keyframes:[...a].reverse(),velocity:-rt})),st.calculatedDuration===null&&(st.calculatedDuration=calcGeneratorDuration(st));const{calculatedDuration:at}=st,ut=at+et,ht=ut*(j+1)-et;return{generator:st,mirroredGenerator:ot,mapPercentToKeyframes:it,calculatedDuration:at,resolvedDuration:ut,totalDuration:ht}}onPostResolved(){const{autoplay:a=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!a?this.pause():this.state=this.pendingPlayState}tick(a,$=!1){const{resolved:j}=this;if(!j){const{keyframes:Mt}=this.options;return{done:!0,value:Mt[Mt.length-1]}}const{finalKeyframe:et,generator:tt,mirroredGenerator:rt,mapPercentToKeyframes:nt,keyframes:it,calculatedDuration:ot,totalDuration:st,resolvedDuration:at}=j;if(this.startTime===null)return tt.next(0);const{delay:ut,repeat:ht,repeatType:bt,repeatDelay:Et,onUpdate:Ct}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-st/this.speed,this.startTime)),$?this.currentTime=a:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(a-this.startTime)*this.speed;const Pt=this.currentTime-ut*(this.speed>=0?1:-1),Tt=this.speed>=0?Pt<0:Pt>st;this.currentTime=Math.max(Pt,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=st);let It=this.currentTime,Lt=tt;if(ht){const Mt=Math.min(this.currentTime,st)/at;let Dt=Math.floor(Mt),Ft=Mt%1;!Ft&&Mt>=1&&(Ft=1),Ft===1&&Dt--,Dt=Math.min(Dt,ht+1),!!(Dt%2)&&(bt==="reverse"?(Ft=1-Ft,Et&&(Ft-=Et/at)):bt==="mirror"&&(Lt=rt)),It=clamp(0,1,Ft)*at}const Nt=Tt?{done:!1,value:it[0]}:Lt.next(It);nt&&(Nt.value=nt(Nt.value));let{done:Ut}=Nt;!Tt&&ot!==null&&(Ut=this.speed>=0?this.currentTime>=st:this.currentTime<=0);const jt=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Ut);return jt&&et!==void 0&&(Nt.value=getFinalKeyframe(it,this.options,et)),Ct&&Ct(Nt.value),jt&&this.finish(),Nt}get duration(){const{resolved:a}=this;return a?millisecondsToSeconds(a.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(a){a=secondsToMilliseconds$1(a),this.currentTime=a,this.holdTime!==null||this.speed===0?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.speed)}get speed(){return this.playbackSpeed}set speed(a){const $=this.playbackSpeed!==a;this.playbackSpeed=a,$&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:a=frameloopDriver,onPlay:$}=this.options;this.driver||(this.driver=a(et=>this.tick(et))),$&&$();const j=this.driver.now();this.holdTime!==null?this.startTime=j-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=j),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var a;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(a=this.currentTime)!==null&&a!==void 0?a:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:a}=this.options;a&&a()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}}const isBezierDefinition=_=>Array.isArray(_)&&typeof _[0]=="number";function isWaapiSupportedEasing(_){return!!(!_||typeof _=="string"&&_ in supportedWaapiEasing||isBezierDefinition(_)||Array.isArray(_)&&_.every(isWaapiSupportedEasing))}const cubicBezierAsString=([_,a,$,j])=>`cubic-bezier(${_}, ${a}, ${$}, ${j})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasingWithDefault(_){return mapEasingToNativeEasing(_)||supportedWaapiEasing.easeOut}function mapEasingToNativeEasing(_){if(_)return isBezierDefinition(_)?cubicBezierAsString(_):Array.isArray(_)?_.map(mapEasingToNativeEasingWithDefault):supportedWaapiEasing[_]}function animateStyle(_,a,$,{delay:j=0,duration:et=300,repeat:tt=0,repeatType:rt="loop",ease:nt,times:it}={}){const ot={[a]:$};it&&(ot.offset=it);const st=mapEasingToNativeEasing(nt);return Array.isArray(st)&&(ot.easing=st),_.animate(ot,{delay:j,duration:et,easing:Array.isArray(st)?"linear":st,fill:"both",iterations:tt+1,direction:rt==="reverse"?"alternate":"normal"})}const supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),sampleDelta=10,maxDuration=2e4;function requiresPregeneratedKeyframes(_){return _.type==="spring"||_.name==="backgroundColor"||!isWaapiSupportedEasing(_.ease)}function pregenerateKeyframes(_,a){const $=new MainThreadAnimation({...a,keyframes:_,repeat:0,delay:0,isGenerator:!0});let j={done:!1,value:_[0]};const et=[];let tt=0;for(;!j.done&&ttthis.onKeyframesResolved(tt,rt),$,j),this.resolver.scheduleResolve()}initPlayback(a,$){var j;let{duration:et=300,times:tt,ease:rt,type:nt,motionValue:it,name:ot}=this.options;if(!(!((j=it.owner)===null||j===void 0)&&j.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:at,onUpdate:ut,motionValue:ht,...bt}=this.options,Et=pregenerateKeyframes(a,bt);a=Et.keyframes,a.length===1&&(a[1]=a[0]),et=Et.duration,tt=Et.times,rt=Et.ease,nt="keyframes"}const st=animateStyle(it.owner.current,ot,a,{...this.options,duration:et,times:tt,ease:rt});return st.startTime=time.now(),this.pendingTimeline?(st.timeline=this.pendingTimeline,this.pendingTimeline=void 0):st.onfinish=()=>{const{onComplete:at}=this.options;it.set(getFinalKeyframe(a,this.options,$)),at&&at(),this.cancel(),this.resolveFinishedPromise()},{animation:st,duration:et,times:tt,type:nt,ease:rt,keyframes:a}}get duration(){const{resolved:a}=this;if(!a)return 0;const{duration:$}=a;return millisecondsToSeconds($)}get time(){const{resolved:a}=this;if(!a)return 0;const{animation:$}=a;return millisecondsToSeconds($.currentTime||0)}set time(a){const{resolved:$}=this;if(!$)return;const{animation:j}=$;j.currentTime=secondsToMilliseconds$1(a)}get speed(){const{resolved:a}=this;if(!a)return 1;const{animation:$}=a;return $.playbackRate}set speed(a){const{resolved:$}=this;if(!$)return;const{animation:j}=$;j.playbackRate=a}get state(){const{resolved:a}=this;if(!a)return"idle";const{animation:$}=a;return $.playState}attachTimeline(a){if(!this._resolved)this.pendingTimeline=a;else{const{resolved:$}=this;if(!$)return noop$b;const{animation:j}=$;j.timeline=a,j.onfinish=null}return noop$b}play(){if(this.isStopped)return;const{resolved:a}=this;if(!a)return;const{animation:$}=a;$.playState==="finished"&&this.updateFinishedPromise(),$.play()}pause(){const{resolved:a}=this;if(!a)return;const{animation:$}=a;$.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:a}=this;if(!a)return;const{animation:$,keyframes:j,duration:et,type:tt,ease:rt,times:nt}=a;if(!($.playState==="idle"||$.playState==="finished")){if(this.time){const{motionValue:it,onUpdate:ot,onComplete:st,...at}=this.options,ut=new MainThreadAnimation({...at,keyframes:j,duration:et,type:tt,ease:rt,times:nt,isGenerator:!0}),ht=secondsToMilliseconds$1(this.time);it.setWithVelocity(ut.sample(ht-sampleDelta).value,ut.sample(ht).value,sampleDelta)}this.cancel()}}complete(){const{resolved:a}=this;a&&a.animation.finish()}cancel(){const{resolved:a}=this;a&&a.animation.cancel()}static supports(a){const{motionValue:$,name:j,repeatDelay:et,repeatType:tt,damping:rt,type:nt}=a;return supportsWaapi()&&j&&acceleratedValues.has(j)&&$&&$.owner&&$.owner.current instanceof HTMLElement&&!$.owner.getProps().onUpdate&&!et&&tt!=="mirror"&&rt!==0&&nt!=="inertia"}}const animateMotionValue=(_,a,$,j={},et,tt)=>rt=>{const nt=getValueTransition(j,_)||{},it=nt.delay||j.delay||0;let{elapsed:ot=0}=j;ot=ot-secondsToMilliseconds$1(it);let st={keyframes:Array.isArray($)?$:[null,$],ease:"easeOut",velocity:a.getVelocity(),...nt,delay:-ot,onUpdate:ut=>{a.set(ut),nt.onUpdate&&nt.onUpdate(ut)},onComplete:()=>{rt(),nt.onComplete&&nt.onComplete()},name:_,motionValue:a,element:tt?void 0:et};isTransitionDefined(nt)||(st={...st,...getDefaultTransition(_,st)}),st.duration&&(st.duration=secondsToMilliseconds$1(st.duration)),st.repeatDelay&&(st.repeatDelay=secondsToMilliseconds$1(st.repeatDelay)),st.from!==void 0&&(st.keyframes[0]=st.from);let at=!1;if((st.type===!1||st.duration===0&&!st.repeatDelay)&&(st.duration=0,st.delay===0&&(at=!0)),at&&!tt&&a.get()!==void 0){const ut=getFinalKeyframe(st.keyframes,nt);if(ut!==void 0){frame.update(()=>{st.onUpdate(ut),st.onComplete()});return}}return!tt&&AcceleratedAnimation.supports(st)?new AcceleratedAnimation(st):new MainThreadAnimation(st)};function isWillChangeMotionValue(_){return!!(isMotionValue(_)&&_.add)}function addUniqueItem(_,a){_.indexOf(a)===-1&&_.push(a)}function removeItem(_,a){const $=_.indexOf(a);$>-1&&_.splice($,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(a){return addUniqueItem(this.subscriptions,a),()=>removeItem(this.subscriptions,a)}notify(a,$,j){const et=this.subscriptions.length;if(et)if(et===1)this.subscriptions[0](a,$,j);else for(let tt=0;tt!isNaN(parseFloat(_));class MotionValue{constructor(a,$={}){this.version="11.2.6",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(j,et=!0)=>{const tt=time.now();this.updatedAt!==tt&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(j),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),et&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(a),this.owner=$.owner}setCurrent(a){this.current=a,this.updatedAt=time.now(),this.canTrackVelocity===null&&a!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,$){this.events[a]||(this.events[a]=new SubscriptionManager);const j=this.events[a].add($);return a==="change"?()=>{j(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:j}clearListeners(){for(const a in this.events)this.events[a].clear()}attach(a,$){this.passiveEffect=a,this.stopPassiveEffect=$}set(a,$=!0){!$||!this.passiveEffect?this.updateAndNotify(a,$):this.passiveEffect(a,this.updateAndNotify)}setWithVelocity(a,$,j){this.set($),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-j}jump(a,$=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,$&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const a=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||a-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const $=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),$)}start(a){return this.stop(),new Promise($=>{this.hasAnimated=!0,this.animation=a($),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(_,a){return new MotionValue(_,a)}function setMotionValue(_,a,$){_.hasValue(a)?_.getValue(a).set($):_.addValue(a,motionValue($))}function setTarget(_,a){const $=resolveVariant(_,a);let{transitionEnd:j={},transition:et={},...tt}=$||{};tt={...tt,...j};for(const rt in tt){const nt=resolveFinalValueInKeyframes(tt[rt]);setMotionValue(_,rt,nt)}}function shouldBlockAnimation({protectedKeys:_,needsAnimating:a},$){const j=_.hasOwnProperty($)&&a[$]!==!0;return a[$]=!1,j}function animateTarget(_,a,{delay:$=0,transitionOverride:j,type:et}={}){var tt;let{transition:rt=_.getDefaultTransition(),transitionEnd:nt,...it}=a;const ot=_.getValue("willChange");j&&(rt=j);const st=[],at=et&&_.animationState&&_.animationState.getState()[et];for(const ut in it){const ht=_.getValue(ut,(tt=_.latestValues[ut])!==null&&tt!==void 0?tt:null),bt=it[ut];if(bt===void 0||at&&shouldBlockAnimation(at,ut))continue;const Et={delay:$,elapsed:0,...getValueTransition(rt||{},ut)};let Ct=!1;if(window.HandoffAppearAnimations){const It=_.getProps()[optimizedAppearDataAttribute];if(It){const Lt=window.HandoffAppearAnimations(It,ut,ht,frame);Lt!==null&&(Et.elapsed=Lt,Ct=!0)}}ht.start(animateMotionValue(ut,ht,bt,_.shouldReduceMotion&&transformProps.has(ut)?{type:!1}:Et,_,Ct));const Pt=ht.animation;Pt&&(isWillChangeMotionValue(ot)&&(ot.add(ut),Pt.then(()=>ot.remove(ut))),st.push(Pt))}return nt&&Promise.all(st).then(()=>{frame.update(()=>{nt&&setTarget(_,nt)})}),st}function animateVariant(_,a,$={}){var j;const et=resolveVariant(_,a,$.type==="exit"?(j=_.presenceContext)===null||j===void 0?void 0:j.custom:void 0);let{transition:tt=_.getDefaultTransition()||{}}=et||{};$.transitionOverride&&(tt=$.transitionOverride);const rt=et?()=>Promise.all(animateTarget(_,et,$)):()=>Promise.resolve(),nt=_.variantChildren&&_.variantChildren.size?(ot=0)=>{const{delayChildren:st=0,staggerChildren:at,staggerDirection:ut}=tt;return animateChildren(_,a,st+ot,at,ut,$)}:()=>Promise.resolve(),{when:it}=tt;if(it){const[ot,st]=it==="beforeChildren"?[rt,nt]:[nt,rt];return ot().then(()=>st())}else return Promise.all([rt(),nt($.delay)])}function animateChildren(_,a,$=0,j=0,et=1,tt){const rt=[],nt=(_.variantChildren.size-1)*j,it=et===1?(ot=0)=>ot*j:(ot=0)=>nt-ot*j;return Array.from(_.variantChildren).sort(sortByTreeOrder).forEach((ot,st)=>{ot.notify("AnimationStart",a),rt.push(animateVariant(ot,a,{...tt,delay:$+it(st)}).then(()=>ot.notify("AnimationComplete",a)))}),Promise.all(rt)}function sortByTreeOrder(_,a){return _.sortNodePosition(a)}function animateVisualElement(_,a,$={}){_.notify("AnimationStart",a);let j;if(Array.isArray(a)){const et=a.map(tt=>animateVariant(_,tt,$));j=Promise.all(et)}else if(typeof a=="string")j=animateVariant(_,a,$);else{const et=typeof a=="function"?resolveVariant(_,a,$.custom):a;j=Promise.all(animateTarget(_,et,$))}return j.then(()=>{frame.postRender(()=>{_.notify("AnimationComplete",a)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(_){return a=>Promise.all(a.map(({animation:$,options:j})=>animateVisualElement(_,$,j)))}function createAnimationState(_){let a=animateList(_);const $=createState();let j=!0;const et=it=>(ot,st)=>{var at;const ut=resolveVariant(_,st,it==="exit"?(at=_.presenceContext)===null||at===void 0?void 0:at.custom:void 0);if(ut){const{transition:ht,transitionEnd:bt,...Et}=ut;ot={...ot,...Et,...bt}}return ot};function tt(it){a=it(_)}function rt(it){const ot=_.getProps(),st=_.getVariantContext(!0)||{},at=[],ut=new Set;let ht={},bt=1/0;for(let Ct=0;Ctbt&&Lt,Dt=!1;const Ft=Array.isArray(It)?It:[It];let Bt=Ft.reduce(et(Pt),{});Nt===!1&&(Bt={});const{prevResolvedValues:yt={}}=Tt,mt={...yt,...Bt},ct=dt=>{Mt=!0,ut.has(dt)&&(Dt=!0,ut.delete(dt)),Tt.needsAnimating[dt]=!0;const vt=_.getValue(dt);vt&&(vt.liveStyle=!1)};for(const dt in mt){const vt=Bt[dt],St=yt[dt];if(ht.hasOwnProperty(dt))continue;let Rt=!1;isKeyframesTarget(vt)&&isKeyframesTarget(St)?Rt=!shallowCompare(vt,St):Rt=vt!==St,Rt?vt!=null?ct(dt):ut.add(dt):vt!==void 0&&ut.has(dt)?ct(dt):Tt.protectedKeys[dt]=!0}Tt.prevProp=It,Tt.prevResolvedValues=Bt,Tt.isActive&&(ht={...ht,...Bt}),j&&_.blockInitialAnimation&&(Mt=!1),Mt&&(!Ut||Dt)&&at.push(...Ft.map(dt=>({animation:dt,options:{type:Pt}})))}if(ut.size){const Ct={};ut.forEach(Pt=>{const Tt=_.getBaseTarget(Pt),It=_.getValue(Pt);It&&(It.liveStyle=!0),Ct[Pt]=Tt??null}),at.push({animation:Ct})}let Et=!!at.length;return j&&(ot.initial===!1||ot.initial===ot.animate)&&!_.manuallyAnimateOnMount&&(Et=!1),j=!1,Et?a(at):Promise.resolve()}function nt(it,ot){var st;if($[it].isActive===ot)return Promise.resolve();(st=_.variantChildren)===null||st===void 0||st.forEach(ut=>{var ht;return(ht=ut.animationState)===null||ht===void 0?void 0:ht.setActive(it,ot)}),$[it].isActive=ot;const at=rt(it);for(const ut in $)$[ut].protectedKeys={};return at}return{animateChanges:rt,setActive:nt,setAnimateFunction:tt,getState:()=>$}}function checkVariantsDidChange(_,a){return typeof a=="string"?a!==_:Array.isArray(a)?!shallowCompare(a,_):!1}function createTypeState(_=!1){return{isActive:_,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class AnimationFeature extends Feature{constructor(a){super(a),a.animationState||(a.animationState=createAnimationState(a))}updateAnimationControlsSubscription(){const{animate:a}=this.node.getProps();this.unmount(),isAnimationControls(a)&&(this.unmount=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:a}=this.node.getProps(),{animate:$}=this.node.prevProps||{};a!==$&&this.updateAnimationControlsSubscription()}unmount(){}}let id$2=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$2++}update(){if(!this.node.presenceContext)return;const{isPresent:a,onExitComplete:$}=this.node.presenceContext,{isPresent:j}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===j)return;const et=this.node.animationState.setActive("exit",!a);$&&!a&&et.then(()=>$(this.id))}mount(){const{register:a}=this.node.presenceContext||{};a&&(this.unmount=a(this.id))}unmount(){}}const animations$1={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(_,a)=>Math.abs(_-a);function distance2D(_,a){const $=distance(_.x,a.x),j=distance(_.y,a.y);return Math.sqrt($**2+j**2)}class PanSession{constructor(a,$,{transformPagePoint:j,contextWindow:et,dragSnapToOrigin:tt=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const at=getPanInfo(this.lastMoveEventInfo,this.history),ut=this.startEvent!==null,ht=distance2D(at.offset,{x:0,y:0})>=3;if(!ut&&!ht)return;const{point:bt}=at,{timestamp:Et}=frameData;this.history.push({...bt,timestamp:Et});const{onStart:Ct,onMove:Pt}=this.handlers;ut||(Ct&&Ct(this.lastMoveEvent,at),this.startEvent=this.lastMoveEvent),Pt&&Pt(this.lastMoveEvent,at)},this.handlePointerMove=(at,ut)=>{this.lastMoveEvent=at,this.lastMoveEventInfo=transformPoint(ut,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(at,ut)=>{this.end();const{onEnd:ht,onSessionEnd:bt,resumeAnimation:Et}=this.handlers;if(this.dragSnapToOrigin&&Et&&Et(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const Ct=getPanInfo(at.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(ut,this.transformPagePoint),this.history);this.startEvent&&ht&&ht(at,Ct),bt&&bt(at,Ct)},!isPrimaryPointer(a))return;this.dragSnapToOrigin=tt,this.handlers=$,this.transformPagePoint=j,this.contextWindow=et||window;const rt=extractEventInfo(a),nt=transformPoint(rt,this.transformPagePoint),{point:it}=nt,{timestamp:ot}=frameData;this.history=[{...it,timestamp:ot}];const{onSessionStart:st}=$;st&&st(a,getPanInfo(nt,this.history)),this.removeListeners=pipe$1(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(_,a){return a?{point:a(_.point)}:_}function subtractPoint(_,a){return{x:_.x-a.x,y:_.y-a.y}}function getPanInfo({point:_},a){return{point:_,delta:subtractPoint(_,lastDevicePoint(a)),offset:subtractPoint(_,startDevicePoint(a)),velocity:getVelocity(a,.1)}}function startDevicePoint(_){return _[0]}function lastDevicePoint(_){return _[_.length-1]}function getVelocity(_,a){if(_.length<2)return{x:0,y:0};let $=_.length-1,j=null;const et=lastDevicePoint(_);for(;$>=0&&(j=_[$],!(et.timestamp-j.timestamp>secondsToMilliseconds$1(a)));)$--;if(!j)return{x:0,y:0};const tt=millisecondsToSeconds(et.timestamp-j.timestamp);if(tt===0)return{x:0,y:0};const rt={x:(et.x-j.x)/tt,y:(et.y-j.y)/tt};return rt.x===1/0&&(rt.x=0),rt.y===1/0&&(rt.y=0),rt}function calcLength(_){return _.max-_.min}function isNear(_,a=0,$=.01){return Math.abs(_-a)<=$}function calcAxisDelta(_,a,$,j=.5){_.origin=j,_.originPoint=mixNumber$1(a.min,a.max,_.origin),_.scale=calcLength($)/calcLength(a),(isNear(_.scale,1,1e-4)||isNaN(_.scale))&&(_.scale=1),_.translate=mixNumber$1($.min,$.max,_.origin)-_.originPoint,(isNear(_.translate)||isNaN(_.translate))&&(_.translate=0)}function calcBoxDelta(_,a,$,j){calcAxisDelta(_.x,a.x,$.x,j?j.originX:void 0),calcAxisDelta(_.y,a.y,$.y,j?j.originY:void 0)}function calcRelativeAxis(_,a,$){_.min=$.min+a.min,_.max=_.min+calcLength(a)}function calcRelativeBox(_,a,$){calcRelativeAxis(_.x,a.x,$.x),calcRelativeAxis(_.y,a.y,$.y)}function calcRelativeAxisPosition(_,a,$){_.min=a.min-$.min,_.max=_.min+calcLength(a)}function calcRelativePosition(_,a,$){calcRelativeAxisPosition(_.x,a.x,$.x),calcRelativeAxisPosition(_.y,a.y,$.y)}function applyConstraints(_,{min:a,max:$},j){return a!==void 0&&_$&&(_=j?mixNumber$1($,_,j.max):Math.min(_,$)),_}function calcRelativeAxisConstraints(_,a,$){return{min:a!==void 0?_.min+a:void 0,max:$!==void 0?_.max+$-(_.max-_.min):void 0}}function calcRelativeConstraints(_,{top:a,left:$,bottom:j,right:et}){return{x:calcRelativeAxisConstraints(_.x,$,et),y:calcRelativeAxisConstraints(_.y,a,j)}}function calcViewportAxisConstraints(_,a){let $=a.min-_.min,j=a.max-_.max;return a.max-a.min<_.max-_.min&&([$,j]=[j,$]),{min:$,max:j}}function calcViewportConstraints(_,a){return{x:calcViewportAxisConstraints(_.x,a.x),y:calcViewportAxisConstraints(_.y,a.y)}}function calcOrigin(_,a){let $=.5;const j=calcLength(_),et=calcLength(a);return et>j?$=progress(a.min,a.max-j,_.min):j>et&&($=progress(_.min,_.max-et,a.min)),clamp(0,1,$)}function rebaseAxisConstraints(_,a){const $={};return a.min!==void 0&&($.min=a.min-_.min),a.max!==void 0&&($.max=a.max-_.min),$}const defaultElastic=.35;function resolveDragElastic(_=defaultElastic){return _===!1?_=0:_===!0&&(_=defaultElastic),{x:resolveAxisElastic(_,"left","right"),y:resolveAxisElastic(_,"top","bottom")}}function resolveAxisElastic(_,a,$){return{min:resolvePointElastic(_,a),max:resolvePointElastic(_,$)}}function resolvePointElastic(_,a){return typeof _=="number"?_:_[a]||0}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(_){return[_("x"),_("y")]}function convertBoundingBoxToBox({top:_,left:a,right:$,bottom:j}){return{x:{min:a,max:$},y:{min:_,max:j}}}function convertBoxToBoundingBox({x:_,y:a}){return{top:a.min,right:_.max,bottom:a.max,left:_.min}}function transformBoxPoints(_,a){if(!a)return _;const $=a({x:_.left,y:_.top}),j=a({x:_.right,y:_.bottom});return{top:$.y,left:$.x,bottom:j.y,right:j.x}}function isIdentityScale(_){return _===void 0||_===1}function hasScale({scale:_,scaleX:a,scaleY:$}){return!isIdentityScale(_)||!isIdentityScale(a)||!isIdentityScale($)}function hasTransform(_){return hasScale(_)||has2DTranslate(_)||_.z||_.rotate||_.rotateX||_.rotateY||_.skewX||_.skewY}function has2DTranslate(_){return is2DTranslate(_.x)||is2DTranslate(_.y)}function is2DTranslate(_){return _&&_!=="0%"}function scalePoint(_,a,$){const j=_-$,et=a*j;return $+et}function applyPointDelta(_,a,$,j,et){return et!==void 0&&(_=scalePoint(_,et,j)),scalePoint(_,$,j)+a}function applyAxisDelta(_,a=0,$=1,j,et){_.min=applyPointDelta(_.min,a,$,j,et),_.max=applyPointDelta(_.max,a,$,j,et)}function applyBoxDelta(_,{x:a,y:$}){applyAxisDelta(_.x,a.translate,a.scale,a.originPoint),applyAxisDelta(_.y,$.translate,$.scale,$.originPoint)}function applyTreeDeltas(_,a,$,j=!1){const et=$.length;if(!et)return;a.x=a.y=1;let tt,rt;for(let nt=0;nt1.0000000000001||_<.999999999999?_:1}function translateAxis(_,a){_.min=_.min+a,_.max=_.max+a}function transformAxis(_,a,[$,j,et]){const tt=a[et]!==void 0?a[et]:.5,rt=mixNumber$1(_.min,_.max,tt);applyAxisDelta(_,a[$],a[j],rt,a.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(_,a){transformAxis(_.x,a,xKeys$1),transformAxis(_.y,a,yKeys$1)}function measureViewportBox(_,a){return convertBoundingBoxToBox(transformBoxPoints(_.getBoundingClientRect(),a))}function measurePageBox(_,a,$){const j=measureViewportBox(_,$),{scroll:et}=a;return et&&(translateAxis(j.x,et.offset.x),translateAxis(j.y,et.offset.y)),j}const getContextWindow=({current:_})=>_?_.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(a){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=a}start(a,{snapToCursor:$=!1}={}){const{presenceContext:j}=this.visualElement;if(j&&j.isPresent===!1)return;const et=st=>{const{dragSnapToOrigin:at}=this.getProps();at?this.pauseAnimation():this.stopAnimation(),$&&this.snapToCursor(extractEventInfo(st,"page").point)},tt=(st,at)=>{const{drag:ut,dragPropagation:ht,onDragStart:bt}=this.getProps();if(ut&&!ht&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(ut),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(Ct=>{let Pt=this.getAxisMotionValue(Ct).get()||0;if(percent.test(Pt)){const{projection:Tt}=this.visualElement;if(Tt&&Tt.layout){const It=Tt.layout.layoutBox[Ct];It&&(Pt=calcLength(It)*(parseFloat(Pt)/100))}}this.originPoint[Ct]=Pt}),bt&&frame.postRender(()=>bt(st,at));const{animationState:Et}=this.visualElement;Et&&Et.setActive("whileDrag",!0)},rt=(st,at)=>{const{dragPropagation:ut,dragDirectionLock:ht,onDirectionLock:bt,onDrag:Et}=this.getProps();if(!ut&&!this.openGlobalLock)return;const{offset:Ct}=at;if(ht&&this.currentDirection===null){this.currentDirection=getCurrentDirection(Ct),this.currentDirection!==null&&bt&&bt(this.currentDirection);return}this.updateAxis("x",at.point,Ct),this.updateAxis("y",at.point,Ct),this.visualElement.render(),Et&&Et(st,at)},nt=(st,at)=>this.stop(st,at),it=()=>eachAxis(st=>{var at;return this.getAnimationState(st)==="paused"&&((at=this.getAxisMotionValue(st).animation)===null||at===void 0?void 0:at.play())}),{dragSnapToOrigin:ot}=this.getProps();this.panSession=new PanSession(a,{onSessionStart:et,onStart:tt,onMove:rt,onSessionEnd:nt,resumeAnimation:it},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:ot,contextWindow:getContextWindow(this.visualElement)})}stop(a,$){const j=this.isDragging;if(this.cancel(),!j)return;const{velocity:et}=$;this.startAnimation(et);const{onDragEnd:tt}=this.getProps();tt&&frame.postRender(()=>tt(a,$))}cancel(){this.isDragging=!1;const{projection:a,animationState:$}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:j}=this.getProps();!j&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),$&&$.setActive("whileDrag",!1)}updateAxis(a,$,j){const{drag:et}=this.getProps();if(!j||!shouldDrag(a,et,this.currentDirection))return;const tt=this.getAxisMotionValue(a);let rt=this.originPoint[a]+j[a];this.constraints&&this.constraints[a]&&(rt=applyConstraints(rt,this.constraints[a],this.elastic[a])),tt.set(rt)}resolveConstraints(){var a;const{dragConstraints:$,dragElastic:j}=this.getProps(),et=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)===null||a===void 0?void 0:a.layout,tt=this.constraints;$&&isRefObject$2($)?this.constraints||(this.constraints=this.resolveRefConstraints()):$&&et?this.constraints=calcRelativeConstraints(et.layoutBox,$):this.constraints=!1,this.elastic=resolveDragElastic(j),tt!==this.constraints&&et&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(rt=>{this.constraints!==!1&&this.getAxisMotionValue(rt)&&(this.constraints[rt]=rebaseAxisConstraints(et.layoutBox[rt],this.constraints[rt]))})}resolveRefConstraints(){const{dragConstraints:a,onMeasureDragConstraints:$}=this.getProps();if(!a||!isRefObject$2(a))return!1;const j=a.current,{projection:et}=this.visualElement;if(!et||!et.layout)return!1;const tt=measurePageBox(j,et.root,this.visualElement.getTransformPagePoint());let rt=calcViewportConstraints(et.layout.layoutBox,tt);if($){const nt=$(convertBoxToBoundingBox(rt));this.hasMutatedConstraints=!!nt,nt&&(rt=convertBoundingBoxToBox(nt))}return rt}startAnimation(a){const{drag:$,dragMomentum:j,dragElastic:et,dragTransition:tt,dragSnapToOrigin:rt,onDragTransitionEnd:nt}=this.getProps(),it=this.constraints||{},ot=eachAxis(st=>{if(!shouldDrag(st,$,this.currentDirection))return;let at=it&&it[st]||{};rt&&(at={min:0,max:0});const ut=et?200:1e6,ht=et?40:1e7,bt={type:"inertia",velocity:j?a[st]:0,bounceStiffness:ut,bounceDamping:ht,timeConstant:750,restDelta:1,restSpeed:10,...tt,...at};return this.startAxisValueAnimation(st,bt)});return Promise.all(ot).then(nt)}startAxisValueAnimation(a,$){const j=this.getAxisMotionValue(a);return j.start(animateMotionValue(a,j,0,$,this.visualElement))}stopAnimation(){eachAxis(a=>this.getAxisMotionValue(a).stop())}pauseAnimation(){eachAxis(a=>{var $;return($=this.getAxisMotionValue(a).animation)===null||$===void 0?void 0:$.pause()})}getAnimationState(a){var $;return($=this.getAxisMotionValue(a).animation)===null||$===void 0?void 0:$.state}getAxisMotionValue(a){const $=`_drag${a.toUpperCase()}`,j=this.visualElement.getProps(),et=j[$];return et||this.visualElement.getValue(a,(j.initial?j.initial[a]:void 0)||0)}snapToCursor(a){eachAxis($=>{const{drag:j}=this.getProps();if(!shouldDrag($,j,this.currentDirection))return;const{projection:et}=this.visualElement,tt=this.getAxisMotionValue($);if(et&&et.layout){const{min:rt,max:nt}=et.layout.layoutBox[$];tt.set(a[$]-mixNumber$1(rt,nt,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:a,dragConstraints:$}=this.getProps(),{projection:j}=this.visualElement;if(!isRefObject$2($)||!j||!this.constraints)return;this.stopAnimation();const et={x:0,y:0};eachAxis(rt=>{const nt=this.getAxisMotionValue(rt);if(nt&&this.constraints!==!1){const it=nt.get();et[rt]=calcOrigin({min:it,max:it},this.constraints[rt])}});const{transformTemplate:tt}=this.visualElement.getProps();this.visualElement.current.style.transform=tt?tt({},""):"none",j.root&&j.root.updateScroll(),j.updateLayout(),this.resolveConstraints(),eachAxis(rt=>{if(!shouldDrag(rt,a,null))return;const nt=this.getAxisMotionValue(rt),{min:it,max:ot}=this.constraints[rt];nt.set(mixNumber$1(it,ot,et[rt]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const a=this.visualElement.current,$=addPointerEvent(a,"pointerdown",it=>{const{drag:ot,dragListener:st=!0}=this.getProps();ot&&st&&this.start(it)}),j=()=>{const{dragConstraints:it}=this.getProps();isRefObject$2(it)&&(this.constraints=this.resolveRefConstraints())},{projection:et}=this.visualElement,tt=et.addEventListener("measure",j);et&&!et.layout&&(et.root&&et.root.updateScroll(),et.updateLayout()),j();const rt=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),nt=et.addEventListener("didUpdate",({delta:it,hasLayoutChanged:ot})=>{this.isDragging&&ot&&(eachAxis(st=>{const at=this.getAxisMotionValue(st);at&&(this.originPoint[st]+=it[st].translate,at.set(at.get()+it[st].translate))}),this.visualElement.render())});return()=>{rt(),$(),tt(),nt&&nt()}}getProps(){const a=this.visualElement.getProps(),{drag:$=!1,dragDirectionLock:j=!1,dragPropagation:et=!1,dragConstraints:tt=!1,dragElastic:rt=defaultElastic,dragMomentum:nt=!0}=a;return{...a,drag:$,dragDirectionLock:j,dragPropagation:et,dragConstraints:tt,dragElastic:rt,dragMomentum:nt}}}function shouldDrag(_,a,$){return(a===!0||a===_)&&($===null||$===_)}function getCurrentDirection(_,a=10){let $=null;return Math.abs(_.y)>a?$="y":Math.abs(_.x)>a&&($="x"),$}class DragGesture extends Feature{constructor(a){super(a),this.removeGroupControls=noop$b,this.removeListeners=noop$b,this.controls=new VisualElementDragControls(a)}mount(){const{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$b}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=_=>(a,$)=>{_&&frame.postRender(()=>_(a,$))};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$b}onPointerDown(a){this.session=new PanSession(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:a,onPanStart:$,onPan:j,onPanEnd:et}=this.node.getProps();return{onSessionStart:asyncHandler(a),onStart:asyncHandler($),onMove:j,onEnd:(tt,rt)=>{delete this.session,et&&frame.postRender(()=>et(tt,rt))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const _=reactExports.useContext(PresenceContext);if(_===null)return[!0,null];const{isPresent:a,onExitComplete:$,register:j}=_,et=reactExports.useId();return reactExports.useEffect(()=>j(et),[]),!a&&$?[!1,()=>$&&$(et)]:[!0]}function useIsPresent(){return isPresent(reactExports.useContext(PresenceContext))}function isPresent(_){return _===null?!0:_.isPresent}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(_,a){return a.max===a.min?0:_/(a.max-a.min)*100}const correctBorderRadius={correct:(_,a)=>{if(!a.target)return _;if(typeof _=="string")if(px.test(_))_=parseFloat(_);else return _;const $=pixelsToPercent(_,a.target.x),j=pixelsToPercent(_,a.target.y);return`${$}% ${j}%`}},correctBoxShadow={correct:(_,{treeScale:a,projectionDelta:$})=>{const j=_,et=complex.parse(_);if(et.length>5)return j;const tt=complex.createTransformer(_),rt=typeof et[0]!="number"?1:0,nt=$.x.scale*a.x,it=$.y.scale*a.y;et[0+rt]/=nt,et[1+rt]/=it;const ot=mixNumber$1(nt,it,.5);return typeof et[2+rt]=="number"&&(et[2+rt]/=ot),typeof et[3+rt]=="number"&&(et[3+rt]/=ot),tt(et)}};class MeasureLayoutWithContext extends reactExports.Component{componentDidMount(){const{visualElement:a,layoutGroup:$,switchLayoutGroup:j,layoutId:et}=this.props,{projection:tt}=a;addScaleCorrector(defaultScaleCorrectors),tt&&($.group&&$.group.add(tt),j&&j.register&&et&&j.register(tt),tt.root.didUpdate(),tt.addEventListener("animationComplete",()=>{this.safeToRemove()}),tt.setOptions({...tt.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){const{layoutDependency:$,visualElement:j,drag:et,isPresent:tt}=this.props,rt=j.projection;return rt&&(rt.isPresent=tt,et||a.layoutDependency!==$||$===void 0?rt.willUpdate():this.safeToRemove(),a.isPresent!==tt&&(tt?rt.promote():rt.relegate()||frame.postRender(()=>{const nt=rt.getStack();(!nt||!nt.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:a}=this.props.visualElement;a&&(a.root.didUpdate(),microtask.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:a,layoutGroup:$,switchLayoutGroup:j}=this.props,{projection:et}=a;et&&(et.scheduleCheckAfterUnmount(),$&&$.group&&$.group.remove(et),j&&j.deregister&&j.deregister(et))}safeToRemove(){const{safeToRemove:a}=this.props;a&&a()}render(){return null}}function MeasureLayout(_){const[a,$]=usePresence(),j=reactExports.useContext(LayoutGroupContext);return jsxRuntimeExports.jsx(MeasureLayoutWithContext,{..._,layoutGroup:j,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:a,safeToRemove:$})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=_=>typeof _=="string"?parseFloat(_):_,isPx=_=>typeof _=="number"||px.test(_);function mixValues(_,a,$,j,et,tt){et?(_.opacity=mixNumber$1(0,$.opacity!==void 0?$.opacity:1,easeCrossfadeIn(j)),_.opacityExit=mixNumber$1(a.opacity!==void 0?a.opacity:1,0,easeCrossfadeOut(j))):tt&&(_.opacity=mixNumber$1(a.opacity!==void 0?a.opacity:1,$.opacity!==void 0?$.opacity:1,j));for(let rt=0;rtj<_?0:j>a?1:$(progress(_,a,j))}function copyAxisInto(_,a){_.min=a.min,_.max=a.max}function copyBoxInto(_,a){copyAxisInto(_.x,a.x),copyAxisInto(_.y,a.y)}function removePointDelta(_,a,$,j,et){return _-=a,_=scalePoint(_,1/$,j),et!==void 0&&(_=scalePoint(_,1/et,j)),_}function removeAxisDelta(_,a=0,$=1,j=.5,et,tt=_,rt=_){if(percent.test(a)&&(a=parseFloat(a),a=mixNumber$1(rt.min,rt.max,a/100)-rt.min),typeof a!="number")return;let nt=mixNumber$1(tt.min,tt.max,j);_===tt&&(nt-=a),_.min=removePointDelta(_.min,a,$,nt,et),_.max=removePointDelta(_.max,a,$,nt,et)}function removeAxisTransforms(_,a,[$,j,et],tt,rt){removeAxisDelta(_,a[$],a[j],a[et],a.scale,tt,rt)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(_,a,$,j){removeAxisTransforms(_.x,a,xKeys,$?$.x:void 0,j?j.x:void 0),removeAxisTransforms(_.y,a,yKeys,$?$.y:void 0,j?j.y:void 0)}function isAxisDeltaZero(_){return _.translate===0&&_.scale===1}function isDeltaZero(_){return isAxisDeltaZero(_.x)&&isAxisDeltaZero(_.y)}function boxEquals(_,a){return _.x.min===a.x.min&&_.x.max===a.x.max&&_.y.min===a.y.min&&_.y.max===a.y.max}function boxEqualsRounded(_,a){return Math.round(_.x.min)===Math.round(a.x.min)&&Math.round(_.x.max)===Math.round(a.x.max)&&Math.round(_.y.min)===Math.round(a.y.min)&&Math.round(_.y.max)===Math.round(a.y.max)}function aspectRatio(_){return calcLength(_.x)/calcLength(_.y)}class NodeStack{constructor(){this.members=[]}add(a){addUniqueItem(this.members,a),a.scheduleRender()}remove(a){if(removeItem(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){const $=this.members[this.members.length-1];$&&this.promote($)}}relegate(a){const $=this.members.findIndex(et=>a===et);if($===0)return!1;let j;for(let et=$;et>=0;et--){const tt=this.members[et];if(tt.isPresent!==!1){j=tt;break}}return j?(this.promote(j),!0):!1}promote(a,$){const j=this.lead;if(a!==j&&(this.prevLead=j,this.lead=a,a.show(),j)){j.instance&&j.scheduleRender(),a.scheduleRender(),a.resumeFrom=j,$&&(a.resumeFrom.preserveOpacity=!0),j.snapshot&&(a.snapshot=j.snapshot,a.snapshot.latestValues=j.animationValues||j.latestValues),a.root&&a.root.isUpdating&&(a.isLayoutDirty=!0);const{crossfade:et}=a.options;et===!1&&j.hide()}}exitAnimationComplete(){this.members.forEach(a=>{const{options:$,resumingFrom:j}=a;$.onExitComplete&&$.onExitComplete(),j&&j.options.onExitComplete&&j.options.onExitComplete()})}scheduleRender(){this.members.forEach(a=>{a.instance&&a.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(_,a,$){let j="";const et=_.x.translate/a.x,tt=_.y.translate/a.y,rt=($==null?void 0:$.z)||0;if((et||tt||rt)&&(j=`translate3d(${et}px, ${tt}px, ${rt}px) `),(a.x!==1||a.y!==1)&&(j+=`scale(${1/a.x}, ${1/a.y}) `),$){const{transformPerspective:ot,rotate:st,rotateX:at,rotateY:ut,skewX:ht,skewY:bt}=$;ot&&(j=`perspective(${ot}px) ${j}`),st&&(j+=`rotate(${st}deg) `),at&&(j+=`rotateX(${at}deg) `),ut&&(j+=`rotateY(${ut}deg) `),ht&&(j+=`skewX(${ht}deg) `),bt&&(j+=`skewY(${bt}deg) `)}const nt=_.x.scale*a.x,it=_.y.scale*a.y;return(nt!==1||it!==1)&&(j+=`scale(${nt}, ${it})`),j||"none"}const compareByDepth=(_,a)=>_.depth-a.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(a){addUniqueItem(this.children,a),this.isDirty=!0}remove(a){removeItem(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(a)}}function delay(_,a){const $=time.now(),j=({timestamp:et})=>{const tt=et-$;tt>=a&&(cancelFrame(j),_(tt-a))};return frame.read(j,!0),()=>cancelFrame(j)}function record(_){window.MotionDebug&&window.MotionDebug.record(_)}function isSVGElement(_){return _ instanceof SVGElement&&_.tagName!=="svg"}function animateSingleValue(_,a,$){const j=isMotionValue(_)?_:motionValue(_);return j.start(animateMotionValue("",j,a,$)),j.animation}const transformAxes=["","X","Y","Z"],hiddenVisibility={visibility:"hidden"},animationTarget=1e3;let id$1=0;const projectionFrameData={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function resetDistortingTransform(_,a,$,j){const{latestValues:et}=a;et[_]&&($[_]=et[_],a.setStaticValue(_,0),j&&(j[_]=0))}function createProjectionNode({attachResizeListener:_,defaultParent:a,measureScroll:$,checkIsScrollRoot:j,resetTransform:et}){return class{constructor(rt={},nt=a==null?void 0:a()){this.id=id$1++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,projectionFrameData.totalNodes=projectionFrameData.resolvedTargetDeltas=projectionFrameData.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(projectionFrameData)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=rt,this.root=nt?nt.root||nt:this,this.path=nt?[...nt.path,nt]:[],this.parent=nt,this.depth=nt?nt.depth+1:0;for(let it=0;itthis.root.updateBlockedByResize=!1;_(rt,()=>{this.root.updateBlockedByResize=!0,at&&at(),at=delay(ut,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}it&&this.root.registerSharedNode(it,this),this.options.animate!==!1&&st&&(it||ot)&&this.addEventListener("didUpdate",({delta:at,hasLayoutChanged:ut,hasRelativeTargetChanged:ht,layout:bt})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const Et=this.options.transition||st.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:Ct,onLayoutAnimationComplete:Pt}=st.getProps(),Tt=!this.targetLayout||!boxEqualsRounded(this.targetLayout,bt)||ht,It=!ut&&ht;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||It||ut&&(Tt||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(at,It);const Lt={...getValueTransition(Et,"layout"),onPlay:Ct,onComplete:Pt};(st.shouldReduceMotion||this.options.layoutRoot)&&(Lt.delay=0,Lt.type=!1),this.startAnimation(Lt)}else ut||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=bt})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const rt=this.getStack();rt&&rt.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,window.HandoffCancelAllAnimations&&window.HandoffCancelAllAnimations(),this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:rt}=this.options;return rt&&rt.getProps().transformTemplate}willUpdate(rt=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let st=0;stthis.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let it=0;it{const Nt=Lt/1e3;mixAxisDelta(at.x,rt.x,Nt),mixAxisDelta(at.y,rt.y,Nt),this.setTargetDelta(at),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(ut,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,ut,Nt),It&&boxEquals(this.relativeTarget,It)&&(this.isProjectionDirty=!1),It||(It=createBox()),copyBoxInto(It,this.relativeTarget)),Et&&(this.animationValues=st,mixValues(st,ot,this.latestValues,Nt,Tt,Pt)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=Nt},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(rt){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,animationTarget,{...rt,onUpdate:nt=>{this.mixTargetDelta(nt),rt.onUpdate&&rt.onUpdate(nt)},onComplete:()=>{rt.onComplete&&rt.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const rt=this.getStack();rt&&rt.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const rt=this.getLead();let{targetWithTransforms:nt,target:it,layout:ot,latestValues:st}=rt;if(!(!nt||!it||!ot)){if(this!==rt&&this.layout&&ot&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,ot.layoutBox)){it=this.target||createBox();const at=calcLength(this.layout.layoutBox.x);it.x.min=rt.target.x.min,it.x.max=it.x.min+at;const ut=calcLength(this.layout.layoutBox.y);it.y.min=rt.target.y.min,it.y.max=it.y.min+ut}copyBoxInto(nt,it),transformBox(nt,st),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,nt,st)}}registerSharedNode(rt,nt){this.sharedNodes.has(rt)||this.sharedNodes.set(rt,new NodeStack),this.sharedNodes.get(rt).add(nt);const ot=nt.options.initialPromotionConfig;nt.promote({transition:ot?ot.transition:void 0,preserveFollowOpacity:ot&&ot.shouldPreserveFollowOpacity?ot.shouldPreserveFollowOpacity(nt):void 0})}isLead(){const rt=this.getStack();return rt?rt.lead===this:!0}getLead(){var rt;const{layoutId:nt}=this.options;return nt?((rt=this.getStack())===null||rt===void 0?void 0:rt.lead)||this:this}getPrevLead(){var rt;const{layoutId:nt}=this.options;return nt?(rt=this.getStack())===null||rt===void 0?void 0:rt.prevLead:void 0}getStack(){const{layoutId:rt}=this.options;if(rt)return this.root.sharedNodes.get(rt)}promote({needsReset:rt,transition:nt,preserveFollowOpacity:it}={}){const ot=this.getStack();ot&&ot.promote(this,it),rt&&(this.projectionDelta=void 0,this.needsReset=!0),nt&&this.setOptions({transition:nt})}relegate(){const rt=this.getStack();return rt?rt.relegate(this):!1}resetSkewAndRotation(){const{visualElement:rt}=this.options;if(!rt)return;let nt=!1;const{latestValues:it}=rt;if((it.z||it.rotate||it.rotateX||it.rotateY||it.rotateZ||it.skewX||it.skewY)&&(nt=!0),!nt)return;const ot={};it.z&&resetDistortingTransform("z",rt,ot,this.animationValues);for(let st=0;st{var nt;return(nt=rt.currentAnimation)===null||nt===void 0?void 0:nt.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(_){_.updateLayout()}function notifyLayoutUpdate(_){var a;const $=((a=_.resumeFrom)===null||a===void 0?void 0:a.snapshot)||_.snapshot;if(_.isLead()&&_.layout&&$&&_.hasListeners("didUpdate")){const{layoutBox:j,measuredBox:et}=_.layout,{animationType:tt}=_.options,rt=$.source!==_.layout.source;tt==="size"?eachAxis(at=>{const ut=rt?$.measuredBox[at]:$.layoutBox[at],ht=calcLength(ut);ut.min=j[at].min,ut.max=ut.min+ht}):shouldAnimatePositionOnly(tt,$.layoutBox,j)&&eachAxis(at=>{const ut=rt?$.measuredBox[at]:$.layoutBox[at],ht=calcLength(j[at]);ut.max=ut.min+ht,_.relativeTarget&&!_.currentAnimation&&(_.isProjectionDirty=!0,_.relativeTarget[at].max=_.relativeTarget[at].min+ht)});const nt=createDelta();calcBoxDelta(nt,j,$.layoutBox);const it=createDelta();rt?calcBoxDelta(it,_.applyTransform(et,!0),$.measuredBox):calcBoxDelta(it,j,$.layoutBox);const ot=!isDeltaZero(nt);let st=!1;if(!_.resumeFrom){const at=_.getClosestProjectingParent();if(at&&!at.resumeFrom){const{snapshot:ut,layout:ht}=at;if(ut&&ht){const bt=createBox();calcRelativePosition(bt,$.layoutBox,ut.layoutBox);const Et=createBox();calcRelativePosition(Et,j,ht.layoutBox),boxEqualsRounded(bt,Et)||(st=!0),at.options.layoutRoot&&(_.relativeTarget=Et,_.relativeTargetOrigin=bt,_.relativeParent=at)}}}_.notifyListeners("didUpdate",{layout:j,snapshot:$,delta:it,layoutDelta:nt,hasLayoutChanged:ot,hasRelativeTargetChanged:st})}else if(_.isLead()){const{onExitComplete:j}=_.options;j&&j()}_.options.transition=void 0}function propagateDirtyNodes(_){projectionFrameData.totalNodes++,_.parent&&(_.isProjecting()||(_.isProjectionDirty=_.parent.isProjectionDirty),_.isSharedProjectionDirty||(_.isSharedProjectionDirty=!!(_.isProjectionDirty||_.parent.isProjectionDirty||_.parent.isSharedProjectionDirty)),_.isTransformDirty||(_.isTransformDirty=_.parent.isTransformDirty))}function cleanDirtyNodes(_){_.isProjectionDirty=_.isSharedProjectionDirty=_.isTransformDirty=!1}function clearSnapshot(_){_.clearSnapshot()}function clearMeasurements(_){_.clearMeasurements()}function clearIsLayoutDirty(_){_.isLayoutDirty=!1}function resetTransformStyle(_){const{visualElement:a}=_.options;a&&a.getProps().onBeforeLayoutMeasure&&a.notify("BeforeLayoutMeasure"),_.resetTransform()}function finishAnimation(_){_.finishAnimation(),_.targetDelta=_.relativeTarget=_.target=void 0,_.isProjectionDirty=!0}function resolveTargetDelta(_){_.resolveTargetDelta()}function calcProjection(_){_.calcProjection()}function resetSkewAndRotation(_){_.resetSkewAndRotation()}function removeLeadSnapshots(_){_.removeLeadSnapshot()}function mixAxisDelta(_,a,$){_.translate=mixNumber$1(a.translate,0,$),_.scale=mixNumber$1(a.scale,1,$),_.origin=a.origin,_.originPoint=a.originPoint}function mixAxis(_,a,$,j){_.min=mixNumber$1(a.min,$.min,j),_.max=mixNumber$1(a.max,$.max,j)}function mixBox(_,a,$,j){mixAxis(_.x,a.x,$.x,j),mixAxis(_.y,a.y,$.y,j)}function hasOpacityCrossfade(_){return _.animationValues&&_.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=_=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(_),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$b;function roundAxis(_){_.min=roundPoint(_.min),_.max=roundPoint(_.max)}function roundBox(_){roundAxis(_.x),roundAxis(_.y)}function shouldAnimatePositionOnly(_,a,$){return _==="position"||_==="preserve-aspect"&&!isNear(aspectRatio(a),aspectRatio($),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(_,a)=>addDomEvent(_,"resize",a),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:_=>({x:_.scrollLeft,y:_.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const _=new DocumentProjectionNode({});_.mount(window),_.setOptions({layoutScroll:!0}),rootProjectionNode.current=_}return rootProjectionNode.current},resetTransform:(_,a)=>{_.style.transform=a!==void 0?a:"none"},checkIsScrollRoot:_=>window.getComputedStyle(_).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}},prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser$1)if(window.matchMedia){const _=window.matchMedia("(prefers-reduced-motion)"),a=()=>prefersReducedMotion.current=_.matches;_.addListener(a),a()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(_,a,$){const{willChange:j}=a;for(const et in a){const tt=a[et],rt=$[et];if(isMotionValue(tt))_.addValue(et,tt),isWillChangeMotionValue(j)&&j.add(et);else if(isMotionValue(rt))_.addValue(et,motionValue(tt,{owner:_})),isWillChangeMotionValue(j)&&j.remove(et);else if(rt!==tt)if(_.hasValue(et)){const nt=_.getValue(et);nt.liveStyle===!0?nt.jump(tt):nt.hasAnimated||nt.set(tt)}else{const nt=_.getStaticValue(et);_.addValue(et,motionValue(nt!==void 0?nt:tt,{owner:_}))}}for(const et in $)a[et]===void 0&&_.removeValue(et);return a}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color$1,complex],findValueType=_=>valueTypes.find(testValueType(_)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(_){if(_)return _.options.allowProjection!==!1?_.projection:getClosestProjectingNode(_.parent)}class VisualElement{scrapeMotionValuesFromProps(a,$,j){return{}}constructor({parent:a,props:$,presenceContext:j,reducedMotionConfig:et,blockInitialAnimation:tt,visualState:rt},nt={}){this.resolveKeyframes=(ut,ht,bt,Et)=>new this.KeyframeResolver(ut,ht,bt,Et,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>frame.render(this.render,!1,!0);const{latestValues:it,renderState:ot}=rt;this.latestValues=it,this.baseTarget={...it},this.initialValues=$.initial?{...it}:{},this.renderState=ot,this.parent=a,this.props=$,this.presenceContext=j,this.depth=a?a.depth+1:0,this.reducedMotionConfig=et,this.options=nt,this.blockInitialAnimation=!!tt,this.isControllingVariants=isControllingVariants($),this.isVariantNode=isVariantNode($),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:st,...at}=this.scrapeMotionValuesFromProps($,{},this);for(const ut in at){const ht=at[ut];it[ut]!==void 0&&isMotionValue(ht)&&(ht.set(it[ut],!1),isWillChangeMotionValue(st)&&st.add(ut))}}mount(a){this.current=a,visualElementStore.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(($,j)=>this.bindToMotionValue(j,$)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){var a;visualElementStore.delete(this.current),this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach($=>$()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const $ in this.events)this.events[$].clear();for(const $ in this.features)(a=this.features[$])===null||a===void 0||a.unmount();this.current=null}bindToMotionValue(a,$){const j=transformProps.has(a),et=$.on("change",rt=>{this.latestValues[a]=rt,this.props.onUpdate&&frame.preRender(this.notifyUpdate),j&&this.projection&&(this.projection.isTransformDirty=!0)}),tt=$.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(a,()=>{et(),tt(),$.owner&&$.stop()})}sortNodePosition(a){return!this.current||!this.sortInstanceNodePosition||this.type!==a.type?0:this.sortInstanceNodePosition(this.current,a.current)}loadFeatures({children:a,...$},j,et,tt){let rt,nt;for(let it=0;itthis.scheduleRender(),animationType:typeof ot=="string"?ot:"both",initialPromotionConfig:tt,layoutScroll:ut,layoutRoot:ht})}return nt}updateFeatures(){for(const a in this.features){const $=this.features[a];$.isMounted?$.update():($.mount(),$.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,$){this.latestValues[a]=$}update(a,$){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=$;for(let j=0;j$.variantChildren.delete(a)}addValue(a,$){const j=this.values.get(a);$!==j&&(j&&this.removeValue(a),this.bindToMotionValue(a,$),this.values.set(a,$),this.latestValues[a]=$.get())}removeValue(a){this.values.delete(a);const $=this.valueSubscriptions.get(a);$&&($(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,$){if(this.props.values&&this.props.values[a])return this.props.values[a];let j=this.values.get(a);return j===void 0&&$!==void 0&&(j=motionValue($===null?void 0:$,{owner:this}),this.addValue(a,j)),j}readValue(a,$){var j;let et=this.latestValues[a]!==void 0||!this.current?this.latestValues[a]:(j=this.getBaseTargetFromProps(this.props,a))!==null&&j!==void 0?j:this.readValueFromInstance(this.current,a,this.options);return et!=null&&(typeof et=="string"&&(isNumericalString(et)||isZeroValueString(et))?et=parseFloat(et):!findValueType(et)&&complex.test($)&&(et=getAnimatableNone(a,$)),this.setBaseTarget(a,isMotionValue(et)?et.get():et)),isMotionValue(et)?et.get():et}setBaseTarget(a,$){this.baseTarget[a]=$}getBaseTarget(a){var $;const{initial:j}=this.props;let et;if(typeof j=="string"||typeof j=="object"){const rt=resolveVariantFromProps(this.props,j,($=this.presenceContext)===null||$===void 0?void 0:$.custom);rt&&(et=rt[a])}if(j&&et!==void 0)return et;const tt=this.getBaseTargetFromProps(this.props,a);return tt!==void 0&&!isMotionValue(tt)?tt:this.initialValues[a]!==void 0&&et===void 0?void 0:this.baseTarget[a]}on(a,$){return this.events[a]||(this.events[a]=new SubscriptionManager),this.events[a].add($)}notify(a,...$){this.events[a]&&this.events[a].notify(...$)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(a,$){return a.compareDocumentPosition($)&2?1:-1}getBaseTargetFromProps(a,$){return a.style?a.style[$]:void 0}removeValueFromRenderState(a,{vars:$,style:j}){delete $[a],delete j[a]}}function getComputedStyle$2(_){return window.getComputedStyle(_)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(a,$){if(transformProps.has($)){const j=getDefaultValueType($);return j&&j.default||0}else{const j=getComputedStyle$2(a),et=(isCSSVariableName($)?j.getPropertyValue($):j[$])||0;return typeof et=="string"?et.trim():et}}measureInstanceViewportBox(a,{transformPagePoint:$}){return measureViewportBox(a,$)}build(a,$,j,et){buildHTMLStyles(a,$,j,et.transformTemplate)}scrapeMotionValuesFromProps(a,$,j){return scrapeMotionValuesFromProps$1(a,$,j)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:a}=this.props;isMotionValue(a)&&(this.childSubscription=a.on("change",$=>{this.current&&(this.current.textContent=`${$}`)}))}renderInstance(a,$,j,et){renderHTML(a,$,j,et)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(a,$){return a[$]}readValueFromInstance(a,$){if(transformProps.has($)){const j=getDefaultValueType($);return j&&j.default||0}return $=camelCaseAttributes.has($)?$:camelToDash($),a.getAttribute($)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(a,$,j){return scrapeMotionValuesFromProps(a,$,j)}build(a,$,j,et){buildSVGAttrs(a,$,j,this.isSVGTag,et.transformTemplate)}renderInstance(a,$,j,et){renderSVG(a,$,j,et)}mount(a){this.isSVGTag=isSVGTag(a.tagName),super.mount(a)}}const createDomVisualElement=(_,a)=>isSVGComponent(_)?new SVGVisualElement(a,{enableHardwareAcceleration:!1}):new HTMLVisualElement(a,{allowProjection:_!==reactExports.Fragment,enableHardwareAcceleration:!0}),layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},preloadedFeatures={...animations$1,...gestureAnimations,...drag,...layout},motion=createMotionProxy((_,a)=>createDomMotionConfig(_,a,preloadedFeatures,createDomVisualElement));function useIsMounted(){const _=reactExports.useRef(!1);return useIsomorphicLayoutEffect$2(()=>(_.current=!0,()=>{_.current=!1}),[]),_}function useForceUpdate(){const _=useIsMounted(),[a,$]=reactExports.useState(0),j=reactExports.useCallback(()=>{_.current&&$(a+1)},[a]);return[reactExports.useCallback(()=>frame.postRender(j),[j]),a]}class PopChildMeasure extends reactExports.Component{getSnapshotBeforeUpdate(a){const $=this.props.childRef.current;if($&&a.isPresent&&!this.props.isPresent){const j=this.props.sizeRef.current;j.height=$.offsetHeight||0,j.width=$.offsetWidth||0,j.top=$.offsetTop,j.left=$.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function PopChild({children:_,isPresent:a}){const $=reactExports.useId(),j=reactExports.useRef(null),et=reactExports.useRef({width:0,height:0,top:0,left:0}),{nonce:tt}=reactExports.useContext(MotionConfigContext);return reactExports.useInsertionEffect(()=>{const{width:rt,height:nt,top:it,left:ot}=et.current;if(a||!j.current||!rt||!nt)return;j.current.dataset.motionPopId=$;const st=document.createElement("style");return tt&&(st.nonce=tt),document.head.appendChild(st),st.sheet&&st.sheet.insertRule(` + )`;return{...!j&&et&&tt,...j?{bgImage:nt}:{bgColor:rt}}},baseStyleLabel$3={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},baseStyleTrack$1=_=>({bg:mode("gray.100","whiteAlpha.300")(_)}),baseStyleFilledTrack$1=_=>({transitionProperty:"common",transitionDuration:"slow",...filledStyle(_)}),baseStyle$A=definePartsStyle$q(_=>({label:baseStyleLabel$3,filledTrack:baseStyleFilledTrack$1(_),track:baseStyleTrack$1(_)})),sizes$h={xs:definePartsStyle$q({track:{h:"1"}}),sm:definePartsStyle$q({track:{h:"2"}}),md:definePartsStyle$q({track:{h:"3"}}),lg:definePartsStyle$q({track:{h:"4"}})},progressTheme=defineMultiStyleConfig$q({sizes:sizes$h,baseStyle:baseStyle$A,defaultProps:{size:"md",colorScheme:"blue"}}),isFunction$7=_=>typeof _=="function";function runIfFn$1(_,...a){return isFunction$7(_)?_(...a):_}var{definePartsStyle:definePartsStyle$p,defineMultiStyleConfig:defineMultiStyleConfig$p}=createMultiStyleConfigHelpers(checkboxAnatomy.keys),$size$3=cssVar$1("checkbox-size"),baseStyleControl$1=_=>{const{colorScheme:a}=_;return{w:$size$3.reference,h:$size$3.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:mode(`${a}.500`,`${a}.200`)(_),borderColor:mode(`${a}.500`,`${a}.200`)(_),color:mode("white","gray.900")(_),_hover:{bg:mode(`${a}.600`,`${a}.300`)(_),borderColor:mode(`${a}.600`,`${a}.300`)(_)},_disabled:{borderColor:mode("gray.200","transparent")(_),bg:mode("gray.200","whiteAlpha.300")(_),color:mode("gray.500","whiteAlpha.500")(_)}},_indeterminate:{bg:mode(`${a}.500`,`${a}.200`)(_),borderColor:mode(`${a}.500`,`${a}.200`)(_),color:mode("white","gray.900")(_)},_disabled:{bg:mode("gray.100","whiteAlpha.100")(_),borderColor:mode("gray.100","transparent")(_)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:mode("red.500","red.300")(_)}}},baseStyleContainer$3={_disabled:{cursor:"not-allowed"}},baseStyleLabel$2={userSelect:"none",_disabled:{opacity:.4}},baseStyleIcon$6={transitionProperty:"transform",transitionDuration:"normal"},baseStyle$z=definePartsStyle$p(_=>({icon:baseStyleIcon$6,container:baseStyleContainer$3,control:runIfFn$1(baseStyleControl$1,_),label:baseStyleLabel$2})),sizes$g={sm:definePartsStyle$p({control:{[$size$3.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:definePartsStyle$p({control:{[$size$3.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:definePartsStyle$p({control:{[$size$3.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},checkboxTheme$1=defineMultiStyleConfig$p({baseStyle:baseStyle$z,sizes:sizes$g,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:defineMultiStyleConfig$o,definePartsStyle:definePartsStyle$o}=createMultiStyleConfigHelpers(radioAnatomy.keys),baseStyleControl=_=>{var a;const $=(a=runIfFn$1(checkboxTheme$1.baseStyle,_))==null?void 0:a.control;return{...$,borderRadius:"full",_checked:{...$==null?void 0:$._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},baseStyle$y=definePartsStyle$o(_=>{var a,$,j,et;return{label:($=(a=checkboxTheme$1).baseStyle)==null?void 0:$.call(a,_).label,container:(et=(j=checkboxTheme$1).baseStyle)==null?void 0:et.call(j,_).container,control:baseStyleControl(_)}}),sizes$f={md:definePartsStyle$o({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:definePartsStyle$o({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:definePartsStyle$o({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},radioTheme$1=defineMultiStyleConfig$o({baseStyle:baseStyle$y,sizes:sizes$f,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:defineMultiStyleConfig$n,definePartsStyle:definePartsStyle$n}=createMultiStyleConfigHelpers(selectAnatomy.keys),$bg$b=cssVar$1("select-bg"),_a$6,baseStyleField$1={...(_a$6=inputTheme.baseStyle)==null?void 0:_a$6.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:$bg$b.reference,[$bg$b.variable]:"colors.white",_dark:{[$bg$b.variable]:"colors.gray.700"},"> option, > optgroup":{bg:$bg$b.reference}},baseStyleIcon$5={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},baseStyle$x=definePartsStyle$n({field:baseStyleField$1,icon:baseStyleIcon$5}),iconSpacing={paddingInlineEnd:"8"},_a2$1,_b$1,_c,_d,_e,_f,_g,_h,sizes$e={lg:{...(_a2$1=inputTheme.sizes)==null?void 0:_a2$1.lg,field:{...(_b$1=inputTheme.sizes)==null?void 0:_b$1.lg.field,...iconSpacing}},md:{...(_c=inputTheme.sizes)==null?void 0:_c.md,field:{...(_d=inputTheme.sizes)==null?void 0:_d.md.field,...iconSpacing}},sm:{...(_e=inputTheme.sizes)==null?void 0:_e.sm,field:{...(_f=inputTheme.sizes)==null?void 0:_f.sm.field,...iconSpacing}},xs:{...(_g=inputTheme.sizes)==null?void 0:_g.xs,field:{...(_h=inputTheme.sizes)==null?void 0:_h.xs.field,...iconSpacing},icon:{insetEnd:"1"}}},selectTheme=defineMultiStyleConfig$n({baseStyle:baseStyle$x,sizes:sizes$e,variants:inputTheme.variants,defaultProps:inputTheme.defaultProps}),$startColor=cssVar$1("skeleton-start-color"),$endColor=cssVar$1("skeleton-end-color"),baseStyle$w={[$startColor.variable]:"colors.gray.100",[$endColor.variable]:"colors.gray.400",_dark:{[$startColor.variable]:"colors.gray.800",[$endColor.variable]:"colors.gray.600"},background:$startColor.reference,borderColor:$endColor.reference,opacity:.7,borderRadius:"sm"},skeletonTheme={baseStyle:baseStyle$w},$bg$a=cssVar$1("skip-link-bg"),baseStyle$v={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[$bg$a.variable]:"colors.white",_dark:{[$bg$a.variable]:"colors.gray.700"},bg:$bg$a.reference}},skipLinkTheme={baseStyle:baseStyle$v},{defineMultiStyleConfig:defineMultiStyleConfig$m,definePartsStyle:definePartsStyle$m}=createMultiStyleConfigHelpers(sliderAnatomy.keys),$thumbSize=cssVar$1("slider-thumb-size"),$trackSize=cssVar$1("slider-track-size"),$bg$9=cssVar$1("slider-bg"),baseStyleContainer$2=_=>{const{orientation:a}=_;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...orient({orientation:a,vertical:{h:"100%"},horizontal:{w:"100%"}})}},baseStyleTrack=_=>({...orient({orientation:_.orientation,horizontal:{h:$trackSize.reference},vertical:{w:$trackSize.reference}}),overflow:"hidden",borderRadius:"sm",[$bg$9.variable]:"colors.gray.200",_dark:{[$bg$9.variable]:"colors.whiteAlpha.200"},_disabled:{[$bg$9.variable]:"colors.gray.300",_dark:{[$bg$9.variable]:"colors.whiteAlpha.300"}},bg:$bg$9.reference}),baseStyleThumb=_=>{const{orientation:a}=_;return{...orient({orientation:a,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:$thumbSize.reference,h:$thumbSize.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},baseStyleFilledTrack=_=>{const{colorScheme:a}=_;return{width:"inherit",height:"inherit",[$bg$9.variable]:`colors.${a}.500`,_dark:{[$bg$9.variable]:`colors.${a}.200`},bg:$bg$9.reference}},baseStyle$u=definePartsStyle$m(_=>({container:baseStyleContainer$2(_),track:baseStyleTrack(_),thumb:baseStyleThumb(_),filledTrack:baseStyleFilledTrack(_)})),sizeLg=definePartsStyle$m({container:{[$thumbSize.variable]:"sizes.4",[$trackSize.variable]:"sizes.1"}}),sizeMd=definePartsStyle$m({container:{[$thumbSize.variable]:"sizes.3.5",[$trackSize.variable]:"sizes.1"}}),sizeSm=definePartsStyle$m({container:{[$thumbSize.variable]:"sizes.2.5",[$trackSize.variable]:"sizes.0.5"}}),sizes$d={lg:sizeLg,md:sizeMd,sm:sizeSm},sliderTheme=defineMultiStyleConfig$m({baseStyle:baseStyle$u,sizes:sizes$d,defaultProps:{size:"md",colorScheme:"blue"}}),$size$2=cssVar("spinner-size"),baseStyle$t={width:[$size$2.reference],height:[$size$2.reference]},sizes$c={xs:{[$size$2.variable]:"sizes.3"},sm:{[$size$2.variable]:"sizes.4"},md:{[$size$2.variable]:"sizes.6"},lg:{[$size$2.variable]:"sizes.8"},xl:{[$size$2.variable]:"sizes.12"}},spinnerTheme={baseStyle:baseStyle$t,sizes:sizes$c,defaultProps:{size:"md"}},{defineMultiStyleConfig:defineMultiStyleConfig$l,definePartsStyle:definePartsStyle$l}=createMultiStyleConfigHelpers(statAnatomy.keys),baseStyleLabel$1={fontWeight:"medium"},baseStyleHelpText={opacity:.8,marginBottom:"2"},baseStyleNumber={verticalAlign:"baseline",fontWeight:"semibold"},baseStyleIcon$4={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},baseStyle$s=definePartsStyle$l({container:{},label:baseStyleLabel$1,helpText:baseStyleHelpText,number:baseStyleNumber,icon:baseStyleIcon$4}),sizes$b={md:definePartsStyle$l({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},statTheme=defineMultiStyleConfig$l({baseStyle:baseStyle$s,sizes:sizes$b,defaultProps:{size:"md"}}),$bg$8=cssVar$1("kbd-bg"),baseStyle$r={[$bg$8.variable]:"colors.gray.100",_dark:{[$bg$8.variable]:"colors.whiteAlpha.100"},bg:$bg$8.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},kbdTheme={baseStyle:baseStyle$r},baseStyle$q={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},linkTheme={baseStyle:baseStyle$q},{defineMultiStyleConfig:defineMultiStyleConfig$k,definePartsStyle:definePartsStyle$k}=createMultiStyleConfigHelpers(listAnatomy.keys),baseStyleIcon$3={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},baseStyle$p=definePartsStyle$k({icon:baseStyleIcon$3}),listTheme$1=defineMultiStyleConfig$k({baseStyle:baseStyle$p}),{defineMultiStyleConfig:defineMultiStyleConfig$j,definePartsStyle:definePartsStyle$j}=createMultiStyleConfigHelpers(menuAnatomy.keys),$bg$7=cssVar$1("menu-bg"),$shadow$2=cssVar$1("menu-shadow"),baseStyleList={[$bg$7.variable]:"#fff",[$shadow$2.variable]:"shadows.sm",_dark:{[$bg$7.variable]:"colors.gray.700",[$shadow$2.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:$bg$7.reference,boxShadow:$shadow$2.reference},baseStyleItem={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[$bg$7.variable]:"colors.gray.100",_dark:{[$bg$7.variable]:"colors.whiteAlpha.100"}},_active:{[$bg$7.variable]:"colors.gray.200",_dark:{[$bg$7.variable]:"colors.whiteAlpha.200"}},_expanded:{[$bg$7.variable]:"colors.gray.100",_dark:{[$bg$7.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:$bg$7.reference},baseStyleGroupTitle={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},baseStyleIcon$2={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},baseStyleCommand={opacity:.6},baseStyleDivider={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},baseStyleButton$1={transitionProperty:"common",transitionDuration:"normal"},baseStyle$o=definePartsStyle$j({button:baseStyleButton$1,list:baseStyleList,item:baseStyleItem,groupTitle:baseStyleGroupTitle,icon:baseStyleIcon$2,command:baseStyleCommand,divider:baseStyleDivider}),menuTheme=defineMultiStyleConfig$j({baseStyle:baseStyle$o}),{defineMultiStyleConfig:defineMultiStyleConfig$i,definePartsStyle:definePartsStyle$i}=createMultiStyleConfigHelpers(modalAnatomy.keys),$bg$6=cssVar$1("modal-bg"),$shadow$1=cssVar$1("modal-shadow"),baseStyleOverlay$1={bg:"blackAlpha.600",zIndex:"modal"},baseStyleDialogContainer$1=_=>{const{isCentered:a,scrollBehavior:$}=_;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:a?"center":"flex-start",overflow:$==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},baseStyleDialog$1=_=>{const{isCentered:a,scrollBehavior:$}=_;return{borderRadius:"md",color:"inherit",my:a?"auto":"16",mx:a?"auto":void 0,zIndex:"modal",maxH:$==="inside"?"calc(100% - 7.5rem)":void 0,[$bg$6.variable]:"colors.white",[$shadow$1.variable]:"shadows.lg",_dark:{[$bg$6.variable]:"colors.gray.700",[$shadow$1.variable]:"shadows.dark-lg"},bg:$bg$6.reference,boxShadow:$shadow$1.reference}},baseStyleHeader$2={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},baseStyleCloseButton$2={position:"absolute",top:"2",insetEnd:"3"},baseStyleBody$2=_=>{const{scrollBehavior:a}=_;return{px:"6",py:"2",flex:"1",overflow:a==="inside"?"auto":void 0}},baseStyleFooter$2={px:"6",py:"4"},baseStyle$n=definePartsStyle$i(_=>({overlay:baseStyleOverlay$1,dialogContainer:runIfFn$1(baseStyleDialogContainer$1,_),dialog:runIfFn$1(baseStyleDialog$1,_),header:baseStyleHeader$2,closeButton:baseStyleCloseButton$2,body:runIfFn$1(baseStyleBody$2,_),footer:baseStyleFooter$2}));function getSize$3(_){return definePartsStyle$i(_==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:_}})}var sizes$a={xs:getSize$3("xs"),sm:getSize$3("sm"),md:getSize$3("md"),lg:getSize$3("lg"),xl:getSize$3("xl"),"2xl":getSize$3("2xl"),"3xl":getSize$3("3xl"),"4xl":getSize$3("4xl"),"5xl":getSize$3("5xl"),"6xl":getSize$3("6xl"),full:getSize$3("full")},modalTheme$1=defineMultiStyleConfig$i({baseStyle:baseStyle$n,sizes:sizes$a,defaultProps:{size:"md"}}),{defineMultiStyleConfig:defineMultiStyleConfig$h,definePartsStyle:definePartsStyle$h}=createMultiStyleConfigHelpers(numberInputAnatomy.keys),$stepperWidth=cssVar("number-input-stepper-width"),$inputPadding=cssVar("number-input-input-padding"),inputPaddingValue=calc($stepperWidth).add("0.5rem").toString(),$bg$5=cssVar("number-input-bg"),$fg$3=cssVar("number-input-color"),$border$2=cssVar("number-input-border-color"),baseStyleRoot={[$stepperWidth.variable]:"sizes.6",[$inputPadding.variable]:inputPaddingValue},baseStyleField=_=>{var a,$;return($=(a=runIfFn$1(inputTheme.baseStyle,_))==null?void 0:a.field)!=null?$:{}},baseStyleStepperGroup={width:$stepperWidth.reference},baseStyleStepper={borderStart:"1px solid",borderStartColor:$border$2.reference,color:$fg$3.reference,bg:$bg$5.reference,[$fg$3.variable]:"colors.chakra-body-text",[$border$2.variable]:"colors.chakra-border-color",_dark:{[$fg$3.variable]:"colors.whiteAlpha.800",[$border$2.variable]:"colors.whiteAlpha.300"},_active:{[$bg$5.variable]:"colors.gray.200",_dark:{[$bg$5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},baseStyle$m=definePartsStyle$h(_=>{var a;return{root:baseStyleRoot,field:(a=runIfFn$1(baseStyleField,_))!=null?a:{},stepperGroup:baseStyleStepperGroup,stepper:baseStyleStepper}});function getSize$2(_){var a,$,j;const et=(a=inputTheme.sizes)==null?void 0:a[_],tt={lg:"md",md:"md",sm:"sm",xs:"sm"},rt=(j=($=et.field)==null?void 0:$.fontSize)!=null?j:"md",nt=typography_default.fontSizes[rt];return definePartsStyle$h({field:{...et.field,paddingInlineEnd:$inputPadding.reference,verticalAlign:"top"},stepper:{fontSize:calc(nt).multiply(.75).toString(),_first:{borderTopEndRadius:tt[_]},_last:{borderBottomEndRadius:tt[_],mt:"-1px",borderTopWidth:1}}})}var sizes$9={xs:getSize$2("xs"),sm:getSize$2("sm"),md:getSize$2("md"),lg:getSize$2("lg")},numberInputTheme=defineMultiStyleConfig$h({baseStyle:baseStyle$m,sizes:sizes$9,variants:inputTheme.variants,defaultProps:inputTheme.defaultProps}),_a$5,baseStyle$l={...(_a$5=inputTheme.baseStyle)==null?void 0:_a$5.field,textAlign:"center"},sizes$8={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},_a2,_b,variants$a={outline:_=>{var a,$,j;return(j=($=runIfFn$1((a=inputTheme.variants)==null?void 0:a.outline,_))==null?void 0:$.field)!=null?j:{}},flushed:_=>{var a,$,j;return(j=($=runIfFn$1((a=inputTheme.variants)==null?void 0:a.flushed,_))==null?void 0:$.field)!=null?j:{}},filled:_=>{var a,$,j;return(j=($=runIfFn$1((a=inputTheme.variants)==null?void 0:a.filled,_))==null?void 0:$.field)!=null?j:{}},unstyled:(_b=(_a2=inputTheme.variants)==null?void 0:_a2.unstyled.field)!=null?_b:{}},pinInputTheme={baseStyle:baseStyle$l,sizes:sizes$8,variants:variants$a,defaultProps:inputTheme.defaultProps},{defineMultiStyleConfig:defineMultiStyleConfig$g,definePartsStyle:definePartsStyle$g}=createMultiStyleConfigHelpers(popoverAnatomy.keys),$popperBg=cssVar("popper-bg"),$arrowBg=cssVar("popper-arrow-bg"),$arrowShadowColor=cssVar("popper-arrow-shadow-color"),baseStylePopper={zIndex:10},baseStyleContent={[$popperBg.variable]:"colors.white",bg:$popperBg.reference,[$arrowBg.variable]:$popperBg.reference,[$arrowShadowColor.variable]:"colors.gray.200",_dark:{[$popperBg.variable]:"colors.gray.700",[$arrowShadowColor.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},baseStyleHeader$1={px:3,py:2,borderBottomWidth:"1px"},baseStyleBody$1={px:3,py:2},baseStyleFooter$1={px:3,py:2,borderTopWidth:"1px"},baseStyleCloseButton$1={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},baseStyle$k=definePartsStyle$g({popper:baseStylePopper,content:baseStyleContent,header:baseStyleHeader$1,body:baseStyleBody$1,footer:baseStyleFooter$1,closeButton:baseStyleCloseButton$1}),popoverTheme=defineMultiStyleConfig$g({baseStyle:baseStyle$k}),{definePartsStyle:definePartsStyle$f,defineMultiStyleConfig:defineMultiStyleConfig$f}=createMultiStyleConfigHelpers(drawerAnatomy.keys),$bg$4=cssVar$1("drawer-bg"),$bs=cssVar$1("drawer-box-shadow");function getSize$1(_){return definePartsStyle$f(_==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:_}})}var baseStyleOverlay={bg:"blackAlpha.600",zIndex:"modal"},baseStyleDialogContainer={display:"flex",zIndex:"modal",justifyContent:"center"},baseStyleDialog=_=>{const{isFullHeight:a}=_;return{...a&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[$bg$4.variable]:"colors.white",[$bs.variable]:"shadows.lg",_dark:{[$bg$4.variable]:"colors.gray.700",[$bs.variable]:"shadows.dark-lg"},bg:$bg$4.reference,boxShadow:$bs.reference}},baseStyleHeader={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},baseStyleCloseButton={position:"absolute",top:"2",insetEnd:"3"},baseStyleBody={px:"6",py:"2",flex:"1",overflow:"auto"},baseStyleFooter={px:"6",py:"4"},baseStyle$j=definePartsStyle$f(_=>({overlay:baseStyleOverlay,dialogContainer:baseStyleDialogContainer,dialog:runIfFn$1(baseStyleDialog,_),header:baseStyleHeader,closeButton:baseStyleCloseButton,body:baseStyleBody,footer:baseStyleFooter})),sizes$7={xs:getSize$1("xs"),sm:getSize$1("md"),md:getSize$1("lg"),lg:getSize$1("2xl"),xl:getSize$1("4xl"),full:getSize$1("full")},drawerTheme$1=defineMultiStyleConfig$f({baseStyle:baseStyle$j,sizes:sizes$7,defaultProps:{size:"xs"}}),{definePartsStyle:definePartsStyle$e,defineMultiStyleConfig:defineMultiStyleConfig$e}=createMultiStyleConfigHelpers(editableAnatomy.keys),baseStylePreview={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},baseStyleInput={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},baseStyleTextarea={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},baseStyle$i=definePartsStyle$e({preview:baseStylePreview,input:baseStyleInput,textarea:baseStyleTextarea}),editableTheme=defineMultiStyleConfig$e({baseStyle:baseStyle$i}),{definePartsStyle:definePartsStyle$d,defineMultiStyleConfig:defineMultiStyleConfig$d}=createMultiStyleConfigHelpers(formAnatomy.keys),$fg$2=cssVar$1("form-control-color"),baseStyleRequiredIndicator={marginStart:"1",[$fg$2.variable]:"colors.red.500",_dark:{[$fg$2.variable]:"colors.red.300"},color:$fg$2.reference},baseStyleHelperText={mt:"2",[$fg$2.variable]:"colors.gray.600",_dark:{[$fg$2.variable]:"colors.whiteAlpha.600"},color:$fg$2.reference,lineHeight:"normal",fontSize:"sm"},baseStyle$h=definePartsStyle$d({container:{width:"100%",position:"relative"},requiredIndicator:baseStyleRequiredIndicator,helperText:baseStyleHelperText}),formTheme=defineMultiStyleConfig$d({baseStyle:baseStyle$h}),{definePartsStyle:definePartsStyle$c,defineMultiStyleConfig:defineMultiStyleConfig$c}=createMultiStyleConfigHelpers(formErrorAnatomy.keys),$fg$1=cssVar$1("form-error-color"),baseStyleText={[$fg$1.variable]:"colors.red.500",_dark:{[$fg$1.variable]:"colors.red.300"},color:$fg$1.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},baseStyleIcon$1={marginEnd:"0.5em",[$fg$1.variable]:"colors.red.500",_dark:{[$fg$1.variable]:"colors.red.300"},color:$fg$1.reference},baseStyle$g=definePartsStyle$c({text:baseStyleText,icon:baseStyleIcon$1}),formErrorTheme=defineMultiStyleConfig$c({baseStyle:baseStyle$g}),baseStyle$f={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},formLabelTheme={baseStyle:baseStyle$f},baseStyle$e={fontFamily:"heading",fontWeight:"bold"},sizes$6={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},headingTheme={baseStyle:baseStyle$e,sizes:sizes$6,defaultProps:{size:"xl"}},{defineMultiStyleConfig:defineMultiStyleConfig$b,definePartsStyle:definePartsStyle$b}=createMultiStyleConfigHelpers(breadcrumbAnatomy.keys),$decor=cssVar$1("breadcrumb-link-decor"),baseStyleLink={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:$decor.reference,[$decor.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[$decor.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},baseStyle$d=definePartsStyle$b({link:baseStyleLink}),breadcrumbTheme=defineMultiStyleConfig$b({baseStyle:baseStyle$d}),baseStyle$c={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},variantGhost=_=>{const{colorScheme:a,theme:$}=_;if(a==="gray")return{color:mode("gray.800","whiteAlpha.900")(_),_hover:{bg:mode("gray.100","whiteAlpha.200")(_)},_active:{bg:mode("gray.200","whiteAlpha.300")(_)}};const j=transparentize(`${a}.200`,.12)($),et=transparentize(`${a}.200`,.24)($);return{color:mode(`${a}.600`,`${a}.200`)(_),bg:"transparent",_hover:{bg:mode(`${a}.50`,j)(_)},_active:{bg:mode(`${a}.100`,et)(_)}}},variantOutline=_=>{const{colorScheme:a}=_,$=mode("gray.200","whiteAlpha.300")(_);return{border:"1px solid",borderColor:a==="gray"?$:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...runIfFn$1(variantGhost,_)}},accessibleColorMap={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},variantSolid$2=_=>{var a;const{colorScheme:$}=_;if($==="gray"){const it=mode("gray.100","whiteAlpha.200")(_);return{bg:it,color:mode("gray.800","whiteAlpha.900")(_),_hover:{bg:mode("gray.200","whiteAlpha.300")(_),_disabled:{bg:it}},_active:{bg:mode("gray.300","whiteAlpha.400")(_)}}}const{bg:j=`${$}.500`,color:et="white",hoverBg:tt=`${$}.600`,activeBg:rt=`${$}.700`}=(a=accessibleColorMap[$])!=null?a:{},nt=mode(j,`${$}.200`)(_);return{bg:nt,color:mode(et,"gray.800")(_),_hover:{bg:mode(tt,`${$}.300`)(_),_disabled:{bg:nt}},_active:{bg:mode(rt,`${$}.400`)(_)}}},variantLink=_=>{const{colorScheme:a}=_;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:mode(`${a}.500`,`${a}.200`)(_),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:mode(`${a}.700`,`${a}.500`)(_)}}},variantUnstyled={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},variants$9={ghost:variantGhost,outline:variantOutline,solid:variantSolid$2,link:variantLink,unstyled:variantUnstyled},sizes$5={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},buttonTheme$1={baseStyle:baseStyle$c,variants:variants$9,sizes:sizes$5,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:definePartsStyle$a,defineMultiStyleConfig:defineMultiStyleConfig$a}=createMultiStyleConfigHelpers(cardAnatomy.keys),$bg$3=cssVar$1("card-bg"),$padding=cssVar$1("card-padding"),$shadow=cssVar$1("card-shadow"),$radius=cssVar$1("card-radius"),$border$1=cssVar$1("card-border-width","0"),$borderColor=cssVar$1("card-border-color"),baseStyle$b=definePartsStyle$a({container:{[$bg$3.variable]:"colors.chakra-body-bg",backgroundColor:$bg$3.reference,boxShadow:$shadow.reference,borderRadius:$radius.reference,color:"chakra-body-text",borderWidth:$border$1.reference,borderColor:$borderColor.reference},body:{padding:$padding.reference,flex:"1 1 0%"},header:{padding:$padding.reference},footer:{padding:$padding.reference}}),sizes$4={sm:definePartsStyle$a({container:{[$radius.variable]:"radii.base",[$padding.variable]:"space.3"}}),md:definePartsStyle$a({container:{[$radius.variable]:"radii.md",[$padding.variable]:"space.5"}}),lg:definePartsStyle$a({container:{[$radius.variable]:"radii.xl",[$padding.variable]:"space.7"}})},variants$8={elevated:definePartsStyle$a({container:{[$shadow.variable]:"shadows.base",_dark:{[$bg$3.variable]:"colors.gray.700"}}}),outline:definePartsStyle$a({container:{[$border$1.variable]:"1px",[$borderColor.variable]:"colors.chakra-border-color"}}),filled:definePartsStyle$a({container:{[$bg$3.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[$padding.variable]:0},header:{[$padding.variable]:0},footer:{[$padding.variable]:0}}},cardTheme=defineMultiStyleConfig$a({baseStyle:baseStyle$b,variants:variants$8,sizes:sizes$4,defaultProps:{variant:"elevated",size:"md"}}),$size$1=cssVar("close-button-size"),$bg$2=cssVar("close-button-bg"),baseStyle$a={w:[$size$1.reference],h:[$size$1.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[$bg$2.variable]:"colors.blackAlpha.100",_dark:{[$bg$2.variable]:"colors.whiteAlpha.100"}},_active:{[$bg$2.variable]:"colors.blackAlpha.200",_dark:{[$bg$2.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:$bg$2.reference},sizes$3={lg:{[$size$1.variable]:"sizes.10",fontSize:"md"},md:{[$size$1.variable]:"sizes.8",fontSize:"xs"},sm:{[$size$1.variable]:"sizes.6",fontSize:"2xs"}},closeButtonTheme={baseStyle:baseStyle$a,sizes:sizes$3,defaultProps:{size:"md"}},{variants:variants$7,defaultProps:defaultProps$1}=badgeTheme,baseStyle$9={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:vars.bg.reference,color:vars.color.reference,boxShadow:vars.shadow.reference},codeTheme={baseStyle:baseStyle$9,variants:variants$7,defaultProps:defaultProps$1},baseStyle$8={w:"100%",mx:"auto",maxW:"prose",px:"4"},containerTheme={baseStyle:baseStyle$8},baseStyle$7={opacity:.6,borderColor:"inherit"},variantSolid$1={borderStyle:"solid"},variantDashed={borderStyle:"dashed"},variants$6={solid:variantSolid$1,dashed:variantDashed},dividerTheme={baseStyle:baseStyle$7,variants:variants$6,defaultProps:{variant:"solid"}},{definePartsStyle:definePartsStyle$9,defineMultiStyleConfig:defineMultiStyleConfig$9}=createMultiStyleConfigHelpers(accordionAnatomy.keys),baseStyleContainer$1={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},baseStyleButton={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},baseStylePanel={pt:"2",px:"4",pb:"5"},baseStyleIcon={fontSize:"1.25em"},baseStyle$6=definePartsStyle$9({container:baseStyleContainer$1,button:baseStyleButton,panel:baseStylePanel,icon:baseStyleIcon}),accordionTheme=defineMultiStyleConfig$9({baseStyle:baseStyle$6}),{definePartsStyle:definePartsStyle$8,defineMultiStyleConfig:defineMultiStyleConfig$8}=createMultiStyleConfigHelpers(alertAnatomy.keys),$fg=cssVar$1("alert-fg"),$bg$1=cssVar$1("alert-bg"),baseStyle$5=definePartsStyle$8({container:{bg:$bg$1.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:$fg.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:$fg.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function getBg(_){const{theme:a,colorScheme:$}=_,j=transparentize(`${$}.200`,.16)(a);return{light:`colors.${$}.100`,dark:j}}var variantSubtle=definePartsStyle$8(_=>{const{colorScheme:a}=_,$=getBg(_);return{container:{[$fg.variable]:`colors.${a}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${a}.200`,[$bg$1.variable]:$.dark}}}}),variantLeftAccent=definePartsStyle$8(_=>{const{colorScheme:a}=_,$=getBg(_);return{container:{[$fg.variable]:`colors.${a}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${a}.200`,[$bg$1.variable]:$.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:$fg.reference}}}),variantTopAccent=definePartsStyle$8(_=>{const{colorScheme:a}=_,$=getBg(_);return{container:{[$fg.variable]:`colors.${a}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${a}.200`,[$bg$1.variable]:$.dark},pt:"2",borderTopWidth:"4px",borderTopColor:$fg.reference}}}),variantSolid=definePartsStyle$8(_=>{const{colorScheme:a}=_;return{container:{[$fg.variable]:"colors.white",[$bg$1.variable]:`colors.${a}.600`,_dark:{[$fg.variable]:"colors.gray.900",[$bg$1.variable]:`colors.${a}.200`},color:$fg.reference}}}),variants$5={subtle:variantSubtle,"left-accent":variantLeftAccent,"top-accent":variantTopAccent,solid:variantSolid},alertTheme=defineMultiStyleConfig$8({baseStyle:baseStyle$5,variants:variants$5,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:definePartsStyle$7,defineMultiStyleConfig:defineMultiStyleConfig$7}=createMultiStyleConfigHelpers(avatarAnatomy.keys),$border=cssVar$1("avatar-border-color"),$bg=cssVar$1("avatar-bg"),$fs=cssVar$1("avatar-font-size"),$size=cssVar$1("avatar-size"),baseStyleBadge={borderRadius:"full",border:"0.2em solid",borderColor:$border.reference,[$border.variable]:"white",_dark:{[$border.variable]:"colors.gray.800"}},baseStyleExcessLabel={bg:$bg.reference,fontSize:$fs.reference,width:$size.reference,height:$size.reference,lineHeight:"1",[$bg.variable]:"colors.gray.200",_dark:{[$bg.variable]:"colors.whiteAlpha.400"}},baseStyleContainer=_=>{const{name:a,theme:$}=_,j=a?randomColor({string:a}):"colors.gray.400",et=isDark(j)($);let tt="white";return et||(tt="gray.800"),{bg:$bg.reference,fontSize:$fs.reference,color:tt,borderColor:$border.reference,verticalAlign:"top",width:$size.reference,height:$size.reference,"&:not([data-loaded])":{[$bg.variable]:j},[$border.variable]:"colors.white",_dark:{[$border.variable]:"colors.gray.800"}}},baseStyleLabel={fontSize:$fs.reference,lineHeight:"1"},baseStyle$4=definePartsStyle$7(_=>({badge:runIfFn$1(baseStyleBadge,_),excessLabel:runIfFn$1(baseStyleExcessLabel,_),container:runIfFn$1(baseStyleContainer,_),label:baseStyleLabel}));function getSize(_){const a=_!=="100%"?sizes_default[_]:void 0;return definePartsStyle$7({container:{[$size.variable]:a??_,[$fs.variable]:`calc(${a??_} / 2.5)`},excessLabel:{[$size.variable]:a??_,[$fs.variable]:`calc(${a??_} / 2.5)`}})}var sizes$2={"2xs":getSize(4),xs:getSize(6),sm:getSize(8),md:getSize(12),lg:getSize(16),xl:getSize(24),"2xl":getSize(32),full:getSize("100%")},avatarTheme=defineMultiStyleConfig$7({baseStyle:baseStyle$4,sizes:sizes$2,defaultProps:{size:"md"}}),components={Accordion:accordionTheme,Alert:alertTheme,Avatar:avatarTheme,Badge:badgeTheme,Breadcrumb:breadcrumbTheme,Button:buttonTheme$1,Checkbox:checkboxTheme$1,CloseButton:closeButtonTheme,Code:codeTheme,Container:containerTheme,Divider:dividerTheme,Drawer:drawerTheme$1,Editable:editableTheme,Form:formTheme,FormError:formErrorTheme,FormLabel:formLabelTheme,Heading:headingTheme,Input:inputTheme,Kbd:kbdTheme,Link:linkTheme,List:listTheme$1,Menu:menuTheme,Modal:modalTheme$1,NumberInput:numberInputTheme,PinInput:pinInputTheme,Popover:popoverTheme,Progress:progressTheme,Radio:radioTheme$1,Select:selectTheme,Skeleton:skeletonTheme,SkipLink:skipLinkTheme,Slider:sliderTheme,Spinner:spinnerTheme,Stat:statTheme,Switch:switchTheme$1,Table:tableTheme,Tabs:tabsTheme$1,Tag:tagTheme,Textarea:textareaTheme,Tooltip:tooltipTheme,Card:cardTheme,Stepper:stepperTheme},semanticTokens={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},styles={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},direction="ltr",config$4={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},theme$1={semanticTokens,direction,...foundations,components,styles,config:config$4};function isFunction$6(_){return typeof _=="function"}function pipe$2(..._){return a=>_.reduce(($,j)=>j($),a)}var createExtendTheme=_=>function(...$){let j=[...$],et=$[$.length-1];return isChakraTheme(et)&&j.length>1?j=j.slice(0,j.length-1):et=_,pipe$2(...j.map(tt=>rt=>isFunction$6(tt)?tt(rt):mergeThemeOverride(rt,tt)))(et)},extendTheme=createExtendTheme(theme$1);function mergeThemeOverride(..._){return mergeWith({},..._,mergeThemeCustomizer)}function mergeThemeCustomizer(_,a,$,j){if((isFunction$6(_)||isFunction$6(a))&&Object.prototype.hasOwnProperty.call(j,$))return(...et)=>{const tt=isFunction$6(_)?_(...et):_,rt=isFunction$6(a)?a(...et):a;return mergeWith({},tt,rt,mergeThemeCustomizer)}}function isElement$4(_){return _!=null&&typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE}function getOwnerDocument$3(_){var a;return isElement$4(_)&&(a=_.ownerDocument)!=null?a:document}function canUseDOM$1(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var isBrowser$2=canUseDOM$1();function omit$5(_,a){const $={};return Object.keys(_).forEach(j=>{a.includes(j)||($[j]=_[j])}),$}function get$5(_,a,$,j){const et=typeof a=="string"?a.split("."):[a];for(j=0;j{const a=new WeakMap;return(j,et,tt,rt)=>{if(typeof j>"u")return _(j,et,tt);a.has(j)||a.set(j,new Map);const nt=a.get(j);if(nt.has(et))return nt.get(et);const it=_(j,et,tt,rt);return nt.set(et,it),it}},memoizedGet=memoize(get$5);function objectFilter(_,a){const $={};return Object.keys(_).forEach(j=>{const et=_[j];a(et,j,_)&&($[j]=et)}),$}var filterUndefined=_=>objectFilter(_,a=>a!=null);function isFunction$5(_){return typeof _=="function"}function runIfFn(_,...a){return isFunction$5(_)?_(...a):_}function callAllHandlers(..._){return function($){_.some(j=>(j==null||j($),$==null?void 0:$.defaultPrevented))}}var hasElementType=typeof Element<"u",hasMap=typeof Map=="function",hasSet=typeof Set=="function",hasArrayBuffer=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function equal$1(_,a){if(_===a)return!0;if(_&&a&&typeof _=="object"&&typeof a=="object"){if(_.constructor!==a.constructor)return!1;var $,j,et;if(Array.isArray(_)){if($=_.length,$!=a.length)return!1;for(j=$;j--!==0;)if(!equal$1(_[j],a[j]))return!1;return!0}var tt;if(hasMap&&_ instanceof Map&&a instanceof Map){if(_.size!==a.size)return!1;for(tt=_.entries();!(j=tt.next()).done;)if(!a.has(j.value[0]))return!1;for(tt=_.entries();!(j=tt.next()).done;)if(!equal$1(j.value[1],a.get(j.value[0])))return!1;return!0}if(hasSet&&_ instanceof Set&&a instanceof Set){if(_.size!==a.size)return!1;for(tt=_.entries();!(j=tt.next()).done;)if(!a.has(j.value[0]))return!1;return!0}if(hasArrayBuffer&&ArrayBuffer.isView(_)&&ArrayBuffer.isView(a)){if($=_.length,$!=a.length)return!1;for(j=$;j--!==0;)if(_[j]!==a[j])return!1;return!0}if(_.constructor===RegExp)return _.source===a.source&&_.flags===a.flags;if(_.valueOf!==Object.prototype.valueOf&&typeof _.valueOf=="function"&&typeof a.valueOf=="function")return _.valueOf()===a.valueOf();if(_.toString!==Object.prototype.toString&&typeof _.toString=="function"&&typeof a.toString=="function")return _.toString()===a.toString();if(et=Object.keys(_),$=et.length,$!==Object.keys(a).length)return!1;for(j=$;j--!==0;)if(!Object.prototype.hasOwnProperty.call(a,et[j]))return!1;if(hasElementType&&_ instanceof Element)return!1;for(j=$;j--!==0;)if(!((et[j]==="_owner"||et[j]==="__v"||et[j]==="__o")&&_.$$typeof)&&!equal$1(_[et[j]],a[et[j]]))return!1;return!0}return _!==_&&a!==a}var reactFastCompare=function(a,$){try{return equal$1(a,$)}catch(j){if((j.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw j}};const isEqual$2=getDefaultExportFromCjs$1(reactFastCompare);function useStyleConfigImpl(_,a={}){var $;const{styleConfig:j,...et}=a,{theme:tt,colorMode:rt}=useChakra(),nt=_?memoizedGet(tt,`components.${_}`):void 0,it=j||nt,at=mergeWith({theme:tt,colorMode:rt},($=it==null?void 0:it.defaultProps)!=null?$:{},filterUndefined(omit$5(et,["children"]))),st=reactExports.useRef({});if(it){const ut=resolveStyleConfig(it)(at);isEqual$2(st.current,ut)||(st.current=ut)}return st.current}function useStyleConfig(_,a={}){return useStyleConfigImpl(_,a)}function useMultiStyleConfig(_,a={}){return useStyleConfigImpl(_,a)}var allPropNames=new Set([...propNames,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),validHTMLProps=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function shouldForwardProp(_){return validHTMLProps.has(_)||!allPropNames.has(_)}function assignAfter(_,...a){if(_==null)throw new TypeError("Cannot convert undefined or null to object");const $={..._};for(const j of a)if(j!=null)for(const et in j)Object.prototype.hasOwnProperty.call(j,et)&&(et in $&&delete $[et],$[et]=j[et]);return $}function compact$1(_){const a=Object.assign({},_);for(let $ in a)a[$]===void 0&&delete a[$];return a}function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(_){for(var a=1;a96?testOmitPropsOnStringTag:testOmitPropsOnComponent},composeShouldForwardProps=function(a,$,j){var et;if($){var tt=$.shouldForwardProp;et=a.__emotion_forwardProp&&tt?function(rt){return a.__emotion_forwardProp(rt)&&tt(rt)}:tt}return typeof et!="function"&&j&&(et=a.__emotion_forwardProp),et},Insertion=function(a){var $=a.cache,j=a.serialized,et=a.isStringTag;return registerStyles($,j,et),useInsertionEffectAlwaysWithSyncFallback(function(){return insertStyles($,j,et)}),null},createStyled=function _(a,$){var j=a.__emotion_real===a,et=j&&a.__emotion_base||a,tt,rt;$!==void 0&&(tt=$.label,rt=$.target);var nt=composeShouldForwardProps(a,$,j),it=nt||getDefaultShouldForwardProp(et),at=!it("as");return function(){var st=arguments,ot=j&&a.__emotion_styles!==void 0?a.__emotion_styles.slice(0):[];if(tt!==void 0&&ot.push("label:"+tt+";"),st[0]==null||st[0].raw===void 0)ot.push.apply(ot,st);else{ot.push(st[0][0]);for(var ut=st.length,dt=1;dta=>{const{theme:$,css:j,__css:et,sx:tt,...rt}=a,nt=objectFilter(rt,(ot,ut)=>isStyleProp(ut)),it=runIfFn(_,a),at=assignAfter({},et,it,filterUndefined(nt),tt),st=css(at)(a.theme);return j?[st,j]:st};function styled(_,a){const{baseStyle:$,...j}=a??{};j.shouldForwardProp||(j.shouldForwardProp=shouldForwardProp);const et=toCSSObject({baseStyle:$}),tt=emotion_styled(_,j)(et);return React$2.forwardRef(function(it,at){const{colorMode:st,forced:ot}=useColorMode();return React$2.createElement(tt,{ref:at,"data-theme":ot?st:void 0,...it})})}function factory(){const _=new Map;return new Proxy(styled,{apply(a,$,j){return styled(...j)},get(a,$){return _.has($)||_.set($,styled($)),_.get($)}})}var chakra=factory();function forwardRef(_){return reactExports.forwardRef(_)}function createContext(_={}){const{strict:a=!0,errorMessage:$="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:j}=_,et=reactExports.createContext(void 0);et.displayName=j;function tt(){var rt;const nt=reactExports.useContext(et);if(!nt&&a){const it=new Error($);throw it.name="ContextError",(rt=Error.captureStackTrace)==null||rt.call(Error,it,tt),it}return nt}return[et.Provider,tt,et]}function ThemeProvider(_){const{cssVarsRoot:a,theme:$,children:j}=_,et=reactExports.useMemo(()=>toCSSVar($),[$]);return jsxRuntimeExports.jsxs(ThemeProvider$1,{theme:et,children:[jsxRuntimeExports.jsx(CSSVars,{root:a}),j]})}function CSSVars({root:_=":host, :root"}){const a=[_,"[data-theme]"].join(",");return jsxRuntimeExports.jsx(Global,{styles:$=>({[a]:$.__cssVars})})}createContext({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function createStylesContext(_){return createContext({name:`${_}StylesContext`,errorMessage:`useStyles: "styles" is undefined. Seems you forgot to wrap the components in "<${_} />" `})}function GlobalStyle(){const{colorMode:_}=useColorMode();return jsxRuntimeExports.jsx(Global,{styles:a=>{const $=memoizedGet(a,"styles.global"),j=runIfFn($,{theme:a,colorMode:_});return j?css(j)(a):void 0}})}var EnvironmentContext=reactExports.createContext({getDocument(){return document},getWindow(){return window}});EnvironmentContext.displayName="EnvironmentContext";function useEnvironment({defer:_}={}){const[,a]=reactExports.useReducer($=>$+1,0);return useSafeLayoutEffect$2(()=>{_&&a()},[_]),reactExports.useContext(EnvironmentContext)}function EnvironmentProvider(_){const{children:a,environment:$,disabled:j}=_,et=reactExports.useRef(null),tt=reactExports.useMemo(()=>$||{getDocument:()=>{var nt,it;return(it=(nt=et.current)==null?void 0:nt.ownerDocument)!=null?it:document},getWindow:()=>{var nt,it;return(it=(nt=et.current)==null?void 0:nt.ownerDocument.defaultView)!=null?it:window}},[$]),rt=!j||!$;return jsxRuntimeExports.jsxs(EnvironmentContext.Provider,{value:tt,children:[a,rt&&jsxRuntimeExports.jsx("span",{id:"__chakra_env",hidden:!0,ref:et})]})}EnvironmentProvider.displayName="EnvironmentProvider";var ChakraProvider$1=_=>{const{children:a,colorModeManager:$,portalZIndex:j,resetScope:et,resetCSS:tt=!0,theme:rt={},environment:nt,cssVarsRoot:it,disableEnvironment:at,disableGlobalStyle:st}=_,ot=jsxRuntimeExports.jsx(EnvironmentProvider,{environment:nt,disabled:at,children:a});return jsxRuntimeExports.jsx(ThemeProvider,{theme:rt,cssVarsRoot:it,children:jsxRuntimeExports.jsxs(ColorModeProvider,{colorModeManager:$,options:rt.config,children:[tt?jsxRuntimeExports.jsx(CSSReset,{scope:et}):jsxRuntimeExports.jsx(CSSPolyfill,{}),!st&&jsxRuntimeExports.jsx(GlobalStyle,{}),j?jsxRuntimeExports.jsx(PortalManager,{zIndex:j,children:ot}):ot]})})},findById=(_,a)=>_.find($=>$.id===a);function findToast(_,a){const $=getToastPosition(_,a),j=$?_[$].findIndex(et=>et.id===a):-1;return{position:$,index:j}}function getToastPosition(_,a){for(const[$,j]of Object.entries(_))if(findById(j,a))return $}function getToastStyle(_){const a=_.includes("right"),$=_.includes("left");let j="center";return a&&(j="flex-end"),$&&(j="flex-start"),{display:"flex",flexDirection:"column",alignItems:j}}function getToastListStyle(_){const $=_==="top"||_==="bottom"?"0 auto":void 0,j=_.includes("top")?"env(safe-area-inset-top, 0px)":void 0,et=_.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,tt=_.includes("left")?void 0:"env(safe-area-inset-right, 0px)",rt=_.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:$,top:j,bottom:et,right:tt,left:rt}}function useCallbackRef$2(_,a=[]){const $=reactExports.useRef(_);return reactExports.useEffect(()=>{$.current=_}),reactExports.useCallback((...j)=>{var et;return(et=$.current)==null?void 0:et.call($,...j)},a)}function useTimeout(_,a){const $=useCallbackRef$2(_);reactExports.useEffect(()=>{if(a==null)return;let j=null;return j=window.setTimeout(()=>{$()},a),()=>{j&&window.clearTimeout(j)}},[a,$])}function useUpdateEffect(_,a){const $=reactExports.useRef(!1),j=reactExports.useRef(!1);reactExports.useEffect(()=>{if($.current&&j.current)return _();j.current=!0},a),reactExports.useEffect(()=>($.current=!0,()=>{$.current=!1}),[])}const MotionConfigContext=reactExports.createContext({transformPagePoint:_=>_,isStatic:!1,reducedMotion:"never"}),MotionContext=reactExports.createContext({}),PresenceContext=reactExports.createContext(null),isBrowser$1=typeof document<"u",useIsomorphicLayoutEffect$2=isBrowser$1?reactExports.useLayoutEffect:reactExports.useEffect,LazyContext=reactExports.createContext({strict:!1}),camelToDash=_=>_.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),optimizedAppearDataId="framerAppearId",optimizedAppearDataAttribute="data-"+camelToDash(optimizedAppearDataId),MotionGlobalConfig={skipAnimations:!1,useManualTiming:!1};class Queue{constructor(){this.order=[],this.scheduled=new Set}add(a){if(!this.scheduled.has(a))return this.scheduled.add(a),this.order.push(a),!0}remove(a){const $=this.order.indexOf(a);$!==-1&&(this.order.splice($,1),this.scheduled.delete(a))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(_){let a=new Queue,$=new Queue,j=0,et=!1,tt=!1;const rt=new WeakSet,nt={schedule:(it,at=!1,st=!1)=>{const ot=st&&et,ut=ot?a:$;return at&&rt.add(it),ut.add(it)&&ot&&et&&(j=a.order.length),it},cancel:it=>{$.remove(it),rt.delete(it)},process:it=>{if(et){tt=!0;return}if(et=!0,[a,$]=[$,a],$.clear(),j=a.order.length,j)for(let at=0;at(ot[ut]=createRenderStep(()=>$=!0),ot),{}),rt=ot=>{tt[ot].process(et)},nt=()=>{const ot=performance.now();$=!1,et.delta=j?1e3/60:Math.max(Math.min(ot-et.timestamp,maxElapsed),1),et.timestamp=ot,et.isProcessing=!0,stepsOrder.forEach(rt),et.isProcessing=!1,$&&a&&(j=!1,_(nt))},it=()=>{$=!0,j=!0,et.isProcessing||_(nt)};return{schedule:stepsOrder.reduce((ot,ut)=>{const dt=tt[ut];return ot[ut]=(mt,xt=!1,Ct=!1)=>($||it(),dt.schedule(mt,xt,Ct)),ot},{}),cancel:ot=>stepsOrder.forEach(ut=>tt[ut].cancel(ot)),state:et,steps:tt}}const{schedule:microtask,cancel:cancelMicrotask}=createRenderBatcher(queueMicrotask,!1);function useVisualElement(_,a,$,j){const{visualElement:et}=reactExports.useContext(MotionContext),tt=reactExports.useContext(LazyContext),rt=reactExports.useContext(PresenceContext),nt=reactExports.useContext(MotionConfigContext).reducedMotion,it=reactExports.useRef();j=j||tt.renderer,!it.current&&j&&(it.current=j(_,{visualState:a,parent:et,props:$,presenceContext:rt,blockInitialAnimation:rt?rt.initial===!1:!1,reducedMotionConfig:nt}));const at=it.current;reactExports.useInsertionEffect(()=>{at&&at.update($,rt)});const st=reactExports.useRef(!!($[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$2(()=>{at&&(microtask.render(at.render),st.current&&at.animationState&&at.animationState.animateChanges())}),reactExports.useEffect(()=>{at&&(at.updateFeatures(),!st.current&&at.animationState&&at.animationState.animateChanges(),st.current&&(st.current=!1,window.HandoffComplete=!0))}),at}function isRefObject$2(_){return _&&typeof _=="object"&&Object.prototype.hasOwnProperty.call(_,"current")}function useMotionRef(_,a,$){return reactExports.useCallback(j=>{j&&_.mount&&_.mount(j),a&&(j?a.mount(j):a.unmount()),$&&(typeof $=="function"?$(j):isRefObject$2($)&&($.current=j))},[a])}function isVariantLabel(_){return typeof _=="string"||Array.isArray(_)}function isAnimationControls(_){return _!==null&&typeof _=="object"&&typeof _.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(_){return isAnimationControls(_.animate)||variantProps.some(a=>isVariantLabel(_[a]))}function isVariantNode(_){return!!(isControllingVariants(_)||_.variants)}function getCurrentTreeVariants(_,a){if(isControllingVariants(_)){const{initial:$,animate:j}=_;return{initial:$===!1||isVariantLabel($)?$:void 0,animate:isVariantLabel(j)?j:void 0}}return _.inherit!==!1?a:{}}function useCreateMotionContext(_){const{initial:a,animate:$}=getCurrentTreeVariants(_,reactExports.useContext(MotionContext));return reactExports.useMemo(()=>({initial:a,animate:$}),[variantLabelsAsDependency(a),variantLabelsAsDependency($)])}function variantLabelsAsDependency(_){return Array.isArray(_)?_.join(" "):_}const featureProps={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},featureDefinitions={};for(const _ in featureProps)featureDefinitions[_]={isEnabled:a=>featureProps[_].some($=>!!a[$])};function loadFeatures(_){for(const a in _)featureDefinitions[a]={...featureDefinitions[a],..._[a]}}const LayoutGroupContext=reactExports.createContext({}),SwitchLayoutGroupContext=reactExports.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:_,createVisualElement:a,useRender:$,useVisualState:j,Component:et}){_&&loadFeatures(_);function tt(nt,it){let at;const st={...reactExports.useContext(MotionConfigContext),...nt,layoutId:useLayoutId(nt)},{isStatic:ot}=st,ut=useCreateMotionContext(nt),dt=j(nt,ot);if(!ot&&isBrowser$1){ut.visualElement=useVisualElement(et,dt,st,a);const mt=reactExports.useContext(SwitchLayoutGroupContext),xt=reactExports.useContext(LazyContext).strict;ut.visualElement&&(at=ut.visualElement.loadFeatures(st,xt,_,mt))}return jsxRuntimeExports.jsxs(MotionContext.Provider,{value:ut,children:[at&&ut.visualElement?jsxRuntimeExports.jsx(at,{visualElement:ut.visualElement,...st}):null,$(et,nt,useMotionRef(dt,ut.visualElement,it),dt,ot,ut.visualElement)]})}const rt=reactExports.forwardRef(tt);return rt[motionComponentSymbol]=et,rt}function useLayoutId({layoutId:_}){const a=reactExports.useContext(LayoutGroupContext).id;return a&&_!==void 0?a+"-"+_:_}function createMotionProxy(_){function a(j,et={}){return createMotionComponent(_(j,et))}if(typeof Proxy>"u")return a;const $=new Map;return new Proxy(a,{get:(j,et)=>($.has(et)||$.set(et,a(et)),$.get(et))})}const lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(_){return typeof _!="string"||_.includes("-")?!1:!!(lowercaseSVGElements.indexOf(_)>-1||/[A-Z]/u.test(_))}const scaleCorrectors={};function addScaleCorrector(_){Object.assign(scaleCorrectors,_)}const transformPropOrder=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],transformProps=new Set(transformPropOrder);function isForcedMotionValue(_,{layout:a,layoutId:$}){return transformProps.has(_)||_.startsWith("origin")||(a||$!==void 0)&&(!!scaleCorrectors[_]||_==="opacity")}const isMotionValue=_=>!!(_&&_.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(_,{enableHardwareAcceleration:a=!0,allowTransformNone:$=!0},j,et){let tt="";for(let rt=0;rta=>typeof a=="string"&&a.startsWith(_),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=_=>startsAsVariableToken(_)?singleCssVariableRegex.test(_.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(_,a)=>a&&typeof _=="number"?a.transform(_):_,clamp=(_,a,$)=>$>a?a:$<_?_:$,number$4={test:_=>typeof _=="number",parse:parseFloat,transform:_=>_},alpha={...number$4,transform:_=>clamp(0,1,_)},scale$1={...number$4,default:1},sanitize=_=>Math.round(_*1e5)/1e5,floatRegex=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,colorRegex=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,singleColorRegex=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function isString$4(_){return typeof _=="string"}const createUnitType=_=>({test:a=>isString$4(a)&&a.endsWith(_)&&a.split(" ").length===1,parse:parseFloat,transform:a=>`${a}${_}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:_=>percent.parse(_)/100,transform:_=>percent.transform(_*100)},int$1={...number$4,transform:Math.round},numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale:scale$1,scaleX:scale$1,scaleY:scale$1,scaleZ:scale$1,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int$1,backgroundPositionX:px,backgroundPositionY:px,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int$1};function buildHTMLStyles(_,a,$,j){const{style:et,vars:tt,transform:rt,transformOrigin:nt}=_;let it=!1,at=!1,st=!0;for(const ot in a){const ut=a[ot];if(isCSSVariableName(ot)){tt[ot]=ut;continue}const dt=numberValueTypes[ot],mt=getValueAsType(ut,dt);if(transformProps.has(ot)){if(it=!0,rt[ot]=mt,!st)continue;ut!==(dt.default||0)&&(st=!1)}else ot.startsWith("origin")?(at=!0,nt[ot]=mt):et[ot]=mt}if(a.transform||(it||j?et.transform=buildTransform(_.transform,$,st,j):et.transform&&(et.transform="none")),at){const{originX:ot="50%",originY:ut="50%",originZ:dt=0}=nt;et.transformOrigin=`${ot} ${ut} ${dt}`}}const createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(_,a,$){for(const j in a)!isMotionValue(a[j])&&!isForcedMotionValue(j,$)&&(_[j]=a[j])}function useInitialMotionValues({transformTemplate:_},a,$){return reactExports.useMemo(()=>{const j=createHtmlRenderState();return buildHTMLStyles(j,a,{enableHardwareAcceleration:!$},_),Object.assign({},j.vars,j.style)},[a])}function useStyle(_,a,$){const j=_.style||{},et={};return copyRawValuesOnly(et,j,_),Object.assign(et,useInitialMotionValues(_,a,$)),et}function useHTMLProps(_,a,$){const j={},et=useStyle(_,a,$);return _.drag&&_.dragListener!==!1&&(j.draggable=!1,et.userSelect=et.WebkitUserSelect=et.WebkitTouchCallout="none",et.touchAction=_.drag===!0?"none":`pan-${_.drag==="x"?"y":"x"}`),_.tabIndex===void 0&&(_.onTap||_.onTapStart||_.whileTap)&&(j.tabIndex=0),j.style=et,j}const validMotionProps=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function isValidMotionProp(_){return _.startsWith("while")||_.startsWith("drag")&&_!=="draggable"||_.startsWith("layout")||_.startsWith("onTap")||_.startsWith("onPan")||_.startsWith("onLayout")||validMotionProps.has(_)}let shouldForward=_=>!isValidMotionProp(_);function loadExternalIsValidProp(_){_&&(shouldForward=a=>a.startsWith("on")?!isValidMotionProp(a):_(a))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(_,a,$){const j={};for(const et in _)et==="values"&&typeof _.values=="object"||(shouldForward(et)||$===!0&&isValidMotionProp(et)||!a&&!isValidMotionProp(et)||_.draggable&&et.startsWith("onDrag"))&&(j[et]=_[et]);return j}function calcOrigin$1(_,a,$){return typeof _=="string"?_:px.transform(a+$*_)}function calcSVGTransformOrigin(_,a,$){const j=calcOrigin$1(a,_.x,_.width),et=calcOrigin$1($,_.y,_.height);return`${j} ${et}`}const dashKeys={offset:"stroke-dashoffset",array:"stroke-dasharray"},camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(_,a,$=1,j=0,et=!0){_.pathLength=1;const tt=et?dashKeys:camelKeys;_[tt.offset]=px.transform(-j);const rt=px.transform(a),nt=px.transform($);_[tt.array]=`${rt} ${nt}`}function buildSVGAttrs(_,{attrX:a,attrY:$,attrScale:j,originX:et,originY:tt,pathLength:rt,pathSpacing:nt=1,pathOffset:it=0,...at},st,ot,ut){if(buildHTMLStyles(_,at,st,ut),ot){_.style.viewBox&&(_.attrs.viewBox=_.style.viewBox);return}_.attrs=_.style,_.style={};const{attrs:dt,style:mt,dimensions:xt}=_;dt.transform&&(xt&&(mt.transform=dt.transform),delete dt.transform),xt&&(et!==void 0||tt!==void 0||mt.transform)&&(mt.transformOrigin=calcSVGTransformOrigin(xt,et!==void 0?et:.5,tt!==void 0?tt:.5)),a!==void 0&&(dt.x=a),$!==void 0&&(dt.y=$),j!==void 0&&(dt.scale=j),rt!==void 0&&buildSVGPath(dt,rt,nt,it,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=_=>typeof _=="string"&&_.toLowerCase()==="svg";function useSVGProps(_,a,$,j){const et=reactExports.useMemo(()=>{const tt=createSvgRenderState();return buildSVGAttrs(tt,a,{enableHardwareAcceleration:!1},isSVGTag(j),_.transformTemplate),{...tt.attrs,style:{...tt.style}}},[a]);if(_.style){const tt={};copyRawValuesOnly(tt,_.style,_),et.style={...tt,...et.style}}return et}function createUseRender(_=!1){return($,j,et,{latestValues:tt},rt)=>{const it=(isSVGComponent($)?useSVGProps:useHTMLProps)(j,tt,rt,$),at=filterProps(j,typeof $=="string",_),st=$!==reactExports.Fragment?{...at,...it,ref:et}:{},{children:ot}=j,ut=reactExports.useMemo(()=>isMotionValue(ot)?ot.get():ot,[ot]);return reactExports.createElement($,{...st,children:ut})}}function renderHTML(_,{style:a,vars:$},j,et){Object.assign(_.style,a,et&&et.getProjectionStyles(j));for(const tt in $)_.style.setProperty(tt,$[tt])}const camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(_,a,$,j){renderHTML(_,a,void 0,j);for(const et in a.attrs)_.setAttribute(camelCaseAttributes.has(et)?et:camelToDash(et),a.attrs[et])}function scrapeMotionValuesFromProps$1(_,a,$){var j;const{style:et}=_,tt={};for(const rt in et)(isMotionValue(et[rt])||a.style&&isMotionValue(a.style[rt])||isForcedMotionValue(rt,_)||((j=$==null?void 0:$.getValue(rt))===null||j===void 0?void 0:j.liveStyle)!==void 0)&&(tt[rt]=et[rt]);return tt}function scrapeMotionValuesFromProps(_,a,$){const j=scrapeMotionValuesFromProps$1(_,a,$);for(const et in _)if(isMotionValue(_[et])||isMotionValue(a[et])){const tt=transformPropOrder.indexOf(et)!==-1?"attr"+et.charAt(0).toUpperCase()+et.substring(1):et;j[tt]=_[et]}return j}function getValueState(_){const a=[{},{}];return _==null||_.values.forEach(($,j)=>{a[0][j]=$.get(),a[1][j]=$.getVelocity()}),a}function resolveVariantFromProps(_,a,$,j){if(typeof a=="function"){const[et,tt]=getValueState(j);a=a($!==void 0?$:_.custom,et,tt)}if(typeof a=="string"&&(a=_.variants&&_.variants[a]),typeof a=="function"){const[et,tt]=getValueState(j);a=a($!==void 0?$:_.custom,et,tt)}return a}function useConstant(_){const a=reactExports.useRef(null);return a.current===null&&(a.current=_()),a.current}const isKeyframesTarget=_=>Array.isArray(_),isCustomValue=_=>!!(_&&typeof _=="object"&&_.mix&&_.toValue),resolveFinalValueInKeyframes=_=>isKeyframesTarget(_)?_[_.length-1]||0:_;function resolveMotionValue(_){const a=isMotionValue(_)?_.get():_;return isCustomValue(a)?a.toValue():a}function makeState({scrapeMotionValuesFromProps:_,createRenderState:a,onMount:$},j,et,tt){const rt={latestValues:makeLatestValues(j,et,tt,_),renderState:a()};return $&&(rt.mount=nt=>$(j,nt,rt)),rt}const makeUseVisualState=_=>(a,$)=>{const j=reactExports.useContext(MotionContext),et=reactExports.useContext(PresenceContext),tt=()=>makeState(_,a,j,et);return $?tt():useConstant(tt)};function makeLatestValues(_,a,$,j){const et={},tt=j(_,{});for(const ut in tt)et[ut]=resolveMotionValue(tt[ut]);let{initial:rt,animate:nt}=_;const it=isControllingVariants(_),at=isVariantNode(_);a&&at&&!it&&_.inherit!==!1&&(rt===void 0&&(rt=a.initial),nt===void 0&&(nt=a.animate));let st=$?$.initial===!1:!1;st=st||rt===!1;const ot=st?nt:rt;return ot&&typeof ot!="boolean"&&!isAnimationControls(ot)&&(Array.isArray(ot)?ot:[ot]).forEach(dt=>{const mt=resolveVariantFromProps(_,dt);if(!mt)return;const{transitionEnd:xt,transition:Ct,...Pt}=mt;for(const Tt in Pt){let kt=Pt[Tt];if(Array.isArray(kt)){const Lt=st?kt.length-1:0;kt=kt[Lt]}kt!==null&&(et[Tt]=kt)}for(const Tt in xt)et[Tt]=xt[Tt]}),et}const noop$b=_=>_,{schedule:frame,cancel:cancelFrame,state:frameData,steps}=createRenderBatcher(typeof requestAnimationFrame<"u"?requestAnimationFrame:noop$b,!0),svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(_,a,{renderState:$,latestValues:j})=>{frame.read(()=>{try{$.dimensions=typeof a.getBBox=="function"?a.getBBox():a.getBoundingClientRect()}catch{$.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs($,j,{enableHardwareAcceleration:!1},isSVGTag(a.tagName),_.transformTemplate),renderSVG(a,$)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(_,{forwardMotionProps:a=!1},$,j){return{...isSVGComponent(_)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:$,useRender:createUseRender(a),createVisualElement:j,Component:_}}function addDomEvent(_,a,$,j={passive:!0}){return _.addEventListener(a,$,j),()=>_.removeEventListener(a,$)}const isPrimaryPointer=_=>_.pointerType==="mouse"?typeof _.button!="number"||_.button<=0:_.isPrimary!==!1;function extractEventInfo(_,a="page"){return{point:{x:_[`${a}X`],y:_[`${a}Y`]}}}const addPointerInfo=_=>a=>isPrimaryPointer(a)&&_(a,extractEventInfo(a));function addPointerEvent(_,a,$,j){return addDomEvent(_,a,addPointerInfo($),j)}const combineFunctions=(_,a)=>$=>a(_($)),pipe$1=(..._)=>_.reduce(combineFunctions);function createLock(_){let a=null;return()=>{const $=()=>{a=null};return a===null?(a=_,$):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(_){let a=!1;if(_==="y")a=globalVerticalLock();else if(_==="x")a=globalHorizontalLock();else{const $=globalHorizontalLock(),j=globalVerticalLock();$&&j?a=()=>{$(),j()}:($&&$(),j&&j())}return a}function isDragActive(){const _=getGlobalLock(!0);return _?(_(),!1):!0}class Feature{constructor(a){this.isMounted=!1,this.node=a}update(){}}function addHoverEvent(_,a){const $=a?"pointerenter":"pointerleave",j=a?"onHoverStart":"onHoverEnd",et=(tt,rt)=>{if(tt.pointerType==="touch"||isDragActive())return;const nt=_.getProps();_.animationState&&nt.whileHover&&_.animationState.setActive("whileHover",a);const it=nt[j];it&&frame.postRender(()=>it(tt,rt))};return addPointerEvent(_.current,$,et,{passive:!_.getProps()[j]})}class HoverGesture extends Feature{mount(){this.unmount=pipe$1(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}}class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch{a=!0}!a||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe$1(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const isNodeOrChild=(_,a)=>a?_===a?!0:isNodeOrChild(_,a.parentElement):!1;function fireSyntheticPointerEvent(_,a){if(!a)return;const $=new PointerEvent("pointer"+_);a($,extractEventInfo($))}class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=noop$b,this.removeEndListeners=noop$b,this.removeAccessibleListeners=noop$b,this.startPointerPress=(a,$)=>{if(this.isPressing)return;this.removeEndListeners();const j=this.node.getProps(),tt=addPointerEvent(window,"pointerup",(nt,it)=>{if(!this.checkPressEnd())return;const{onTap:at,onTapCancel:st,globalTapTarget:ot}=this.node.getProps(),ut=!ot&&!isNodeOrChild(this.node.current,nt.target)?st:at;ut&&frame.update(()=>ut(nt,it))},{passive:!(j.onTap||j.onPointerUp)}),rt=addPointerEvent(window,"pointercancel",(nt,it)=>this.cancelPress(nt,it),{passive:!(j.onTapCancel||j.onPointerCancel)});this.removeEndListeners=pipe$1(tt,rt),this.startPress(a,$)},this.startAccessiblePress=()=>{const a=tt=>{if(tt.key!=="Enter"||this.isPressing)return;const rt=nt=>{nt.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(it,at)=>{const{onTap:st}=this.node.getProps();st&&frame.postRender(()=>st(it,at))})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",rt),fireSyntheticPointerEvent("down",(nt,it)=>{this.startPress(nt,it)})},$=addDomEvent(this.node.current,"keydown",a),j=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(tt,rt)=>this.cancelPress(tt,rt))},et=addDomEvent(this.node.current,"blur",j);this.removeAccessibleListeners=pipe$1($,et)}}startPress(a,$){this.isPressing=!0;const{onTapStart:j,whileTap:et}=this.node.getProps();et&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),j&&frame.postRender(()=>j(a,$))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(a,$){if(!this.checkPressEnd())return;const{onTapCancel:j}=this.node.getProps();j&&frame.postRender(()=>j(a,$))}mount(){const a=this.node.getProps(),$=addPointerEvent(a.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(a.onTapStart||a.onPointerStart)}),j=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe$1($,j)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const observerCallbacks=new WeakMap,observers=new WeakMap,fireObserverCallback=_=>{const a=observerCallbacks.get(_.target);a&&a(_)},fireAllObserverCallbacks=_=>{_.forEach(fireObserverCallback)};function initIntersectionObserver({root:_,...a}){const $=_||document;observers.has($)||observers.set($,{});const j=observers.get($),et=JSON.stringify(a);return j[et]||(j[et]=new IntersectionObserver(fireAllObserverCallbacks,{root:_,...a})),j[et]}function observeIntersection(_,a,$){const j=initIntersectionObserver(a);return observerCallbacks.set(_,$),j.observe(_),()=>{observerCallbacks.delete(_),j.unobserve(_)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:a={}}=this.node.getProps(),{root:$,margin:j,amount:et="some",once:tt}=a,rt={root:$?$.current:void 0,rootMargin:j,threshold:typeof et=="number"?et:thresholdNames[et]},nt=it=>{const{isIntersecting:at}=it;if(this.isInView===at||(this.isInView=at,tt&&!at&&this.hasEnteredView))return;at&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",at);const{onViewportEnter:st,onViewportLeave:ot}=this.node.getProps(),ut=at?st:ot;ut&&ut(it)};return observeIntersection(this.node.current,rt,nt)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:a,prevProps:$}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(a,$))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:_={}},{viewport:a={}}={}){return $=>_[$]!==a[$]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(_,a){if(!Array.isArray(a))return!1;const $=a.length;if($!==_.length)return!1;for(let j=0;j<$;j++)if(a[j]!==_[j])return!1;return!0}function resolveVariant(_,a,$){const j=_.getProps();return resolveVariantFromProps(j,a,$!==void 0?$:j.custom,_)}const secondsToMilliseconds$1=_=>_*1e3,millisecondsToSeconds=_=>_/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=_=>({type:"spring",stiffness:550,damping:_===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(_,{keyframes:a})=>a.length>2?keyframesTransition:transformProps.has(_)?_.startsWith("scale")?criticallyDampedSpring(a[1]):underDampedSpring:ease;function isTransitionDefined({when:_,delay:a,delayChildren:$,staggerChildren:j,staggerDirection:et,repeat:tt,repeatType:rt,repeatDelay:nt,from:it,elapsed:at,...st}){return!!Object.keys(st).length}function getValueTransition(_,a){return _[a]||_.default||_}const isNotNull=_=>_!==null;function getFinalKeyframe(_,{repeat:a,repeatType:$="loop"},j){const et=_.filter(isNotNull),tt=a&&$!=="loop"&&a%2===1?0:et.length-1;return!tt||j===void 0?et[tt]:j}let now$1;function clearTime(){now$1=void 0}const time={now:()=>(now$1===void 0&&time.set(frameData.isProcessing||MotionGlobalConfig.useManualTiming?frameData.timestamp:performance.now()),now$1),set:_=>{now$1=_,queueMicrotask(clearTime)}},isZeroValueString=_=>/^0[^.\s]+$/u.test(_);function isNone(_){return typeof _=="number"?_===0:_!==null?_==="none"||_==="0"||isZeroValueString(_):!0}let invariant$1=noop$b;const isNumericalString=_=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(_),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(_){const a=splitCSSVariableRegex.exec(_);if(!a)return[,];const[,$,j,et]=a;return[`--${$??j}`,et]}function getVariableValue(_,a,$=1){const[j,et]=parseCSSVariable(_);if(!j)return;const tt=window.getComputedStyle(a).getPropertyValue(j);if(tt){const rt=tt.trim();return isNumericalString(rt)?parseFloat(rt):rt}return isCSSVariableToken(et)?getVariableValue(et,a,$+1):et}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=_=>_===number$4||_===px,getPosFromMatrix=(_,a)=>parseFloat(_.split(", ")[a]),getTranslateFromMatrix=(_,a)=>($,{transform:j})=>{if(j==="none"||!j)return 0;const et=j.match(/^matrix3d\((.+)\)$/u);if(et)return getPosFromMatrix(et[1],a);{const tt=j.match(/^matrix\((.+)\)$/u);return tt?getPosFromMatrix(tt[1],_):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(_=>!transformKeys.has(_));function removeNonTranslationalTransform(_){const a=[];return nonTranslationalTransformKeys.forEach($=>{const j=_.getValue($);j!==void 0&&(a.push([$,j.get()]),j.set($.startsWith("scale")?1:0))}),a}const positionalValues={width:({x:_},{paddingLeft:a="0",paddingRight:$="0"})=>_.max-_.min-parseFloat(a)-parseFloat($),height:({y:_},{paddingTop:a="0",paddingBottom:$="0"})=>_.max-_.min-parseFloat(a)-parseFloat($),top:(_,{top:a})=>parseFloat(a),left:(_,{left:a})=>parseFloat(a),bottom:({y:_},{top:a})=>parseFloat(a)+(_.max-_.min),right:({x:_},{left:a})=>parseFloat(a)+(_.max-_.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x;positionalValues.translateY=positionalValues.y;const testValueType=_=>a=>a.test(_),auto$1={test:_=>_==="auto",parse:_=>_},dimensionValueTypes=[number$4,px,percent,degrees,vw,vh,auto$1],findDimensionValueType=_=>dimensionValueTypes.find(testValueType(_)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const _=Array.from(toResolve).filter(j=>j.needsMeasurement),a=new Set(_.map(j=>j.element)),$=new Map;a.forEach(j=>{const et=removeNonTranslationalTransform(j);et.length&&($.set(j,et),j.render())}),_.forEach(j=>j.measureInitialState()),a.forEach(j=>{j.render();const et=$.get(j);et&&et.forEach(([tt,rt])=>{var nt;(nt=j.getValue(tt))===null||nt===void 0||nt.set(rt)})}),_.forEach(j=>j.measureEndState()),_.forEach(j=>{j.suspendedScrollY!==void 0&&window.scrollTo(0,j.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(_=>_.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(_=>{_.readKeyframes(),_.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(a,$,j,et,tt,rt=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...a],this.onComplete=$,this.name=j,this.motionValue=et,this.element=tt,this.isAsync=rt}scheduleResolve(){this.isScheduled=!0,this.isAsync?(toResolve.add(this),isScheduled||(isScheduled=!0,frame.read(readAllKeyframes),frame.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:a,name:$,element:j,motionValue:et}=this;for(let tt=0;tt$=>!!(isString$4($)&&singleColorRegex.test($)&&$.startsWith(_)||a&&Object.prototype.hasOwnProperty.call($,a)),splitColor=(_,a,$)=>j=>{if(!isString$4(j))return j;const[et,tt,rt,nt]=j.match(floatRegex);return{[_]:parseFloat(et),[a]:parseFloat(tt),[$]:parseFloat(rt),alpha:nt!==void 0?parseFloat(nt):1}},clampRgbUnit=_=>clamp(0,255,_),rgbUnit={...number$4,transform:_=>Math.round(clampRgbUnit(_))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:_,green:a,blue:$,alpha:j=1})=>"rgba("+rgbUnit.transform(_)+", "+rgbUnit.transform(a)+", "+rgbUnit.transform($)+", "+sanitize(alpha.transform(j))+")"};function parseHex$1(_){let a="",$="",j="",et="";return _.length>5?(a=_.substring(1,3),$=_.substring(3,5),j=_.substring(5,7),et=_.substring(7,9)):(a=_.substring(1,2),$=_.substring(2,3),j=_.substring(3,4),et=_.substring(4,5),a+=a,$+=$,j+=j,et+=et),{red:parseInt(a,16),green:parseInt($,16),blue:parseInt(j,16),alpha:et?parseInt(et,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex$1,transform:rgba.transform},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:_,saturation:a,lightness:$,alpha:j=1})=>"hsla("+Math.round(_)+", "+percent.transform(sanitize(a))+", "+percent.transform(sanitize($))+", "+sanitize(alpha.transform(j))+")"},color$1={test:_=>rgba.test(_)||hex.test(_)||hsla.test(_),parse:_=>rgba.test(_)?rgba.parse(_):hsla.test(_)?hsla.parse(_):hex.parse(_),transform:_=>isString$4(_)?_:_.hasOwnProperty("red")?rgba.transform(_):hsla.transform(_)};function test$1(_){var a,$;return isNaN(_)&&isString$4(_)&&(((a=_.match(floatRegex))===null||a===void 0?void 0:a.length)||0)+((($=_.match(colorRegex))===null||$===void 0?void 0:$.length)||0)>0}const NUMBER_TOKEN="number",COLOR_TOKEN="color",VAR_TOKEN="var",VAR_FUNCTION_TOKEN="var(",SPLIT_TOKEN="${}",complexRegex=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function analyseComplexValue(_){const a=_.toString(),$=[],j={color:[],number:[],var:[]},et=[];let tt=0;const nt=a.replace(complexRegex,it=>(color$1.test(it)?(j.color.push(tt),et.push(COLOR_TOKEN),$.push(color$1.parse(it))):it.startsWith(VAR_FUNCTION_TOKEN)?(j.var.push(tt),et.push(VAR_TOKEN),$.push(it)):(j.number.push(tt),et.push(NUMBER_TOKEN),$.push(parseFloat(it))),++tt,SPLIT_TOKEN)).split(SPLIT_TOKEN);return{values:$,split:nt,indexes:j,types:et}}function parseComplexValue(_){return analyseComplexValue(_).values}function createTransformer(_){const{split:a,types:$}=analyseComplexValue(_),j=a.length;return et=>{let tt="";for(let rt=0;rttypeof _=="number"?0:_;function getAnimatableNone$1(_){const a=parseComplexValue(_);return createTransformer(_)(a.map(convertNumbersToZero))}const complex={test:test$1,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(_){const[a,$]=_.slice(0,-1).split("(");if(a==="drop-shadow")return _;const[j]=$.match(floatRegex)||[];if(!j)return _;const et=$.replace(j,"");let tt=maxDefaults.has(a)?1:0;return j!==$&&(tt*=100),a+"("+tt+et+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter$1={...complex,getAnimatableNone:_=>{const a=_.match(functionRegex);return a?a.map(applyDefaultFilter).join(" "):_}},defaultValueTypes={...numberValueTypes,color:color$1,backgroundColor:color$1,outlineColor:color$1,fill:color$1,stroke:color$1,borderColor:color$1,borderTopColor:color$1,borderRightColor:color$1,borderBottomColor:color$1,borderLeftColor:color$1,filter:filter$1,WebkitFilter:filter$1},getDefaultValueType=_=>defaultValueTypes[_];function getAnimatableNone(_,a){let $=getDefaultValueType(_);return $!==filter$1&&($=complex),$.getAnimatableNone?$.getAnimatableNone(a):void 0}const invalidTemplates=new Set(["auto","none","0"]);function makeNoneKeyframesAnimatable(_,a,$){let j=0,et;for(;j<_.length&&!et;){const tt=_[j];typeof tt=="string"&&!invalidTemplates.has(tt)&&analyseComplexValue(tt).values.length&&(et=_[j]),j++}if(et&&$)for(const tt of a)_[tt]=getAnimatableNone($,et)}class DOMKeyframesResolver extends KeyframeResolver{constructor(a,$,j,et){super(a,$,j,et,et==null?void 0:et.owner,!0)}readKeyframes(){const{unresolvedKeyframes:a,element:$,name:j}=this;if(!$.current)return;super.readKeyframes();for(let it=0;it{$.getValue(it).set(at)}),this.resolveNoneKeyframes()}}function memo(_){let a;return()=>(a===void 0&&(a=_()),a)}const isAnimatable=(_,a)=>a==="zIndex"?!1:!!(typeof _=="number"||Array.isArray(_)||typeof _=="string"&&(complex.test(_)||_==="0")&&!_.startsWith("url("));function hasKeyframesChanged(_){const a=_[0];if(_.length===1)return!0;for(let $=0;$<_.length;$++)if(_[$]!==a)return!0}function canAnimate(_,a,$,j){const et=_[0];if(et===null)return!1;if(a==="display"||a==="visibility")return!0;const tt=_[_.length-1],rt=isAnimatable(et,a),nt=isAnimatable(tt,a);return!rt||!nt?!1:hasKeyframesChanged(_)||$==="spring"&&j}class BaseAnimation{constructor({autoplay:a=!0,delay:$=0,type:j="keyframes",repeat:et=0,repeatDelay:tt=0,repeatType:rt="loop",...nt}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:a,delay:$,type:j,repeat:et,repeatDelay:tt,repeatType:rt,...nt},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&flushKeyframeResolvers(),this._resolved}onKeyframesResolved(a,$){this.hasAttemptedResolve=!0;const{name:j,type:et,velocity:tt,delay:rt,onComplete:nt,onUpdate:it,isGenerator:at}=this.options;if(!at&&!canAnimate(a,j,et,tt))if(rt)this.options.duration=0;else{it==null||it(getFinalKeyframe(a,this.options,$)),nt==null||nt(),this.resolveFinishedPromise();return}const st=this.initPlayback(a,$);st!==!1&&(this._resolved={keyframes:a,finalKeyframe:$,...st},this.onPostResolved())}onPostResolved(){}then(a,$){return this.currentFinishedPromise.then(a,$)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(a=>{this.resolveFinishedPromise=a})}}function velocityPerSecond(_,a){return a?_*(1e3/a):0}const velocitySampleDuration=5;function calcGeneratorVelocity(_,a,$){const j=Math.max(a-velocitySampleDuration,0);return velocityPerSecond($-_(j),a-j)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:_=800,bounce:a=.25,velocity:$=0,mass:j=1}){let et,tt,rt=1-a;rt=clamp(minDamping,maxDamping,rt),_=clamp(minDuration,maxDuration$1,millisecondsToSeconds(_)),rt<1?(et=at=>{const st=at*rt,ot=st*_,ut=st-$,dt=calcAngularFreq(at,rt),mt=Math.exp(-ot);return safeMin-ut/dt*mt},tt=at=>{const ot=at*rt*_,ut=ot*$+$,dt=Math.pow(rt,2)*Math.pow(at,2)*_,mt=Math.exp(-ot),xt=calcAngularFreq(Math.pow(at,2),rt);return(-et(at)+safeMin>0?-1:1)*((ut-dt)*mt)/xt}):(et=at=>{const st=Math.exp(-at*_),ot=(at-$)*_+1;return-safeMin+st*ot},tt=at=>{const st=Math.exp(-at*_),ot=($-at)*(_*_);return st*ot});const nt=5/_,it=approximateRoot(et,tt,nt);if(_=secondsToMilliseconds$1(_),isNaN(it))return{stiffness:100,damping:10,duration:_};{const at=Math.pow(it,2)*j;return{stiffness:at,damping:rt*2*Math.sqrt(j*at),duration:_}}}const rootIterations=12;function approximateRoot(_,a,$){let j=$;for(let et=1;et_[$]!==void 0)}function getSpringOptions(_){let a={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,..._};if(!isSpringType(_,physicsKeys)&&isSpringType(_,durationKeys)){const $=findSpring(_);a={...a,...$,mass:1},a.isResolvedFromDuration=!0}return a}function spring({keyframes:_,restDelta:a,restSpeed:$,...j}){const et=_[0],tt=_[_.length-1],rt={done:!1,value:et},{stiffness:nt,damping:it,mass:at,duration:st,velocity:ot,isResolvedFromDuration:ut}=getSpringOptions({...j,velocity:-millisecondsToSeconds(j.velocity||0)}),dt=ot||0,mt=it/(2*Math.sqrt(nt*at)),xt=tt-et,Ct=millisecondsToSeconds(Math.sqrt(nt/at)),Pt=Math.abs(xt)<5;$||($=Pt?.01:2),a||(a=Pt?.005:.5);let Tt;if(mt<1){const kt=calcAngularFreq(Ct,mt);Tt=Lt=>{const Nt=Math.exp(-mt*Ct*Lt);return tt-Nt*((dt+mt*Ct*xt)/kt*Math.sin(kt*Lt)+xt*Math.cos(kt*Lt))}}else if(mt===1)Tt=kt=>tt-Math.exp(-Ct*kt)*(xt+(dt+Ct*xt)*kt);else{const kt=Ct*Math.sqrt(mt*mt-1);Tt=Lt=>{const Nt=Math.exp(-mt*Ct*Lt),zt=Math.min(kt*Lt,300);return tt-Nt*((dt+mt*Ct*xt)*Math.sinh(zt)+kt*xt*Math.cosh(zt))/kt}}return{calculatedDuration:ut&&st||null,next:kt=>{const Lt=Tt(kt);if(ut)rt.done=kt>=st;else{let Nt=dt;kt!==0&&(mt<1?Nt=calcGeneratorVelocity(Tt,kt,Lt):Nt=0);const zt=Math.abs(Nt)<=$,jt=Math.abs(tt-Lt)<=a;rt.done=zt&&jt}return rt.value=rt.done?tt:Lt,rt}}}function inertia({keyframes:_,velocity:a=0,power:$=.8,timeConstant:j=325,bounceDamping:et=10,bounceStiffness:tt=500,modifyTarget:rt,min:nt,max:it,restDelta:at=.5,restSpeed:st}){const ot=_[0],ut={done:!1,value:ot},dt=Mt=>nt!==void 0&&Mtit,mt=Mt=>nt===void 0?it:it===void 0||Math.abs(nt-Mt)-xt*Math.exp(-Mt/j),kt=Mt=>Pt+Tt(Mt),Lt=Mt=>{const Dt=Tt(Mt),Ft=kt(Mt);ut.done=Math.abs(Dt)<=at,ut.value=ut.done?Pt:Ft};let Nt,zt;const jt=Mt=>{dt(ut.value)&&(Nt=Mt,zt=spring({keyframes:[ut.value,mt(ut.value)],velocity:calcGeneratorVelocity(kt,Mt,ut.value),damping:et,stiffness:tt,restDelta:at,restSpeed:st}))};return jt(0),{calculatedDuration:null,next:Mt=>{let Dt=!1;return!zt&&Nt===void 0&&(Dt=!0,Lt(Mt),jt(Mt)),Nt!==void 0&&Mt>=Nt?zt.next(Mt-Nt):(!Dt&&Lt(Mt),ut)}}}const calcBezier=(_,a,$)=>(((1-3*$+3*a)*_+(3*$-6*a))*_+3*a)*_,subdivisionPrecision=1e-7,subdivisionMaxIterations=12;function binarySubdivide(_,a,$,j,et){let tt,rt,nt=0;do rt=a+($-a)/2,tt=calcBezier(rt,j,et)-_,tt>0?$=rt:a=rt;while(Math.abs(tt)>subdivisionPrecision&&++ntbinarySubdivide(tt,0,1,_,$);return tt=>tt===0||tt===1?tt:calcBezier(et(tt),a,j)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=_=>Array.isArray(_)&&typeof _[0]!="number",mirrorEasing=_=>a=>a<=.5?_(2*a)/2:(2-_(2*(1-a)))/2,reverseEasing=_=>a=>1-_(1-a),circIn=_=>1-Math.sin(Math.acos(_)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=_=>(_*=2)<1?.5*backIn(_):.5*(2-Math.pow(2,-10*(_-1))),easingLookup={linear:noop$b,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=_=>{if(Array.isArray(_)){invariant$1(_.length===4);const[a,$,j,et]=_;return cubicBezier(a,$,j,et)}else if(typeof _=="string")return invariant$1(easingLookup[_]!==void 0),easingLookup[_];return _},progress=(_,a,$)=>{const j=a-_;return j===0?1:($-_)/j},mixNumber$1=(_,a,$)=>_+(a-_)*$;function hueToRgb(_,a,$){return $<0&&($+=1),$>1&&($-=1),$<1/6?_+(a-_)*6*$:$<1/2?a:$<2/3?_+(a-_)*(2/3-$)*6:_}function hslaToRgba({hue:_,saturation:a,lightness:$,alpha:j}){_/=360,a/=100,$/=100;let et=0,tt=0,rt=0;if(!a)et=tt=rt=$;else{const nt=$<.5?$*(1+a):$+a-$*a,it=2*$-nt;et=hueToRgb(it,nt,_+1/3),tt=hueToRgb(it,nt,_),rt=hueToRgb(it,nt,_-1/3)}return{red:Math.round(et*255),green:Math.round(tt*255),blue:Math.round(rt*255),alpha:j}}const mixLinearColor=(_,a,$)=>{const j=_*_,et=$*(a*a-j)+j;return et<0?0:Math.sqrt(et)},colorTypes=[hex,rgba,hsla],getColorType=_=>colorTypes.find(a=>a.test(_));function asRGBA(_){const a=getColorType(_);let $=a.parse(_);return a===hsla&&($=hslaToRgba($)),$}const mixColor=(_,a)=>{const $=asRGBA(_),j=asRGBA(a),et={...$};return tt=>(et.red=mixLinearColor($.red,j.red,tt),et.green=mixLinearColor($.green,j.green,tt),et.blue=mixLinearColor($.blue,j.blue,tt),et.alpha=mixNumber$1($.alpha,j.alpha,tt),rgba.transform(et))},invisibleValues=new Set(["none","hidden"]);function mixVisibility(_,a){return invisibleValues.has(_)?$=>$<=0?_:a:$=>$>=1?a:_}function mixImmediate(_,a){return $=>$>0?a:_}function mixNumber(_,a){return $=>mixNumber$1(_,a,$)}function getMixer(_){return typeof _=="number"?mixNumber:typeof _=="string"?isCSSVariableToken(_)?mixImmediate:color$1.test(_)?mixColor:mixComplex:Array.isArray(_)?mixArray:typeof _=="object"?color$1.test(_)?mixColor:mixObject:mixImmediate}function mixArray(_,a){const $=[..._],j=$.length,et=_.map((tt,rt)=>getMixer(tt)(tt,a[rt]));return tt=>{for(let rt=0;rt{for(const tt in j)$[tt]=j[tt](et);return $}}function matchOrder(_,a){var $;const j=[],et={color:0,var:0,number:0};for(let tt=0;tt{const $=complex.createTransformer(a),j=analyseComplexValue(_),et=analyseComplexValue(a);return j.indexes.var.length===et.indexes.var.length&&j.indexes.color.length===et.indexes.color.length&&j.indexes.number.length>=et.indexes.number.length?invisibleValues.has(_)&&!et.values.length||invisibleValues.has(a)&&!j.values.length?mixVisibility(_,a):pipe$1(mixArray(matchOrder(j,et),et.values),$):mixImmediate(_,a)};function mix(_,a,$){return typeof _=="number"&&typeof a=="number"&&typeof $=="number"?mixNumber$1(_,a,$):getMixer(_)(_,a)}function createMixers(_,a,$){const j=[],et=$||mix,tt=_.length-1;for(let rt=0;rta[0];if(tt===2&&_[0]===_[1])return()=>a[1];_[0]>_[tt-1]&&(_=[..._].reverse(),a=[...a].reverse());const rt=createMixers(a,j,et),nt=rt.length,it=at=>{let st=0;if(nt>1)for(;st<_.length-2&&!(at<_[st+1]);st++);const ot=progress(_[st],_[st+1],at);return rt[st](ot)};return $?at=>it(clamp(_[0],_[tt-1],at)):it}function fillOffset(_,a){const $=_[_.length-1];for(let j=1;j<=a;j++){const et=progress(0,a,j);_.push(mixNumber$1($,1,et))}}function defaultOffset(_){const a=[0];return fillOffset(a,_.length-1),a}function convertOffsetToTimes(_,a){return _.map($=>$*a)}function defaultEasing(_,a){return _.map(()=>a||easeInOut).splice(0,_.length-1)}function keyframes({duration:_=300,keyframes:a,times:$,ease:j="easeInOut"}){const et=isEasingArray(j)?j.map(easingDefinitionToFunction):easingDefinitionToFunction(j),tt={done:!1,value:a[0]},rt=convertOffsetToTimes($&&$.length===a.length?$:defaultOffset(a),_),nt=interpolate(rt,a,{ease:Array.isArray(et)?et:defaultEasing(a,et)});return{calculatedDuration:_,next:it=>(tt.value=nt(it),tt.done=it>=_,tt)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(_){let a=0;const $=50;let j=_.next(a);for(;!j.done&&a=maxGeneratorDuration?1/0:a}const frameloopDriver=_=>{const a=({timestamp:$})=>_($);return{start:()=>frame.update(a,!0),stop:()=>cancelFrame(a),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=_=>_/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:a=KeyframeResolver,...$}){super($),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:nt}=this.options;nt&&nt()};const{name:j,motionValue:et,keyframes:tt}=this.options,rt=(nt,it)=>this.onKeyframesResolved(nt,it);j&&et&&et.owner?this.resolver=et.owner.resolveKeyframes(tt,rt,j,et):this.resolver=new a(tt,rt,j,et),this.resolver.scheduleResolve()}initPlayback(a){const{type:$="keyframes",repeat:j=0,repeatDelay:et=0,repeatType:tt,velocity:rt=0}=this.options,nt=generators[$]||keyframes;let it,at;nt!==keyframes&&typeof a[0]!="number"&&(it=pipe$1(percentToProgress,mix(a[0],a[1])),a=[0,100]);const st=nt({...this.options,keyframes:a});tt==="mirror"&&(at=nt({...this.options,keyframes:[...a].reverse(),velocity:-rt})),st.calculatedDuration===null&&(st.calculatedDuration=calcGeneratorDuration(st));const{calculatedDuration:ot}=st,ut=ot+et,dt=ut*(j+1)-et;return{generator:st,mirroredGenerator:at,mapPercentToKeyframes:it,calculatedDuration:ot,resolvedDuration:ut,totalDuration:dt}}onPostResolved(){const{autoplay:a=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!a?this.pause():this.state=this.pendingPlayState}tick(a,$=!1){const{resolved:j}=this;if(!j){const{keyframes:Mt}=this.options;return{done:!0,value:Mt[Mt.length-1]}}const{finalKeyframe:et,generator:tt,mirroredGenerator:rt,mapPercentToKeyframes:nt,keyframes:it,calculatedDuration:at,totalDuration:st,resolvedDuration:ot}=j;if(this.startTime===null)return tt.next(0);const{delay:ut,repeat:dt,repeatType:mt,repeatDelay:xt,onUpdate:Ct}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-st/this.speed,this.startTime)),$?this.currentTime=a:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(a-this.startTime)*this.speed;const Pt=this.currentTime-ut*(this.speed>=0?1:-1),Tt=this.speed>=0?Pt<0:Pt>st;this.currentTime=Math.max(Pt,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=st);let kt=this.currentTime,Lt=tt;if(dt){const Mt=Math.min(this.currentTime,st)/ot;let Dt=Math.floor(Mt),Ft=Mt%1;!Ft&&Mt>=1&&(Ft=1),Ft===1&&Dt--,Dt=Math.min(Dt,dt+1),!!(Dt%2)&&(mt==="reverse"?(Ft=1-Ft,xt&&(Ft-=xt/ot)):mt==="mirror"&&(Lt=rt)),kt=clamp(0,1,Ft)*ot}const Nt=Tt?{done:!1,value:it[0]}:Lt.next(kt);nt&&(Nt.value=nt(Nt.value));let{done:zt}=Nt;!Tt&&at!==null&&(zt=this.speed>=0?this.currentTime>=st:this.currentTime<=0);const jt=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&zt);return jt&&et!==void 0&&(Nt.value=getFinalKeyframe(it,this.options,et)),Ct&&Ct(Nt.value),jt&&this.finish(),Nt}get duration(){const{resolved:a}=this;return a?millisecondsToSeconds(a.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(a){a=secondsToMilliseconds$1(a),this.currentTime=a,this.holdTime!==null||this.speed===0?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.speed)}get speed(){return this.playbackSpeed}set speed(a){const $=this.playbackSpeed!==a;this.playbackSpeed=a,$&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:a=frameloopDriver,onPlay:$}=this.options;this.driver||(this.driver=a(et=>this.tick(et))),$&&$();const j=this.driver.now();this.holdTime!==null?this.startTime=j-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=j),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var a;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(a=this.currentTime)!==null&&a!==void 0?a:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:a}=this.options;a&&a()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}}const isBezierDefinition=_=>Array.isArray(_)&&typeof _[0]=="number";function isWaapiSupportedEasing(_){return!!(!_||typeof _=="string"&&_ in supportedWaapiEasing||isBezierDefinition(_)||Array.isArray(_)&&_.every(isWaapiSupportedEasing))}const cubicBezierAsString=([_,a,$,j])=>`cubic-bezier(${_}, ${a}, ${$}, ${j})`,supportedWaapiEasing={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasingWithDefault(_){return mapEasingToNativeEasing(_)||supportedWaapiEasing.easeOut}function mapEasingToNativeEasing(_){if(_)return isBezierDefinition(_)?cubicBezierAsString(_):Array.isArray(_)?_.map(mapEasingToNativeEasingWithDefault):supportedWaapiEasing[_]}function animateStyle(_,a,$,{delay:j=0,duration:et=300,repeat:tt=0,repeatType:rt="loop",ease:nt,times:it}={}){const at={[a]:$};it&&(at.offset=it);const st=mapEasingToNativeEasing(nt);return Array.isArray(st)&&(at.easing=st),_.animate(at,{delay:j,duration:et,easing:Array.isArray(st)?"linear":st,fill:"both",iterations:tt+1,direction:rt==="reverse"?"alternate":"normal"})}const supportsWaapi=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),acceleratedValues=new Set(["opacity","clipPath","filter","transform"]),sampleDelta=10,maxDuration=2e4;function requiresPregeneratedKeyframes(_){return _.type==="spring"||_.name==="backgroundColor"||!isWaapiSupportedEasing(_.ease)}function pregenerateKeyframes(_,a){const $=new MainThreadAnimation({...a,keyframes:_,repeat:0,delay:0,isGenerator:!0});let j={done:!1,value:_[0]};const et=[];let tt=0;for(;!j.done&&ttthis.onKeyframesResolved(tt,rt),$,j),this.resolver.scheduleResolve()}initPlayback(a,$){var j;let{duration:et=300,times:tt,ease:rt,type:nt,motionValue:it,name:at}=this.options;if(!(!((j=it.owner)===null||j===void 0)&&j.current))return!1;if(requiresPregeneratedKeyframes(this.options)){const{onComplete:ot,onUpdate:ut,motionValue:dt,...mt}=this.options,xt=pregenerateKeyframes(a,mt);a=xt.keyframes,a.length===1&&(a[1]=a[0]),et=xt.duration,tt=xt.times,rt=xt.ease,nt="keyframes"}const st=animateStyle(it.owner.current,at,a,{...this.options,duration:et,times:tt,ease:rt});return st.startTime=time.now(),this.pendingTimeline?(st.timeline=this.pendingTimeline,this.pendingTimeline=void 0):st.onfinish=()=>{const{onComplete:ot}=this.options;it.set(getFinalKeyframe(a,this.options,$)),ot&&ot(),this.cancel(),this.resolveFinishedPromise()},{animation:st,duration:et,times:tt,type:nt,ease:rt,keyframes:a}}get duration(){const{resolved:a}=this;if(!a)return 0;const{duration:$}=a;return millisecondsToSeconds($)}get time(){const{resolved:a}=this;if(!a)return 0;const{animation:$}=a;return millisecondsToSeconds($.currentTime||0)}set time(a){const{resolved:$}=this;if(!$)return;const{animation:j}=$;j.currentTime=secondsToMilliseconds$1(a)}get speed(){const{resolved:a}=this;if(!a)return 1;const{animation:$}=a;return $.playbackRate}set speed(a){const{resolved:$}=this;if(!$)return;const{animation:j}=$;j.playbackRate=a}get state(){const{resolved:a}=this;if(!a)return"idle";const{animation:$}=a;return $.playState}attachTimeline(a){if(!this._resolved)this.pendingTimeline=a;else{const{resolved:$}=this;if(!$)return noop$b;const{animation:j}=$;j.timeline=a,j.onfinish=null}return noop$b}play(){if(this.isStopped)return;const{resolved:a}=this;if(!a)return;const{animation:$}=a;$.playState==="finished"&&this.updateFinishedPromise(),$.play()}pause(){const{resolved:a}=this;if(!a)return;const{animation:$}=a;$.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:a}=this;if(!a)return;const{animation:$,keyframes:j,duration:et,type:tt,ease:rt,times:nt}=a;if(!($.playState==="idle"||$.playState==="finished")){if(this.time){const{motionValue:it,onUpdate:at,onComplete:st,...ot}=this.options,ut=new MainThreadAnimation({...ot,keyframes:j,duration:et,type:tt,ease:rt,times:nt,isGenerator:!0}),dt=secondsToMilliseconds$1(this.time);it.setWithVelocity(ut.sample(dt-sampleDelta).value,ut.sample(dt).value,sampleDelta)}this.cancel()}}complete(){const{resolved:a}=this;a&&a.animation.finish()}cancel(){const{resolved:a}=this;a&&a.animation.cancel()}static supports(a){const{motionValue:$,name:j,repeatDelay:et,repeatType:tt,damping:rt,type:nt}=a;return supportsWaapi()&&j&&acceleratedValues.has(j)&&$&&$.owner&&$.owner.current instanceof HTMLElement&&!$.owner.getProps().onUpdate&&!et&&tt!=="mirror"&&rt!==0&&nt!=="inertia"}}const animateMotionValue=(_,a,$,j={},et,tt)=>rt=>{const nt=getValueTransition(j,_)||{},it=nt.delay||j.delay||0;let{elapsed:at=0}=j;at=at-secondsToMilliseconds$1(it);let st={keyframes:Array.isArray($)?$:[null,$],ease:"easeOut",velocity:a.getVelocity(),...nt,delay:-at,onUpdate:ut=>{a.set(ut),nt.onUpdate&&nt.onUpdate(ut)},onComplete:()=>{rt(),nt.onComplete&&nt.onComplete()},name:_,motionValue:a,element:tt?void 0:et};isTransitionDefined(nt)||(st={...st,...getDefaultTransition(_,st)}),st.duration&&(st.duration=secondsToMilliseconds$1(st.duration)),st.repeatDelay&&(st.repeatDelay=secondsToMilliseconds$1(st.repeatDelay)),st.from!==void 0&&(st.keyframes[0]=st.from);let ot=!1;if((st.type===!1||st.duration===0&&!st.repeatDelay)&&(st.duration=0,st.delay===0&&(ot=!0)),ot&&!tt&&a.get()!==void 0){const ut=getFinalKeyframe(st.keyframes,nt);if(ut!==void 0){frame.update(()=>{st.onUpdate(ut),st.onComplete()});return}}return!tt&&AcceleratedAnimation.supports(st)?new AcceleratedAnimation(st):new MainThreadAnimation(st)};function isWillChangeMotionValue(_){return!!(isMotionValue(_)&&_.add)}function addUniqueItem(_,a){_.indexOf(a)===-1&&_.push(a)}function removeItem(_,a){const $=_.indexOf(a);$>-1&&_.splice($,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(a){return addUniqueItem(this.subscriptions,a),()=>removeItem(this.subscriptions,a)}notify(a,$,j){const et=this.subscriptions.length;if(et)if(et===1)this.subscriptions[0](a,$,j);else for(let tt=0;tt!isNaN(parseFloat(_));class MotionValue{constructor(a,$={}){this.version="11.2.6",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(j,et=!0)=>{const tt=time.now();this.updatedAt!==tt&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(j),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),et&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(a),this.owner=$.owner}setCurrent(a){this.current=a,this.updatedAt=time.now(),this.canTrackVelocity===null&&a!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,$){this.events[a]||(this.events[a]=new SubscriptionManager);const j=this.events[a].add($);return a==="change"?()=>{j(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:j}clearListeners(){for(const a in this.events)this.events[a].clear()}attach(a,$){this.passiveEffect=a,this.stopPassiveEffect=$}set(a,$=!0){!$||!this.passiveEffect?this.updateAndNotify(a,$):this.passiveEffect(a,this.updateAndNotify)}setWithVelocity(a,$,j){this.set($),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-j}jump(a,$=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,$&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const a=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||a-this.updatedAt>MAX_VELOCITY_DELTA)return 0;const $=Math.min(this.updatedAt-this.prevUpdatedAt,MAX_VELOCITY_DELTA);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),$)}start(a){return this.stop(),new Promise($=>{this.hasAnimated=!0,this.animation=a($),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function motionValue(_,a){return new MotionValue(_,a)}function setMotionValue(_,a,$){_.hasValue(a)?_.getValue(a).set($):_.addValue(a,motionValue($))}function setTarget(_,a){const $=resolveVariant(_,a);let{transitionEnd:j={},transition:et={},...tt}=$||{};tt={...tt,...j};for(const rt in tt){const nt=resolveFinalValueInKeyframes(tt[rt]);setMotionValue(_,rt,nt)}}function shouldBlockAnimation({protectedKeys:_,needsAnimating:a},$){const j=_.hasOwnProperty($)&&a[$]!==!0;return a[$]=!1,j}function animateTarget(_,a,{delay:$=0,transitionOverride:j,type:et}={}){var tt;let{transition:rt=_.getDefaultTransition(),transitionEnd:nt,...it}=a;const at=_.getValue("willChange");j&&(rt=j);const st=[],ot=et&&_.animationState&&_.animationState.getState()[et];for(const ut in it){const dt=_.getValue(ut,(tt=_.latestValues[ut])!==null&&tt!==void 0?tt:null),mt=it[ut];if(mt===void 0||ot&&shouldBlockAnimation(ot,ut))continue;const xt={delay:$,elapsed:0,...getValueTransition(rt||{},ut)};let Ct=!1;if(window.HandoffAppearAnimations){const kt=_.getProps()[optimizedAppearDataAttribute];if(kt){const Lt=window.HandoffAppearAnimations(kt,ut,dt,frame);Lt!==null&&(xt.elapsed=Lt,Ct=!0)}}dt.start(animateMotionValue(ut,dt,mt,_.shouldReduceMotion&&transformProps.has(ut)?{type:!1}:xt,_,Ct));const Pt=dt.animation;Pt&&(isWillChangeMotionValue(at)&&(at.add(ut),Pt.then(()=>at.remove(ut))),st.push(Pt))}return nt&&Promise.all(st).then(()=>{frame.update(()=>{nt&&setTarget(_,nt)})}),st}function animateVariant(_,a,$={}){var j;const et=resolveVariant(_,a,$.type==="exit"?(j=_.presenceContext)===null||j===void 0?void 0:j.custom:void 0);let{transition:tt=_.getDefaultTransition()||{}}=et||{};$.transitionOverride&&(tt=$.transitionOverride);const rt=et?()=>Promise.all(animateTarget(_,et,$)):()=>Promise.resolve(),nt=_.variantChildren&&_.variantChildren.size?(at=0)=>{const{delayChildren:st=0,staggerChildren:ot,staggerDirection:ut}=tt;return animateChildren(_,a,st+at,ot,ut,$)}:()=>Promise.resolve(),{when:it}=tt;if(it){const[at,st]=it==="beforeChildren"?[rt,nt]:[nt,rt];return at().then(()=>st())}else return Promise.all([rt(),nt($.delay)])}function animateChildren(_,a,$=0,j=0,et=1,tt){const rt=[],nt=(_.variantChildren.size-1)*j,it=et===1?(at=0)=>at*j:(at=0)=>nt-at*j;return Array.from(_.variantChildren).sort(sortByTreeOrder).forEach((at,st)=>{at.notify("AnimationStart",a),rt.push(animateVariant(at,a,{...tt,delay:$+it(st)}).then(()=>at.notify("AnimationComplete",a)))}),Promise.all(rt)}function sortByTreeOrder(_,a){return _.sortNodePosition(a)}function animateVisualElement(_,a,$={}){_.notify("AnimationStart",a);let j;if(Array.isArray(a)){const et=a.map(tt=>animateVariant(_,tt,$));j=Promise.all(et)}else if(typeof a=="string")j=animateVariant(_,a,$);else{const et=typeof a=="function"?resolveVariant(_,a,$.custom):a;j=Promise.all(animateTarget(_,et,$))}return j.then(()=>{frame.postRender(()=>{_.notify("AnimationComplete",a)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(_){return a=>Promise.all(a.map(({animation:$,options:j})=>animateVisualElement(_,$,j)))}function createAnimationState(_){let a=animateList(_);const $=createState();let j=!0;const et=it=>(at,st)=>{var ot;const ut=resolveVariant(_,st,it==="exit"?(ot=_.presenceContext)===null||ot===void 0?void 0:ot.custom:void 0);if(ut){const{transition:dt,transitionEnd:mt,...xt}=ut;at={...at,...xt,...mt}}return at};function tt(it){a=it(_)}function rt(it){const at=_.getProps(),st=_.getVariantContext(!0)||{},ot=[],ut=new Set;let dt={},mt=1/0;for(let Ct=0;Ctmt&&Lt,Dt=!1;const Ft=Array.isArray(kt)?kt:[kt];let Bt=Ft.reduce(et(Pt),{});Nt===!1&&(Bt={});const{prevResolvedValues:yt={}}=Tt,bt={...yt,...Bt},ct=ht=>{Mt=!0,ut.has(ht)&&(Dt=!0,ut.delete(ht)),Tt.needsAnimating[ht]=!0;const vt=_.getValue(ht);vt&&(vt.liveStyle=!1)};for(const ht in bt){const vt=Bt[ht],St=yt[ht];if(dt.hasOwnProperty(ht))continue;let Rt=!1;isKeyframesTarget(vt)&&isKeyframesTarget(St)?Rt=!shallowCompare(vt,St):Rt=vt!==St,Rt?vt!=null?ct(ht):ut.add(ht):vt!==void 0&&ut.has(ht)?ct(ht):Tt.protectedKeys[ht]=!0}Tt.prevProp=kt,Tt.prevResolvedValues=Bt,Tt.isActive&&(dt={...dt,...Bt}),j&&_.blockInitialAnimation&&(Mt=!1),Mt&&(!zt||Dt)&&ot.push(...Ft.map(ht=>({animation:ht,options:{type:Pt}})))}if(ut.size){const Ct={};ut.forEach(Pt=>{const Tt=_.getBaseTarget(Pt),kt=_.getValue(Pt);kt&&(kt.liveStyle=!0),Ct[Pt]=Tt??null}),ot.push({animation:Ct})}let xt=!!ot.length;return j&&(at.initial===!1||at.initial===at.animate)&&!_.manuallyAnimateOnMount&&(xt=!1),j=!1,xt?a(ot):Promise.resolve()}function nt(it,at){var st;if($[it].isActive===at)return Promise.resolve();(st=_.variantChildren)===null||st===void 0||st.forEach(ut=>{var dt;return(dt=ut.animationState)===null||dt===void 0?void 0:dt.setActive(it,at)}),$[it].isActive=at;const ot=rt(it);for(const ut in $)$[ut].protectedKeys={};return ot}return{animateChanges:rt,setActive:nt,setAnimateFunction:tt,getState:()=>$}}function checkVariantsDidChange(_,a){return typeof a=="string"?a!==_:Array.isArray(a)?!shallowCompare(a,_):!1}function createTypeState(_=!1){return{isActive:_,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}class AnimationFeature extends Feature{constructor(a){super(a),a.animationState||(a.animationState=createAnimationState(a))}updateAnimationControlsSubscription(){const{animate:a}=this.node.getProps();this.unmount(),isAnimationControls(a)&&(this.unmount=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:a}=this.node.getProps(),{animate:$}=this.node.prevProps||{};a!==$&&this.updateAnimationControlsSubscription()}unmount(){}}let id$2=0;class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=id$2++}update(){if(!this.node.presenceContext)return;const{isPresent:a,onExitComplete:$}=this.node.presenceContext,{isPresent:j}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===j)return;const et=this.node.animationState.setActive("exit",!a);$&&!a&&et.then(()=>$(this.id))}mount(){const{register:a}=this.node.presenceContext||{};a&&(this.unmount=a(this.id))}unmount(){}}const animations$1={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(_,a)=>Math.abs(_-a);function distance2D(_,a){const $=distance(_.x,a.x),j=distance(_.y,a.y);return Math.sqrt($**2+j**2)}class PanSession{constructor(a,$,{transformPagePoint:j,contextWindow:et,dragSnapToOrigin:tt=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const ot=getPanInfo(this.lastMoveEventInfo,this.history),ut=this.startEvent!==null,dt=distance2D(ot.offset,{x:0,y:0})>=3;if(!ut&&!dt)return;const{point:mt}=ot,{timestamp:xt}=frameData;this.history.push({...mt,timestamp:xt});const{onStart:Ct,onMove:Pt}=this.handlers;ut||(Ct&&Ct(this.lastMoveEvent,ot),this.startEvent=this.lastMoveEvent),Pt&&Pt(this.lastMoveEvent,ot)},this.handlePointerMove=(ot,ut)=>{this.lastMoveEvent=ot,this.lastMoveEventInfo=transformPoint(ut,this.transformPagePoint),frame.update(this.updatePoint,!0)},this.handlePointerUp=(ot,ut)=>{this.end();const{onEnd:dt,onSessionEnd:mt,resumeAnimation:xt}=this.handlers;if(this.dragSnapToOrigin&&xt&&xt(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const Ct=getPanInfo(ot.type==="pointercancel"?this.lastMoveEventInfo:transformPoint(ut,this.transformPagePoint),this.history);this.startEvent&&dt&&dt(ot,Ct),mt&&mt(ot,Ct)},!isPrimaryPointer(a))return;this.dragSnapToOrigin=tt,this.handlers=$,this.transformPagePoint=j,this.contextWindow=et||window;const rt=extractEventInfo(a),nt=transformPoint(rt,this.transformPagePoint),{point:it}=nt,{timestamp:at}=frameData;this.history=[{...it,timestamp:at}];const{onSessionStart:st}=$;st&&st(a,getPanInfo(nt,this.history)),this.removeListeners=pipe$1(addPointerEvent(this.contextWindow,"pointermove",this.handlePointerMove),addPointerEvent(this.contextWindow,"pointerup",this.handlePointerUp),addPointerEvent(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(_,a){return a?{point:a(_.point)}:_}function subtractPoint(_,a){return{x:_.x-a.x,y:_.y-a.y}}function getPanInfo({point:_},a){return{point:_,delta:subtractPoint(_,lastDevicePoint(a)),offset:subtractPoint(_,startDevicePoint(a)),velocity:getVelocity(a,.1)}}function startDevicePoint(_){return _[0]}function lastDevicePoint(_){return _[_.length-1]}function getVelocity(_,a){if(_.length<2)return{x:0,y:0};let $=_.length-1,j=null;const et=lastDevicePoint(_);for(;$>=0&&(j=_[$],!(et.timestamp-j.timestamp>secondsToMilliseconds$1(a)));)$--;if(!j)return{x:0,y:0};const tt=millisecondsToSeconds(et.timestamp-j.timestamp);if(tt===0)return{x:0,y:0};const rt={x:(et.x-j.x)/tt,y:(et.y-j.y)/tt};return rt.x===1/0&&(rt.x=0),rt.y===1/0&&(rt.y=0),rt}function calcLength(_){return _.max-_.min}function isNear(_,a=0,$=.01){return Math.abs(_-a)<=$}function calcAxisDelta(_,a,$,j=.5){_.origin=j,_.originPoint=mixNumber$1(a.min,a.max,_.origin),_.scale=calcLength($)/calcLength(a),(isNear(_.scale,1,1e-4)||isNaN(_.scale))&&(_.scale=1),_.translate=mixNumber$1($.min,$.max,_.origin)-_.originPoint,(isNear(_.translate)||isNaN(_.translate))&&(_.translate=0)}function calcBoxDelta(_,a,$,j){calcAxisDelta(_.x,a.x,$.x,j?j.originX:void 0),calcAxisDelta(_.y,a.y,$.y,j?j.originY:void 0)}function calcRelativeAxis(_,a,$){_.min=$.min+a.min,_.max=_.min+calcLength(a)}function calcRelativeBox(_,a,$){calcRelativeAxis(_.x,a.x,$.x),calcRelativeAxis(_.y,a.y,$.y)}function calcRelativeAxisPosition(_,a,$){_.min=a.min-$.min,_.max=_.min+calcLength(a)}function calcRelativePosition(_,a,$){calcRelativeAxisPosition(_.x,a.x,$.x),calcRelativeAxisPosition(_.y,a.y,$.y)}function applyConstraints(_,{min:a,max:$},j){return a!==void 0&&_$&&(_=j?mixNumber$1($,_,j.max):Math.min(_,$)),_}function calcRelativeAxisConstraints(_,a,$){return{min:a!==void 0?_.min+a:void 0,max:$!==void 0?_.max+$-(_.max-_.min):void 0}}function calcRelativeConstraints(_,{top:a,left:$,bottom:j,right:et}){return{x:calcRelativeAxisConstraints(_.x,$,et),y:calcRelativeAxisConstraints(_.y,a,j)}}function calcViewportAxisConstraints(_,a){let $=a.min-_.min,j=a.max-_.max;return a.max-a.min<_.max-_.min&&([$,j]=[j,$]),{min:$,max:j}}function calcViewportConstraints(_,a){return{x:calcViewportAxisConstraints(_.x,a.x),y:calcViewportAxisConstraints(_.y,a.y)}}function calcOrigin(_,a){let $=.5;const j=calcLength(_),et=calcLength(a);return et>j?$=progress(a.min,a.max-j,_.min):j>et&&($=progress(_.min,_.max-et,a.min)),clamp(0,1,$)}function rebaseAxisConstraints(_,a){const $={};return a.min!==void 0&&($.min=a.min-_.min),a.max!==void 0&&($.max=a.max-_.min),$}const defaultElastic=.35;function resolveDragElastic(_=defaultElastic){return _===!1?_=0:_===!0&&(_=defaultElastic),{x:resolveAxisElastic(_,"left","right"),y:resolveAxisElastic(_,"top","bottom")}}function resolveAxisElastic(_,a,$){return{min:resolvePointElastic(_,a),max:resolvePointElastic(_,$)}}function resolvePointElastic(_,a){return typeof _=="number"?_:_[a]||0}const createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(_){return[_("x"),_("y")]}function convertBoundingBoxToBox({top:_,left:a,right:$,bottom:j}){return{x:{min:a,max:$},y:{min:_,max:j}}}function convertBoxToBoundingBox({x:_,y:a}){return{top:a.min,right:_.max,bottom:a.max,left:_.min}}function transformBoxPoints(_,a){if(!a)return _;const $=a({x:_.left,y:_.top}),j=a({x:_.right,y:_.bottom});return{top:$.y,left:$.x,bottom:j.y,right:j.x}}function isIdentityScale(_){return _===void 0||_===1}function hasScale({scale:_,scaleX:a,scaleY:$}){return!isIdentityScale(_)||!isIdentityScale(a)||!isIdentityScale($)}function hasTransform(_){return hasScale(_)||has2DTranslate(_)||_.z||_.rotate||_.rotateX||_.rotateY||_.skewX||_.skewY}function has2DTranslate(_){return is2DTranslate(_.x)||is2DTranslate(_.y)}function is2DTranslate(_){return _&&_!=="0%"}function scalePoint(_,a,$){const j=_-$,et=a*j;return $+et}function applyPointDelta(_,a,$,j,et){return et!==void 0&&(_=scalePoint(_,et,j)),scalePoint(_,$,j)+a}function applyAxisDelta(_,a=0,$=1,j,et){_.min=applyPointDelta(_.min,a,$,j,et),_.max=applyPointDelta(_.max,a,$,j,et)}function applyBoxDelta(_,{x:a,y:$}){applyAxisDelta(_.x,a.translate,a.scale,a.originPoint),applyAxisDelta(_.y,$.translate,$.scale,$.originPoint)}function applyTreeDeltas(_,a,$,j=!1){const et=$.length;if(!et)return;a.x=a.y=1;let tt,rt;for(let nt=0;nt1.0000000000001||_<.999999999999?_:1}function translateAxis(_,a){_.min=_.min+a,_.max=_.max+a}function transformAxis(_,a,[$,j,et]){const tt=a[et]!==void 0?a[et]:.5,rt=mixNumber$1(_.min,_.max,tt);applyAxisDelta(_,a[$],a[j],rt,a.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(_,a){transformAxis(_.x,a,xKeys$1),transformAxis(_.y,a,yKeys$1)}function measureViewportBox(_,a){return convertBoundingBoxToBox(transformBoxPoints(_.getBoundingClientRect(),a))}function measurePageBox(_,a,$){const j=measureViewportBox(_,$),{scroll:et}=a;return et&&(translateAxis(j.x,et.offset.x),translateAxis(j.y,et.offset.y)),j}const getContextWindow=({current:_})=>_?_.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(a){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=a}start(a,{snapToCursor:$=!1}={}){const{presenceContext:j}=this.visualElement;if(j&&j.isPresent===!1)return;const et=st=>{const{dragSnapToOrigin:ot}=this.getProps();ot?this.pauseAnimation():this.stopAnimation(),$&&this.snapToCursor(extractEventInfo(st,"page").point)},tt=(st,ot)=>{const{drag:ut,dragPropagation:dt,onDragStart:mt}=this.getProps();if(ut&&!dt&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(ut),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(Ct=>{let Pt=this.getAxisMotionValue(Ct).get()||0;if(percent.test(Pt)){const{projection:Tt}=this.visualElement;if(Tt&&Tt.layout){const kt=Tt.layout.layoutBox[Ct];kt&&(Pt=calcLength(kt)*(parseFloat(Pt)/100))}}this.originPoint[Ct]=Pt}),mt&&frame.postRender(()=>mt(st,ot));const{animationState:xt}=this.visualElement;xt&&xt.setActive("whileDrag",!0)},rt=(st,ot)=>{const{dragPropagation:ut,dragDirectionLock:dt,onDirectionLock:mt,onDrag:xt}=this.getProps();if(!ut&&!this.openGlobalLock)return;const{offset:Ct}=ot;if(dt&&this.currentDirection===null){this.currentDirection=getCurrentDirection(Ct),this.currentDirection!==null&&mt&&mt(this.currentDirection);return}this.updateAxis("x",ot.point,Ct),this.updateAxis("y",ot.point,Ct),this.visualElement.render(),xt&&xt(st,ot)},nt=(st,ot)=>this.stop(st,ot),it=()=>eachAxis(st=>{var ot;return this.getAnimationState(st)==="paused"&&((ot=this.getAxisMotionValue(st).animation)===null||ot===void 0?void 0:ot.play())}),{dragSnapToOrigin:at}=this.getProps();this.panSession=new PanSession(a,{onSessionStart:et,onStart:tt,onMove:rt,onSessionEnd:nt,resumeAnimation:it},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:at,contextWindow:getContextWindow(this.visualElement)})}stop(a,$){const j=this.isDragging;if(this.cancel(),!j)return;const{velocity:et}=$;this.startAnimation(et);const{onDragEnd:tt}=this.getProps();tt&&frame.postRender(()=>tt(a,$))}cancel(){this.isDragging=!1;const{projection:a,animationState:$}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:j}=this.getProps();!j&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),$&&$.setActive("whileDrag",!1)}updateAxis(a,$,j){const{drag:et}=this.getProps();if(!j||!shouldDrag(a,et,this.currentDirection))return;const tt=this.getAxisMotionValue(a);let rt=this.originPoint[a]+j[a];this.constraints&&this.constraints[a]&&(rt=applyConstraints(rt,this.constraints[a],this.elastic[a])),tt.set(rt)}resolveConstraints(){var a;const{dragConstraints:$,dragElastic:j}=this.getProps(),et=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)===null||a===void 0?void 0:a.layout,tt=this.constraints;$&&isRefObject$2($)?this.constraints||(this.constraints=this.resolveRefConstraints()):$&&et?this.constraints=calcRelativeConstraints(et.layoutBox,$):this.constraints=!1,this.elastic=resolveDragElastic(j),tt!==this.constraints&&et&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(rt=>{this.constraints!==!1&&this.getAxisMotionValue(rt)&&(this.constraints[rt]=rebaseAxisConstraints(et.layoutBox[rt],this.constraints[rt]))})}resolveRefConstraints(){const{dragConstraints:a,onMeasureDragConstraints:$}=this.getProps();if(!a||!isRefObject$2(a))return!1;const j=a.current,{projection:et}=this.visualElement;if(!et||!et.layout)return!1;const tt=measurePageBox(j,et.root,this.visualElement.getTransformPagePoint());let rt=calcViewportConstraints(et.layout.layoutBox,tt);if($){const nt=$(convertBoxToBoundingBox(rt));this.hasMutatedConstraints=!!nt,nt&&(rt=convertBoundingBoxToBox(nt))}return rt}startAnimation(a){const{drag:$,dragMomentum:j,dragElastic:et,dragTransition:tt,dragSnapToOrigin:rt,onDragTransitionEnd:nt}=this.getProps(),it=this.constraints||{},at=eachAxis(st=>{if(!shouldDrag(st,$,this.currentDirection))return;let ot=it&&it[st]||{};rt&&(ot={min:0,max:0});const ut=et?200:1e6,dt=et?40:1e7,mt={type:"inertia",velocity:j?a[st]:0,bounceStiffness:ut,bounceDamping:dt,timeConstant:750,restDelta:1,restSpeed:10,...tt,...ot};return this.startAxisValueAnimation(st,mt)});return Promise.all(at).then(nt)}startAxisValueAnimation(a,$){const j=this.getAxisMotionValue(a);return j.start(animateMotionValue(a,j,0,$,this.visualElement))}stopAnimation(){eachAxis(a=>this.getAxisMotionValue(a).stop())}pauseAnimation(){eachAxis(a=>{var $;return($=this.getAxisMotionValue(a).animation)===null||$===void 0?void 0:$.pause()})}getAnimationState(a){var $;return($=this.getAxisMotionValue(a).animation)===null||$===void 0?void 0:$.state}getAxisMotionValue(a){const $=`_drag${a.toUpperCase()}`,j=this.visualElement.getProps(),et=j[$];return et||this.visualElement.getValue(a,(j.initial?j.initial[a]:void 0)||0)}snapToCursor(a){eachAxis($=>{const{drag:j}=this.getProps();if(!shouldDrag($,j,this.currentDirection))return;const{projection:et}=this.visualElement,tt=this.getAxisMotionValue($);if(et&&et.layout){const{min:rt,max:nt}=et.layout.layoutBox[$];tt.set(a[$]-mixNumber$1(rt,nt,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:a,dragConstraints:$}=this.getProps(),{projection:j}=this.visualElement;if(!isRefObject$2($)||!j||!this.constraints)return;this.stopAnimation();const et={x:0,y:0};eachAxis(rt=>{const nt=this.getAxisMotionValue(rt);if(nt&&this.constraints!==!1){const it=nt.get();et[rt]=calcOrigin({min:it,max:it},this.constraints[rt])}});const{transformTemplate:tt}=this.visualElement.getProps();this.visualElement.current.style.transform=tt?tt({},""):"none",j.root&&j.root.updateScroll(),j.updateLayout(),this.resolveConstraints(),eachAxis(rt=>{if(!shouldDrag(rt,a,null))return;const nt=this.getAxisMotionValue(rt),{min:it,max:at}=this.constraints[rt];nt.set(mixNumber$1(it,at,et[rt]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const a=this.visualElement.current,$=addPointerEvent(a,"pointerdown",it=>{const{drag:at,dragListener:st=!0}=this.getProps();at&&st&&this.start(it)}),j=()=>{const{dragConstraints:it}=this.getProps();isRefObject$2(it)&&(this.constraints=this.resolveRefConstraints())},{projection:et}=this.visualElement,tt=et.addEventListener("measure",j);et&&!et.layout&&(et.root&&et.root.updateScroll(),et.updateLayout()),j();const rt=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),nt=et.addEventListener("didUpdate",({delta:it,hasLayoutChanged:at})=>{this.isDragging&&at&&(eachAxis(st=>{const ot=this.getAxisMotionValue(st);ot&&(this.originPoint[st]+=it[st].translate,ot.set(ot.get()+it[st].translate))}),this.visualElement.render())});return()=>{rt(),$(),tt(),nt&&nt()}}getProps(){const a=this.visualElement.getProps(),{drag:$=!1,dragDirectionLock:j=!1,dragPropagation:et=!1,dragConstraints:tt=!1,dragElastic:rt=defaultElastic,dragMomentum:nt=!0}=a;return{...a,drag:$,dragDirectionLock:j,dragPropagation:et,dragConstraints:tt,dragElastic:rt,dragMomentum:nt}}}function shouldDrag(_,a,$){return(a===!0||a===_)&&($===null||$===_)}function getCurrentDirection(_,a=10){let $=null;return Math.abs(_.y)>a?$="y":Math.abs(_.x)>a&&($="x"),$}class DragGesture extends Feature{constructor(a){super(a),this.removeGroupControls=noop$b,this.removeListeners=noop$b,this.controls=new VisualElementDragControls(a)}mount(){const{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$b}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=_=>(a,$)=>{_&&frame.postRender(()=>_(a,$))};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$b}onPointerDown(a){this.session=new PanSession(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:a,onPanStart:$,onPan:j,onPanEnd:et}=this.node.getProps();return{onSessionStart:asyncHandler(a),onStart:asyncHandler($),onMove:j,onEnd:(tt,rt)=>{delete this.session,et&&frame.postRender(()=>et(tt,rt))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const _=reactExports.useContext(PresenceContext);if(_===null)return[!0,null];const{isPresent:a,onExitComplete:$,register:j}=_,et=reactExports.useId();return reactExports.useEffect(()=>j(et),[]),!a&&$?[!1,()=>$&&$(et)]:[!0]}function useIsPresent(){return isPresent(reactExports.useContext(PresenceContext))}function isPresent(_){return _===null?!0:_.isPresent}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(_,a){return a.max===a.min?0:_/(a.max-a.min)*100}const correctBorderRadius={correct:(_,a)=>{if(!a.target)return _;if(typeof _=="string")if(px.test(_))_=parseFloat(_);else return _;const $=pixelsToPercent(_,a.target.x),j=pixelsToPercent(_,a.target.y);return`${$}% ${j}%`}},correctBoxShadow={correct:(_,{treeScale:a,projectionDelta:$})=>{const j=_,et=complex.parse(_);if(et.length>5)return j;const tt=complex.createTransformer(_),rt=typeof et[0]!="number"?1:0,nt=$.x.scale*a.x,it=$.y.scale*a.y;et[0+rt]/=nt,et[1+rt]/=it;const at=mixNumber$1(nt,it,.5);return typeof et[2+rt]=="number"&&(et[2+rt]/=at),typeof et[3+rt]=="number"&&(et[3+rt]/=at),tt(et)}};class MeasureLayoutWithContext extends reactExports.Component{componentDidMount(){const{visualElement:a,layoutGroup:$,switchLayoutGroup:j,layoutId:et}=this.props,{projection:tt}=a;addScaleCorrector(defaultScaleCorrectors),tt&&($.group&&$.group.add(tt),j&&j.register&&et&&j.register(tt),tt.root.didUpdate(),tt.addEventListener("animationComplete",()=>{this.safeToRemove()}),tt.setOptions({...tt.options,onExitComplete:()=>this.safeToRemove()})),globalProjectionState.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){const{layoutDependency:$,visualElement:j,drag:et,isPresent:tt}=this.props,rt=j.projection;return rt&&(rt.isPresent=tt,et||a.layoutDependency!==$||$===void 0?rt.willUpdate():this.safeToRemove(),a.isPresent!==tt&&(tt?rt.promote():rt.relegate()||frame.postRender(()=>{const nt=rt.getStack();(!nt||!nt.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:a}=this.props.visualElement;a&&(a.root.didUpdate(),microtask.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:a,layoutGroup:$,switchLayoutGroup:j}=this.props,{projection:et}=a;et&&(et.scheduleCheckAfterUnmount(),$&&$.group&&$.group.remove(et),j&&j.deregister&&j.deregister(et))}safeToRemove(){const{safeToRemove:a}=this.props;a&&a()}render(){return null}}function MeasureLayout(_){const[a,$]=usePresence(),j=reactExports.useContext(LayoutGroupContext);return jsxRuntimeExports.jsx(MeasureLayoutWithContext,{..._,layoutGroup:j,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:a,safeToRemove:$})}const defaultScaleCorrectors={borderRadius:{...correctBorderRadius,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=_=>typeof _=="string"?parseFloat(_):_,isPx=_=>typeof _=="number"||px.test(_);function mixValues(_,a,$,j,et,tt){et?(_.opacity=mixNumber$1(0,$.opacity!==void 0?$.opacity:1,easeCrossfadeIn(j)),_.opacityExit=mixNumber$1(a.opacity!==void 0?a.opacity:1,0,easeCrossfadeOut(j))):tt&&(_.opacity=mixNumber$1(a.opacity!==void 0?a.opacity:1,$.opacity!==void 0?$.opacity:1,j));for(let rt=0;rtj<_?0:j>a?1:$(progress(_,a,j))}function copyAxisInto(_,a){_.min=a.min,_.max=a.max}function copyBoxInto(_,a){copyAxisInto(_.x,a.x),copyAxisInto(_.y,a.y)}function removePointDelta(_,a,$,j,et){return _-=a,_=scalePoint(_,1/$,j),et!==void 0&&(_=scalePoint(_,1/et,j)),_}function removeAxisDelta(_,a=0,$=1,j=.5,et,tt=_,rt=_){if(percent.test(a)&&(a=parseFloat(a),a=mixNumber$1(rt.min,rt.max,a/100)-rt.min),typeof a!="number")return;let nt=mixNumber$1(tt.min,tt.max,j);_===tt&&(nt-=a),_.min=removePointDelta(_.min,a,$,nt,et),_.max=removePointDelta(_.max,a,$,nt,et)}function removeAxisTransforms(_,a,[$,j,et],tt,rt){removeAxisDelta(_,a[$],a[j],a[et],a.scale,tt,rt)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(_,a,$,j){removeAxisTransforms(_.x,a,xKeys,$?$.x:void 0,j?j.x:void 0),removeAxisTransforms(_.y,a,yKeys,$?$.y:void 0,j?j.y:void 0)}function isAxisDeltaZero(_){return _.translate===0&&_.scale===1}function isDeltaZero(_){return isAxisDeltaZero(_.x)&&isAxisDeltaZero(_.y)}function boxEquals(_,a){return _.x.min===a.x.min&&_.x.max===a.x.max&&_.y.min===a.y.min&&_.y.max===a.y.max}function boxEqualsRounded(_,a){return Math.round(_.x.min)===Math.round(a.x.min)&&Math.round(_.x.max)===Math.round(a.x.max)&&Math.round(_.y.min)===Math.round(a.y.min)&&Math.round(_.y.max)===Math.round(a.y.max)}function aspectRatio(_){return calcLength(_.x)/calcLength(_.y)}class NodeStack{constructor(){this.members=[]}add(a){addUniqueItem(this.members,a),a.scheduleRender()}remove(a){if(removeItem(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){const $=this.members[this.members.length-1];$&&this.promote($)}}relegate(a){const $=this.members.findIndex(et=>a===et);if($===0)return!1;let j;for(let et=$;et>=0;et--){const tt=this.members[et];if(tt.isPresent!==!1){j=tt;break}}return j?(this.promote(j),!0):!1}promote(a,$){const j=this.lead;if(a!==j&&(this.prevLead=j,this.lead=a,a.show(),j)){j.instance&&j.scheduleRender(),a.scheduleRender(),a.resumeFrom=j,$&&(a.resumeFrom.preserveOpacity=!0),j.snapshot&&(a.snapshot=j.snapshot,a.snapshot.latestValues=j.animationValues||j.latestValues),a.root&&a.root.isUpdating&&(a.isLayoutDirty=!0);const{crossfade:et}=a.options;et===!1&&j.hide()}}exitAnimationComplete(){this.members.forEach(a=>{const{options:$,resumingFrom:j}=a;$.onExitComplete&&$.onExitComplete(),j&&j.options.onExitComplete&&j.options.onExitComplete()})}scheduleRender(){this.members.forEach(a=>{a.instance&&a.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(_,a,$){let j="";const et=_.x.translate/a.x,tt=_.y.translate/a.y,rt=($==null?void 0:$.z)||0;if((et||tt||rt)&&(j=`translate3d(${et}px, ${tt}px, ${rt}px) `),(a.x!==1||a.y!==1)&&(j+=`scale(${1/a.x}, ${1/a.y}) `),$){const{transformPerspective:at,rotate:st,rotateX:ot,rotateY:ut,skewX:dt,skewY:mt}=$;at&&(j=`perspective(${at}px) ${j}`),st&&(j+=`rotate(${st}deg) `),ot&&(j+=`rotateX(${ot}deg) `),ut&&(j+=`rotateY(${ut}deg) `),dt&&(j+=`skewX(${dt}deg) `),mt&&(j+=`skewY(${mt}deg) `)}const nt=_.x.scale*a.x,it=_.y.scale*a.y;return(nt!==1||it!==1)&&(j+=`scale(${nt}, ${it})`),j||"none"}const compareByDepth=(_,a)=>_.depth-a.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(a){addUniqueItem(this.children,a),this.isDirty=!0}remove(a){removeItem(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(a)}}function delay(_,a){const $=time.now(),j=({timestamp:et})=>{const tt=et-$;tt>=a&&(cancelFrame(j),_(tt-a))};return frame.read(j,!0),()=>cancelFrame(j)}function record(_){window.MotionDebug&&window.MotionDebug.record(_)}function isSVGElement(_){return _ instanceof SVGElement&&_.tagName!=="svg"}function animateSingleValue(_,a,$){const j=isMotionValue(_)?_:motionValue(_);return j.start(animateMotionValue("",j,a,$)),j.animation}const transformAxes=["","X","Y","Z"],hiddenVisibility={visibility:"hidden"},animationTarget=1e3;let id$1=0;const projectionFrameData={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function resetDistortingTransform(_,a,$,j){const{latestValues:et}=a;et[_]&&($[_]=et[_],a.setStaticValue(_,0),j&&(j[_]=0))}function createProjectionNode({attachResizeListener:_,defaultParent:a,measureScroll:$,checkIsScrollRoot:j,resetTransform:et}){return class{constructor(rt={},nt=a==null?void 0:a()){this.id=id$1++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,projectionFrameData.totalNodes=projectionFrameData.resolvedTargetDeltas=projectionFrameData.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(projectionFrameData)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=rt,this.root=nt?nt.root||nt:this,this.path=nt?[...nt.path,nt]:[],this.parent=nt,this.depth=nt?nt.depth+1:0;for(let it=0;itthis.root.updateBlockedByResize=!1;_(rt,()=>{this.root.updateBlockedByResize=!0,ot&&ot(),ot=delay(ut,250),globalProjectionState.hasAnimatedSinceResize&&(globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}it&&this.root.registerSharedNode(it,this),this.options.animate!==!1&&st&&(it||at)&&this.addEventListener("didUpdate",({delta:ot,hasLayoutChanged:ut,hasRelativeTargetChanged:dt,layout:mt})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const xt=this.options.transition||st.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:Ct,onLayoutAnimationComplete:Pt}=st.getProps(),Tt=!this.targetLayout||!boxEqualsRounded(this.targetLayout,mt)||dt,kt=!ut&&dt;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||kt||ut&&(Tt||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(ot,kt);const Lt={...getValueTransition(xt,"layout"),onPlay:Ct,onComplete:Pt};(st.shouldReduceMotion||this.options.layoutRoot)&&(Lt.delay=0,Lt.type=!1),this.startAnimation(Lt)}else ut||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=mt})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const rt=this.getStack();rt&&rt.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,window.HandoffCancelAllAnimations&&window.HandoffCancelAllAnimations(),this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){const{visualElement:rt}=this.options;return rt&&rt.getProps().transformTemplate}willUpdate(rt=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let st=0;stthis.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){frame.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let it=0;it{const Nt=Lt/1e3;mixAxisDelta(ot.x,rt.x,Nt),mixAxisDelta(ot.y,rt.y,Nt),this.setTargetDelta(ot),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(ut,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,ut,Nt),kt&&boxEquals(this.relativeTarget,kt)&&(this.isProjectionDirty=!1),kt||(kt=createBox()),copyBoxInto(kt,this.relativeTarget)),xt&&(this.animationValues=st,mixValues(st,at,this.latestValues,Nt,Tt,Pt)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=Nt},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(rt){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=frame.update(()=>{globalProjectionState.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,animationTarget,{...rt,onUpdate:nt=>{this.mixTargetDelta(nt),rt.onUpdate&&rt.onUpdate(nt)},onComplete:()=>{rt.onComplete&&rt.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const rt=this.getStack();rt&&rt.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(animationTarget),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const rt=this.getLead();let{targetWithTransforms:nt,target:it,layout:at,latestValues:st}=rt;if(!(!nt||!it||!at)){if(this!==rt&&this.layout&&at&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,at.layoutBox)){it=this.target||createBox();const ot=calcLength(this.layout.layoutBox.x);it.x.min=rt.target.x.min,it.x.max=it.x.min+ot;const ut=calcLength(this.layout.layoutBox.y);it.y.min=rt.target.y.min,it.y.max=it.y.min+ut}copyBoxInto(nt,it),transformBox(nt,st),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,nt,st)}}registerSharedNode(rt,nt){this.sharedNodes.has(rt)||this.sharedNodes.set(rt,new NodeStack),this.sharedNodes.get(rt).add(nt);const at=nt.options.initialPromotionConfig;nt.promote({transition:at?at.transition:void 0,preserveFollowOpacity:at&&at.shouldPreserveFollowOpacity?at.shouldPreserveFollowOpacity(nt):void 0})}isLead(){const rt=this.getStack();return rt?rt.lead===this:!0}getLead(){var rt;const{layoutId:nt}=this.options;return nt?((rt=this.getStack())===null||rt===void 0?void 0:rt.lead)||this:this}getPrevLead(){var rt;const{layoutId:nt}=this.options;return nt?(rt=this.getStack())===null||rt===void 0?void 0:rt.prevLead:void 0}getStack(){const{layoutId:rt}=this.options;if(rt)return this.root.sharedNodes.get(rt)}promote({needsReset:rt,transition:nt,preserveFollowOpacity:it}={}){const at=this.getStack();at&&at.promote(this,it),rt&&(this.projectionDelta=void 0,this.needsReset=!0),nt&&this.setOptions({transition:nt})}relegate(){const rt=this.getStack();return rt?rt.relegate(this):!1}resetSkewAndRotation(){const{visualElement:rt}=this.options;if(!rt)return;let nt=!1;const{latestValues:it}=rt;if((it.z||it.rotate||it.rotateX||it.rotateY||it.rotateZ||it.skewX||it.skewY)&&(nt=!0),!nt)return;const at={};it.z&&resetDistortingTransform("z",rt,at,this.animationValues);for(let st=0;st{var nt;return(nt=rt.currentAnimation)===null||nt===void 0?void 0:nt.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(_){_.updateLayout()}function notifyLayoutUpdate(_){var a;const $=((a=_.resumeFrom)===null||a===void 0?void 0:a.snapshot)||_.snapshot;if(_.isLead()&&_.layout&&$&&_.hasListeners("didUpdate")){const{layoutBox:j,measuredBox:et}=_.layout,{animationType:tt}=_.options,rt=$.source!==_.layout.source;tt==="size"?eachAxis(ot=>{const ut=rt?$.measuredBox[ot]:$.layoutBox[ot],dt=calcLength(ut);ut.min=j[ot].min,ut.max=ut.min+dt}):shouldAnimatePositionOnly(tt,$.layoutBox,j)&&eachAxis(ot=>{const ut=rt?$.measuredBox[ot]:$.layoutBox[ot],dt=calcLength(j[ot]);ut.max=ut.min+dt,_.relativeTarget&&!_.currentAnimation&&(_.isProjectionDirty=!0,_.relativeTarget[ot].max=_.relativeTarget[ot].min+dt)});const nt=createDelta();calcBoxDelta(nt,j,$.layoutBox);const it=createDelta();rt?calcBoxDelta(it,_.applyTransform(et,!0),$.measuredBox):calcBoxDelta(it,j,$.layoutBox);const at=!isDeltaZero(nt);let st=!1;if(!_.resumeFrom){const ot=_.getClosestProjectingParent();if(ot&&!ot.resumeFrom){const{snapshot:ut,layout:dt}=ot;if(ut&&dt){const mt=createBox();calcRelativePosition(mt,$.layoutBox,ut.layoutBox);const xt=createBox();calcRelativePosition(xt,j,dt.layoutBox),boxEqualsRounded(mt,xt)||(st=!0),ot.options.layoutRoot&&(_.relativeTarget=xt,_.relativeTargetOrigin=mt,_.relativeParent=ot)}}}_.notifyListeners("didUpdate",{layout:j,snapshot:$,delta:it,layoutDelta:nt,hasLayoutChanged:at,hasRelativeTargetChanged:st})}else if(_.isLead()){const{onExitComplete:j}=_.options;j&&j()}_.options.transition=void 0}function propagateDirtyNodes(_){projectionFrameData.totalNodes++,_.parent&&(_.isProjecting()||(_.isProjectionDirty=_.parent.isProjectionDirty),_.isSharedProjectionDirty||(_.isSharedProjectionDirty=!!(_.isProjectionDirty||_.parent.isProjectionDirty||_.parent.isSharedProjectionDirty)),_.isTransformDirty||(_.isTransformDirty=_.parent.isTransformDirty))}function cleanDirtyNodes(_){_.isProjectionDirty=_.isSharedProjectionDirty=_.isTransformDirty=!1}function clearSnapshot(_){_.clearSnapshot()}function clearMeasurements(_){_.clearMeasurements()}function clearIsLayoutDirty(_){_.isLayoutDirty=!1}function resetTransformStyle(_){const{visualElement:a}=_.options;a&&a.getProps().onBeforeLayoutMeasure&&a.notify("BeforeLayoutMeasure"),_.resetTransform()}function finishAnimation(_){_.finishAnimation(),_.targetDelta=_.relativeTarget=_.target=void 0,_.isProjectionDirty=!0}function resolveTargetDelta(_){_.resolveTargetDelta()}function calcProjection(_){_.calcProjection()}function resetSkewAndRotation(_){_.resetSkewAndRotation()}function removeLeadSnapshots(_){_.removeLeadSnapshot()}function mixAxisDelta(_,a,$){_.translate=mixNumber$1(a.translate,0,$),_.scale=mixNumber$1(a.scale,1,$),_.origin=a.origin,_.originPoint=a.originPoint}function mixAxis(_,a,$,j){_.min=mixNumber$1(a.min,$.min,j),_.max=mixNumber$1(a.max,$.max,j)}function mixBox(_,a,$,j){mixAxis(_.x,a.x,$.x,j),mixAxis(_.y,a.y,$.y,j)}function hasOpacityCrossfade(_){return _.animationValues&&_.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=_=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(_),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$b;function roundAxis(_){_.min=roundPoint(_.min),_.max=roundPoint(_.max)}function roundBox(_){roundAxis(_.x),roundAxis(_.y)}function shouldAnimatePositionOnly(_,a,$){return _==="position"||_==="preserve-aspect"&&!isNear(aspectRatio(a),aspectRatio($),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(_,a)=>addDomEvent(_,"resize",a),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:_=>({x:_.scrollLeft,y:_.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const _=new DocumentProjectionNode({});_.mount(window),_.setOptions({layoutScroll:!0}),rootProjectionNode.current=_}return rootProjectionNode.current},resetTransform:(_,a)=>{_.style.transform=a!==void 0?a:"none"},checkIsScrollRoot:_=>window.getComputedStyle(_).position==="fixed"}),drag={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:HTMLProjectionNode,MeasureLayout}},prefersReducedMotion={current:null},hasReducedMotionListener={current:!1};function initPrefersReducedMotion(){if(hasReducedMotionListener.current=!0,!!isBrowser$1)if(window.matchMedia){const _=window.matchMedia("(prefers-reduced-motion)"),a=()=>prefersReducedMotion.current=_.matches;_.addListener(a),a()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(_,a,$){const{willChange:j}=a;for(const et in a){const tt=a[et],rt=$[et];if(isMotionValue(tt))_.addValue(et,tt),isWillChangeMotionValue(j)&&j.add(et);else if(isMotionValue(rt))_.addValue(et,motionValue(tt,{owner:_})),isWillChangeMotionValue(j)&&j.remove(et);else if(rt!==tt)if(_.hasValue(et)){const nt=_.getValue(et);nt.liveStyle===!0?nt.jump(tt):nt.hasAnimated||nt.set(tt)}else{const nt=_.getStaticValue(et);_.addValue(et,motionValue(nt!==void 0?nt:tt,{owner:_}))}}for(const et in $)a[et]===void 0&&_.removeValue(et);return a}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color$1,complex],findValueType=_=>valueTypes.find(testValueType(_)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(_){if(_)return _.options.allowProjection!==!1?_.projection:getClosestProjectingNode(_.parent)}class VisualElement{scrapeMotionValuesFromProps(a,$,j){return{}}constructor({parent:a,props:$,presenceContext:j,reducedMotionConfig:et,blockInitialAnimation:tt,visualState:rt},nt={}){this.resolveKeyframes=(ut,dt,mt,xt)=>new this.KeyframeResolver(ut,dt,mt,xt,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>frame.render(this.render,!1,!0);const{latestValues:it,renderState:at}=rt;this.latestValues=it,this.baseTarget={...it},this.initialValues=$.initial?{...it}:{},this.renderState=at,this.parent=a,this.props=$,this.presenceContext=j,this.depth=a?a.depth+1:0,this.reducedMotionConfig=et,this.options=nt,this.blockInitialAnimation=!!tt,this.isControllingVariants=isControllingVariants($),this.isVariantNode=isVariantNode($),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:st,...ot}=this.scrapeMotionValuesFromProps($,{},this);for(const ut in ot){const dt=ot[ut];it[ut]!==void 0&&isMotionValue(dt)&&(dt.set(it[ut],!1),isWillChangeMotionValue(st)&&st.add(ut))}}mount(a){this.current=a,visualElementStore.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(($,j)=>this.bindToMotionValue(j,$)),hasReducedMotionListener.current||initPrefersReducedMotion(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:prefersReducedMotion.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){var a;visualElementStore.delete(this.current),this.projection&&this.projection.unmount(),cancelFrame(this.notifyUpdate),cancelFrame(this.render),this.valueSubscriptions.forEach($=>$()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const $ in this.events)this.events[$].clear();for(const $ in this.features)(a=this.features[$])===null||a===void 0||a.unmount();this.current=null}bindToMotionValue(a,$){const j=transformProps.has(a),et=$.on("change",rt=>{this.latestValues[a]=rt,this.props.onUpdate&&frame.preRender(this.notifyUpdate),j&&this.projection&&(this.projection.isTransformDirty=!0)}),tt=$.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(a,()=>{et(),tt(),$.owner&&$.stop()})}sortNodePosition(a){return!this.current||!this.sortInstanceNodePosition||this.type!==a.type?0:this.sortInstanceNodePosition(this.current,a.current)}loadFeatures({children:a,...$},j,et,tt){let rt,nt;for(let it=0;itthis.scheduleRender(),animationType:typeof at=="string"?at:"both",initialPromotionConfig:tt,layoutScroll:ut,layoutRoot:dt})}return nt}updateFeatures(){for(const a in this.features){const $=this.features[a];$.isMounted?$.update():($.mount(),$.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,$){this.latestValues[a]=$}update(a,$){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=$;for(let j=0;j$.variantChildren.delete(a)}addValue(a,$){const j=this.values.get(a);$!==j&&(j&&this.removeValue(a),this.bindToMotionValue(a,$),this.values.set(a,$),this.latestValues[a]=$.get())}removeValue(a){this.values.delete(a);const $=this.valueSubscriptions.get(a);$&&($(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,$){if(this.props.values&&this.props.values[a])return this.props.values[a];let j=this.values.get(a);return j===void 0&&$!==void 0&&(j=motionValue($===null?void 0:$,{owner:this}),this.addValue(a,j)),j}readValue(a,$){var j;let et=this.latestValues[a]!==void 0||!this.current?this.latestValues[a]:(j=this.getBaseTargetFromProps(this.props,a))!==null&&j!==void 0?j:this.readValueFromInstance(this.current,a,this.options);return et!=null&&(typeof et=="string"&&(isNumericalString(et)||isZeroValueString(et))?et=parseFloat(et):!findValueType(et)&&complex.test($)&&(et=getAnimatableNone(a,$)),this.setBaseTarget(a,isMotionValue(et)?et.get():et)),isMotionValue(et)?et.get():et}setBaseTarget(a,$){this.baseTarget[a]=$}getBaseTarget(a){var $;const{initial:j}=this.props;let et;if(typeof j=="string"||typeof j=="object"){const rt=resolveVariantFromProps(this.props,j,($=this.presenceContext)===null||$===void 0?void 0:$.custom);rt&&(et=rt[a])}if(j&&et!==void 0)return et;const tt=this.getBaseTargetFromProps(this.props,a);return tt!==void 0&&!isMotionValue(tt)?tt:this.initialValues[a]!==void 0&&et===void 0?void 0:this.baseTarget[a]}on(a,$){return this.events[a]||(this.events[a]=new SubscriptionManager),this.events[a].add($)}notify(a,...$){this.events[a]&&this.events[a].notify(...$)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(a,$){return a.compareDocumentPosition($)&2?1:-1}getBaseTargetFromProps(a,$){return a.style?a.style[$]:void 0}removeValueFromRenderState(a,{vars:$,style:j}){delete $[a],delete j[a]}}function getComputedStyle$2(_){return window.getComputedStyle(_)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(a,$){if(transformProps.has($)){const j=getDefaultValueType($);return j&&j.default||0}else{const j=getComputedStyle$2(a),et=(isCSSVariableName($)?j.getPropertyValue($):j[$])||0;return typeof et=="string"?et.trim():et}}measureInstanceViewportBox(a,{transformPagePoint:$}){return measureViewportBox(a,$)}build(a,$,j,et){buildHTMLStyles(a,$,j,et.transformTemplate)}scrapeMotionValuesFromProps(a,$,j){return scrapeMotionValuesFromProps$1(a,$,j)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:a}=this.props;isMotionValue(a)&&(this.childSubscription=a.on("change",$=>{this.current&&(this.current.textContent=`${$}`)}))}renderInstance(a,$,j,et){renderHTML(a,$,j,et)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(a,$){return a[$]}readValueFromInstance(a,$){if(transformProps.has($)){const j=getDefaultValueType($);return j&&j.default||0}return $=camelCaseAttributes.has($)?$:camelToDash($),a.getAttribute($)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(a,$,j){return scrapeMotionValuesFromProps(a,$,j)}build(a,$,j,et){buildSVGAttrs(a,$,j,this.isSVGTag,et.transformTemplate)}renderInstance(a,$,j,et){renderSVG(a,$,j,et)}mount(a){this.isSVGTag=isSVGTag(a.tagName),super.mount(a)}}const createDomVisualElement=(_,a)=>isSVGComponent(_)?new SVGVisualElement(a,{enableHardwareAcceleration:!1}):new HTMLVisualElement(a,{allowProjection:_!==reactExports.Fragment,enableHardwareAcceleration:!0}),layout={layout:{ProjectionNode:HTMLProjectionNode,MeasureLayout}},preloadedFeatures={...animations$1,...gestureAnimations,...drag,...layout},motion=createMotionProxy((_,a)=>createDomMotionConfig(_,a,preloadedFeatures,createDomVisualElement));function useIsMounted(){const _=reactExports.useRef(!1);return useIsomorphicLayoutEffect$2(()=>(_.current=!0,()=>{_.current=!1}),[]),_}function useForceUpdate(){const _=useIsMounted(),[a,$]=reactExports.useState(0),j=reactExports.useCallback(()=>{_.current&&$(a+1)},[a]);return[reactExports.useCallback(()=>frame.postRender(j),[j]),a]}class PopChildMeasure extends reactExports.Component{getSnapshotBeforeUpdate(a){const $=this.props.childRef.current;if($&&a.isPresent&&!this.props.isPresent){const j=this.props.sizeRef.current;j.height=$.offsetHeight||0,j.width=$.offsetWidth||0,j.top=$.offsetTop,j.left=$.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function PopChild({children:_,isPresent:a}){const $=reactExports.useId(),j=reactExports.useRef(null),et=reactExports.useRef({width:0,height:0,top:0,left:0}),{nonce:tt}=reactExports.useContext(MotionConfigContext);return reactExports.useInsertionEffect(()=>{const{width:rt,height:nt,top:it,left:at}=et.current;if(a||!j.current||!rt||!nt)return;j.current.dataset.motionPopId=$;const st=document.createElement("style");return tt&&(st.nonce=tt),document.head.appendChild(st),st.sheet&&st.sheet.insertRule(` [data-motion-pop-id="${$}"] { position: absolute !important; width: ${rt}px !important; height: ${nt}px !important; top: ${it}px !important; - left: ${ot}px !important; + left: ${at}px !important; } - `),()=>{document.head.removeChild(st)}},[a]),jsxRuntimeExports.jsx(PopChildMeasure,{isPresent:a,childRef:j,sizeRef:et,children:reactExports.cloneElement(_,{ref:j})})}const PresenceChild=({children:_,initial:a,isPresent:$,onExitComplete:j,custom:et,presenceAffectsLayout:tt,mode:rt})=>{const nt=useConstant(newChildrenMap),it=reactExports.useId(),ot=reactExports.useMemo(()=>({id:it,initial:a,isPresent:$,custom:et,onExitComplete:st=>{nt.set(st,!0);for(const at of nt.values())if(!at)return;j&&j()},register:st=>(nt.set(st,!1),()=>nt.delete(st))}),tt?[Math.random()]:[$]);return reactExports.useMemo(()=>{nt.forEach((st,at)=>nt.set(at,!1))},[$]),reactExports.useEffect(()=>{!$&&!nt.size&&j&&j()},[$]),rt==="popLayout"&&(_=jsxRuntimeExports.jsx(PopChild,{isPresent:$,children:_})),jsxRuntimeExports.jsx(PresenceContext.Provider,{value:ot,children:_})};function newChildrenMap(){return new Map}function useUnmountEffect(_){return reactExports.useEffect(()=>()=>_(),[])}const getChildKey=_=>_.key||"";function updateChildLookup(_,a){_.forEach($=>{const j=getChildKey($);a.set(j,$)})}function onlyElements(_){const a=[];return reactExports.Children.forEach(_,$=>{reactExports.isValidElement($)&&a.push($)}),a}const AnimatePresence=({children:_,custom:a,initial:$=!0,onExitComplete:j,exitBeforeEnter:et,presenceAffectsLayout:tt=!0,mode:rt="sync"})=>{const nt=reactExports.useContext(LayoutGroupContext).forceRender||useForceUpdate()[0],it=useIsMounted(),ot=onlyElements(_);let st=ot;const at=reactExports.useRef(new Map).current,ut=reactExports.useRef(st),ht=reactExports.useRef(new Map).current,bt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$2(()=>{bt.current=!1,updateChildLookup(ot,ht),ut.current=st}),useUnmountEffect(()=>{bt.current=!0,ht.clear(),at.clear()}),bt.current)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:st.map(Tt=>jsxRuntimeExports.jsx(PresenceChild,{isPresent:!0,initial:$?void 0:!1,presenceAffectsLayout:tt,mode:rt,children:Tt},getChildKey(Tt)))});st=[...st];const Et=ut.current.map(getChildKey),Ct=ot.map(getChildKey),Pt=Et.length;for(let Tt=0;Tt{if(Ct.indexOf(It)!==-1)return;const Lt=ht.get(It);if(!Lt)return;const Nt=Et.indexOf(It);let Ut=Tt;if(!Ut){const jt=()=>{at.delete(It);const Mt=Array.from(ht.keys()).filter(Dt=>!Ct.includes(Dt));if(Mt.forEach(Dt=>ht.delete(Dt)),ut.current=ot.filter(Dt=>{const Ft=getChildKey(Dt);return Ft===It||Mt.includes(Ft)}),!at.size){if(it.current===!1)return;nt(),j&&j()}};Ut=jsxRuntimeExports.jsx(PresenceChild,{isPresent:!1,onExitComplete:jt,custom:a,presenceAffectsLayout:tt,mode:rt,children:Lt},getChildKey(Lt)),at.set(It,Ut)}st.splice(Nt,0,Ut)}),st=st.map(Tt=>{const It=Tt.key;return at.has(It)?Tt:jsxRuntimeExports.jsx(PresenceChild,{isPresent:!0,presenceAffectsLayout:tt,mode:rt,children:Tt},getChildKey(Tt))}),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:at.size?st:st.map(Tt=>reactExports.cloneElement(Tt))})};var toastMotionVariants={initial:_=>{const{position:a}=_,$=["top","bottom"].includes(a)?"y":"x";let j=["top-right","bottom-right"].includes(a)?1:-1;return a==="bottom"&&(j=1),{opacity:0,[$]:j*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},ToastComponent=reactExports.memo(_=>{const{id:a,message:$,onCloseComplete:j,onRequestRemove:et,requestClose:tt=!1,position:rt="bottom",duration:nt=5e3,containerStyle:it,motionVariants:ot=toastMotionVariants,toastSpacing:st="0.5rem"}=_,[at,ut]=reactExports.useState(nt),ht=useIsPresent();useUpdateEffect(()=>{ht||j==null||j()},[ht]),useUpdateEffect(()=>{ut(nt)},[nt]);const bt=()=>ut(null),Et=()=>ut(nt),Ct=()=>{ht&&et()};reactExports.useEffect(()=>{ht&&tt&&et()},[ht,tt,et]),useTimeout(Ct,at);const Pt=reactExports.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:st,...it}),[it,st]),Tt=reactExports.useMemo(()=>getToastStyle(rt),[rt]);return jsxRuntimeExports.jsx(motion.div,{layout:!0,className:"chakra-toast",variants:ot,initial:"initial",animate:"animate",exit:"exit",onHoverStart:bt,onHoverEnd:Et,custom:{position:rt},style:Tt,children:jsxRuntimeExports.jsx(chakra.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:Pt,children:runIfFn$2($,{id:a,onClose:Ct})})})});ToastComponent.displayName="ToastComponent";function getToastPlacement(_,a){var $;const j=_??"bottom",tt={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[j];return($=tt==null?void 0:tt[a])!=null?$:j}var fallbackIcon={path:jsxRuntimeExports.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),jsxRuntimeExports.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),jsxRuntimeExports.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Icon=forwardRef((_,a)=>{const{as:$,viewBox:j,color:et="currentColor",focusable:tt=!1,children:rt,className:nt,__css:it,...ot}=_,st=cx("chakra-icon",nt),at=useStyleConfig("Icon",_),ut={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:et,...it,...at},ht={ref:a,focusable:tt,className:st,__css:ut},bt=j??fallbackIcon.viewBox;if($&&typeof $!="string")return jsxRuntimeExports.jsx(chakra.svg,{as:$,...ht,...ot});const Et=rt??fallbackIcon.path;return jsxRuntimeExports.jsx(chakra.svg,{verticalAlign:"middle",viewBox:bt,...ht,...ot,children:Et})});Icon.displayName="Icon";function createIcon(_){const{viewBox:a="0 0 24 24",d:$,displayName:j,defaultProps:et={}}=_,tt=reactExports.Children.toArray(_.path),rt=forwardRef((nt,it)=>jsxRuntimeExports.jsx(Icon,{ref:it,viewBox:a,...et,...nt,children:tt.length?tt:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:$})}));return rt.displayName=j,rt}function CheckIcon$3(_){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function InfoIcon(_){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function WarningIcon$1(_){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var spin=keyframes$1({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Spinner=forwardRef((_,a)=>{const $=useStyleConfig("Spinner",_),{label:j="Loading...",thickness:et="2px",speed:tt="0.45s",emptyColor:rt="transparent",className:nt,...it}=omitThemingProps(_),ot=cx("chakra-spinner",nt),st={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:et,borderBottomColor:rt,borderLeftColor:rt,animation:`${spin} ${tt} linear infinite`,...$};return jsxRuntimeExports.jsx(chakra.div,{ref:a,__css:st,className:ot,...it,children:j&&jsxRuntimeExports.jsx(chakra.span,{srOnly:!0,children:j})})});Spinner.displayName="Spinner";var[AlertProvider,useAlertContext]=createContext$1({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[AlertStylesProvider,useAlertStyles]=createContext$1({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),STATUSES={info:{icon:InfoIcon,colorScheme:"blue"},warning:{icon:WarningIcon$1,colorScheme:"orange"},success:{icon:CheckIcon$3,colorScheme:"green"},error:{icon:WarningIcon$1,colorScheme:"red"},loading:{icon:Spinner,colorScheme:"blue"}};function getStatusColorScheme(_){return STATUSES[_].colorScheme}function getStatusIcon(_){return STATUSES[_].icon}var AlertDescription=forwardRef(function(a,$){const j=useAlertStyles(),{status:et}=useAlertContext(),tt={display:"inline",...j.description};return jsxRuntimeExports.jsx(chakra.div,{ref:$,"data-status":et,...a,className:cx("chakra-alert__desc",a.className),__css:tt})});AlertDescription.displayName="AlertDescription";function AlertIcon(_){const{status:a}=useAlertContext(),$=getStatusIcon(a),j=useAlertStyles(),et=a==="loading"?j.spinner:j.icon;return jsxRuntimeExports.jsx(chakra.span,{display:"inherit","data-status":a,..._,className:cx("chakra-alert__icon",_.className),__css:et,children:_.children||jsxRuntimeExports.jsx($,{h:"100%",w:"100%"})})}AlertIcon.displayName="AlertIcon";var AlertTitle=forwardRef(function(a,$){const j=useAlertStyles(),{status:et}=useAlertContext();return jsxRuntimeExports.jsx(chakra.div,{ref:$,"data-status":et,...a,className:cx("chakra-alert__title",a.className),__css:j.title})});AlertTitle.displayName="AlertTitle";var Alert=forwardRef(function(a,$){var j;const{status:et="info",addRole:tt=!0,...rt}=omitThemingProps(a),nt=(j=a.colorScheme)!=null?j:getStatusColorScheme(et),it=useMultiStyleConfig("Alert",{...a,colorScheme:nt}),ot={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...it.container};return jsxRuntimeExports.jsx(AlertProvider,{value:{status:et},children:jsxRuntimeExports.jsx(AlertStylesProvider,{value:it,children:jsxRuntimeExports.jsx(chakra.div,{"data-status":et,role:tt?"alert":void 0,ref:$,...rt,className:cx("chakra-alert",a.className),__css:ot})})})});Alert.displayName="Alert";function CloseIcon(_){return jsxRuntimeExports.jsx(Icon,{focusable:"false","aria-hidden":!0,..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var CloseButton=forwardRef(function(a,$){const j=useStyleConfig("CloseButton",a),{children:et,isDisabled:tt,__css:rt,...nt}=omitThemingProps(a),it={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return jsxRuntimeExports.jsx(chakra.button,{type:"button","aria-label":"Close",ref:$,disabled:tt,__css:{...it,...j,...rt},...nt,children:et||jsxRuntimeExports.jsx(CloseIcon,{width:"1em",height:"1em"})})});CloseButton.displayName="CloseButton";var initialState$b={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},toastStore=createStore$1(initialState$b);function createStore$1(_){let a=_;const $=new Set,j=et=>{a=et(a),$.forEach(tt=>tt())};return{getState:()=>a,subscribe:et=>($.add(et),()=>{j(()=>_),$.delete(et)}),removeToast:(et,tt)=>{j(rt=>({...rt,[tt]:rt[tt].filter(nt=>nt.id!=et)}))},notify:(et,tt)=>{const rt=createToast(et,tt),{position:nt,id:it}=rt;return j(ot=>{var st,at;const ht=nt.includes("top")?[rt,...(st=ot[nt])!=null?st:[]]:[...(at=ot[nt])!=null?at:[],rt];return{...ot,[nt]:ht}}),it},update:(et,tt)=>{et&&j(rt=>{const nt={...rt},{position:it,index:ot}=findToast(nt,et);return it&&ot!==-1&&(nt[it][ot]={...nt[it][ot],...tt,message:createRenderToast(tt)}),nt})},closeAll:({positions:et}={})=>{j(tt=>(et??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((it,ot)=>(it[ot]=tt[ot].map(st=>({...st,requestClose:!0})),it),{...tt}))},close:et=>{j(tt=>{const rt=getToastPosition(tt,et);return rt?{...tt,[rt]:tt[rt].map(nt=>nt.id==et?{...nt,requestClose:!0}:nt)}:tt})},isActive:et=>!!findToast(toastStore.getState(),et).position}}var counter=0;function createToast(_,a={}){var $,j;counter+=1;const et=($=a.id)!=null?$:counter,tt=(j=a.position)!=null?j:"bottom";return{id:et,message:_,position:tt,duration:a.duration,onCloseComplete:a.onCloseComplete,onRequestRemove:()=>toastStore.removeToast(String(et),tt),status:a.status,requestClose:!1,containerStyle:a.containerStyle}}var Toast=_=>{const{status:a,variant:$="solid",id:j,title:et,isClosable:tt,onClose:rt,description:nt,colorScheme:it,icon:ot}=_,st=j?{root:`toast-${j}`,title:`toast-${j}-title`,description:`toast-${j}-description`}:void 0;return jsxRuntimeExports.jsxs(Alert,{addRole:!1,status:a,variant:$,id:st==null?void 0:st.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:it,children:[jsxRuntimeExports.jsx(AlertIcon,{children:ot}),jsxRuntimeExports.jsxs(chakra.div,{flex:"1",maxWidth:"100%",children:[et&&jsxRuntimeExports.jsx(AlertTitle,{id:st==null?void 0:st.title,children:et}),nt&&jsxRuntimeExports.jsx(AlertDescription,{id:st==null?void 0:st.description,display:"block",children:nt})]}),tt&&jsxRuntimeExports.jsx(CloseButton,{size:"sm",onClick:rt,position:"absolute",insetEnd:1,top:1})]})};function createRenderToast(_={}){const{render:a,toastComponent:$=Toast}=_;return et=>typeof a=="function"?a({...et,..._}):jsxRuntimeExports.jsx($,{...et,..._})}function createToastFn(_,a){const $=et=>{var tt;return{...a,...et,position:getToastPlacement((tt=et==null?void 0:et.position)!=null?tt:a==null?void 0:a.position,_)}},j=et=>{const tt=$(et),rt=createRenderToast(tt);return toastStore.notify(rt,tt)};return j.update=(et,tt)=>{toastStore.update(et,$(tt))},j.promise=(et,tt)=>{const rt=j({...tt.loading,status:"loading",duration:null});et.then(nt=>j.update(rt,{status:"success",duration:5e3,...runIfFn$2(tt.success,nt)})).catch(nt=>j.update(rt,{status:"error",duration:5e3,...runIfFn$2(tt.error,nt)}))},j.closeAll=toastStore.closeAll,j.close=toastStore.close,j.isActive=toastStore.isActive,j}var[ToastOptionProvider,useToastOptionContext]=createContext$1({name:"ToastOptionsContext",strict:!1}),ToastProvider=_=>{const a=reactExports.useSyncExternalStore(toastStore.subscribe,toastStore.getState,toastStore.getState),{motionVariants:$,component:j=ToastComponent,portalProps:et}=_,rt=Object.keys(a).map(nt=>{const it=a[nt];return jsxRuntimeExports.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${nt}`,id:`chakra-toast-manager-${nt}`,style:getToastListStyle(nt),children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:it.map(ot=>jsxRuntimeExports.jsx(j,{motionVariants:$,...ot},ot.id))})},nt)});return jsxRuntimeExports.jsx(Portal,{...et,children:rt})};function useToast(_){const{theme:a}=useChakra(),$=useToastOptionContext();return reactExports.useMemo(()=>createToastFn(a.direction,{...$,..._}),[_,a.direction,$])}var createChakraProvider=_=>function({children:$,theme:j=_,toastOptions:et,...tt}){return jsxRuntimeExports.jsxs(ChakraProvider$1,{theme:j,...tt,children:[jsxRuntimeExports.jsx(ToastOptionProvider,{value:et==null?void 0:et.defaultOptions,children:$}),jsxRuntimeExports.jsx(ToastProvider,{...et})]})},ChakraProvider=createChakraProvider(theme$1),__defProp$8=Object.defineProperty,__defNormalProp$3=(_,a,$)=>a in _?__defProp$8(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__publicField$3=(_,a,$)=>(__defNormalProp$3(_,typeof a!="symbol"?a+"":a,$),$);function sortNodes(_){return _.sort((a,$)=>{const j=a.compareDocumentPosition($);if(j&Node.DOCUMENT_POSITION_FOLLOWING||j&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(j&Node.DOCUMENT_POSITION_PRECEDING||j&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(j&Node.DOCUMENT_POSITION_DISCONNECTED||j&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var isElement$3=_=>typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE;function getNextIndex(_,a,$){let j=_+1;return $&&j>=a&&(j=0),j}function getPrevIndex(_,a,$){let j=_-1;return $&&j<0&&(j=a),j}var useSafeLayoutEffect$1=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,cast=_=>_,DescendantsManager=class{constructor(){__publicField$3(this,"descendants",new Map),__publicField$3(this,"register",_=>{if(_!=null)return isElement$3(_)?this.registerNode(_):a=>{this.registerNode(a,_)}}),__publicField$3(this,"unregister",_=>{this.descendants.delete(_);const a=sortNodes(Array.from(this.descendants.keys()));this.assignIndex(a)}),__publicField$3(this,"destroy",()=>{this.descendants.clear()}),__publicField$3(this,"assignIndex",_=>{this.descendants.forEach(a=>{const $=_.indexOf(a.node);a.index=$,a.node.dataset.index=a.index.toString()})}),__publicField$3(this,"count",()=>this.descendants.size),__publicField$3(this,"enabledCount",()=>this.enabledValues().length),__publicField$3(this,"values",()=>Array.from(this.descendants.values()).sort((a,$)=>a.index-$.index)),__publicField$3(this,"enabledValues",()=>this.values().filter(_=>!_.disabled)),__publicField$3(this,"item",_=>{if(this.count()!==0)return this.values()[_]}),__publicField$3(this,"enabledItem",_=>{if(this.enabledCount()!==0)return this.enabledValues()[_]}),__publicField$3(this,"first",()=>this.item(0)),__publicField$3(this,"firstEnabled",()=>this.enabledItem(0)),__publicField$3(this,"last",()=>this.item(this.descendants.size-1)),__publicField$3(this,"lastEnabled",()=>{const _=this.enabledValues().length-1;return this.enabledItem(_)}),__publicField$3(this,"indexOf",_=>{var a,$;return _&&($=(a=this.descendants.get(_))==null?void 0:a.index)!=null?$:-1}),__publicField$3(this,"enabledIndexOf",_=>_==null?-1:this.enabledValues().findIndex(a=>a.node.isSameNode(_))),__publicField$3(this,"next",(_,a=!0)=>{const $=getNextIndex(_,this.count(),a);return this.item($)}),__publicField$3(this,"nextEnabled",(_,a=!0)=>{const $=this.item(_);if(!$)return;const j=this.enabledIndexOf($.node),et=getNextIndex(j,this.enabledCount(),a);return this.enabledItem(et)}),__publicField$3(this,"prev",(_,a=!0)=>{const $=getPrevIndex(_,this.count()-1,a);return this.item($)}),__publicField$3(this,"prevEnabled",(_,a=!0)=>{const $=this.item(_);if(!$)return;const j=this.enabledIndexOf($.node),et=getPrevIndex(j,this.enabledCount()-1,a);return this.enabledItem(et)}),__publicField$3(this,"registerNode",(_,a)=>{if(!_||this.descendants.has(_))return;const $=Array.from(this.descendants.keys()).concat(_),j=sortNodes($);a!=null&&a.disabled&&(a.disabled=!!a.disabled);const et={node:_,index:-1,...a};this.descendants.set(_,et),this.assignIndex(j)})}};function assignRef$1(_,a){if(_!=null){if(typeof _=="function"){_(a);return}try{_.current=a}catch{throw new Error(`Cannot assign value '${a}' to ref '${_}'`)}}}function mergeRefs(..._){return a=>{_.forEach($=>{assignRef$1($,a)})}}function useMergeRefs$1(..._){return reactExports.useMemo(()=>mergeRefs(..._),_)}function useDescendants(){const _=reactExports.useRef(new DescendantsManager);return useSafeLayoutEffect$1(()=>()=>_.current.destroy()),_.current}var[DescendantsContextProvider,useDescendantsContext]=createContext$1({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function useDescendant(_){const a=useDescendantsContext(),[$,j]=reactExports.useState(-1),et=reactExports.useRef(null);useSafeLayoutEffect$1(()=>()=>{et.current&&a.unregister(et.current)},[]),useSafeLayoutEffect$1(()=>{if(!et.current)return;const rt=Number(et.current.dataset.index);$!=rt&&!Number.isNaN(rt)&&j(rt)});const tt=cast(_?a.register(_):a.register);return{descendants:a,index:$,enabledIndex:a.enabledIndexOf(et.current),register:mergeRefs(tt,et)}}function createDescendantContext(){return[cast(DescendantsContextProvider),()=>cast(useDescendantsContext()),()=>useDescendants(),et=>useDescendant(et)]}var[AccordionStylesProvider,useAccordionStyles]=createContext$1({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[AccordionItemProvider,useAccordionItemContext]=createContext$1({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[AccordionDescendantsProvider,useAccordionDescendantsContext,useAccordionDescendants,useAccordionDescendant]=createDescendantContext(),AccordionButton=forwardRef(function(a,$){const{getButtonProps:j}=useAccordionItemContext(),et=j(a,$),rt={display:"flex",alignItems:"center",width:"100%",outline:0,...useAccordionStyles().button};return jsxRuntimeExports.jsx(chakra.button,{...et,className:cx("chakra-accordion__button",a.className),__css:rt})});AccordionButton.displayName="AccordionButton";function useControllableState(_){const{value:a,defaultValue:$,onChange:j,shouldUpdate:et=(ut,ht)=>ut!==ht}=_,tt=useCallbackRef$2(j),rt=useCallbackRef$2(et),[nt,it]=reactExports.useState($),ot=a!==void 0,st=ot?a:nt,at=useCallbackRef$2(ut=>{const bt=typeof ut=="function"?ut(st):ut;rt(st,bt)&&(ot||it(bt),tt(bt))},[ot,tt,st,rt]);return[st,at]}function useAccordion(_){const{onChange:a,defaultIndex:$,index:j,allowMultiple:et,allowToggle:tt,...rt}=_;allowMultipleWarning(_),allowMultipleAndAllowToggleWarning(_);const nt=useAccordionDescendants(),[it,ot]=reactExports.useState(-1);reactExports.useEffect(()=>()=>{ot(-1)},[]);const[st,at]=useControllableState({value:j,defaultValue(){return et?$??[]:$??-1},onChange:a});return{index:st,setIndex:at,htmlProps:rt,getAccordionItemProps:ht=>{let bt=!1;return ht!==null&&(bt=Array.isArray(st)?st.includes(ht):st===ht),{isOpen:bt,onChange:Ct=>{if(ht!==null)if(et&&Array.isArray(st)){const Pt=Ct?st.concat(ht):st.filter(Tt=>Tt!==ht);at(Pt)}else Ct?at(ht):tt&&at(-1)}}},focusedIndex:it,setFocusedIndex:ot,descendants:nt}}var[AccordionProvider,useAccordionContext]=createContext$1({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function useAccordionItem(_){const{isDisabled:a,isFocusable:$,id:j,...et}=_,{getAccordionItemProps:tt,setFocusedIndex:rt}=useAccordionContext(),nt=reactExports.useRef(null),it=reactExports.useId(),ot=j??it,st=`accordion-button-${ot}`,at=`accordion-panel-${ot}`;focusableNotDisabledWarning(_);const{register:ut,index:ht,descendants:bt}=useAccordionDescendant({disabled:a&&!$}),{isOpen:Et,onChange:Ct}=tt(ht===-1?null:ht);warnIfOpenAndDisabled({isOpen:Et,isDisabled:a});const Pt=()=>{Ct==null||Ct(!0)},Tt=()=>{Ct==null||Ct(!1)},It=reactExports.useCallback(()=>{Ct==null||Ct(!Et),rt(ht)},[ht,rt,Et,Ct]),Lt=reactExports.useCallback(Mt=>{const Ft={ArrowDown:()=>{const Bt=bt.nextEnabled(ht);Bt==null||Bt.node.focus()},ArrowUp:()=>{const Bt=bt.prevEnabled(ht);Bt==null||Bt.node.focus()},Home:()=>{const Bt=bt.firstEnabled();Bt==null||Bt.node.focus()},End:()=>{const Bt=bt.lastEnabled();Bt==null||Bt.node.focus()}}[Mt.key];Ft&&(Mt.preventDefault(),Ft(Mt))},[bt,ht]),Nt=reactExports.useCallback(()=>{rt(ht)},[rt,ht]),Ut=reactExports.useCallback(function(Dt={},Ft=null){return{...Dt,type:"button",ref:mergeRefs(ut,nt,Ft),id:st,disabled:!!a,"aria-expanded":!!Et,"aria-controls":at,onClick:callAllHandlers$1(Dt.onClick,It),onFocus:callAllHandlers$1(Dt.onFocus,Nt),onKeyDown:callAllHandlers$1(Dt.onKeyDown,Lt)}},[st,a,Et,It,Nt,Lt,at,ut]),jt=reactExports.useCallback(function(Dt={},Ft=null){return{...Dt,ref:Ft,role:"region",id:at,"aria-labelledby":st,hidden:!Et}},[st,Et,at]);return{isOpen:Et,isDisabled:a,isFocusable:$,onOpen:Pt,onClose:Tt,getButtonProps:Ut,getPanelProps:jt,htmlProps:et}}function allowMultipleWarning(_){const a=_.index||_.defaultIndex,$=a!=null&&!Array.isArray(a)&&_.allowMultiple;warn({condition:!!$,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof a},`})}function allowMultipleAndAllowToggleWarning(_){warn({condition:!!(_.allowMultiple&&_.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function focusableNotDisabledWarning(_){warn({condition:!!(_.isFocusable&&!_.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. - `})}function warnIfOpenAndDisabled(_){warn({condition:_.isOpen&&!!_.isDisabled,message:"Cannot open a disabled accordion item"})}function AccordionIcon(_){const{isOpen:a,isDisabled:$}=useAccordionItemContext(),{reduceMotion:j}=useAccordionContext(),et=cx("chakra-accordion__icon",_.className),tt=useAccordionStyles(),rt={opacity:$?.4:1,transform:a?"rotate(-180deg)":void 0,transition:j?void 0:"transform 0.2s",transformOrigin:"center",...tt.icon};return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24","aria-hidden":!0,className:et,__css:rt,..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}AccordionIcon.displayName="AccordionIcon";var AccordionItem=forwardRef(function(a,$){const{children:j,className:et}=a,{htmlProps:tt,...rt}=useAccordionItem(a),it={...useAccordionStyles().container,overflowAnchor:"none"},ot=reactExports.useMemo(()=>rt,[rt]);return jsxRuntimeExports.jsx(AccordionItemProvider,{value:ot,children:jsxRuntimeExports.jsx(chakra.div,{ref:$,...tt,className:cx("chakra-accordion__item",et),__css:it,children:typeof j=="function"?j({isExpanded:!!rt.isOpen,isDisabled:!!rt.isDisabled}):j})})});AccordionItem.displayName="AccordionItem";var TRANSITION_EASINGS={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},TRANSITION_VARIANTS={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function getSlideTransition(_){var a;switch((a=_==null?void 0:_.direction)!=null?a:"right"){case"right":return TRANSITION_VARIANTS.slideRight;case"left":return TRANSITION_VARIANTS.slideLeft;case"bottom":return TRANSITION_VARIANTS.slideDown;case"top":return TRANSITION_VARIANTS.slideUp;default:return TRANSITION_VARIANTS.slideRight}}var TRANSITION_DEFAULTS={enter:{duration:.2,ease:TRANSITION_EASINGS.easeOut},exit:{duration:.1,ease:TRANSITION_EASINGS.easeIn}},withDelay={enter:(_,a)=>({..._,delay:typeof a=="number"?a:a==null?void 0:a.enter}),exit:(_,a)=>({..._,delay:typeof a=="number"?a:a==null?void 0:a.exit})},isNumeric$1=_=>_!=null&&parseInt(_.toString(),10)>0,defaultTransitions={exit:{height:{duration:.2,ease:TRANSITION_EASINGS.ease},opacity:{duration:.3,ease:TRANSITION_EASINGS.ease}},enter:{height:{duration:.3,ease:TRANSITION_EASINGS.ease},opacity:{duration:.4,ease:TRANSITION_EASINGS.ease}}},variants$4={exit:({animateOpacity:_,startingHeight:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{..._&&{opacity:isNumeric$1(a)?1:0},height:a,transitionEnd:j==null?void 0:j.exit,transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(defaultTransitions.exit,et)}},enter:({animateOpacity:_,endingHeight:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{..._&&{opacity:1},height:a,transitionEnd:j==null?void 0:j.enter,transition:(tt=$==null?void 0:$.enter)!=null?tt:withDelay.enter(defaultTransitions.enter,et)}}},Collapse=reactExports.forwardRef((_,a)=>{const{in:$,unmountOnExit:j,animateOpacity:et=!0,startingHeight:tt=0,endingHeight:rt="auto",style:nt,className:it,transition:ot,transitionEnd:st,...at}=_,[ut,ht]=reactExports.useState(!1);reactExports.useEffect(()=>{const Tt=setTimeout(()=>{ht(!0)});return()=>clearTimeout(Tt)},[]),warn({condition:Number(tt)>0&&!!j,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const bt=parseFloat(tt.toString())>0,Et={startingHeight:tt,endingHeight:rt,animateOpacity:et,transition:ut?ot:{enter:{duration:0}},transitionEnd:{enter:st==null?void 0:st.enter,exit:j?st==null?void 0:st.exit:{...st==null?void 0:st.exit,display:bt?"block":"none"}}},Ct=j?$:!0,Pt=$||j?"enter":"exit";return jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,custom:Et,children:Ct&&jsxRuntimeExports.jsx(motion.div,{ref:a,...at,className:cx("chakra-collapse",it),style:{overflow:"hidden",display:"block",...nt},custom:Et,variants:variants$4,initial:j?"exit":!1,animate:Pt,exit:"exit"})})});Collapse.displayName="Collapse";var variants$3={enter:({transition:_,transitionEnd:a,delay:$}={})=>{var j;return{opacity:1,transition:(j=_==null?void 0:_.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:a==null?void 0:a.enter}},exit:({transition:_,transitionEnd:a,delay:$}={})=>{var j;return{opacity:0,transition:(j=_==null?void 0:_.exit)!=null?j:withDelay.exit(TRANSITION_DEFAULTS.exit,$),transitionEnd:a==null?void 0:a.exit}}},fadeConfig={initial:"exit",animate:"enter",exit:"exit",variants:variants$3},Fade=reactExports.forwardRef(function(a,$){const{unmountOnExit:j,in:et,className:tt,transition:rt,transitionEnd:nt,delay:it,...ot}=a,st=et||j?"enter":"exit",at=j?et&&j:!0,ut={transition:rt,transitionEnd:nt,delay:it};return jsxRuntimeExports.jsx(AnimatePresence,{custom:ut,children:at&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-fade",tt),custom:ut,...fadeConfig,animate:st,...ot})})});Fade.displayName="Fade";var variants$2={exit:({reverse:_,initialScale:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{opacity:0,..._?{scale:a,transitionEnd:j==null?void 0:j.exit}:{transitionEnd:{scale:a,...j==null?void 0:j.exit}},transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(TRANSITION_DEFAULTS.exit,et)}},enter:({transitionEnd:_,transition:a,delay:$})=>{var j;return{opacity:1,scale:1,transition:(j=a==null?void 0:a.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:_==null?void 0:_.enter}}},scaleFadeConfig={initial:"exit",animate:"enter",exit:"exit",variants:variants$2},ScaleFade=reactExports.forwardRef(function(a,$){const{unmountOnExit:j,in:et,reverse:tt=!0,initialScale:rt=.95,className:nt,transition:it,transitionEnd:ot,delay:st,...at}=a,ut=j?et&&j:!0,ht=et||j?"enter":"exit",bt={initialScale:rt,reverse:tt,transition:it,transitionEnd:ot,delay:st};return jsxRuntimeExports.jsx(AnimatePresence,{custom:bt,children:ut&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-offset-slide",nt),...scaleFadeConfig,animate:ht,custom:bt,...at})})});ScaleFade.displayName="ScaleFade";var variants$1={initial:({offsetX:_,offsetY:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{opacity:0,x:_,y:a,transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(TRANSITION_DEFAULTS.exit,et),transitionEnd:j==null?void 0:j.exit}},enter:({transition:_,transitionEnd:a,delay:$})=>{var j;return{opacity:1,x:0,y:0,transition:(j=_==null?void 0:_.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:a==null?void 0:a.enter}},exit:({offsetY:_,offsetX:a,transition:$,transitionEnd:j,reverse:et,delay:tt})=>{var rt;const nt={x:a,y:_};return{opacity:0,transition:(rt=$==null?void 0:$.exit)!=null?rt:withDelay.exit(TRANSITION_DEFAULTS.exit,tt),...et?{...nt,transitionEnd:j==null?void 0:j.exit}:{transitionEnd:{...nt,...j==null?void 0:j.exit}}}}},slideFadeConfig={initial:"initial",animate:"enter",exit:"exit",variants:variants$1},SlideFade=reactExports.forwardRef(function(a,$){const{unmountOnExit:j,in:et,reverse:tt=!0,className:rt,offsetX:nt=0,offsetY:it=8,transition:ot,transitionEnd:st,delay:at,...ut}=a,ht=j?et&&j:!0,bt=et||j?"enter":"exit",Et={offsetX:nt,offsetY:it,reverse:tt,transition:ot,transitionEnd:st,delay:at};return jsxRuntimeExports.jsx(AnimatePresence,{custom:Et,children:ht&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-offset-slide",rt),custom:Et,...slideFadeConfig,animate:bt,...ut})})});SlideFade.displayName="SlideFade";var defaultTransition={exit:{duration:.15,ease:TRANSITION_EASINGS.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},variants={exit:({direction:_,transition:a,transitionEnd:$,delay:j})=>{var et;const{exit:tt}=getSlideTransition({direction:_});return{...tt,transition:(et=a==null?void 0:a.exit)!=null?et:withDelay.exit(defaultTransition.exit,j),transitionEnd:$==null?void 0:$.exit}},enter:({direction:_,transitionEnd:a,transition:$,delay:j})=>{var et;const{enter:tt}=getSlideTransition({direction:_});return{...tt,transition:(et=$==null?void 0:$.enter)!=null?et:withDelay.enter(defaultTransition.enter,j),transitionEnd:a==null?void 0:a.enter}}},Slide=reactExports.forwardRef(function(a,$){const{direction:j="right",style:et,unmountOnExit:tt,in:rt,className:nt,transition:it,transitionEnd:ot,delay:st,motionProps:at,...ut}=a,ht=getSlideTransition({direction:j}),bt=Object.assign({position:"fixed"},ht.position,et),Et=tt?rt&&tt:!0,Ct=rt||tt?"enter":"exit",Pt={transitionEnd:ot,transition:it,direction:j,delay:st};return jsxRuntimeExports.jsx(AnimatePresence,{custom:Pt,children:Et&&jsxRuntimeExports.jsx(motion.div,{...ut,ref:$,initial:"exit",className:cx("chakra-slide",nt),animate:Ct,exit:"exit",custom:Pt,variants,style:bt,...at})})});Slide.displayName="Slide";var AccordionPanel=forwardRef(function(a,$){const{className:j,motionProps:et,...tt}=a,{reduceMotion:rt}=useAccordionContext(),{getPanelProps:nt,isOpen:it}=useAccordionItemContext(),ot=nt(tt,$),st=cx("chakra-accordion__panel",j),at=useAccordionStyles();rt||delete ot.hidden;const ut=jsxRuntimeExports.jsx(chakra.div,{...ot,__css:at.panel,className:st});return rt?ut:jsxRuntimeExports.jsx(Collapse,{in:it,...et,children:ut})});AccordionPanel.displayName="AccordionPanel";var Accordion=forwardRef(function({children:a,reduceMotion:$,...j},et){const tt=useMultiStyleConfig("Accordion",j),rt=omitThemingProps(j),{htmlProps:nt,descendants:it,...ot}=useAccordion(rt),st=reactExports.useMemo(()=>({...ot,reduceMotion:!!$}),[ot,$]);return jsxRuntimeExports.jsx(AccordionDescendantsProvider,{value:it,children:jsxRuntimeExports.jsx(AccordionProvider,{value:st,children:jsxRuntimeExports.jsx(AccordionStylesProvider,{value:tt,children:jsxRuntimeExports.jsx(chakra.div,{ref:et,...nt,className:cx("chakra-accordion",j.className),__css:tt.root,children:a})})})})});Accordion.displayName="Accordion";var NativeImage=forwardRef(function(a,$){const{htmlWidth:j,htmlHeight:et,alt:tt,...rt}=a;return jsxRuntimeExports.jsx("img",{width:j,height:et,ref:$,alt:tt,...rt})});NativeImage.displayName="NativeImage";function useImage(_){const{loading:a,src:$,srcSet:j,onLoad:et,onError:tt,crossOrigin:rt,sizes:nt,ignoreFallback:it}=_,[ot,st]=reactExports.useState("pending");reactExports.useEffect(()=>{st($?"loading":"pending")},[$]);const at=reactExports.useRef(),ut=reactExports.useCallback(()=>{if(!$)return;ht();const bt=new Image;bt.src=$,rt&&(bt.crossOrigin=rt),j&&(bt.srcset=j),nt&&(bt.sizes=nt),a&&(bt.loading=a),bt.onload=Et=>{ht(),st("loaded"),et==null||et(Et)},bt.onerror=Et=>{ht(),st("failed"),tt==null||tt(Et)},at.current=bt},[$,rt,j,nt,et,tt,a]),ht=()=>{at.current&&(at.current.onload=null,at.current.onerror=null,at.current=null)};return useSafeLayoutEffect$2(()=>{if(!it)return ot==="loading"&&ut(),()=>{ht()}},[ot,ut,it]),it?"loaded":ot}var shouldShowFallbackImage=(_,a)=>_!=="loaded"&&a==="beforeLoadOrError"||_==="failed"&&a==="onError";function omit$4(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}var Image$1=forwardRef(function(a,$){const{fallbackSrc:j,fallback:et,src:tt,srcSet:rt,align:nt,fit:it,loading:ot,ignoreFallback:st,crossOrigin:at,fallbackStrategy:ut="beforeLoadOrError",referrerPolicy:ht,...bt}=a,Et=j!==void 0||et!==void 0,Ct=ot!=null||st||!Et,Pt=useImage({...a,crossOrigin:at,ignoreFallback:Ct}),Tt=shouldShowFallbackImage(Pt,ut),It={ref:$,objectFit:it,objectPosition:nt,...Ct?bt:omit$4(bt,["onError","onLoad"])};return Tt?et||jsxRuntimeExports.jsx(chakra.img,{as:NativeImage,className:"chakra-image__placeholder",src:j,...It}):jsxRuntimeExports.jsx(chakra.img,{as:NativeImage,src:tt,srcSet:rt,crossOrigin:at,loading:ot,referrerPolicy:ht,className:"chakra-image",...It})});Image$1.displayName="Image";function getValidChildren(_){return reactExports.Children.toArray(_).filter(a=>reactExports.isValidElement(a))}var[ButtonGroupProvider,useButtonGroup]=createContext$1({strict:!1,name:"ButtonGroupContext"});function useButtonType(_){const[a,$]=reactExports.useState(!_);return{ref:reactExports.useCallback(tt=>{tt&&$(tt.tagName==="BUTTON")},[]),type:a?"button":void 0}}function ButtonIcon(_){const{children:a,className:$,...j}=_,et=reactExports.isValidElement(a)?reactExports.cloneElement(a,{"aria-hidden":!0,focusable:!1}):a,tt=cx("chakra-button__icon",$);return jsxRuntimeExports.jsx(chakra.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...j,className:tt,children:et})}ButtonIcon.displayName="ButtonIcon";function ButtonSpinner(_){const{label:a,placement:$,spacing:j="0.5rem",children:et=jsxRuntimeExports.jsx(Spinner,{color:"currentColor",width:"1em",height:"1em"}),className:tt,__css:rt,...nt}=_,it=cx("chakra-button__spinner",tt),ot=$==="start"?"marginEnd":"marginStart",st=reactExports.useMemo(()=>({display:"flex",alignItems:"center",position:a?"relative":"absolute",[ot]:a?j:0,fontSize:"1em",lineHeight:"normal",...rt}),[rt,a,ot,j]);return jsxRuntimeExports.jsx(chakra.div,{className:it,...nt,__css:st,children:et})}ButtonSpinner.displayName="ButtonSpinner";var Button=forwardRef((_,a)=>{const $=useButtonGroup(),j=useStyleConfig("Button",{...$,..._}),{isDisabled:et=$==null?void 0:$.isDisabled,isLoading:tt,isActive:rt,children:nt,leftIcon:it,rightIcon:ot,loadingText:st,iconSpacing:at="0.5rem",type:ut,spinner:ht,spinnerPlacement:bt="start",className:Et,as:Ct,...Pt}=omitThemingProps(_),Tt=reactExports.useMemo(()=>{const Ut={...j==null?void 0:j._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...j,...!!$&&{_focus:Ut}}},[j,$]),{ref:It,type:Lt}=useButtonType(Ct),Nt={rightIcon:ot,leftIcon:it,iconSpacing:at,children:nt};return jsxRuntimeExports.jsxs(chakra.button,{ref:useMergeRefs$1(a,It),as:Ct,type:ut??Lt,"data-active":dataAttr(rt),"data-loading":dataAttr(tt),__css:Tt,className:cx("chakra-button",Et),...Pt,disabled:et||tt,children:[tt&&bt==="start"&&jsxRuntimeExports.jsx(ButtonSpinner,{className:"chakra-button__spinner--start",label:st,placement:"start",spacing:at,children:ht}),tt?st||jsxRuntimeExports.jsx(chakra.span,{opacity:0,children:jsxRuntimeExports.jsx(ButtonContent,{...Nt})}):jsxRuntimeExports.jsx(ButtonContent,{...Nt}),tt&&bt==="end"&&jsxRuntimeExports.jsx(ButtonSpinner,{className:"chakra-button__spinner--end",label:st,placement:"end",spacing:at,children:ht})]})});Button.displayName="Button";function ButtonContent(_){const{leftIcon:a,rightIcon:$,children:j,iconSpacing:et}=_;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[a&&jsxRuntimeExports.jsx(ButtonIcon,{marginEnd:et,children:a}),j,$&&jsxRuntimeExports.jsx(ButtonIcon,{marginStart:et,children:$})]})}var IconButton=forwardRef((_,a)=>{const{icon:$,children:j,isRound:et,"aria-label":tt,...rt}=_,nt=$||j,it=reactExports.isValidElement(nt)?reactExports.cloneElement(nt,{"aria-hidden":!0,focusable:!1}):null;return jsxRuntimeExports.jsx(Button,{padding:"0",borderRadius:et?"full":void 0,ref:a,"aria-label":tt,...rt,children:it})});IconButton.displayName="IconButton";var[CardStylesProvider,useCardStyles]=createStylesContext("Card"),CardBody=forwardRef(function(a,$){const{className:j,...et}=a,tt=useCardStyles();return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-card__body",j),__css:tt.body,...et})}),Card=forwardRef(function(a,$){const{className:j,children:et,direction:tt="column",justify:rt,align:nt,...it}=omitThemingProps(a),ot=useMultiStyleConfig("Card",a);return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-card",j),__css:{display:"flex",flexDirection:tt,justifyContent:rt,alignItems:nt,position:"relative",minWidth:0,wordWrap:"break-word",...ot.container},...it,children:jsxRuntimeExports.jsx(CardStylesProvider,{value:ot,children:et})})}),[CheckboxGroupProvider,useCheckboxGroupContext]=createContext$1({name:"CheckboxGroupContext",strict:!1});function useInitialAnimationState(_){const[a,$]=reactExports.useState(_),[j,et]=reactExports.useState(!1);return _!==a&&(et(!0),$(_)),j}function CheckIcon$2(_){return jsxRuntimeExports.jsx(chakra.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},..._,children:jsxRuntimeExports.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function IndeterminateIcon(_){return jsxRuntimeExports.jsx(chakra.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},..._,children:jsxRuntimeExports.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function CheckboxIcon(_){const{isIndeterminate:a,isChecked:$,...j}=_,et=a?IndeterminateIcon:CheckIcon$2;return $||a?jsxRuntimeExports.jsx(chakra.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:jsxRuntimeExports.jsx(et,{...j})}):null}var[FormControlStylesProvider,useFormControlStyles]=createContext$1({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[FormControlProvider,useFormControlContext]=createContext$1({strict:!1,name:"FormControlContext"});function useFormControlProvider(_){const{id:a,isRequired:$,isInvalid:j,isDisabled:et,isReadOnly:tt,...rt}=_,nt=reactExports.useId(),it=a||`field-${nt}`,ot=`${it}-label`,st=`${it}-feedback`,at=`${it}-helptext`,[ut,ht]=reactExports.useState(!1),[bt,Et]=reactExports.useState(!1),[Ct,Pt]=reactExports.useState(!1),Tt=reactExports.useCallback((jt={},Mt=null)=>({id:at,...jt,ref:mergeRefs(Mt,Dt=>{Dt&&Et(!0)})}),[at]),It=reactExports.useCallback((jt={},Mt=null)=>({...jt,ref:Mt,"data-focus":dataAttr(Ct),"data-disabled":dataAttr(et),"data-invalid":dataAttr(j),"data-readonly":dataAttr(tt),id:jt.id!==void 0?jt.id:ot,htmlFor:jt.htmlFor!==void 0?jt.htmlFor:it}),[it,et,Ct,j,tt,ot]),Lt=reactExports.useCallback((jt={},Mt=null)=>({id:st,...jt,ref:mergeRefs(Mt,Dt=>{Dt&&ht(!0)}),"aria-live":"polite"}),[st]),Nt=reactExports.useCallback((jt={},Mt=null)=>({...jt,...rt,ref:Mt,role:"group","data-focus":dataAttr(Ct),"data-disabled":dataAttr(et),"data-invalid":dataAttr(j),"data-readonly":dataAttr(tt)}),[rt,et,Ct,j,tt]),Ut=reactExports.useCallback((jt={},Mt=null)=>({...jt,ref:Mt,role:"presentation","aria-hidden":!0,children:jt.children||"*"}),[]);return{isRequired:!!$,isInvalid:!!j,isReadOnly:!!tt,isDisabled:!!et,isFocused:!!Ct,onFocus:()=>Pt(!0),onBlur:()=>Pt(!1),hasFeedbackText:ut,setHasFeedbackText:ht,hasHelpText:bt,setHasHelpText:Et,id:it,labelId:ot,feedbackId:st,helpTextId:at,htmlProps:rt,getHelpTextProps:Tt,getErrorMessageProps:Lt,getRootProps:Nt,getLabelProps:It,getRequiredIndicatorProps:Ut}}var FormControl=forwardRef(function(a,$){const j=useMultiStyleConfig("Form",a),et=omitThemingProps(a),{getRootProps:tt,htmlProps:rt,...nt}=useFormControlProvider(et),it=cx("chakra-form-control",a.className);return jsxRuntimeExports.jsx(FormControlProvider,{value:nt,children:jsxRuntimeExports.jsx(FormControlStylesProvider,{value:j,children:jsxRuntimeExports.jsx(chakra.div,{...tt({},$),className:it,__css:j.container})})})});FormControl.displayName="FormControl";var FormHelperText=forwardRef(function(a,$){const j=useFormControlContext(),et=useFormControlStyles(),tt=cx("chakra-form__helper-text",a.className);return jsxRuntimeExports.jsx(chakra.div,{...j==null?void 0:j.getHelpTextProps(a,$),__css:et.helperText,className:tt})});FormHelperText.displayName="FormHelperText";var[FormErrorStylesProvider,useFormErrorStyles]=createContext$1({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),FormErrorMessage$1=forwardRef((_,a)=>{const $=useMultiStyleConfig("FormError",_),j=omitThemingProps(_),et=useFormControlContext();return et!=null&&et.isInvalid?jsxRuntimeExports.jsx(FormErrorStylesProvider,{value:$,children:jsxRuntimeExports.jsx(chakra.div,{...et==null?void 0:et.getErrorMessageProps(j,a),className:cx("chakra-form__error-message",_.className),__css:{display:"flex",alignItems:"center",...$.text}})}):null});FormErrorMessage$1.displayName="FormErrorMessage";var FormErrorIcon=forwardRef((_,a)=>{const $=useFormErrorStyles(),j=useFormControlContext();if(!(j!=null&&j.isInvalid))return null;const et=cx("chakra-form__error-icon",_.className);return jsxRuntimeExports.jsx(Icon,{ref:a,"aria-hidden":!0,..._,__css:$.icon,className:et,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});FormErrorIcon.displayName="FormErrorIcon";var FormLabel=forwardRef(function(a,$){var j;const et=useStyleConfig("FormLabel",a),tt=omitThemingProps(a),{className:rt,children:nt,requiredIndicator:it=jsxRuntimeExports.jsx(RequiredIndicator,{}),optionalIndicator:ot=null,...st}=tt,at=useFormControlContext(),ut=(j=at==null?void 0:at.getLabelProps(st,$))!=null?j:{ref:$,...st};return jsxRuntimeExports.jsxs(chakra.label,{...ut,className:cx("chakra-form__label",tt.className),__css:{display:"block",textAlign:"start",...et},children:[nt,at!=null&&at.isRequired?it:ot]})});FormLabel.displayName="FormLabel";var RequiredIndicator=forwardRef(function(a,$){const j=useFormControlContext(),et=useFormControlStyles();if(!(j!=null&&j.isRequired))return null;const tt=cx("chakra-form__required-indicator",a.className);return jsxRuntimeExports.jsx(chakra.span,{...j==null?void 0:j.getRequiredIndicatorProps(a,$),__css:et.requiredIndicator,className:tt})});RequiredIndicator.displayName="RequiredIndicator";function useFormControl(_){const{isDisabled:a,isInvalid:$,isReadOnly:j,isRequired:et,...tt}=useFormControlProps(_);return{...tt,disabled:a,readOnly:j,required:et,"aria-invalid":ariaAttr($),"aria-required":ariaAttr(et),"aria-readonly":ariaAttr(j)}}function useFormControlProps(_){var a,$,j;const et=useFormControlContext(),{id:tt,disabled:rt,readOnly:nt,required:it,isRequired:ot,isInvalid:st,isReadOnly:at,isDisabled:ut,onFocus:ht,onBlur:bt,...Et}=_,Ct=_["aria-describedby"]?[_["aria-describedby"]]:[];return et!=null&&et.hasFeedbackText&&(et!=null&&et.isInvalid)&&Ct.push(et.feedbackId),et!=null&&et.hasHelpText&&Ct.push(et.helpTextId),{...Et,"aria-describedby":Ct.join(" ")||void 0,id:tt??(et==null?void 0:et.id),isDisabled:(a=rt??ut)!=null?a:et==null?void 0:et.isDisabled,isReadOnly:($=nt??at)!=null?$:et==null?void 0:et.isReadOnly,isRequired:(j=it??ot)!=null?j:et==null?void 0:et.isRequired,isInvalid:st??(et==null?void 0:et.isInvalid),onFocus:callAllHandlers$1(et==null?void 0:et.onFocus,ht),onBlur:callAllHandlers$1(et==null?void 0:et.onBlur,bt)}}var visuallyHiddenStyle$1={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},isDom$1=()=>typeof document<"u",hasSetup=!1,modality=null,hasEventBeforeFocus=!1,hasBlurredWindowRecently=!1,handlers=new Set;function trigger(_,a){handlers.forEach($=>$(_,a))}var isMac=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function isValidKey(_){return!(_.metaKey||!isMac&&_.altKey||_.ctrlKey||_.key==="Control"||_.key==="Shift"||_.key==="Meta")}function onKeyboardEvent(_){hasEventBeforeFocus=!0,isValidKey(_)&&(modality="keyboard",trigger("keyboard",_))}function onPointerEvent(_){if(modality="pointer",_.type==="mousedown"||_.type==="pointerdown"){hasEventBeforeFocus=!0;const a=_.composedPath?_.composedPath()[0]:_.target;let $=!1;try{$=a.matches(":focus-visible")}catch{}if($)return;trigger("pointer",_)}}function isVirtualClick(_){return _.mozInputSource===0&&_.isTrusted?!0:_.detail===0&&!_.pointerType}function onClickEvent(_){isVirtualClick(_)&&(hasEventBeforeFocus=!0,modality="virtual")}function onWindowFocus(_){_.target===window||_.target===document||(!hasEventBeforeFocus&&!hasBlurredWindowRecently&&(modality="virtual",trigger("virtual",_)),hasEventBeforeFocus=!1,hasBlurredWindowRecently=!1)}function onWindowBlur$1(){hasEventBeforeFocus=!1,hasBlurredWindowRecently=!0}function isFocusVisible(){return modality!=="pointer"}function setupGlobalFocusEvents(){if(!isDom$1()||hasSetup)return;const{focus:_}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...$){hasEventBeforeFocus=!0,_.apply(this,$)},document.addEventListener("keydown",onKeyboardEvent,!0),document.addEventListener("keyup",onKeyboardEvent,!0),document.addEventListener("click",onClickEvent,!0),window.addEventListener("focus",onWindowFocus,!0),window.addEventListener("blur",onWindowBlur$1,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",onPointerEvent,!0),document.addEventListener("pointermove",onPointerEvent,!0),document.addEventListener("pointerup",onPointerEvent,!0)):(document.addEventListener("mousedown",onPointerEvent,!0),document.addEventListener("mousemove",onPointerEvent,!0),document.addEventListener("mouseup",onPointerEvent,!0)),hasSetup=!0}function trackFocusVisible(_){setupGlobalFocusEvents(),_(isFocusVisible());const a=()=>_(isFocusVisible());return handlers.add(a),()=>{handlers.delete(a)}}function omit$3(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}function useCheckbox(_={}){const a=useFormControlProps(_),{isDisabled:$,isReadOnly:j,isRequired:et,isInvalid:tt,id:rt,onBlur:nt,onFocus:it,"aria-describedby":ot}=a,{defaultChecked:st,isChecked:at,isFocusable:ut,onChange:ht,isIndeterminate:bt,name:Et,value:Ct,tabIndex:Pt=void 0,"aria-label":Tt,"aria-labelledby":It,"aria-invalid":Lt,...Nt}=_,Ut=omit$3(Nt,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),jt=useCallbackRef$2(ht),Mt=useCallbackRef$2(nt),Dt=useCallbackRef$2(it),[Ft,Bt]=reactExports.useState(!1),[yt,mt]=reactExports.useState(!1),[ct,dt]=reactExports.useState(!1),[vt,St]=reactExports.useState(!1);reactExports.useEffect(()=>trackFocusVisible(Bt),[]);const Rt=reactExports.useRef(null),[$t,xt]=reactExports.useState(!0),[At,wt]=reactExports.useState(!!st),Ot=at!==void 0,tr=Ot?at:At,nr=reactExports.useCallback(pr=>{if(j||$){pr.preventDefault();return}Ot||wt(tr?pr.target.checked:bt?!0:pr.target.checked),jt==null||jt(pr)},[j,$,tr,Ot,bt,jt]);useSafeLayoutEffect$2(()=>{Rt.current&&(Rt.current.indeterminate=!!bt)},[bt]),useUpdateEffect(()=>{$&&mt(!1)},[$,mt]),useSafeLayoutEffect$2(()=>{const pr=Rt.current;if(!(pr!=null&&pr.form))return;const kr=()=>{wt(!!st)};return pr.form.addEventListener("reset",kr),()=>{var Ir;return(Ir=pr.form)==null?void 0:Ir.removeEventListener("reset",kr)}},[]);const ir=$&&!ut,Wt=reactExports.useCallback(pr=>{pr.key===" "&&St(!0)},[St]),Kt=reactExports.useCallback(pr=>{pr.key===" "&&St(!1)},[St]);useSafeLayoutEffect$2(()=>{if(!Rt.current)return;Rt.current.checked!==tr&&wt(Rt.current.checked)},[Rt.current]);const Jt=reactExports.useCallback((pr={},kr=null)=>{const Ir=lr=>{yt&&lr.preventDefault(),St(!0)};return{...pr,ref:kr,"data-active":dataAttr(vt),"data-hover":dataAttr(ct),"data-checked":dataAttr(tr),"data-focus":dataAttr(yt),"data-focus-visible":dataAttr(yt&&Ft),"data-indeterminate":dataAttr(bt),"data-disabled":dataAttr($),"data-invalid":dataAttr(tt),"data-readonly":dataAttr(j),"aria-hidden":!0,onMouseDown:callAllHandlers$1(pr.onMouseDown,Ir),onMouseUp:callAllHandlers$1(pr.onMouseUp,()=>St(!1)),onMouseEnter:callAllHandlers$1(pr.onMouseEnter,()=>dt(!0)),onMouseLeave:callAllHandlers$1(pr.onMouseLeave,()=>dt(!1))}},[vt,tr,$,yt,Ft,ct,bt,tt,j]),Ht=reactExports.useCallback((pr={},kr=null)=>({...pr,ref:kr,"data-active":dataAttr(vt),"data-hover":dataAttr(ct),"data-checked":dataAttr(tr),"data-focus":dataAttr(yt),"data-focus-visible":dataAttr(yt&&Ft),"data-indeterminate":dataAttr(bt),"data-disabled":dataAttr($),"data-invalid":dataAttr(tt),"data-readonly":dataAttr(j)}),[vt,tr,$,yt,Ft,ct,bt,tt,j]),qt=reactExports.useCallback((pr={},kr=null)=>({...Ut,...pr,ref:mergeRefs(kr,Ir=>{Ir&&xt(Ir.tagName==="LABEL")}),onClick:callAllHandlers$1(pr.onClick,()=>{var Ir;$t||((Ir=Rt.current)==null||Ir.click(),requestAnimationFrame(()=>{var lr;(lr=Rt.current)==null||lr.focus({preventScroll:!0})}))}),"data-disabled":dataAttr($),"data-checked":dataAttr(tr),"data-invalid":dataAttr(tt)}),[Ut,$,tr,tt,$t]),Qt=reactExports.useCallback((pr={},kr=null)=>({...pr,ref:mergeRefs(Rt,kr),type:"checkbox",name:Et,value:Ct,id:rt,tabIndex:Pt,onChange:callAllHandlers$1(pr.onChange,nr),onBlur:callAllHandlers$1(pr.onBlur,Mt,()=>mt(!1)),onFocus:callAllHandlers$1(pr.onFocus,Dt,()=>mt(!0)),onKeyDown:callAllHandlers$1(pr.onKeyDown,Wt),onKeyUp:callAllHandlers$1(pr.onKeyUp,Kt),required:et,checked:tr,disabled:ir,readOnly:j,"aria-label":Tt,"aria-labelledby":It,"aria-invalid":Lt?!!Lt:tt,"aria-describedby":ot,"aria-disabled":$,style:visuallyHiddenStyle$1}),[Et,Ct,rt,nr,Mt,Dt,Wt,Kt,et,tr,ir,j,Tt,It,Lt,tt,ot,$,Pt]),dr=reactExports.useCallback((pr={},kr=null)=>({...pr,ref:kr,onMouseDown:callAllHandlers$1(pr.onMouseDown,stopEvent$1),"data-disabled":dataAttr($),"data-checked":dataAttr(tr),"data-invalid":dataAttr(tt)}),[tr,$,tt]);return{state:{isInvalid:tt,isFocused:yt,isChecked:tr,isActive:vt,isHovered:ct,isIndeterminate:bt,isDisabled:$,isReadOnly:j,isRequired:et},getRootProps:qt,getCheckboxProps:Jt,getIndicatorProps:Ht,getInputProps:Qt,getLabelProps:dr,htmlProps:Ut}}function stopEvent$1(_){_.preventDefault(),_.stopPropagation()}var controlStyles={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},rootStyles={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},checkAnim=keyframes$1({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),indeterminateOpacityAnim=keyframes$1({from:{opacity:0},to:{opacity:1}}),indeterminateScaleAnim=keyframes$1({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Checkbox=forwardRef(function(a,$){const j=useCheckboxGroupContext(),et={...j,...a},tt=useMultiStyleConfig("Checkbox",et),rt=omitThemingProps(a),{spacing:nt="0.5rem",className:it,children:ot,iconColor:st,iconSize:at,icon:ut=jsxRuntimeExports.jsx(CheckboxIcon,{}),isChecked:ht,isDisabled:bt=j==null?void 0:j.isDisabled,onChange:Et,inputProps:Ct,...Pt}=rt;let Tt=ht;j!=null&&j.value&&rt.value&&(Tt=j.value.includes(rt.value));let It=Et;j!=null&&j.onChange&&rt.value&&(It=callAll(j.onChange,Et));const{state:Lt,getInputProps:Nt,getCheckboxProps:Ut,getLabelProps:jt,getRootProps:Mt}=useCheckbox({...Pt,isDisabled:bt,isChecked:Tt,onChange:It}),Dt=useInitialAnimationState(Lt.isChecked),Ft=reactExports.useMemo(()=>({animation:Dt?Lt.isIndeterminate?`${indeterminateOpacityAnim} 20ms linear, ${indeterminateScaleAnim} 200ms linear`:`${checkAnim} 200ms linear`:void 0,fontSize:at,color:st,...tt.icon}),[st,at,Dt,Lt.isIndeterminate,tt.icon]),Bt=reactExports.cloneElement(ut,{__css:Ft,isIndeterminate:Lt.isIndeterminate,isChecked:Lt.isChecked});return jsxRuntimeExports.jsxs(chakra.label,{__css:{...rootStyles,...tt.container},className:cx("chakra-checkbox",it),...Mt(),children:[jsxRuntimeExports.jsx("input",{className:"chakra-checkbox__input",...Nt(Ct,$)}),jsxRuntimeExports.jsx(chakra.span,{__css:{...controlStyles,...tt.control},className:"chakra-checkbox__control",...Ut(),children:Bt}),ot&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-checkbox__label",...jt(),__css:{marginStart:nt,...tt.label},children:ot})]})});Checkbox.displayName="Checkbox";function useEventListener(_,a,$,j){const et=useCallbackRef$2($);return reactExports.useEffect(()=>{const tt=typeof _=="function"?_():_??document;if(!(!$||!tt))return tt.addEventListener(a,et,j),()=>{tt.removeEventListener(a,et,j)}},[a,_,j,et,$]),()=>{const tt=typeof _=="function"?_():_??document;tt==null||tt.removeEventListener(a,et,j)}}function isRefObject$1(_){return"current"in _}var isDom=()=>typeof window<"u";function getPlatform(){var _;const a=navigator.userAgentData;return(_=a==null?void 0:a.platform)!=null?_:navigator.platform}var vn=_=>isDom()&&_.test(navigator.vendor),pt=_=>isDom()&&_.test(getPlatform()),isApple=()=>pt(/mac|iphone|ipad|ipod/i),isSafari=()=>isApple()&&vn(/apple/i);function useFocusOnPointerDown(_){const{ref:a,elements:$,enabled:j}=_,et=()=>{var tt,rt;return(rt=(tt=a.current)==null?void 0:tt.ownerDocument)!=null?rt:document};useEventListener(et,"pointerdown",tt=>{if(!isSafari()||!j)return;const rt=tt.target,it=($??[a]).some(ot=>{const st=isRefObject$1(ot)?ot.current:ot;return(st==null?void 0:st.contains(rt))||st===rt});et().activeElement!==rt&&it&&(tt.preventDefault(),rt.focus())})}function _objectWithoutPropertiesLoose$3(_,a){if(_==null)return{};var $={},j=Object.keys(_),et,tt;for(tt=0;tt=0)&&($[et]=_[et]);return $}function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(_){for(var a=1;a0&&tt[tt.length-1])&&(ot[0]===6||ot[0]===2)){$=0;continue}if(ot[0]===3&&(!tt||ot[1]>tt[0]&&ot[1]=_.length&&(_=void 0),{value:_&&_[j++],done:!_}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(_,a){var $=typeof Symbol=="function"&&_[Symbol.iterator];if(!$)return _;var j=$.call(_),et,tt=[],rt;try{for(;(a===void 0||a-- >0)&&!(et=j.next()).done;)tt.push(et.value)}catch(nt){rt={error:nt}}finally{try{et&&!et.done&&($=j.return)&&$.call(j)}finally{if(rt)throw rt.error}}return tt}function __spreadArray(_,a,$){if($||arguments.length===2)for(var j=0,et=a.length,tt;j1||nt(ut,ht)})})}function nt(ut,ht){try{it(j[ut](ht))}catch(bt){at(tt[0][3],bt)}}function it(ut){ut.value instanceof __await?Promise.resolve(ut.value.v).then(ot,st):at(tt[0][2],ut)}function ot(ut){nt("next",ut)}function st(ut){nt("throw",ut)}function at(ut,ht){ut(ht),tt.shift(),tt.length&&nt(tt[0][0],tt[0][1])}}function __asyncValues(_){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=_[Symbol.asyncIterator],$;return a?a.call(_):(_=typeof __values=="function"?__values(_):_[Symbol.iterator](),$={},j("next"),j("throw"),j("return"),$[Symbol.asyncIterator]=function(){return this},$);function j(tt){$[tt]=_[tt]&&function(rt){return new Promise(function(nt,it){rt=_[tt](rt),et(nt,it,rt.done,rt.value)})}}function et(tt,rt,nt,it){Promise.resolve(it).then(function(ot){tt({value:ot,done:nt})},rt)}}typeof SuppressedError=="function"&&SuppressedError;function ItoI(_){return _}function innerCreateMedium(_,a){a===void 0&&(a=ItoI);var $=[],j=!1,et={read:function(){if(j)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return $.length?$[$.length-1]:_},useMedium:function(tt){var rt=a(tt,j);return $.push(rt),function(){$=$.filter(function(nt){return nt!==rt})}},assignSyncMedium:function(tt){for(j=!0;$.length;){var rt=$;$=[],rt.forEach(tt)}$={push:function(nt){return tt(nt)},filter:function(){return $}}},assignMedium:function(tt){j=!0;var rt=[];if($.length){var nt=$;$=[],nt.forEach(tt),rt=$}var it=function(){var st=rt;rt=[],st.forEach(tt)},ot=function(){return Promise.resolve().then(it)};ot(),$={push:function(st){rt.push(st),ot()},filter:function(st){return rt=rt.filter(st),$}}}};return et}function createMedium(_,a){return a===void 0&&(a=ItoI),innerCreateMedium(_,a)}function createSidecarMedium(_){_===void 0&&(_={});var a=innerCreateMedium(null);return a.options=__assign({async:!0,ssr:!1},_),a}var SideCar$2=function(_){var a=_.sideCar,$=__rest$3(_,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var j=a.read();if(!j)throw new Error("Sidecar medium not found");return reactExports.createElement(j,__assign({},$))};SideCar$2.isSideCarExport=!0;function exportSidecar(_,a){return _.useMedium(a),SideCar$2}var mediumFocus=createMedium({},function(_){var a=_.target,$=_.currentTarget;return{target:a,currentTarget:$}}),mediumBlur=createMedium(),mediumEffect=createMedium(),mediumSidecar=createSidecarMedium({async:!0}),emptyArray=[],FocusLock$1=reactExports.forwardRef(function(a,$){var j,et=reactExports.useState(),tt=et[0],rt=et[1],nt=reactExports.useRef(),it=reactExports.useRef(!1),ot=reactExports.useRef(null),st=a.children,at=a.disabled,ut=a.noFocusGuards,ht=a.persistentFocus,bt=a.crossFrame,Et=a.autoFocus;a.allowTextSelection;var Ct=a.group,Pt=a.className,Tt=a.whiteList,It=a.hasPositiveIndices,Lt=a.shards,Nt=Lt===void 0?emptyArray:Lt,Ut=a.as,jt=Ut===void 0?"div":Ut,Mt=a.lockProps,Dt=Mt===void 0?{}:Mt,Ft=a.sideCar,Bt=a.returnFocus,yt=a.focusOptions,mt=a.onActivation,ct=a.onDeactivation,dt=reactExports.useState({}),vt=dt[0],St=reactExports.useCallback(function(){ot.current=ot.current||document&&document.activeElement,nt.current&&mt&&mt(nt.current),it.current=!0},[mt]),Rt=reactExports.useCallback(function(){it.current=!1,ct&&ct(nt.current)},[ct]);reactExports.useEffect(function(){at||(ot.current=null)},[]);var $t=reactExports.useCallback(function(Wt){var Kt=ot.current;if(Kt&&Kt.focus){var Jt=typeof Bt=="function"?Bt(Kt):Bt;if(Jt){var Ht=typeof Jt=="object"?Jt:void 0;ot.current=null,Wt?Promise.resolve().then(function(){return Kt.focus(Ht)}):Kt.focus(Ht)}}},[Bt]),xt=reactExports.useCallback(function(Wt){it.current&&mediumFocus.useMedium(Wt)},[]),At=mediumBlur.useMedium,wt=reactExports.useCallback(function(Wt){nt.current!==Wt&&(nt.current=Wt,rt(Wt))},[]),Ot=_extends$5((j={},j[FOCUS_DISABLED]=at&&"disabled",j[FOCUS_GROUP]=Ct,j),Dt),tr=ut!==!0,nr=tr&&ut!=="tail",ir=useMergeRefs([$,wt]);return reactExports.createElement(reactExports.Fragment,null,tr&&[reactExports.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:at?-1:0,style:hiddenGuard}),It?reactExports.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:at?-1:1,style:hiddenGuard}):null],!at&&reactExports.createElement(Ft,{id:vt,sideCar:mediumSidecar,observed:tt,disabled:at,persistentFocus:ht,crossFrame:bt,autoFocus:Et,whiteList:Tt,shards:Nt,onActivation:St,onDeactivation:Rt,returnFocus:$t,focusOptions:yt}),reactExports.createElement(jt,_extends$5({ref:ir},Ot,{className:Pt,onBlur:At,onFocus:xt}),st),nr&&reactExports.createElement("div",{"data-focus-guard":!0,tabIndex:at?-1:0,style:hiddenGuard}))});FocusLock$1.propTypes={};FocusLock$1.defaultProps={children:void 0,disabled:!1,returnFocus:!1,focusOptions:void 0,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,hasPositiveIndices:void 0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};function _setPrototypeOf$2(_,a){return _setPrototypeOf$2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,et){return j.__proto__=et,j},_setPrototypeOf$2(_,a)}function _inheritsLoose$1(_,a){_.prototype=Object.create(a.prototype),_.prototype.constructor=_,_setPrototypeOf$2(_,a)}function _typeof$6(_){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof$6(_)}function _toPrimitive(_,a){if(_typeof$6(_)!=="object"||_===null)return _;var $=_[Symbol.toPrimitive];if($!==void 0){var j=$.call(_,a||"default");if(_typeof$6(j)!=="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(_)}function _toPropertyKey(_){var a=_toPrimitive(_,"string");return _typeof$6(a)==="symbol"?a:String(a)}function _defineProperty$8(_,a,$){return a=_toPropertyKey(a),a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}function withSideEffect(_,a){function $(j){return j.displayName||j.name||"Component"}return function(et){var tt=[],rt;function nt(){rt=_(tt.map(function(ot){return ot.props})),a(rt)}var it=function(ot){_inheritsLoose$1(st,ot);function st(){return ot.apply(this,arguments)||this}st.peek=function(){return rt};var at=st.prototype;return at.componentDidMount=function(){tt.push(this),nt()},at.componentDidUpdate=function(){nt()},at.componentWillUnmount=function(){var ht=tt.indexOf(this);tt.splice(ht,1),nt()},at.render=function(){return React$2.createElement(et,this.props)},st}(reactExports.PureComponent);return _defineProperty$8(it,"displayName","SideEffect("+$(et)+")"),it}}var toArray$4=function(_){for(var a=Array(_.length),$=0;$<_.length;++$)a[$]=_[$];return a},asArray=function(_){return Array.isArray(_)?_:[_]},getFirst=function(_){return Array.isArray(_)?_[0]:_},isElementHidden=function(_){if(_.nodeType!==Node.ELEMENT_NODE)return!1;var a=window.getComputedStyle(_,null);return!a||!a.getPropertyValue?!1:a.getPropertyValue("display")==="none"||a.getPropertyValue("visibility")==="hidden"},getParentNode$1=function(_){return _.parentNode&&_.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.parentNode.host:_.parentNode},isTopNode=function(_){return _===document||_&&_.nodeType===Node.DOCUMENT_NODE},isVisibleUncached=function(_,a){return!_||isTopNode(_)||!isElementHidden(_)&&a(getParentNode$1(_))},isVisibleCached=function(_,a){var $=_.get(a);if($!==void 0)return $;var j=isVisibleUncached(a,isVisibleCached.bind(void 0,_));return _.set(a,j),j},isAutoFocusAllowedUncached=function(_,a){return _&&!isTopNode(_)?isAutoFocusAllowed(_)?a(getParentNode$1(_)):!1:!0},isAutoFocusAllowedCached=function(_,a){var $=_.get(a);if($!==void 0)return $;var j=isAutoFocusAllowedUncached(a,isAutoFocusAllowedCached.bind(void 0,_));return _.set(a,j),j},getDataset=function(_){return _.dataset},isHTMLButtonElement=function(_){return _.tagName==="BUTTON"},isHTMLInputElement=function(_){return _.tagName==="INPUT"},isRadioElement=function(_){return isHTMLInputElement(_)&&_.type==="radio"},notHiddenInput=function(_){return!((isHTMLInputElement(_)||isHTMLButtonElement(_))&&(_.type==="hidden"||_.disabled))},isAutoFocusAllowed=function(_){var a=_.getAttribute(FOCUS_NO_AUTOFOCUS);return![!0,"true",""].includes(a)},isGuard=function(_){var a;return!!(_&&(!((a=getDataset(_))===null||a===void 0)&&a.focusGuard))},isNotAGuard=function(_){return!isGuard(_)},isDefined=function(_){return!!_},tabSort=function(_,a){var $=_.tabIndex-a.tabIndex,j=_.index-a.index;if($){if(!_.tabIndex)return 1;if(!a.tabIndex)return-1}return $||j},orderByTabIndex=function(_,a,$){return toArray$4(_).map(function(j,et){return{node:j,index:et,tabIndex:$&&j.tabIndex===-1?(j.dataset||{}).focusGuard?0:-1:j.tabIndex}}).filter(function(j){return!a||j.tabIndex>=0}).sort(tabSort)},tabbables=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],queryTabbables=tabbables.join(","),queryGuardTabbables="".concat(queryTabbables,", [data-focus-guard]"),getFocusablesWithShadowDom=function(_,a){return toArray$4((_.shadowRoot||_).children).reduce(function($,j){return $.concat(j.matches(a?queryGuardTabbables:queryTabbables)?[j]:[],getFocusablesWithShadowDom(j))},[])},getFocusablesWithIFrame=function(_,a){var $;return _ instanceof HTMLIFrameElement&&(!(($=_.contentDocument)===null||$===void 0)&&$.body)?getFocusables([_.contentDocument.body],a):[_]},getFocusables=function(_,a){return _.reduce(function($,j){var et,tt=getFocusablesWithShadowDom(j,a),rt=(et=[]).concat.apply(et,tt.map(function(nt){return getFocusablesWithIFrame(nt,a)}));return $.concat(rt,j.parentNode?toArray$4(j.parentNode.querySelectorAll(queryTabbables)).filter(function(nt){return nt===j}):[])},[])},getParentAutofocusables=function(_){var a=_.querySelectorAll("[".concat(FOCUS_AUTO,"]"));return toArray$4(a).map(function($){return getFocusables([$])}).reduce(function($,j){return $.concat(j)},[])},filterFocusable=function(_,a){return toArray$4(_).filter(function($){return isVisibleCached(a,$)}).filter(function($){return notHiddenInput($)})},filterAutoFocusable=function(_,a){return a===void 0&&(a=new Map),toArray$4(_).filter(function($){return isAutoFocusAllowedCached(a,$)})},getTabbableNodes=function(_,a,$){return orderByTabIndex(filterFocusable(getFocusables(_,$),a),!0,$)},getFocusableNodes=function(_,a){return orderByTabIndex(filterFocusable(getFocusables(_),a),!1)},parentAutofocusables=function(_,a){return filterFocusable(getParentAutofocusables(_),a)},contains$2=function(_,a){return _.shadowRoot?contains$2(_.shadowRoot,a):Object.getPrototypeOf(_).contains!==void 0&&Object.getPrototypeOf(_).contains.call(_,a)?!0:toArray$4(_.children).some(function($){var j;if($ instanceof HTMLIFrameElement){var et=(j=$.contentDocument)===null||j===void 0?void 0:j.body;return et?contains$2(et,a):!1}return contains$2($,a)})},filterNested=function(_){for(var a=new Set,$=_.length,j=0;j<$;j+=1)for(var et=j+1;et<$;et+=1){var tt=_[j].compareDocumentPosition(_[et]);(tt&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&a.add(et),(tt&Node.DOCUMENT_POSITION_CONTAINS)>0&&a.add(j)}return _.filter(function(rt,nt){return!a.has(nt)})},getTopParent=function(_){return _.parentNode?getTopParent(_.parentNode):_},getAllAffectedNodes=function(_){var a=asArray(_);return a.filter(Boolean).reduce(function($,j){var et=j.getAttribute(FOCUS_GROUP);return $.push.apply($,et?filterNested(toArray$4(getTopParent(j).querySelectorAll("[".concat(FOCUS_GROUP,'="').concat(et,'"]:not([').concat(FOCUS_DISABLED,'="disabled"])')))):[j]),$},[])},safeProbe=function(_){try{return _()}catch{return}},getActiveElement$1=function(_){if(_===void 0&&(_=document),!(!_||!_.activeElement)){var a=_.activeElement;return a.shadowRoot?getActiveElement$1(a.shadowRoot):a instanceof HTMLIFrameElement&&safeProbe(function(){return a.contentWindow.document})?getActiveElement$1(a.contentWindow.document):a}},focusInFrame=function(_,a){return _===a},focusInsideIframe=function(_,a){return!!toArray$4(_.querySelectorAll("iframe")).some(function($){return focusInFrame($,a)})},focusInside=function(_,a){return a===void 0&&(a=getActiveElement$1(getFirst(_).ownerDocument)),!a||a.dataset&&a.dataset.focusGuard?!1:getAllAffectedNodes(_).some(function($){return contains$2($,a)||focusInsideIframe($,a)})},focusIsHidden=function(_){_===void 0&&(_=document);var a=getActiveElement$1(_);return a?toArray$4(_.querySelectorAll("[".concat(FOCUS_ALLOW,"]"))).some(function($){return contains$2($,a)}):!1},findSelectedRadio=function(_,a){return a.filter(isRadioElement).filter(function($){return $.name===_.name}).filter(function($){return $.checked})[0]||_},correctNode=function(_,a){return isRadioElement(_)&&_.name?findSelectedRadio(_,a):_},correctNodes=function(_){var a=new Set;return _.forEach(function($){return a.add(correctNode($,_))}),_.filter(function($){return a.has($)})},pickFirstFocus=function(_){return _[0]&&_.length>1?correctNode(_[0],_):_[0]},pickFocusable=function(_,a){return _.length>1?_.indexOf(correctNode(_[a],_)):a},NEW_FOCUS="NEW_FOCUS",newFocus=function(_,a,$,j){var et=_.length,tt=_[0],rt=_[et-1],nt=isGuard($);if(!($&&_.indexOf($)>=0)){var it=$!==void 0?a.indexOf($):-1,ot=j?a.indexOf(j):it,st=j?_.indexOf(j):-1,at=it-ot,ut=a.indexOf(tt),ht=a.indexOf(rt),bt=correctNodes(a),Et=$!==void 0?bt.indexOf($):-1,Ct=Et-(j?bt.indexOf(j):it),Pt=pickFocusable(_,0),Tt=pickFocusable(_,et-1);if(it===-1||st===-1)return NEW_FOCUS;if(!at&&st>=0)return st;if(it<=ut&&nt&&Math.abs(at)>1)return Tt;if(it>=ht&&nt&&Math.abs(at)>1)return Pt;if(at&&Math.abs(Ct)>1)return st;if(it<=ut)return Tt;if(it>ht)return Pt;if(at)return Math.abs(at)>1?st:(et+st+at)%et}},findAutoFocused=function(_){return function(a){var $,j=($=getDataset(a))===null||$===void 0?void 0:$.autofocus;return a.autofocus||j!==void 0&&j!=="false"||_.indexOf(a)>=0}},pickAutofocus=function(_,a,$){var j=_.map(function(tt){var rt=tt.node;return rt}),et=filterAutoFocusable(j.filter(findAutoFocused($)));return et&&et.length?pickFirstFocus(et):pickFirstFocus(filterAutoFocusable(a))},getParents=function(_,a){return a===void 0&&(a=[]),a.push(_),_.parentNode&&getParents(_.parentNode.host||_.parentNode,a),a},getCommonParent=function(_,a){for(var $=getParents(_),j=getParents(a),et=0;et<$.length;et+=1){var tt=$[et];if(j.indexOf(tt)>=0)return tt}return!1},getTopCommonParent=function(_,a,$){var j=asArray(_),et=asArray(a),tt=j[0],rt=!1;return et.filter(Boolean).forEach(function(nt){rt=getCommonParent(rt||nt,nt)||rt,$.filter(Boolean).forEach(function(it){var ot=getCommonParent(tt,it);ot&&(!rt||contains$2(ot,rt)?rt=ot:rt=getCommonParent(ot,rt))})}),rt},allParentAutofocusables=function(_,a){return _.reduce(function($,j){return $.concat(parentAutofocusables(j,a))},[])},reorderNodes=function(_,a){var $=new Map;return a.forEach(function(j){return $.set(j.node,j)}),_.map(function(j){return $.get(j)}).filter(isDefined)},focusSolver=function(_,a){var $=getActiveElement$1(asArray(_).length>0?document:getFirst(_).ownerDocument),j=getAllAffectedNodes(_).filter(isNotAGuard),et=getTopCommonParent($||_,_,j),tt=new Map,rt=getFocusableNodes(j,tt),nt=getTabbableNodes(j,tt).filter(function(ht){var bt=ht.node;return isNotAGuard(bt)});if(!(!nt[0]&&(nt=rt,!nt[0]))){var it=getFocusableNodes([et],tt).map(function(ht){var bt=ht.node;return bt}),ot=reorderNodes(it,nt),st=ot.map(function(ht){var bt=ht.node;return bt}),at=newFocus(st,it,$,a);if(at===NEW_FOCUS){var ut=pickAutofocus(rt,st,allParentAutofocusables(j,tt));if(ut)return{node:ut};console.warn("focus-lock: cannot find any node to move focus into");return}return at===void 0?at:ot[at]}},expandFocusableNodes=function(_){var a=getAllAffectedNodes(_).filter(isNotAGuard),$=getTopCommonParent(_,_,a),j=new Map,et=getTabbableNodes([$],j,!0),tt=getTabbableNodes(a,j).filter(function(rt){var nt=rt.node;return isNotAGuard(nt)}).map(function(rt){var nt=rt.node;return nt});return et.map(function(rt){var nt=rt.node,it=rt.index;return{node:nt,index:it,lockItem:tt.indexOf(nt)>=0,guard:isGuard(nt)}})},focusOn=function(_,a){"focus"in _&&_.focus(a),"contentWindow"in _&&_.contentWindow&&_.contentWindow.focus()},guardCount=0,lockDisabled=!1,moveFocusInside=function(_,a,$){$===void 0&&($={});var j=focusSolver(_,a);if(!lockDisabled&&j){if(guardCount>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),lockDisabled=!0,setTimeout(function(){lockDisabled=!1},1);return}guardCount++,focusOn(j.node,$.focusOptions),guardCount--}};function deferAction(_){setTimeout(_,1)}var focusOnBody=function(){return document&&document.activeElement===document.body},isFreeFocus=function(){return focusOnBody()||focusIsHidden()},lastActiveTrap=null,lastActiveFocus=null,lastPortaledElement=null,focusWasOutsideWindow=!1,defaultWhitelist=function(){return!0},focusWhitelisted=function(a){return(lastActiveTrap.whiteList||defaultWhitelist)(a)},recordPortal=function(a,$){lastPortaledElement={observerNode:a,portaledElement:$}},focusIsPortaledPair=function(a){return lastPortaledElement&&lastPortaledElement.portaledElement===a};function autoGuard(_,a,$,j){var et=null,tt=_;do{var rt=j[tt];if(rt.guard)rt.node.dataset.focusAutoGuard&&(et=rt);else if(rt.lockItem){if(tt!==_)return;et=null}else break}while((tt+=$)!==a);et&&(et.node.tabIndex=0)}var extractRef$2=function(a){return a&&"current"in a?a.current:a},focusWasOutside=function(a){return a?!!focusWasOutsideWindow:focusWasOutsideWindow==="meanwhile"},checkInHost=function _(a,$,j){return $&&($.host===a&&(!$.activeElement||j.contains($.activeElement))||$.parentNode&&_(a,$.parentNode,j))},withinHost=function(a,$){return $.some(function(j){return checkInHost(a,j,j)})},activateTrap=function(){var a=!1;if(lastActiveTrap){var $=lastActiveTrap,j=$.observed,et=$.persistentFocus,tt=$.autoFocus,rt=$.shards,nt=$.crossFrame,it=$.focusOptions,ot=j||lastPortaledElement&&lastPortaledElement.portaledElement,st=document&&document.activeElement;if(ot){var at=[ot].concat(rt.map(extractRef$2).filter(Boolean));if((!st||focusWhitelisted(st))&&(et||focusWasOutside(nt)||!isFreeFocus()||!lastActiveFocus&&tt)&&(ot&&!(focusInside(at)||st&&withinHost(st,at)||focusIsPortaledPair(st))&&(document&&!lastActiveFocus&&st&&!tt?(st.blur&&st.blur(),document.body.focus()):(a=moveFocusInside(at,lastActiveFocus,{focusOptions:it}),lastPortaledElement={})),focusWasOutsideWindow=!1,lastActiveFocus=document&&document.activeElement),document){var ut=document&&document.activeElement,ht=expandFocusableNodes(at),bt=ht.map(function(Et){var Ct=Et.node;return Ct}).indexOf(ut);bt>-1&&(ht.filter(function(Et){var Ct=Et.guard,Pt=Et.node;return Ct&&Pt.dataset.focusAutoGuard}).forEach(function(Et){var Ct=Et.node;return Ct.removeAttribute("tabIndex")}),autoGuard(bt,ht.length,1,ht),autoGuard(bt,-1,-1,ht))}}}return a},onTrap=function(a){activateTrap()&&a&&(a.stopPropagation(),a.preventDefault())},onBlur=function(){return deferAction(activateTrap)},onFocus=function(a){var $=a.target,j=a.currentTarget;j.contains($)||recordPortal(j,$)},FocusWatcher=function(){return null},onWindowBlur=function(){focusWasOutsideWindow="just",deferAction(function(){focusWasOutsideWindow="meanwhile"})},attachHandler=function(){document.addEventListener("focusin",onTrap),document.addEventListener("focusout",onBlur),window.addEventListener("blur",onWindowBlur)},detachHandler=function(){document.removeEventListener("focusin",onTrap),document.removeEventListener("focusout",onBlur),window.removeEventListener("blur",onWindowBlur)};function reducePropsToState(_){return _.filter(function(a){var $=a.disabled;return!$})}function handleStateChangeOnClient(_){var a=_.slice(-1)[0];a&&!lastActiveTrap&&attachHandler();var $=lastActiveTrap,j=$&&a&&a.id===$.id;lastActiveTrap=a,$&&!j&&($.onDeactivation(),_.filter(function(et){var tt=et.id;return tt===$.id}).length||$.returnFocus(!a)),a?(lastActiveFocus=null,(!j||$.observed!==a.observed)&&a.onActivation(),activateTrap(),deferAction(activateTrap)):(detachHandler(),lastActiveFocus=null)}mediumFocus.assignSyncMedium(onFocus);mediumBlur.assignMedium(onBlur);mediumEffect.assignMedium(function(_){return _({moveFocusInside,focusInside})});const FocusTrap$1=withSideEffect(reducePropsToState,handleStateChangeOnClient)(FocusWatcher);var FocusLockCombination=reactExports.forwardRef(function(a,$){return reactExports.createElement(FocusLock$1,_extends$5({sideCar:FocusTrap$1,ref:$},a))}),_ref=FocusLock$1.propTypes||{};_ref.sideCar;_objectWithoutPropertiesLoose$3(_ref,["sideCar"]);FocusLockCombination.propTypes={};function isElement$2(_){return _!=null&&typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE}function isHTMLElement$3(_){var a;if(!isElement$2(_))return!1;const $=(a=_.ownerDocument.defaultView)!=null?a:window;return _ instanceof $.HTMLElement}function getOwnerWindow(_){var a,$;return($=(a=getOwnerDocument$2(_))==null?void 0:a.defaultView)!=null?$:window}function getOwnerDocument$2(_){return isElement$2(_)?_.ownerDocument:document}function getActiveElement(_){return getOwnerDocument$2(_).activeElement}function isScrollParent$1(_){const a=_.ownerDocument.defaultView||window,{overflow:$,overflowX:j,overflowY:et}=a.getComputedStyle(_);return/auto|scroll|overlay|hidden/.test($+et+j)}function getParent(_){return _.localName==="html"?_:_.assignedSlot||_.parentElement||_.ownerDocument.documentElement}function getScrollParent$1(_){return["html","body","#document"].includes(_.localName)?_.ownerDocument.body:isHTMLElement$3(_)&&isScrollParent$1(_)?_:getScrollParent$1(getParent(_))}var hasTabIndex=_=>_.hasAttribute("tabindex"),hasNegativeTabIndex=_=>hasTabIndex(_)&&_.tabIndex===-1;function isDisabled(_){return!!_.getAttribute("disabled")||!!_.getAttribute("aria-disabled")}function isHidden(_){return _.parentElement&&isHidden(_.parentElement)?!0:_.hidden}function isContentEditable(_){const a=_.getAttribute("contenteditable");return a!=="false"&&a!=null}function isFocusable(_){if(!isHTMLElement$3(_)||isHidden(_)||isDisabled(_))return!1;const{localName:a}=_;if(["input","select","textarea","button"].indexOf(a)>=0)return!0;const j={a:()=>_.hasAttribute("href"),audio:()=>_.hasAttribute("controls"),video:()=>_.hasAttribute("controls")};return a in j?j[a]():isContentEditable(_)?!0:hasTabIndex(_)}function isTabbable(_){return _?isHTMLElement$3(_)&&isFocusable(_)&&!hasNegativeTabIndex(_):!1}var focusableElList=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],focusableElSelector=focusableElList.join(),isVisible=_=>_.offsetWidth>0&&_.offsetHeight>0;function getAllFocusable(_){const a=Array.from(_.querySelectorAll(focusableElSelector));return a.unshift(_),a.filter($=>isFocusable($)&&isVisible($))}var _a$3,FocusTrap=(_a$3=FocusLockCombination.default)!=null?_a$3:FocusLockCombination,FocusLock=_=>{const{initialFocusRef:a,finalFocusRef:$,contentRef:j,restoreFocus:et,children:tt,isDisabled:rt,autoFocus:nt,persistentFocus:it,lockFocusAcrossFrames:ot}=_,st=reactExports.useCallback(()=>{a!=null&&a.current?a.current.focus():j!=null&&j.current&&getAllFocusable(j.current).length===0&&requestAnimationFrame(()=>{var bt;(bt=j.current)==null||bt.focus()})},[a,j]),at=reactExports.useCallback(()=>{var ht;(ht=$==null?void 0:$.current)==null||ht.focus()},[$]),ut=et&&!$;return jsxRuntimeExports.jsx(FocusTrap,{crossFrame:ot,persistentFocus:it,autoFocus:nt,disabled:rt,onActivation:st,onDeactivation:at,returnFocus:ut,children:tt})};FocusLock.displayName="FocusLock";var useSafeLayoutEffect=isBrowser$2?reactExports.useLayoutEffect:reactExports.useEffect;function useCallbackRef(_,a=[]){const $=reactExports.useRef(_);return useSafeLayoutEffect(()=>{$.current=_}),reactExports.useCallback((...j)=>{var et;return(et=$.current)==null?void 0:et.call($,...j)},a)}function useOutsideClick$1(_){const{ref:a,handler:$,enabled:j=!0}=_,et=useCallbackRef($),rt=reactExports.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;reactExports.useEffect(()=>{if(!j)return;const nt=at=>{isValidEvent$1(at,a)&&(rt.isPointerDown=!0)},it=at=>{if(rt.ignoreEmulatedMouseEvents){rt.ignoreEmulatedMouseEvents=!1;return}rt.isPointerDown&&$&&isValidEvent$1(at,a)&&(rt.isPointerDown=!1,et(at))},ot=at=>{rt.ignoreEmulatedMouseEvents=!0,$&&rt.isPointerDown&&isValidEvent$1(at,a)&&(rt.isPointerDown=!1,et(at))},st=getOwnerDocument$3(a.current);return st.addEventListener("mousedown",nt,!0),st.addEventListener("mouseup",it,!0),st.addEventListener("touchstart",nt,!0),st.addEventListener("touchend",ot,!0),()=>{st.removeEventListener("mousedown",nt,!0),st.removeEventListener("mouseup",it,!0),st.removeEventListener("touchstart",nt,!0),st.removeEventListener("touchend",ot,!0)}},[$,a,et,rt,j])}function isValidEvent$1(_,a){var $;const j=_.target;return j&&!getOwnerDocument$3(j).contains(j)?!1:!(($=a.current)!=null&&$.contains(j))}function useId(_,a){const $=reactExports.useId();return reactExports.useMemo(()=>_||[a,$].filter(Boolean).join("-"),[_,a,$])}function useControllableProp(_,a){const $=_!==void 0;return[$,$&&typeof _<"u"?_:a]}function useDisclosure$1(_={}){const{onClose:a,onOpen:$,isOpen:j,id:et}=_,tt=useCallbackRef($),rt=useCallbackRef(a),[nt,it]=reactExports.useState(_.defaultIsOpen||!1),[ot,st]=useControllableProp(j,nt),at=useId(et,"disclosure"),ut=reactExports.useCallback(()=>{ot||it(!1),rt==null||rt()},[ot,rt]),ht=reactExports.useCallback(()=>{ot||it(!0),tt==null||tt()},[ot,tt]),bt=reactExports.useCallback(()=>{(st?ut:ht)()},[st,ht,ut]);return{isOpen:!!st,onOpen:ht,onClose:ut,onToggle:bt,isControlled:ot,getButtonProps:(Et={})=>({...Et,"aria-expanded":st,"aria-controls":at,onClick:callAllHandlers(Et.onClick,bt)}),getDisclosureProps:(Et={})=>({...Et,hidden:!st,id:at})}}var[InputGroupStylesProvider,useInputGroupStyles]=createContext$1({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),InputGroup=forwardRef(function(a,$){const j=useMultiStyleConfig("Input",a),{children:et,className:tt,...rt}=omitThemingProps(a),nt=cx("chakra-input__group",tt),it={},ot=getValidChildren(et),st=j.field;ot.forEach(ut=>{var ht,bt;j&&(st&&ut.type.id==="InputLeftElement"&&(it.paddingStart=(ht=st.height)!=null?ht:st.h),st&&ut.type.id==="InputRightElement"&&(it.paddingEnd=(bt=st.height)!=null?bt:st.h),ut.type.id==="InputRightAddon"&&(it.borderEndRadius=0),ut.type.id==="InputLeftAddon"&&(it.borderStartRadius=0))});const at=ot.map(ut=>{var ht,bt;const Et=compact$1({size:((ht=ut.props)==null?void 0:ht.size)||a.size,variant:((bt=ut.props)==null?void 0:bt.variant)||a.variant});return ut.type.id!=="Input"?reactExports.cloneElement(ut,Et):reactExports.cloneElement(ut,Object.assign(Et,it,ut.props))});return jsxRuntimeExports.jsx(chakra.div,{className:nt,ref:$,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...j.group},"data-group":!0,...rt,children:jsxRuntimeExports.jsx(InputGroupStylesProvider,{value:j,children:at})})});InputGroup.displayName="InputGroup";var StyledInputElement=chakra("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),InputElement=forwardRef(function(a,$){var j,et;const{placement:tt="left",...rt}=a,nt=useInputGroupStyles(),it=nt.field,st={[tt==="left"?"insetStart":"insetEnd"]:"0",width:(j=it==null?void 0:it.height)!=null?j:it==null?void 0:it.h,height:(et=it==null?void 0:it.height)!=null?et:it==null?void 0:it.h,fontSize:it==null?void 0:it.fontSize,...nt.element};return jsxRuntimeExports.jsx(StyledInputElement,{ref:$,__css:st,...rt})});InputElement.id="InputElement";InputElement.displayName="InputElement";var InputLeftElement=forwardRef(function(a,$){const{className:j,...et}=a,tt=cx("chakra-input__left-element",j);return jsxRuntimeExports.jsx(InputElement,{ref:$,placement:"left",className:tt,...et})});InputLeftElement.id="InputLeftElement";InputLeftElement.displayName="InputLeftElement";var InputRightElement=forwardRef(function(a,$){const{className:j,...et}=a,tt=cx("chakra-input__right-element",j);return jsxRuntimeExports.jsx(InputElement,{ref:$,placement:"right",className:tt,...et})});InputRightElement.id="InputRightElement";InputRightElement.displayName="InputRightElement";var Input=forwardRef(function(a,$){const{htmlSize:j,...et}=a,tt=useMultiStyleConfig("Input",et),rt=omitThemingProps(et),nt=useFormControl(rt),it=cx("chakra-input",a.className);return jsxRuntimeExports.jsx(chakra.input,{size:j,...nt,__css:tt.field,ref:$,className:it})});Input.displayName="Input";Input.id="Input";var Link$1=forwardRef(function(a,$){const j=useStyleConfig("Link",a),{className:et,isExternal:tt,...rt}=omitThemingProps(a);return jsxRuntimeExports.jsx(chakra.a,{target:tt?"_blank":void 0,rel:tt?"noopener":void 0,ref:$,className:cx("chakra-link",et),...rt,__css:j})});Link$1.displayName="Link";var[ListStylesProvider,useListStyles]=createContext$1({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),List=forwardRef(function(a,$){const j=useMultiStyleConfig("List",a),{children:et,styleType:tt="none",stylePosition:rt,spacing:nt,...it}=omitThemingProps(a),ot=getValidChildren(et),at=nt?{["& > *:not(style) ~ *:not(style)"]:{mt:nt}}:{};return jsxRuntimeExports.jsx(ListStylesProvider,{value:j,children:jsxRuntimeExports.jsx(chakra.ul,{ref:$,listStyleType:tt,listStylePosition:rt,role:"list",__css:{...j.container,...at},...it,children:ot})})});List.displayName="List";var OrderedList=forwardRef((_,a)=>{const{as:$,...j}=_;return jsxRuntimeExports.jsx(List,{ref:a,as:"ol",styleType:"decimal",marginStart:"1em",...j})});OrderedList.displayName="OrderedList";var UnorderedList=forwardRef(function(a,$){const{as:j,...et}=a;return jsxRuntimeExports.jsx(List,{ref:$,as:"ul",styleType:"initial",marginStart:"1em",...et})});UnorderedList.displayName="UnorderedList";var ListItem=forwardRef(function(a,$){const j=useListStyles();return jsxRuntimeExports.jsx(chakra.li,{ref:$,...a,__css:j.item})});ListItem.displayName="ListItem";var ListIcon=forwardRef(function(a,$){const j=useListStyles();return jsxRuntimeExports.jsx(Icon,{ref:$,role:"presentation",...a,__css:j.icon})});ListIcon.displayName="ListIcon";var Grid=forwardRef(function(a,$){const{templateAreas:j,gap:et,rowGap:tt,columnGap:rt,column:nt,row:it,autoFlow:ot,autoRows:st,templateRows:at,autoColumns:ut,templateColumns:ht,...bt}=a,Et={display:"grid",gridTemplateAreas:j,gridGap:et,gridRowGap:tt,gridColumnGap:rt,gridAutoColumns:ut,gridColumn:nt,gridRow:it,gridAutoFlow:ot,gridAutoRows:st,gridTemplateRows:at,gridTemplateColumns:ht};return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:Et,...bt})});Grid.displayName="Grid";function mapResponsive(_,a){return Array.isArray(_)?_.map($=>$===null?null:a($)):isObject$5(_)?Object.keys(_).reduce(($,j)=>($[j]=a(_[j]),$),{}):_!=null?a(_):null}var SimpleGrid=forwardRef(function(a,$){const{columns:j,spacingX:et,spacingY:tt,spacing:rt,minChildWidth:nt,...it}=a,ot=useTheme(),st=nt?widthToColumns(nt,ot):countToColumns(j);return jsxRuntimeExports.jsx(Grid,{ref:$,gap:rt,columnGap:et,rowGap:tt,templateColumns:st,...it})});SimpleGrid.displayName="SimpleGrid";function toPx(_){return typeof _=="number"?`${_}px`:_}function widthToColumns(_,a){return mapResponsive(_,$=>{const j=getToken("sizes",$,toPx($))(a);return $===null?null:`repeat(auto-fit, minmax(${j}, 1fr))`})}function countToColumns(_){return mapResponsive(_,a=>a===null?null:`repeat(${a}, minmax(0, 1fr))`)}var Text=forwardRef(function(a,$){const j=useStyleConfig("Text",a),{className:et,align:tt,decoration:rt,casing:nt,...it}=omitThemingProps(a),ot=compact$1({textAlign:a.align,textDecoration:a.decoration,textTransform:a.casing});return jsxRuntimeExports.jsx(chakra.p,{ref:$,className:cx("chakra-text",a.className),...ot,...it,__css:j})});Text.displayName="Text";var Wrap=forwardRef(function(a,$){const{spacing:j="0.5rem",spacingX:et,spacingY:tt,children:rt,justify:nt,direction:it,align:ot,className:st,shouldWrapChildren:at,...ut}=a,ht=reactExports.useMemo(()=>at?reactExports.Children.map(rt,(bt,Et)=>jsxRuntimeExports.jsx(WrapItem,{children:bt},Et)):rt,[rt,at]);return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-wrap",st),...ut,children:jsxRuntimeExports.jsx(chakra.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:nt,alignItems:ot,flexDirection:it,listStyleType:"none",gap:j,columnGap:et,rowGap:tt,padding:"0"},children:ht})})});Wrap.displayName="Wrap";var WrapItem=forwardRef(function(a,$){const{className:j,...et}=a;return jsxRuntimeExports.jsx(chakra.li,{ref:$,__css:{display:"flex",alignItems:"flex-start"},className:cx("chakra-wrap__listitem",j),...et})});WrapItem.displayName="WrapItem";var StackItem=_=>jsxRuntimeExports.jsx(chakra.div,{className:"chakra-stack__item",..._,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,..._.__css}});StackItem.displayName="StackItem";function getDividerStyles(_){const{spacing:a,direction:$}=_,j={column:{my:a,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:a,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:a,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:a,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":mapResponsive($,et=>j[et])}}var Stack=forwardRef((_,a)=>{const{isInline:$,direction:j,align:et,justify:tt,spacing:rt="0.5rem",wrap:nt,children:it,divider:ot,className:st,shouldWrapChildren:at,...ut}=_,ht=$?"row":j??"column",bt=reactExports.useMemo(()=>getDividerStyles({spacing:rt,direction:ht}),[rt,ht]),Et=!!ot,Ct=!at&&!Et,Pt=reactExports.useMemo(()=>{const It=getValidChildren(it);return Ct?It:It.map((Lt,Nt)=>{const Ut=typeof Lt.key<"u"?Lt.key:Nt,jt=Nt+1===It.length,Dt=at?jsxRuntimeExports.jsx(StackItem,{children:Lt},Ut):Lt;if(!Et)return Dt;const Ft=reactExports.cloneElement(ot,{__css:bt}),Bt=jt?null:Ft;return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[Dt,Bt]},Ut)})},[ot,bt,Et,Ct,at,it]),Tt=cx("chakra-stack",st);return jsxRuntimeExports.jsx(chakra.div,{ref:a,display:"flex",alignItems:et,justifyContent:tt,flexDirection:ht,flexWrap:nt,gap:Et?void 0:rt,className:Tt,...ut,children:Pt})});Stack.displayName="Stack";var VStack=forwardRef((_,a)=>jsxRuntimeExports.jsx(Stack,{align:"center",..._,direction:"column",ref:a}));VStack.displayName="VStack";function spanFn(_){return mapResponsive(_,a=>a==="auto"?"auto":`span ${a}/span ${a}`)}var GridItem=forwardRef(function(a,$){const{area:j,colSpan:et,colStart:tt,colEnd:rt,rowEnd:nt,rowSpan:it,rowStart:ot,...st}=a,at=compact$1({gridArea:j,gridColumn:spanFn(et),gridRow:spanFn(it),gridColumnStart:tt,gridColumnEnd:rt,gridRowStart:ot,gridRowEnd:nt});return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:at,...st})});GridItem.displayName="GridItem";var Heading=forwardRef(function(a,$){const j=useStyleConfig("Heading",a),{className:et,...tt}=omitThemingProps(a);return jsxRuntimeExports.jsx(chakra.h2,{ref:$,className:cx("chakra-heading",a.className),...tt,__css:j})});Heading.displayName="Heading";var Box=chakra("div");Box.displayName="Box";var Square=forwardRef(function(a,$){const{size:j,centerContent:et=!0,...tt}=a,rt=et?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return jsxRuntimeExports.jsx(Box,{ref:$,boxSize:j,__css:{...rt,flexShrink:0,flexGrow:0},...tt})});Square.displayName="Square";var Circle=forwardRef(function(a,$){const{size:j,...et}=a;return jsxRuntimeExports.jsx(Square,{size:j,ref:$,borderRadius:"9999px",...et})});Circle.displayName="Circle";var AspectRatio=forwardRef(function(_,a){const{ratio:$=4/3,children:j,className:et,...tt}=_,rt=reactExports.Children.only(j),nt=cx("chakra-aspect-ratio",et);return jsxRuntimeExports.jsx(chakra.div,{ref:a,position:"relative",className:nt,_before:{height:0,content:'""',display:"block",paddingBottom:mapResponsive($,it=>`${1/it*100}%`)},__css:{"& > *:not(style)":{overflow:"hidden",position:"absolute",top:"0",right:"0",bottom:"0",left:"0",display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},"& > img, & > video":{objectFit:"cover"}},...tt,children:rt})});AspectRatio.displayName="AspectRatio";var Center=chakra("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});Center.displayName="Center";var centerStyles={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};forwardRef(function(a,$){const{axis:j="both",...et}=a;return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:centerStyles[j],...et,position:"absolute"})});var Divider=forwardRef(function(a,$){const{borderLeftWidth:j,borderBottomWidth:et,borderTopWidth:tt,borderRightWidth:rt,borderWidth:nt,borderStyle:it,borderColor:ot,...st}=useStyleConfig("Divider",a),{className:at,orientation:ut="horizontal",__css:ht,...bt}=omitThemingProps(a),Et={vertical:{borderLeftWidth:j||rt||nt||"1px",height:"100%"},horizontal:{borderBottomWidth:et||tt||nt||"1px",width:"100%"}};return jsxRuntimeExports.jsx(chakra.hr,{ref:$,"aria-orientation":ut,...bt,__css:{...st,border:"0",borderColor:ot,borderStyle:it,...Et[ut],...ht},className:cx("chakra-divider",at)})});Divider.displayName="Divider";var Flex=forwardRef(function(a,$){const{direction:j,align:et,justify:tt,wrap:rt,basis:nt,grow:it,shrink:ot,...st}=a,at={display:"flex",flexDirection:j,alignItems:et,justifyContent:tt,flexWrap:rt,flexBasis:nt,flexGrow:it,flexShrink:ot};return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:at,...st})});Flex.displayName="Flex";function useMediaQuery(_,a={}){const{ssr:$=!0,fallback:j}=a,{getWindow:et}=useEnvironment(),tt=Array.isArray(_)?_:[_];let rt=Array.isArray(j)?j:[j];rt=rt.filter(ot=>ot!=null);const[nt,it]=reactExports.useState(()=>tt.map((ot,st)=>({media:ot,matches:$?!!rt[st]:et().matchMedia(ot).matches})));return reactExports.useEffect(()=>{const ot=et();it(tt.map(ut=>({media:ut,matches:ot.matchMedia(ut).matches})));const st=tt.map(ut=>ot.matchMedia(ut)),at=ut=>{it(ht=>ht.slice().map(bt=>bt.media===ut.media?{...bt,matches:ut.matches}:bt))};return st.forEach(ut=>{typeof ut.addListener=="function"?ut.addListener(at):ut.addEventListener("change",at)}),()=>{st.forEach(ut=>{typeof ut.removeListener=="function"?ut.removeListener(at):ut.removeEventListener("change",at)})}},[et]),nt.map(ot=>ot.matches)}function isPrintableCharacter(_){const{key:a}=_;return a.length===1||a.length>1&&/[^a-zA-Z0-9]/.test(a)}function useShortcut(_={}){const{timeout:a=300,preventDefault:$=()=>!0}=_,[j,et]=reactExports.useState([]),tt=reactExports.useRef(),rt=()=>{tt.current&&(clearTimeout(tt.current),tt.current=null)},nt=()=>{rt(),tt.current=setTimeout(()=>{et([]),tt.current=null},a)};reactExports.useEffect(()=>rt,[]);function it(ot){return st=>{if(st.key==="Backspace"){const at=[...j];at.pop(),et(at);return}if(isPrintableCharacter(st)){const at=j.concat(st.key);$(st)&&(st.preventDefault(),st.stopPropagation()),et(at),ot(at.join("")),nt()}}}return it}function getNextItemFromSearch(_,a,$,j){if(a==null)return j;if(!j)return _.find(rt=>$(rt).toLowerCase().startsWith(a.toLowerCase()));const et=_.filter(tt=>$(tt).toLowerCase().startsWith(a.toLowerCase()));if(et.length>0){let tt;return et.includes(j)?(tt=et.indexOf(j)+1,tt===et.length&&(tt=0),et[tt]):(tt=_.indexOf(et[0]),_[tt])}return j}function useEventListeners(){const _=reactExports.useRef(new Map),a=_.current,$=reactExports.useCallback((et,tt,rt,nt)=>{_.current.set(rt,{type:tt,el:et,options:nt}),et.addEventListener(tt,rt,nt)},[]),j=reactExports.useCallback((et,tt,rt,nt)=>{et.removeEventListener(tt,rt,nt),_.current.delete(rt)},[]);return reactExports.useEffect(()=>()=>{a.forEach((et,tt)=>{j(et.el,et.type,tt,et.options)})},[j,a]),{add:$,remove:j}}function isValidElement(_){const a=_.target,{tagName:$,isContentEditable:j}=a;return $!=="INPUT"&&$!=="TEXTAREA"&&j!==!0}function useClickable(_={}){const{ref:a,isDisabled:$,isFocusable:j,clickOnEnter:et=!0,clickOnSpace:tt=!0,onMouseDown:rt,onMouseUp:nt,onClick:it,onKeyDown:ot,onKeyUp:st,tabIndex:at,onMouseOver:ut,onMouseLeave:ht,...bt}=_,[Et,Ct]=reactExports.useState(!0),[Pt,Tt]=reactExports.useState(!1),It=useEventListeners(),Lt=St=>{St&&St.tagName!=="BUTTON"&&Ct(!1)},Nt=Et?at:at||0,Ut=$&&!j,jt=reactExports.useCallback(St=>{if($){St.stopPropagation(),St.preventDefault();return}St.currentTarget.focus(),it==null||it(St)},[$,it]),Mt=reactExports.useCallback(St=>{Pt&&isValidElement(St)&&(St.preventDefault(),St.stopPropagation(),Tt(!1),It.remove(document,"keyup",Mt,!1))},[Pt,It]),Dt=reactExports.useCallback(St=>{if(ot==null||ot(St),$||St.defaultPrevented||St.metaKey||!isValidElement(St.nativeEvent)||Et)return;const Rt=et&&St.key==="Enter";tt&&St.key===" "&&(St.preventDefault(),Tt(!0)),Rt&&(St.preventDefault(),St.currentTarget.click()),It.add(document,"keyup",Mt,!1)},[$,Et,ot,et,tt,It,Mt]),Ft=reactExports.useCallback(St=>{if(st==null||st(St),$||St.defaultPrevented||St.metaKey||!isValidElement(St.nativeEvent)||Et)return;tt&&St.key===" "&&(St.preventDefault(),Tt(!1),St.currentTarget.click())},[tt,Et,$,st]),Bt=reactExports.useCallback(St=>{St.button===0&&(Tt(!1),It.remove(document,"mouseup",Bt,!1))},[It]),yt=reactExports.useCallback(St=>{if(St.button!==0)return;if($){St.stopPropagation(),St.preventDefault();return}Et||Tt(!0),St.currentTarget.focus({preventScroll:!0}),It.add(document,"mouseup",Bt,!1),rt==null||rt(St)},[$,Et,rt,It,Bt]),mt=reactExports.useCallback(St=>{St.button===0&&(Et||Tt(!1),nt==null||nt(St))},[nt,Et]),ct=reactExports.useCallback(St=>{if($){St.preventDefault();return}ut==null||ut(St)},[$,ut]),dt=reactExports.useCallback(St=>{Pt&&(St.preventDefault(),Tt(!1)),ht==null||ht(St)},[Pt,ht]),vt=mergeRefs(a,Lt);return Et?{...bt,ref:vt,type:"button","aria-disabled":Ut?void 0:$,disabled:Ut,onClick:jt,onMouseDown:rt,onMouseUp:nt,onKeyUp:st,onKeyDown:ot,onMouseOver:ut,onMouseLeave:ht}:{...bt,ref:vt,role:"button","data-active":dataAttr(Pt),"aria-disabled":$?"true":void 0,tabIndex:Ut?void 0:Nt,onClick:jt,onMouseDown:yt,onMouseUp:mt,onKeyUp:Ft,onKeyDown:Dt,onMouseOver:ct,onMouseLeave:dt}}function preventReturnFocus(_){const a=_.current;if(!a)return!1;const $=getActiveElement(a);return!$||a.contains($)?!1:!!isTabbable($)}function useFocusOnHide(_,a){const{shouldFocus:$,visible:j,focusRef:et}=a,tt=$&&!j;useUpdateEffect(()=>{if(!tt||preventReturnFocus(_))return;const rt=(et==null?void 0:et.current)||_.current;let nt;if(rt)return nt=requestAnimationFrame(()=>{rt.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(nt)}},[tt,_,et])}var defaultOptions$2={preventScroll:!0,shouldFocus:!1};function useFocusOnShow(_,a=defaultOptions$2){const{focusRef:$,preventScroll:j,shouldFocus:et,visible:tt}=a,rt=isRefObject(_)?_.current:_,nt=et&&tt,it=reactExports.useRef(nt),ot=reactExports.useRef(tt);useSafeLayoutEffect$2(()=>{!ot.current&&tt&&(it.current=nt),ot.current=tt},[tt,nt]);const st=reactExports.useCallback(()=>{if(!(!tt||!rt||!it.current)&&(it.current=!1,!rt.contains(document.activeElement)))if($!=null&&$.current)requestAnimationFrame(()=>{var at;(at=$.current)==null||at.focus({preventScroll:j})});else{const at=getAllFocusable(rt);at.length>0&&requestAnimationFrame(()=>{at[0].focus({preventScroll:j})})}},[tt,j,rt,$]);useUpdateEffect(()=>{st()},[st]),useEventListener(rt,"transitionend",st)}function isRefObject(_){return"current"in _}var toVar=(_,a)=>({var:_,varRef:a?`var(${_}, ${a})`:`var(${_})`}),cssVars={arrowShadowColor:toVar("--popper-arrow-shadow-color"),arrowSize:toVar("--popper-arrow-size","8px"),arrowSizeHalf:toVar("--popper-arrow-size-half"),arrowBg:toVar("--popper-arrow-bg"),transformOrigin:toVar("--popper-transform-origin"),arrowOffset:toVar("--popper-arrow-offset")};function getBoxShadow(_){if(_.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(_.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(_.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(_.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var transforms={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},toTransformOrigin=_=>transforms[_],defaultEventListeners={scroll:!0,resize:!0};function getEventListenerOptions(_){let a;return typeof _=="object"?a={enabled:!0,options:{...defaultEventListeners,..._}}:a={enabled:_,options:defaultEventListeners},a}var matchWidth={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:_})=>{_.styles.popper.width=`${_.rects.reference.width}px`},effect:({state:_})=>()=>{const a=_.elements.reference;_.elements.popper.style.width=`${a.offsetWidth}px`}},transformOrigin={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:_})=>{setTransformOrigin(_)},effect:({state:_})=>()=>{setTransformOrigin(_)}},setTransformOrigin=_=>{_.elements.popper.style.setProperty(cssVars.transformOrigin.var,toTransformOrigin(_.placement))},positionArrow={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:_})=>{setArrowStyles(_)}},setArrowStyles=_=>{var a;if(!_.placement)return;const $=getArrowStyle$1(_.placement);if((a=_.elements)!=null&&a.arrow&&$){Object.assign(_.elements.arrow.style,{[$.property]:$.value,width:cssVars.arrowSize.varRef,height:cssVars.arrowSize.varRef,zIndex:-1});const j={[cssVars.arrowSizeHalf.var]:`calc(${cssVars.arrowSize.varRef} / 2 - 1px)`,[cssVars.arrowOffset.var]:`calc(${cssVars.arrowSizeHalf.varRef} * -1)`};for(const et in j)_.elements.arrow.style.setProperty(et,j[et])}},getArrowStyle$1=_=>{if(_.startsWith("top"))return{property:"bottom",value:cssVars.arrowOffset.varRef};if(_.startsWith("bottom"))return{property:"top",value:cssVars.arrowOffset.varRef};if(_.startsWith("left"))return{property:"right",value:cssVars.arrowOffset.varRef};if(_.startsWith("right"))return{property:"left",value:cssVars.arrowOffset.varRef}},innerArrow={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:_})=>{setInnerArrowStyles(_)},effect:({state:_})=>()=>{setInnerArrowStyles(_)}},setInnerArrowStyles=_=>{if(!_.elements.arrow)return;const a=_.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!a)return;const $=getBoxShadow(_.placement);$&&a.style.setProperty("--popper-arrow-default-shadow",$),Object.assign(a.style,{transform:"rotate(45deg)",background:cssVars.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},logicals={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},opposites={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function getPopperPlacement(_,a="ltr"){var $,j;const et=(($=logicals[_])==null?void 0:$[a])||_;return a==="ltr"?et:(j=opposites[_])!=null?j:et}var top="top",bottom="bottom",right="right",left="left",auto="auto",basePlacements=[top,bottom,right,left],start="start",end="end",clippingParents="clippingParents",viewport="viewport",popper="popper",reference="reference",variationPlacements=basePlacements.reduce(function(_,a){return _.concat([a+"-"+start,a+"-"+end])},[]),placements=[].concat(basePlacements,[auto]).reduce(function(_,a){return _.concat([a,a+"-"+start,a+"-"+end])},[]),beforeRead="beforeRead",read="read",afterRead="afterRead",beforeMain="beforeMain",main$5="main",afterMain="afterMain",beforeWrite="beforeWrite",write="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read,afterRead,beforeMain,main$5,afterMain,beforeWrite,write,afterWrite];function getNodeName(_){return _?(_.nodeName||"").toLowerCase():null}function getWindow(_){if(_==null)return window;if(_.toString()!=="[object Window]"){var a=_.ownerDocument;return a&&a.defaultView||window}return _}function isElement$1(_){var a=getWindow(_).Element;return _ instanceof a||_ instanceof Element}function isHTMLElement$2(_){var a=getWindow(_).HTMLElement;return _ instanceof a||_ instanceof HTMLElement}function isShadowRoot(_){if(typeof ShadowRoot>"u")return!1;var a=getWindow(_).ShadowRoot;return _ instanceof a||_ instanceof ShadowRoot}function applyStyles(_){var a=_.state;Object.keys(a.elements).forEach(function($){var j=a.styles[$]||{},et=a.attributes[$]||{},tt=a.elements[$];!isHTMLElement$2(tt)||!getNodeName(tt)||(Object.assign(tt.style,j),Object.keys(et).forEach(function(rt){var nt=et[rt];nt===!1?tt.removeAttribute(rt):tt.setAttribute(rt,nt===!0?"":nt)}))})}function effect$2(_){var a=_.state,$={popper:{position:a.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(a.elements.popper.style,$.popper),a.styles=$,a.elements.arrow&&Object.assign(a.elements.arrow.style,$.arrow),function(){Object.keys(a.elements).forEach(function(j){var et=a.elements[j],tt=a.attributes[j]||{},rt=Object.keys(a.styles.hasOwnProperty(j)?a.styles[j]:$[j]),nt=rt.reduce(function(it,ot){return it[ot]="",it},{});!isHTMLElement$2(et)||!getNodeName(et)||(Object.assign(et.style,nt),Object.keys(tt).forEach(function(it){et.removeAttribute(it)}))})}}const applyStyles$1={name:"applyStyles",enabled:!0,phase:"write",fn:applyStyles,effect:effect$2,requires:["computeStyles"]};function getBasePlacement(_){return _.split("-")[0]}var max$1=Math.max,min=Math.min,round=Math.round;function getUAString(){var _=navigator.userAgentData;return _!=null&&_.brands&&Array.isArray(_.brands)?_.brands.map(function(a){return a.brand+"/"+a.version}).join(" "):navigator.userAgent}function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString())}function getBoundingClientRect(_,a,$){a===void 0&&(a=!1),$===void 0&&($=!1);var j=_.getBoundingClientRect(),et=1,tt=1;a&&isHTMLElement$2(_)&&(et=_.offsetWidth>0&&round(j.width)/_.offsetWidth||1,tt=_.offsetHeight>0&&round(j.height)/_.offsetHeight||1);var rt=isElement$1(_)?getWindow(_):window,nt=rt.visualViewport,it=!isLayoutViewport()&&$,ot=(j.left+(it&&nt?nt.offsetLeft:0))/et,st=(j.top+(it&&nt?nt.offsetTop:0))/tt,at=j.width/et,ut=j.height/tt;return{width:at,height:ut,top:st,right:ot+at,bottom:st+ut,left:ot,x:ot,y:st}}function getLayoutRect(_){var a=getBoundingClientRect(_),$=_.offsetWidth,j=_.offsetHeight;return Math.abs(a.width-$)<=1&&($=a.width),Math.abs(a.height-j)<=1&&(j=a.height),{x:_.offsetLeft,y:_.offsetTop,width:$,height:j}}function contains$1(_,a){var $=a.getRootNode&&a.getRootNode();if(_.contains(a))return!0;if($&&isShadowRoot($)){var j=a;do{if(j&&_.isSameNode(j))return!0;j=j.parentNode||j.host}while(j)}return!1}function getComputedStyle$1(_){return getWindow(_).getComputedStyle(_)}function isTableElement(_){return["table","td","th"].indexOf(getNodeName(_))>=0}function getDocumentElement(_){return((isElement$1(_)?_.ownerDocument:_.document)||window.document).documentElement}function getParentNode(_){return getNodeName(_)==="html"?_:_.assignedSlot||_.parentNode||(isShadowRoot(_)?_.host:null)||getDocumentElement(_)}function getTrueOffsetParent(_){return!isHTMLElement$2(_)||getComputedStyle$1(_).position==="fixed"?null:_.offsetParent}function getContainingBlock(_){var a=/firefox/i.test(getUAString()),$=/Trident/i.test(getUAString());if($&&isHTMLElement$2(_)){var j=getComputedStyle$1(_);if(j.position==="fixed")return null}var et=getParentNode(_);for(isShadowRoot(et)&&(et=et.host);isHTMLElement$2(et)&&["html","body"].indexOf(getNodeName(et))<0;){var tt=getComputedStyle$1(et);if(tt.transform!=="none"||tt.perspective!=="none"||tt.contain==="paint"||["transform","perspective"].indexOf(tt.willChange)!==-1||a&&tt.willChange==="filter"||a&&tt.filter&&tt.filter!=="none")return et;et=et.parentNode}return null}function getOffsetParent(_){for(var a=getWindow(_),$=getTrueOffsetParent(_);$&&isTableElement($)&&getComputedStyle$1($).position==="static";)$=getTrueOffsetParent($);return $&&(getNodeName($)==="html"||getNodeName($)==="body"&&getComputedStyle$1($).position==="static")?a:$||getContainingBlock(_)||a}function getMainAxisFromPlacement(_){return["top","bottom"].indexOf(_)>=0?"x":"y"}function within(_,a,$){return max$1(_,min(a,$))}function withinMaxClamp(_,a,$){var j=within(_,a,$);return j>$?$:j}function getFreshSideObject(){return{top:0,right:0,bottom:0,left:0}}function mergePaddingObject(_){return Object.assign({},getFreshSideObject(),_)}function expandToHashMap(_,a){return a.reduce(function($,j){return $[j]=_,$},{})}var toPaddingObject=function(a,$){return a=typeof a=="function"?a(Object.assign({},$.rects,{placement:$.placement})):a,mergePaddingObject(typeof a!="number"?a:expandToHashMap(a,basePlacements))};function arrow(_){var a,$=_.state,j=_.name,et=_.options,tt=$.elements.arrow,rt=$.modifiersData.popperOffsets,nt=getBasePlacement($.placement),it=getMainAxisFromPlacement(nt),ot=[left,right].indexOf(nt)>=0,st=ot?"height":"width";if(!(!tt||!rt)){var at=toPaddingObject(et.padding,$),ut=getLayoutRect(tt),ht=it==="y"?top:left,bt=it==="y"?bottom:right,Et=$.rects.reference[st]+$.rects.reference[it]-rt[it]-$.rects.popper[st],Ct=rt[it]-$.rects.reference[it],Pt=getOffsetParent(tt),Tt=Pt?it==="y"?Pt.clientHeight||0:Pt.clientWidth||0:0,It=Et/2-Ct/2,Lt=at[ht],Nt=Tt-ut[st]-at[bt],Ut=Tt/2-ut[st]/2+It,jt=within(Lt,Ut,Nt),Mt=it;$.modifiersData[j]=(a={},a[Mt]=jt,a.centerOffset=jt-Ut,a)}}function effect$1(_){var a=_.state,$=_.options,j=$.element,et=j===void 0?"[data-popper-arrow]":j;et!=null&&(typeof et=="string"&&(et=a.elements.popper.querySelector(et),!et)||contains$1(a.elements.popper,et)&&(a.elements.arrow=et))}const arrow$1={name:"arrow",enabled:!0,phase:"main",fn:arrow,effect:effect$1,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function getVariation(_){return _.split("-")[1]}var unsetSides={top:"auto",right:"auto",bottom:"auto",left:"auto"};function roundOffsetsByDPR(_,a){var $=_.x,j=_.y,et=a.devicePixelRatio||1;return{x:round($*et)/et||0,y:round(j*et)/et||0}}function mapToStyles(_){var a,$=_.popper,j=_.popperRect,et=_.placement,tt=_.variation,rt=_.offsets,nt=_.position,it=_.gpuAcceleration,ot=_.adaptive,st=_.roundOffsets,at=_.isFixed,ut=rt.x,ht=ut===void 0?0:ut,bt=rt.y,Et=bt===void 0?0:bt,Ct=typeof st=="function"?st({x:ht,y:Et}):{x:ht,y:Et};ht=Ct.x,Et=Ct.y;var Pt=rt.hasOwnProperty("x"),Tt=rt.hasOwnProperty("y"),It=left,Lt=top,Nt=window;if(ot){var Ut=getOffsetParent($),jt="clientHeight",Mt="clientWidth";if(Ut===getWindow($)&&(Ut=getDocumentElement($),getComputedStyle$1(Ut).position!=="static"&&nt==="absolute"&&(jt="scrollHeight",Mt="scrollWidth")),Ut=Ut,et===top||(et===left||et===right)&&tt===end){Lt=bottom;var Dt=at&&Ut===Nt&&Nt.visualViewport?Nt.visualViewport.height:Ut[jt];Et-=Dt-j.height,Et*=it?1:-1}if(et===left||(et===top||et===bottom)&&tt===end){It=right;var Ft=at&&Ut===Nt&&Nt.visualViewport?Nt.visualViewport.width:Ut[Mt];ht-=Ft-j.width,ht*=it?1:-1}}var Bt=Object.assign({position:nt},ot&&unsetSides),yt=st===!0?roundOffsetsByDPR({x:ht,y:Et},getWindow($)):{x:ht,y:Et};if(ht=yt.x,Et=yt.y,it){var mt;return Object.assign({},Bt,(mt={},mt[Lt]=Tt?"0":"",mt[It]=Pt?"0":"",mt.transform=(Nt.devicePixelRatio||1)<=1?"translate("+ht+"px, "+Et+"px)":"translate3d("+ht+"px, "+Et+"px, 0)",mt))}return Object.assign({},Bt,(a={},a[Lt]=Tt?Et+"px":"",a[It]=Pt?ht+"px":"",a.transform="",a))}function computeStyles(_){var a=_.state,$=_.options,j=$.gpuAcceleration,et=j===void 0?!0:j,tt=$.adaptive,rt=tt===void 0?!0:tt,nt=$.roundOffsets,it=nt===void 0?!0:nt,ot={placement:getBasePlacement(a.placement),variation:getVariation(a.placement),popper:a.elements.popper,popperRect:a.rects.popper,gpuAcceleration:et,isFixed:a.options.strategy==="fixed"};a.modifiersData.popperOffsets!=null&&(a.styles.popper=Object.assign({},a.styles.popper,mapToStyles(Object.assign({},ot,{offsets:a.modifiersData.popperOffsets,position:a.options.strategy,adaptive:rt,roundOffsets:it})))),a.modifiersData.arrow!=null&&(a.styles.arrow=Object.assign({},a.styles.arrow,mapToStyles(Object.assign({},ot,{offsets:a.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:it})))),a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-placement":a.placement})}const computeStyles$1={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:computeStyles,data:{}};var passive={passive:!0};function effect(_){var a=_.state,$=_.instance,j=_.options,et=j.scroll,tt=et===void 0?!0:et,rt=j.resize,nt=rt===void 0?!0:rt,it=getWindow(a.elements.popper),ot=[].concat(a.scrollParents.reference,a.scrollParents.popper);return tt&&ot.forEach(function(st){st.addEventListener("scroll",$.update,passive)}),nt&&it.addEventListener("resize",$.update,passive),function(){tt&&ot.forEach(function(st){st.removeEventListener("scroll",$.update,passive)}),nt&&it.removeEventListener("resize",$.update,passive)}}const eventListeners={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect,data:{}};var hash$a={left:"right",right:"left",bottom:"top",top:"bottom"};function getOppositePlacement(_){return _.replace(/left|right|bottom|top/g,function(a){return hash$a[a]})}var hash$9={start:"end",end:"start"};function getOppositeVariationPlacement(_){return _.replace(/start|end/g,function(a){return hash$9[a]})}function getWindowScroll(_){var a=getWindow(_),$=a.pageXOffset,j=a.pageYOffset;return{scrollLeft:$,scrollTop:j}}function getWindowScrollBarX(_){return getBoundingClientRect(getDocumentElement(_)).left+getWindowScroll(_).scrollLeft}function getViewportRect(_,a){var $=getWindow(_),j=getDocumentElement(_),et=$.visualViewport,tt=j.clientWidth,rt=j.clientHeight,nt=0,it=0;if(et){tt=et.width,rt=et.height;var ot=isLayoutViewport();(ot||!ot&&a==="fixed")&&(nt=et.offsetLeft,it=et.offsetTop)}return{width:tt,height:rt,x:nt+getWindowScrollBarX(_),y:it}}function getDocumentRect(_){var a,$=getDocumentElement(_),j=getWindowScroll(_),et=(a=_.ownerDocument)==null?void 0:a.body,tt=max$1($.scrollWidth,$.clientWidth,et?et.scrollWidth:0,et?et.clientWidth:0),rt=max$1($.scrollHeight,$.clientHeight,et?et.scrollHeight:0,et?et.clientHeight:0),nt=-j.scrollLeft+getWindowScrollBarX(_),it=-j.scrollTop;return getComputedStyle$1(et||$).direction==="rtl"&&(nt+=max$1($.clientWidth,et?et.clientWidth:0)-tt),{width:tt,height:rt,x:nt,y:it}}function isScrollParent(_){var a=getComputedStyle$1(_),$=a.overflow,j=a.overflowX,et=a.overflowY;return/auto|scroll|overlay|hidden/.test($+et+j)}function getScrollParent(_){return["html","body","#document"].indexOf(getNodeName(_))>=0?_.ownerDocument.body:isHTMLElement$2(_)&&isScrollParent(_)?_:getScrollParent(getParentNode(_))}function listScrollParents(_,a){var $;a===void 0&&(a=[]);var j=getScrollParent(_),et=j===(($=_.ownerDocument)==null?void 0:$.body),tt=getWindow(j),rt=et?[tt].concat(tt.visualViewport||[],isScrollParent(j)?j:[]):j,nt=a.concat(rt);return et?nt:nt.concat(listScrollParents(getParentNode(rt)))}function rectToClientRect(_){return Object.assign({},_,{left:_.x,top:_.y,right:_.x+_.width,bottom:_.y+_.height})}function getInnerBoundingClientRect(_,a){var $=getBoundingClientRect(_,!1,a==="fixed");return $.top=$.top+_.clientTop,$.left=$.left+_.clientLeft,$.bottom=$.top+_.clientHeight,$.right=$.left+_.clientWidth,$.width=_.clientWidth,$.height=_.clientHeight,$.x=$.left,$.y=$.top,$}function getClientRectFromMixedType(_,a,$){return a===viewport?rectToClientRect(getViewportRect(_,$)):isElement$1(a)?getInnerBoundingClientRect(a,$):rectToClientRect(getDocumentRect(getDocumentElement(_)))}function getClippingParents(_){var a=listScrollParents(getParentNode(_)),$=["absolute","fixed"].indexOf(getComputedStyle$1(_).position)>=0,j=$&&isHTMLElement$2(_)?getOffsetParent(_):_;return isElement$1(j)?a.filter(function(et){return isElement$1(et)&&contains$1(et,j)&&getNodeName(et)!=="body"}):[]}function getClippingRect(_,a,$,j){var et=a==="clippingParents"?getClippingParents(_):[].concat(a),tt=[].concat(et,[$]),rt=tt[0],nt=tt.reduce(function(it,ot){var st=getClientRectFromMixedType(_,ot,j);return it.top=max$1(st.top,it.top),it.right=min(st.right,it.right),it.bottom=min(st.bottom,it.bottom),it.left=max$1(st.left,it.left),it},getClientRectFromMixedType(_,rt,j));return nt.width=nt.right-nt.left,nt.height=nt.bottom-nt.top,nt.x=nt.left,nt.y=nt.top,nt}function computeOffsets(_){var a=_.reference,$=_.element,j=_.placement,et=j?getBasePlacement(j):null,tt=j?getVariation(j):null,rt=a.x+a.width/2-$.width/2,nt=a.y+a.height/2-$.height/2,it;switch(et){case top:it={x:rt,y:a.y-$.height};break;case bottom:it={x:rt,y:a.y+a.height};break;case right:it={x:a.x+a.width,y:nt};break;case left:it={x:a.x-$.width,y:nt};break;default:it={x:a.x,y:a.y}}var ot=et?getMainAxisFromPlacement(et):null;if(ot!=null){var st=ot==="y"?"height":"width";switch(tt){case start:it[ot]=it[ot]-(a[st]/2-$[st]/2);break;case end:it[ot]=it[ot]+(a[st]/2-$[st]/2);break}}return it}function detectOverflow(_,a){a===void 0&&(a={});var $=a,j=$.placement,et=j===void 0?_.placement:j,tt=$.strategy,rt=tt===void 0?_.strategy:tt,nt=$.boundary,it=nt===void 0?clippingParents:nt,ot=$.rootBoundary,st=ot===void 0?viewport:ot,at=$.elementContext,ut=at===void 0?popper:at,ht=$.altBoundary,bt=ht===void 0?!1:ht,Et=$.padding,Ct=Et===void 0?0:Et,Pt=mergePaddingObject(typeof Ct!="number"?Ct:expandToHashMap(Ct,basePlacements)),Tt=ut===popper?reference:popper,It=_.rects.popper,Lt=_.elements[bt?Tt:ut],Nt=getClippingRect(isElement$1(Lt)?Lt:Lt.contextElement||getDocumentElement(_.elements.popper),it,st,rt),Ut=getBoundingClientRect(_.elements.reference),jt=computeOffsets({reference:Ut,element:It,strategy:"absolute",placement:et}),Mt=rectToClientRect(Object.assign({},It,jt)),Dt=ut===popper?Mt:Ut,Ft={top:Nt.top-Dt.top+Pt.top,bottom:Dt.bottom-Nt.bottom+Pt.bottom,left:Nt.left-Dt.left+Pt.left,right:Dt.right-Nt.right+Pt.right},Bt=_.modifiersData.offset;if(ut===popper&&Bt){var yt=Bt[et];Object.keys(Ft).forEach(function(mt){var ct=[right,bottom].indexOf(mt)>=0?1:-1,dt=[top,bottom].indexOf(mt)>=0?"y":"x";Ft[mt]+=yt[dt]*ct})}return Ft}function computeAutoPlacement(_,a){a===void 0&&(a={});var $=a,j=$.placement,et=$.boundary,tt=$.rootBoundary,rt=$.padding,nt=$.flipVariations,it=$.allowedAutoPlacements,ot=it===void 0?placements:it,st=getVariation(j),at=st?nt?variationPlacements:variationPlacements.filter(function(bt){return getVariation(bt)===st}):basePlacements,ut=at.filter(function(bt){return ot.indexOf(bt)>=0});ut.length===0&&(ut=at);var ht=ut.reduce(function(bt,Et){return bt[Et]=detectOverflow(_,{placement:Et,boundary:et,rootBoundary:tt,padding:rt})[getBasePlacement(Et)],bt},{});return Object.keys(ht).sort(function(bt,Et){return ht[bt]-ht[Et]})}function getExpandedFallbackPlacements(_){if(getBasePlacement(_)===auto)return[];var a=getOppositePlacement(_);return[getOppositeVariationPlacement(_),a,getOppositeVariationPlacement(a)]}function flip(_){var a=_.state,$=_.options,j=_.name;if(!a.modifiersData[j]._skip){for(var et=$.mainAxis,tt=et===void 0?!0:et,rt=$.altAxis,nt=rt===void 0?!0:rt,it=$.fallbackPlacements,ot=$.padding,st=$.boundary,at=$.rootBoundary,ut=$.altBoundary,ht=$.flipVariations,bt=ht===void 0?!0:ht,Et=$.allowedAutoPlacements,Ct=a.options.placement,Pt=getBasePlacement(Ct),Tt=Pt===Ct,It=it||(Tt||!bt?[getOppositePlacement(Ct)]:getExpandedFallbackPlacements(Ct)),Lt=[Ct].concat(It).reduce(function(tr,nr){return tr.concat(getBasePlacement(nr)===auto?computeAutoPlacement(a,{placement:nr,boundary:st,rootBoundary:at,padding:ot,flipVariations:bt,allowedAutoPlacements:Et}):nr)},[]),Nt=a.rects.reference,Ut=a.rects.popper,jt=new Map,Mt=!0,Dt=Lt[0],Ft=0;Ft=0,dt=ct?"width":"height",vt=detectOverflow(a,{placement:Bt,boundary:st,rootBoundary:at,altBoundary:ut,padding:ot}),St=ct?mt?right:left:mt?bottom:top;Nt[dt]>Ut[dt]&&(St=getOppositePlacement(St));var Rt=getOppositePlacement(St),$t=[];if(tt&&$t.push(vt[yt]<=0),nt&&$t.push(vt[St]<=0,vt[Rt]<=0),$t.every(function(tr){return tr})){Dt=Bt,Mt=!1;break}jt.set(Bt,$t)}if(Mt)for(var xt=bt?3:1,At=function(nr){var ir=Lt.find(function(Wt){var Kt=jt.get(Wt);if(Kt)return Kt.slice(0,nr).every(function(Jt){return Jt})});if(ir)return Dt=ir,"break"},wt=xt;wt>0;wt--){var Ot=At(wt);if(Ot==="break")break}a.placement!==Dt&&(a.modifiersData[j]._skip=!0,a.placement=Dt,a.reset=!0)}}const flip$1={name:"flip",enabled:!0,phase:"main",fn:flip,requiresIfExists:["offset"],data:{_skip:!1}};function getSideOffsets(_,a,$){return $===void 0&&($={x:0,y:0}),{top:_.top-a.height-$.y,right:_.right-a.width+$.x,bottom:_.bottom-a.height+$.y,left:_.left-a.width-$.x}}function isAnySideFullyClipped(_){return[top,right,bottom,left].some(function(a){return _[a]>=0})}function hide(_){var a=_.state,$=_.name,j=a.rects.reference,et=a.rects.popper,tt=a.modifiersData.preventOverflow,rt=detectOverflow(a,{elementContext:"reference"}),nt=detectOverflow(a,{altBoundary:!0}),it=getSideOffsets(rt,j),ot=getSideOffsets(nt,et,tt),st=isAnySideFullyClipped(it),at=isAnySideFullyClipped(ot);a.modifiersData[$]={referenceClippingOffsets:it,popperEscapeOffsets:ot,isReferenceHidden:st,hasPopperEscaped:at},a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-reference-hidden":st,"data-popper-escaped":at})}const hide$1={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hide};function distanceAndSkiddingToXY(_,a,$){var j=getBasePlacement(_),et=[left,top].indexOf(j)>=0?-1:1,tt=typeof $=="function"?$(Object.assign({},a,{placement:_})):$,rt=tt[0],nt=tt[1];return rt=rt||0,nt=(nt||0)*et,[left,right].indexOf(j)>=0?{x:nt,y:rt}:{x:rt,y:nt}}function offset(_){var a=_.state,$=_.options,j=_.name,et=$.offset,tt=et===void 0?[0,0]:et,rt=placements.reduce(function(st,at){return st[at]=distanceAndSkiddingToXY(at,a.rects,tt),st},{}),nt=rt[a.placement],it=nt.x,ot=nt.y;a.modifiersData.popperOffsets!=null&&(a.modifiersData.popperOffsets.x+=it,a.modifiersData.popperOffsets.y+=ot),a.modifiersData[j]=rt}const offset$1={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset};function popperOffsets(_){var a=_.state,$=_.name;a.modifiersData[$]=computeOffsets({reference:a.rects.reference,element:a.rects.popper,strategy:"absolute",placement:a.placement})}const popperOffsets$1={name:"popperOffsets",enabled:!0,phase:"read",fn:popperOffsets,data:{}};function getAltAxis(_){return _==="x"?"y":"x"}function preventOverflow(_){var a=_.state,$=_.options,j=_.name,et=$.mainAxis,tt=et===void 0?!0:et,rt=$.altAxis,nt=rt===void 0?!1:rt,it=$.boundary,ot=$.rootBoundary,st=$.altBoundary,at=$.padding,ut=$.tether,ht=ut===void 0?!0:ut,bt=$.tetherOffset,Et=bt===void 0?0:bt,Ct=detectOverflow(a,{boundary:it,rootBoundary:ot,padding:at,altBoundary:st}),Pt=getBasePlacement(a.placement),Tt=getVariation(a.placement),It=!Tt,Lt=getMainAxisFromPlacement(Pt),Nt=getAltAxis(Lt),Ut=a.modifiersData.popperOffsets,jt=a.rects.reference,Mt=a.rects.popper,Dt=typeof Et=="function"?Et(Object.assign({},a.rects,{placement:a.placement})):Et,Ft=typeof Dt=="number"?{mainAxis:Dt,altAxis:Dt}:Object.assign({mainAxis:0,altAxis:0},Dt),Bt=a.modifiersData.offset?a.modifiersData.offset[a.placement]:null,yt={x:0,y:0};if(Ut){if(tt){var mt,ct=Lt==="y"?top:left,dt=Lt==="y"?bottom:right,vt=Lt==="y"?"height":"width",St=Ut[Lt],Rt=St+Ct[ct],$t=St-Ct[dt],xt=ht?-Mt[vt]/2:0,At=Tt===start?jt[vt]:Mt[vt],wt=Tt===start?-Mt[vt]:-jt[vt],Ot=a.elements.arrow,tr=ht&&Ot?getLayoutRect(Ot):{width:0,height:0},nr=a.modifiersData["arrow#persistent"]?a.modifiersData["arrow#persistent"].padding:getFreshSideObject(),ir=nr[ct],Wt=nr[dt],Kt=within(0,jt[vt],tr[vt]),Jt=It?jt[vt]/2-xt-Kt-ir-Ft.mainAxis:At-Kt-ir-Ft.mainAxis,Ht=It?-jt[vt]/2+xt+Kt+Wt+Ft.mainAxis:wt+Kt+Wt+Ft.mainAxis,qt=a.elements.arrow&&getOffsetParent(a.elements.arrow),Qt=qt?Lt==="y"?qt.clientTop||0:qt.clientLeft||0:0,dr=(mt=Bt==null?void 0:Bt[Lt])!=null?mt:0,xr=St+Jt-dr-Qt,pr=St+Ht-dr,kr=within(ht?min(Rt,xr):Rt,St,ht?max$1($t,pr):$t);Ut[Lt]=kr,yt[Lt]=kr-St}if(nt){var Ir,lr=Lt==="x"?top:left,fr=Lt==="x"?bottom:right,Er=Ut[Nt],$r=Nt==="y"?"height":"width",Pr=Er+Ct[lr],Rr=Er-Ct[fr],Ar=[top,left].indexOf(Pt)!==-1,Or=(Ir=Bt==null?void 0:Bt[Nt])!=null?Ir:0,Lr=Ar?Pr:Er-jt[$r]-Mt[$r]-Or+Ft.altAxis,or=Ar?Er+jt[$r]+Mt[$r]-Or-Ft.altAxis:Rr,Yt=ht&&Ar?withinMaxClamp(Lr,Er,or):within(ht?Lr:Pr,Er,ht?or:Rr);Ut[Nt]=Yt,yt[Nt]=Yt-Er}a.modifiersData[j]=yt}}const preventOverflow$1={name:"preventOverflow",enabled:!0,phase:"main",fn:preventOverflow,requiresIfExists:["offset"]};function getHTMLElementScroll(_){return{scrollLeft:_.scrollLeft,scrollTop:_.scrollTop}}function getNodeScroll(_){return _===getWindow(_)||!isHTMLElement$2(_)?getWindowScroll(_):getHTMLElementScroll(_)}function isElementScaled(_){var a=_.getBoundingClientRect(),$=round(a.width)/_.offsetWidth||1,j=round(a.height)/_.offsetHeight||1;return $!==1||j!==1}function getCompositeRect(_,a,$){$===void 0&&($=!1);var j=isHTMLElement$2(a),et=isHTMLElement$2(a)&&isElementScaled(a),tt=getDocumentElement(a),rt=getBoundingClientRect(_,et,$),nt={scrollLeft:0,scrollTop:0},it={x:0,y:0};return(j||!j&&!$)&&((getNodeName(a)!=="body"||isScrollParent(tt))&&(nt=getNodeScroll(a)),isHTMLElement$2(a)?(it=getBoundingClientRect(a,!0),it.x+=a.clientLeft,it.y+=a.clientTop):tt&&(it.x=getWindowScrollBarX(tt))),{x:rt.left+nt.scrollLeft-it.x,y:rt.top+nt.scrollTop-it.y,width:rt.width,height:rt.height}}function order(_){var a=new Map,$=new Set,j=[];_.forEach(function(tt){a.set(tt.name,tt)});function et(tt){$.add(tt.name);var rt=[].concat(tt.requires||[],tt.requiresIfExists||[]);rt.forEach(function(nt){if(!$.has(nt)){var it=a.get(nt);it&&et(it)}}),j.push(tt)}return _.forEach(function(tt){$.has(tt.name)||et(tt)}),j}function orderModifiers(_){var a=order(_);return modifierPhases.reduce(function($,j){return $.concat(a.filter(function(et){return et.phase===j}))},[])}function debounce(_){var a;return function(){return a||(a=new Promise(function($){Promise.resolve().then(function(){a=void 0,$(_())})})),a}}function mergeByName(_){var a=_.reduce(function($,j){var et=$[j.name];return $[j.name]=et?Object.assign({},et,j,{options:Object.assign({},et.options,j.options),data:Object.assign({},et.data,j.data)}):j,$},{});return Object.keys(a).map(function($){return a[$]})}var DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var _=arguments.length,a=new Array(_),$=0;$<_;$++)a[$]=arguments[$];return!a.some(function(j){return!(j&&typeof j.getBoundingClientRect=="function")})}function popperGenerator(_){_===void 0&&(_={});var a=_,$=a.defaultModifiers,j=$===void 0?[]:$,et=a.defaultOptions,tt=et===void 0?DEFAULT_OPTIONS:et;return function(nt,it,ot){ot===void 0&&(ot=tt);var st={placement:"bottom",orderedModifiers:[],options:Object.assign({},DEFAULT_OPTIONS,tt),modifiersData:{},elements:{reference:nt,popper:it},attributes:{},styles:{}},at=[],ut=!1,ht={state:st,setOptions:function(Pt){var Tt=typeof Pt=="function"?Pt(st.options):Pt;Et(),st.options=Object.assign({},tt,st.options,Tt),st.scrollParents={reference:isElement$1(nt)?listScrollParents(nt):nt.contextElement?listScrollParents(nt.contextElement):[],popper:listScrollParents(it)};var It=orderModifiers(mergeByName([].concat(j,st.options.modifiers)));return st.orderedModifiers=It.filter(function(Lt){return Lt.enabled}),bt(),ht.update()},forceUpdate:function(){if(!ut){var Pt=st.elements,Tt=Pt.reference,It=Pt.popper;if(areValidElements(Tt,It)){st.rects={reference:getCompositeRect(Tt,getOffsetParent(It),st.options.strategy==="fixed"),popper:getLayoutRect(It)},st.reset=!1,st.placement=st.options.placement,st.orderedModifiers.forEach(function(Ft){return st.modifiersData[Ft.name]=Object.assign({},Ft.data)});for(var Lt=0;Lt{}),It=reactExports.useCallback(()=>{var Ft;!a||!bt.current||!Et.current||((Ft=Tt.current)==null||Ft.call(Tt),Ct.current=createPopper(bt.current,Et.current,{placement:Pt,modifiers:[innerArrow,positionArrow,transformOrigin,{...matchWidth,enabled:!!ut},{name:"eventListeners",...getEventListenerOptions(rt)},{name:"arrow",options:{padding:tt}},{name:"offset",options:{offset:nt??[0,it]}},{name:"flip",enabled:!!ot,options:{padding:8}},{name:"preventOverflow",enabled:!!at,options:{boundary:st}},...$??[]],strategy:et}),Ct.current.forceUpdate(),Tt.current=Ct.current.destroy)},[Pt,a,$,ut,rt,tt,nt,it,ot,at,st,et]);reactExports.useEffect(()=>()=>{var Ft;!bt.current&&!Et.current&&((Ft=Ct.current)==null||Ft.destroy(),Ct.current=null)},[]);const Lt=reactExports.useCallback(Ft=>{bt.current=Ft,It()},[It]),Nt=reactExports.useCallback((Ft={},Bt=null)=>({...Ft,ref:mergeRefs(Lt,Bt)}),[Lt]),Ut=reactExports.useCallback(Ft=>{Et.current=Ft,It()},[It]),jt=reactExports.useCallback((Ft={},Bt=null)=>({...Ft,ref:mergeRefs(Ut,Bt),style:{...Ft.style,position:et,minWidth:ut?void 0:"max-content",inset:"0 auto auto 0"}}),[et,Ut,ut]),Mt=reactExports.useCallback((Ft={},Bt=null)=>{const{size:yt,shadowColor:mt,bg:ct,style:dt,...vt}=Ft;return{...vt,ref:Bt,"data-popper-arrow":"",style:getArrowStyle(Ft)}},[]),Dt=reactExports.useCallback((Ft={},Bt=null)=>({...Ft,ref:Bt,"data-popper-arrow-inner":""}),[]);return{update(){var Ft;(Ft=Ct.current)==null||Ft.update()},forceUpdate(){var Ft;(Ft=Ct.current)==null||Ft.forceUpdate()},transformOrigin:cssVars.transformOrigin.varRef,referenceRef:Lt,popperRef:Ut,getPopperProps:jt,getArrowProps:Mt,getArrowInnerProps:Dt,getReferenceProps:Nt}}function getArrowStyle(_){const{size:a,shadowColor:$,bg:j,style:et}=_,tt={...et,position:"absolute"};return a&&(tt["--popper-arrow-size"]=a),$&&(tt["--popper-arrow-shadow-color"]=$),j&&(tt["--popper-arrow-bg"]=j),tt}function useDisclosure(_={}){const{onClose:a,onOpen:$,isOpen:j,id:et}=_,tt=useCallbackRef$2($),rt=useCallbackRef$2(a),[nt,it]=reactExports.useState(_.defaultIsOpen||!1),ot=j!==void 0?j:nt,st=j!==void 0,at=reactExports.useId(),ut=et??`disclosure-${at}`,ht=reactExports.useCallback(()=>{st||it(!1),rt==null||rt()},[st,rt]),bt=reactExports.useCallback(()=>{st||it(!0),tt==null||tt()},[st,tt]),Et=reactExports.useCallback(()=>{ot?ht():bt()},[ot,bt,ht]);function Ct(Tt={}){return{...Tt,"aria-expanded":ot,"aria-controls":ut,onClick(It){var Lt;(Lt=Tt.onClick)==null||Lt.call(Tt,It),Et()}}}function Pt(Tt={}){return{...Tt,hidden:!ot,id:ut}}return{isOpen:ot,onOpen:bt,onClose:ht,onToggle:Et,isControlled:st,getButtonProps:Ct,getDisclosureProps:Pt}}function useOutsideClick(_){const{ref:a,handler:$,enabled:j=!0}=_,et=useCallbackRef$2($),rt=reactExports.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;reactExports.useEffect(()=>{if(!j)return;const nt=at=>{isValidEvent(at,a)&&(rt.isPointerDown=!0)},it=at=>{if(rt.ignoreEmulatedMouseEvents){rt.ignoreEmulatedMouseEvents=!1;return}rt.isPointerDown&&$&&isValidEvent(at,a)&&(rt.isPointerDown=!1,et(at))},ot=at=>{rt.ignoreEmulatedMouseEvents=!0,$&&rt.isPointerDown&&isValidEvent(at,a)&&(rt.isPointerDown=!1,et(at))},st=getOwnerDocument$1(a.current);return st.addEventListener("mousedown",nt,!0),st.addEventListener("mouseup",it,!0),st.addEventListener("touchstart",nt,!0),st.addEventListener("touchend",ot,!0),()=>{st.removeEventListener("mousedown",nt,!0),st.removeEventListener("mouseup",it,!0),st.removeEventListener("touchstart",nt,!0),st.removeEventListener("touchend",ot,!0)}},[$,a,et,rt,j])}function isValidEvent(_,a){var $;const j=_.target;return j&&!getOwnerDocument$1(j).contains(j)?!1:!(($=a.current)!=null&&$.contains(j))}function getOwnerDocument$1(_){var a;return(a=_==null?void 0:_.ownerDocument)!=null?a:document}function useAnimationState(_){const{isOpen:a,ref:$}=_,[j,et]=reactExports.useState(a),[tt,rt]=reactExports.useState(!1);return reactExports.useEffect(()=>{tt||(et(a),rt(!0))},[a,tt,j]),useEventListener(()=>$.current,"animationend",()=>{et(a)}),{present:!(a?!1:!j),onComplete(){var it;const ot=getOwnerWindow($.current),st=new ot.CustomEvent("animationend",{bubbles:!0});(it=$.current)==null||it.dispatchEvent(st)}}}function lazyDisclosure(_){const{wasSelected:a,enabled:$,isSelected:j,mode:et="unmount"}=_;return!!(!$||j||et==="keepMounted"&&a)}var[MenuDescendantsProvider,useMenuDescendantsContext,useMenuDescendants,useMenuDescendant]=createDescendantContext(),[MenuProvider,useMenuContext]=createContext$1({strict:!1,name:"MenuContext"});function useIds$1(_,...a){const $=reactExports.useId(),j=_||$;return reactExports.useMemo(()=>a.map(et=>`${et}-${j}`),[j,a])}function getOwnerDocument(_){var a;return(a=_==null?void 0:_.ownerDocument)!=null?a:document}function isActiveElement(_){return getOwnerDocument(_).activeElement===_}function useMenu(_={}){const{id:a,closeOnSelect:$=!0,closeOnBlur:j=!0,initialFocusRef:et,autoSelect:tt=!0,isLazy:rt,isOpen:nt,defaultIsOpen:it,onClose:ot,onOpen:st,placement:at="bottom-start",lazyBehavior:ut="unmount",direction:ht,computePositionOnMount:bt=!1,...Et}=_,Ct=reactExports.useRef(null),Pt=reactExports.useRef(null),Tt=useMenuDescendants(),It=reactExports.useCallback(()=>{requestAnimationFrame(()=>{var Ot;(Ot=Ct.current)==null||Ot.focus({preventScroll:!1})})},[]),Lt=reactExports.useCallback(()=>{const Ot=setTimeout(()=>{var tr;if(et)(tr=et.current)==null||tr.focus();else{const nr=Tt.firstEnabled();nr&&mt(nr.index)}});Rt.current.add(Ot)},[Tt,et]),Nt=reactExports.useCallback(()=>{const Ot=setTimeout(()=>{const tr=Tt.lastEnabled();tr&&mt(tr.index)});Rt.current.add(Ot)},[Tt]),Ut=reactExports.useCallback(()=>{st==null||st(),tt?Lt():It()},[tt,Lt,It,st]),{isOpen:jt,onOpen:Mt,onClose:Dt,onToggle:Ft}=useDisclosure({isOpen:nt,defaultIsOpen:it,onClose:ot,onOpen:Ut});useOutsideClick({enabled:jt&&j,ref:Ct,handler:Ot=>{var tr;(tr=Pt.current)!=null&&tr.contains(Ot.target)||Dt()}});const Bt=usePopper({...Et,enabled:jt||bt,placement:at,direction:ht}),[yt,mt]=reactExports.useState(-1);useUpdateEffect(()=>{jt||mt(-1)},[jt]),useFocusOnHide(Ct,{focusRef:Pt,visible:jt,shouldFocus:!0});const ct=useAnimationState({isOpen:jt,ref:Ct}),[dt,vt]=useIds$1(a,"menu-button","menu-list"),St=reactExports.useCallback(()=>{Mt(),It()},[Mt,It]),Rt=reactExports.useRef(new Set([]));reactExports.useEffect(()=>{const Ot=Rt.current;return()=>{Ot.forEach(tr=>clearTimeout(tr)),Ot.clear()}},[]);const $t=reactExports.useCallback(()=>{Mt(),Lt()},[Lt,Mt]),xt=reactExports.useCallback(()=>{Mt(),Nt()},[Mt,Nt]),At=reactExports.useCallback(()=>{var Ot,tr;const nr=getOwnerDocument(Ct.current),ir=(Ot=Ct.current)==null?void 0:Ot.contains(nr.activeElement);if(!(jt&&!ir))return;const Kt=(tr=Tt.item(yt))==null?void 0:tr.node;Kt==null||Kt.focus({preventScroll:!0})},[jt,yt,Tt]),wt=reactExports.useRef(null);return{openAndFocusMenu:St,openAndFocusFirstItem:$t,openAndFocusLastItem:xt,onTransitionEnd:At,unstable__animationState:ct,descendants:Tt,popper:Bt,buttonId:dt,menuId:vt,forceUpdate:Bt.forceUpdate,orientation:"vertical",isOpen:jt,onToggle:Ft,onOpen:Mt,onClose:Dt,menuRef:Ct,buttonRef:Pt,focusedIndex:yt,closeOnSelect:$,closeOnBlur:j,autoSelect:tt,setFocusedIndex:mt,isLazy:rt,lazyBehavior:ut,initialFocusRef:et,rafId:wt}}function useMenuButton(_={},a=null){const $=useMenuContext(),{onToggle:j,popper:et,openAndFocusFirstItem:tt,openAndFocusLastItem:rt}=$,nt=reactExports.useCallback(it=>{const ot=it.key,at={Enter:tt,ArrowDown:tt,ArrowUp:rt}[ot];at&&(it.preventDefault(),it.stopPropagation(),at(it))},[tt,rt]);return{..._,ref:mergeRefs($.buttonRef,a,et.referenceRef),id:$.buttonId,"data-active":dataAttr($.isOpen),"aria-expanded":$.isOpen,"aria-haspopup":"menu","aria-controls":$.menuId,onClick:callAllHandlers$1(_.onClick,j),onKeyDown:callAllHandlers$1(_.onKeyDown,nt)}}function isTargetMenuItem(_){var a;return isHTMLElement$1(_)&&!!((a=_==null?void 0:_.getAttribute("role"))!=null&&a.startsWith("menuitem"))}function useMenuList(_={},a=null){const $=useMenuContext();if(!$)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:j,setFocusedIndex:et,menuRef:tt,isOpen:rt,onClose:nt,menuId:it,isLazy:ot,lazyBehavior:st,unstable__animationState:at}=$,ut=useMenuDescendantsContext(),ht=useShortcut({preventDefault:Pt=>Pt.key!==" "&&isTargetMenuItem(Pt.target)}),bt=reactExports.useCallback(Pt=>{if(!Pt.currentTarget.contains(Pt.target))return;const Tt=Pt.key,Lt={Tab:Ut=>Ut.preventDefault(),Escape:nt,ArrowDown:()=>{const Ut=ut.nextEnabled(j);Ut&&et(Ut.index)},ArrowUp:()=>{const Ut=ut.prevEnabled(j);Ut&&et(Ut.index)}}[Tt];if(Lt){Pt.preventDefault(),Lt(Pt);return}const Nt=ht(Ut=>{const jt=getNextItemFromSearch(ut.values(),Ut,Mt=>{var Dt,Ft;return(Ft=(Dt=Mt==null?void 0:Mt.node)==null?void 0:Dt.textContent)!=null?Ft:""},ut.item(j));if(jt){const Mt=ut.indexOf(jt.node);et(Mt)}});isTargetMenuItem(Pt.target)&&Nt(Pt)},[ut,j,ht,nt,et]),Et=reactExports.useRef(!1);rt&&(Et.current=!0);const Ct=lazyDisclosure({wasSelected:Et.current,enabled:ot,mode:st,isSelected:at.present});return{..._,ref:mergeRefs(tt,a),children:Ct?_.children:null,tabIndex:-1,role:"menu",id:it,style:{..._.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:callAllHandlers$1(_.onKeyDown,bt)}}function useMenuPositioner(_={}){const{popper:a,isOpen:$}=useMenuContext();return a.getPopperProps({..._,style:{visibility:$?"visible":"hidden",..._.style}})}function useMenuItem(_={},a=null){const{onMouseEnter:$,onMouseMove:j,onMouseLeave:et,onClick:tt,onFocus:rt,isDisabled:nt,isFocusable:it,closeOnSelect:ot,type:st,...at}=_,ut=useMenuContext(),{setFocusedIndex:ht,focusedIndex:bt,closeOnSelect:Et,onClose:Ct,menuRef:Pt,isOpen:Tt,menuId:It,rafId:Lt}=ut,Nt=reactExports.useRef(null),Ut=`${It}-menuitem-${reactExports.useId()}`,{index:jt,register:Mt}=useMenuDescendant({disabled:nt&&!it}),Dt=reactExports.useCallback(St=>{$==null||$(St),!nt&&ht(jt)},[ht,jt,nt,$]),Ft=reactExports.useCallback(St=>{j==null||j(St),Nt.current&&!isActiveElement(Nt.current)&&Dt(St)},[Dt,j]),Bt=reactExports.useCallback(St=>{et==null||et(St),!nt&&ht(-1)},[ht,nt,et]),yt=reactExports.useCallback(St=>{tt==null||tt(St),isTargetMenuItem(St.currentTarget)&&(ot??Et)&&Ct()},[Ct,tt,Et,ot]),mt=reactExports.useCallback(St=>{rt==null||rt(St),ht(jt)},[ht,rt,jt]),ct=jt===bt,dt=nt&&!it;useUpdateEffect(()=>{if(Tt)return ct&&!dt&&Nt.current?(Lt.current&&cancelAnimationFrame(Lt.current),Lt.current=requestAnimationFrame(()=>{var St;(St=Nt.current)==null||St.focus({preventScroll:!0}),Lt.current=null})):Pt.current&&!isActiveElement(Pt.current)&&Pt.current.focus({preventScroll:!0}),()=>{Lt.current&&cancelAnimationFrame(Lt.current)}},[ct,dt,Pt,Tt]);const vt=useClickable({onClick:yt,onFocus:mt,onMouseEnter:Dt,onMouseMove:Ft,onMouseLeave:Bt,ref:mergeRefs(Mt,Nt,a),isDisabled:nt,isFocusable:it});return{...at,...vt,type:st??vt.type,id:Ut,role:"menuitem",tabIndex:ct?0:-1}}function isHTMLElement$1(_){var a;if(!isElement(_))return!1;const $=(a=_.ownerDocument.defaultView)!=null?a:window;return _ instanceof $.HTMLElement}function isElement(_){return _!=null&&typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE}var[MenuStylesProvider,useMenuStyles]=createContext$1({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Menu=_=>{const{children:a}=_,$=useMultiStyleConfig("Menu",_),j=omitThemingProps(_),{direction:et}=useTheme(),{descendants:tt,...rt}=useMenu({...j,direction:et}),nt=reactExports.useMemo(()=>rt,[rt]),{isOpen:it,onClose:ot,forceUpdate:st}=nt;return jsxRuntimeExports.jsx(MenuDescendantsProvider,{value:tt,children:jsxRuntimeExports.jsx(MenuProvider,{value:nt,children:jsxRuntimeExports.jsx(MenuStylesProvider,{value:$,children:runIfFn$2(a,{isOpen:it,onClose:ot,forceUpdate:st})})})})};Menu.displayName="Menu";var MenuCommand=forwardRef((_,a)=>{const $=useMenuStyles();return jsxRuntimeExports.jsx(chakra.span,{ref:a,..._,__css:$.command,className:"chakra-menu__command"})});MenuCommand.displayName="MenuCommand";var StyledMenuItem=forwardRef((_,a)=>{const{type:$,...j}=_,et=useMenuStyles(),tt=j.as||$?$??void 0:"button",rt=reactExports.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...et.item}),[et.item]);return jsxRuntimeExports.jsx(chakra.button,{ref:a,type:tt,...j,__css:rt})}),MenuIcon=_=>{const{className:a,children:$,...j}=_,et=useMenuStyles(),tt=reactExports.Children.only($),rt=reactExports.isValidElement(tt)?reactExports.cloneElement(tt,{focusable:"false","aria-hidden":!0,className:cx("chakra-menu__icon",tt.props.className)}):null,nt=cx("chakra-menu__icon-wrapper",a);return jsxRuntimeExports.jsx(chakra.span,{className:nt,...j,__css:et.icon,children:rt})};MenuIcon.displayName="MenuIcon";var MenuItem$1=forwardRef((_,a)=>{const{icon:$,iconSpacing:j="0.75rem",command:et,commandSpacing:tt="0.75rem",children:rt,...nt}=_,it=useMenuItem(nt,a),st=$||et?jsxRuntimeExports.jsx("span",{style:{pointerEvents:"none",flex:1},children:rt}):rt;return jsxRuntimeExports.jsxs(StyledMenuItem,{...it,className:cx("chakra-menu__menuitem",it.className),children:[$&&jsxRuntimeExports.jsx(MenuIcon,{fontSize:"0.8em",marginEnd:j,children:$}),st,et&&jsxRuntimeExports.jsx(MenuCommand,{marginStart:tt,children:et})]})});MenuItem$1.displayName="MenuItem";var motionVariants={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},MenuTransition=chakra(motion.div),MenuList=forwardRef(function(a,$){var j,et;const{rootProps:tt,motionProps:rt,...nt}=a,{isOpen:it,onTransitionEnd:ot,unstable__animationState:st}=useMenuContext(),at=useMenuList(nt,$),ut=useMenuPositioner(tt),ht=useMenuStyles();return jsxRuntimeExports.jsx(chakra.div,{...ut,__css:{zIndex:(et=a.zIndex)!=null?et:(j=ht.list)==null?void 0:j.zIndex},children:jsxRuntimeExports.jsx(MenuTransition,{variants:motionVariants,initial:!1,animate:it?"enter":"exit",__css:{outline:0,...ht.list},...rt,className:cx("chakra-menu__menu-list",at.className),...at,onUpdate:ot,onAnimationComplete:callAll(st.onComplete,at.onAnimationComplete)})})});MenuList.displayName="MenuList";var StyledMenuButton=forwardRef((_,a)=>{const $=useMenuStyles();return jsxRuntimeExports.jsx(chakra.button,{ref:a,..._,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...$.button}})}),MenuButton=forwardRef((_,a)=>{const{children:$,as:j,...et}=_,tt=useMenuButton(et,a),rt=j||StyledMenuButton;return jsxRuntimeExports.jsx(rt,{...tt,className:cx("chakra-menu__menu-button",_.className),children:jsxRuntimeExports.jsx(chakra.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:_.children})})});MenuButton.displayName="MenuButton";var transitions={slideInBottom:{...slideFadeConfig,custom:{offsetY:16,reverse:!0}},slideInRight:{...slideFadeConfig,custom:{offsetX:16,reverse:!0}},slideInTop:{...slideFadeConfig,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...slideFadeConfig,custom:{offsetX:-16,reverse:!0}},scale:{...scaleFadeConfig,custom:{initialScale:.95,reverse:!0}},none:{}},MotionSection$1=chakra(motion.section),getMotionProps=_=>transitions[_||"none"],ModalTransition=reactExports.forwardRef((_,a)=>{const{preset:$,motionProps:j=getMotionProps($),...et}=_;return jsxRuntimeExports.jsx(MotionSection$1,{ref:a,...j,...et})});ModalTransition.displayName="ModalTransition";var __defProp$7=Object.defineProperty,__defNormalProp$2=(_,a,$)=>a in _?__defProp$7(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__publicField$2=(_,a,$)=>(__defNormalProp$2(_,a+"",$),$),ModalManager=class{constructor(){__publicField$2(this,"modals"),this.modals=new Map}add(_){return this.modals.set(_,this.modals.size+1),this.modals.size}remove(_){this.modals.delete(_)}isTopModal(_){return _?this.modals.get(_)===this.modals.size:!1}},modalManager=new ModalManager;function useModalManager(_,a){const[$,j]=reactExports.useState(0);return reactExports.useEffect(()=>{const et=_.current;if(et){if(a){const tt=modalManager.add(et);j(tt)}return()=>{modalManager.remove(et),j(0)}}},[a,_]),$}var getDefaultParent=function(_){if(typeof document>"u")return null;var a=Array.isArray(_)?_[0]:_;return a.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(_){return _&&(_.host||unwrapHost(_.parentNode))},correctTargets=function(_,a){return a.map(function($){if(_.contains($))return $;var j=unwrapHost($);return j&&_.contains(j)?j:(console.error("aria-hidden",$,"in not contained inside",_,". Doing nothing"),null)}).filter(function($){return!!$})},applyAttributeToOthers=function(_,a,$,j){var et=correctTargets(a,Array.isArray(_)?_:[_]);markerMap[$]||(markerMap[$]=new WeakMap);var tt=markerMap[$],rt=[],nt=new Set,it=new Set(et),ot=function(at){!at||nt.has(at)||(nt.add(at),ot(at.parentNode))};et.forEach(ot);var st=function(at){!at||it.has(at)||Array.prototype.forEach.call(at.children,function(ut){if(nt.has(ut))st(ut);else{var ht=ut.getAttribute(j),bt=ht!==null&&ht!=="false",Et=(counterMap.get(ut)||0)+1,Ct=(tt.get(ut)||0)+1;counterMap.set(ut,Et),tt.set(ut,Ct),rt.push(ut),Et===1&&bt&&uncontrolledNodes.set(ut,!0),Ct===1&&ut.setAttribute($,"true"),bt||ut.setAttribute(j,"true")}})};return st(a),nt.clear(),lockCount++,function(){rt.forEach(function(at){var ut=counterMap.get(at)-1,ht=tt.get(at)-1;counterMap.set(at,ut),tt.set(at,ht),ut||(uncontrolledNodes.has(at)||at.removeAttribute(j),uncontrolledNodes.delete(at)),ht||at.removeAttribute($)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(_,a,$){$===void 0&&($="data-aria-hidden");var j=Array.from(Array.isArray(_)?_:[_]),et=getDefaultParent(_);return et?(j.push.apply(j,Array.from(et.querySelectorAll("[aria-live]"))),applyAttributeToOthers(j,et,$,"aria-hidden")):function(){return null}};function useModal(_){const{isOpen:a,onClose:$,id:j,closeOnOverlayClick:et=!0,closeOnEsc:tt=!0,useInert:rt=!0,onOverlayClick:nt,onEsc:it}=_,ot=reactExports.useRef(null),st=reactExports.useRef(null),[at,ut,ht]=useIds(j,"chakra-modal","chakra-modal--header","chakra-modal--body");useAriaHidden(ot,a&&rt);const bt=useModalManager(ot,a),Et=reactExports.useRef(null),Ct=reactExports.useCallback(Dt=>{Et.current=Dt.target},[]),Pt=reactExports.useCallback(Dt=>{Dt.key==="Escape"&&(Dt.stopPropagation(),tt&&($==null||$()),it==null||it())},[tt,$,it]),[Tt,It]=reactExports.useState(!1),[Lt,Nt]=reactExports.useState(!1),Ut=reactExports.useCallback((Dt={},Ft=null)=>({role:"dialog",...Dt,ref:mergeRefs(Ft,ot),id:at,tabIndex:-1,"aria-modal":!0,"aria-labelledby":Tt?ut:void 0,"aria-describedby":Lt?ht:void 0,onClick:callAllHandlers$1(Dt.onClick,Bt=>Bt.stopPropagation())}),[ht,Lt,at,ut,Tt]),jt=reactExports.useCallback(Dt=>{Dt.stopPropagation(),Et.current===Dt.target&&modalManager.isTopModal(ot.current)&&(et&&($==null||$()),nt==null||nt())},[$,et,nt]),Mt=reactExports.useCallback((Dt={},Ft=null)=>({...Dt,ref:mergeRefs(Ft,st),onClick:callAllHandlers$1(Dt.onClick,jt),onKeyDown:callAllHandlers$1(Dt.onKeyDown,Pt),onMouseDown:callAllHandlers$1(Dt.onMouseDown,Ct)}),[Pt,Ct,jt]);return{isOpen:a,onClose:$,headerId:ut,bodyId:ht,setBodyMounted:Nt,setHeaderMounted:It,dialogRef:ot,overlayRef:st,getDialogProps:Ut,getDialogContainerProps:Mt,index:bt}}function useAriaHidden(_,a){const $=_.current;reactExports.useEffect(()=>{if(!(!_.current||!a))return hideOthers(_.current)},[a,_,$])}function useIds(_,...a){const $=reactExports.useId(),j=_||$;return reactExports.useMemo(()=>a.map(et=>`${et}-${j}`),[j,a])}var[ModalStylesProvider,useModalStyles]=createContext$1({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ModalContextProvider,useModalContext]=createContext$1({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Modal=_=>{const a={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,..._},{portalProps:$,children:j,autoFocus:et,trapFocus:tt,initialFocusRef:rt,finalFocusRef:nt,returnFocusOnClose:it,blockScrollOnMount:ot,allowPinchZoom:st,preserveScrollBarGap:at,motionPreset:ut,lockFocusAcrossFrames:ht,onCloseComplete:bt}=a,Et=useMultiStyleConfig("Modal",a),Pt={...useModal(a),autoFocus:et,trapFocus:tt,initialFocusRef:rt,finalFocusRef:nt,returnFocusOnClose:it,blockScrollOnMount:ot,allowPinchZoom:st,preserveScrollBarGap:at,motionPreset:ut,lockFocusAcrossFrames:ht};return jsxRuntimeExports.jsx(ModalContextProvider,{value:Pt,children:jsxRuntimeExports.jsx(ModalStylesProvider,{value:Et,children:jsxRuntimeExports.jsx(AnimatePresence,{onExitComplete:bt,children:Pt.isOpen&&jsxRuntimeExports.jsx(Portal,{...$,children:j})})})})};Modal.displayName="Modal";var zeroRightClassName$1="right-scroll-bar-position",fullWidthClassName$1="width-before-scroll-bar",noScrollbarsClassName$1="with-scroll-bars-hidden",removedBarSizeVariable$1="--removed-body-scroll-bar-size",effectCar$1=createSidecarMedium(),nothing$1=function(){},RemoveScroll$1=reactExports.forwardRef(function(_,a){var $=reactExports.useRef(null),j=reactExports.useState({onScrollCapture:nothing$1,onWheelCapture:nothing$1,onTouchMoveCapture:nothing$1}),et=j[0],tt=j[1],rt=_.forwardProps,nt=_.children,it=_.className,ot=_.removeScrollBar,st=_.enabled,at=_.shards,ut=_.sideCar,ht=_.noIsolation,bt=_.inert,Et=_.allowPinchZoom,Ct=_.as,Pt=Ct===void 0?"div":Ct,Tt=_.gapMode,It=__rest$3(_,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Lt=ut,Nt=useMergeRefs([$,a]),Ut=__assign(__assign({},It),et);return reactExports.createElement(reactExports.Fragment,null,st&&reactExports.createElement(Lt,{sideCar:effectCar$1,removeScrollBar:ot,shards:at,noIsolation:ht,inert:bt,setCallbacks:tt,allowPinchZoom:!!Et,lockRef:$,gapMode:Tt}),rt?reactExports.cloneElement(reactExports.Children.only(nt),__assign(__assign({},Ut),{ref:Nt})):reactExports.createElement(Pt,__assign({},Ut,{className:it,ref:Nt}),nt))});RemoveScroll$1.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll$1.classNames={fullWidth:fullWidthClassName$1,zeroRight:zeroRightClassName$1};var getNonce$1=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var _=document.createElement("style");_.type="text/css";var a=getNonce$1();return a&&_.setAttribute("nonce",a),_}function injectStyles(_,a){_.styleSheet?_.styleSheet.cssText=a:_.appendChild(document.createTextNode(a))}function insertStyleTag(_){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(_)}var stylesheetSingleton=function(){var _=0,a=null;return{add:function($){_==0&&(a=makeStyleTag())&&(injectStyles(a,$),insertStyleTag(a)),_++},remove:function(){_--,!_&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},styleHookSingleton=function(){var _=stylesheetSingleton();return function(a,$){reactExports.useEffect(function(){return _.add(a),function(){_.remove()}},[a&&$])}},styleSingleton=function(){var _=styleHookSingleton(),a=function($){var j=$.styles,et=$.dynamic;return _(j,et),null};return a},zeroGap$1={left:0,top:0,right:0,gap:0},parse$b=function(_){return parseInt(_||"",10)||0},getOffset$1=function(_){var a=window.getComputedStyle(document.body),$=a[_==="padding"?"paddingLeft":"marginLeft"],j=a[_==="padding"?"paddingTop":"marginTop"],et=a[_==="padding"?"paddingRight":"marginRight"];return[parse$b($),parse$b(j),parse$b(et)]},getGapWidth$1=function(_){if(_===void 0&&(_="margin"),typeof window>"u")return zeroGap$1;var a=getOffset$1(_),$=document.documentElement.clientWidth,j=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,j-$+a[2]-a[0])}},Style$1=styleSingleton(),getStyles$1=function(_,a,$,j){var et=_.left,tt=_.top,rt=_.right,nt=_.gap;return $===void 0&&($="margin"),` + `),()=>{document.head.removeChild(st)}},[a]),jsxRuntimeExports.jsx(PopChildMeasure,{isPresent:a,childRef:j,sizeRef:et,children:reactExports.cloneElement(_,{ref:j})})}const PresenceChild=({children:_,initial:a,isPresent:$,onExitComplete:j,custom:et,presenceAffectsLayout:tt,mode:rt})=>{const nt=useConstant(newChildrenMap),it=reactExports.useId(),at=reactExports.useMemo(()=>({id:it,initial:a,isPresent:$,custom:et,onExitComplete:st=>{nt.set(st,!0);for(const ot of nt.values())if(!ot)return;j&&j()},register:st=>(nt.set(st,!1),()=>nt.delete(st))}),tt?[Math.random()]:[$]);return reactExports.useMemo(()=>{nt.forEach((st,ot)=>nt.set(ot,!1))},[$]),reactExports.useEffect(()=>{!$&&!nt.size&&j&&j()},[$]),rt==="popLayout"&&(_=jsxRuntimeExports.jsx(PopChild,{isPresent:$,children:_})),jsxRuntimeExports.jsx(PresenceContext.Provider,{value:at,children:_})};function newChildrenMap(){return new Map}function useUnmountEffect(_){return reactExports.useEffect(()=>()=>_(),[])}const getChildKey=_=>_.key||"";function updateChildLookup(_,a){_.forEach($=>{const j=getChildKey($);a.set(j,$)})}function onlyElements(_){const a=[];return reactExports.Children.forEach(_,$=>{reactExports.isValidElement($)&&a.push($)}),a}const AnimatePresence=({children:_,custom:a,initial:$=!0,onExitComplete:j,exitBeforeEnter:et,presenceAffectsLayout:tt=!0,mode:rt="sync"})=>{const nt=reactExports.useContext(LayoutGroupContext).forceRender||useForceUpdate()[0],it=useIsMounted(),at=onlyElements(_);let st=at;const ot=reactExports.useRef(new Map).current,ut=reactExports.useRef(st),dt=reactExports.useRef(new Map).current,mt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$2(()=>{mt.current=!1,updateChildLookup(at,dt),ut.current=st}),useUnmountEffect(()=>{mt.current=!0,dt.clear(),ot.clear()}),mt.current)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:st.map(Tt=>jsxRuntimeExports.jsx(PresenceChild,{isPresent:!0,initial:$?void 0:!1,presenceAffectsLayout:tt,mode:rt,children:Tt},getChildKey(Tt)))});st=[...st];const xt=ut.current.map(getChildKey),Ct=at.map(getChildKey),Pt=xt.length;for(let Tt=0;Tt{if(Ct.indexOf(kt)!==-1)return;const Lt=dt.get(kt);if(!Lt)return;const Nt=xt.indexOf(kt);let zt=Tt;if(!zt){const jt=()=>{ot.delete(kt);const Mt=Array.from(dt.keys()).filter(Dt=>!Ct.includes(Dt));if(Mt.forEach(Dt=>dt.delete(Dt)),ut.current=at.filter(Dt=>{const Ft=getChildKey(Dt);return Ft===kt||Mt.includes(Ft)}),!ot.size){if(it.current===!1)return;nt(),j&&j()}};zt=jsxRuntimeExports.jsx(PresenceChild,{isPresent:!1,onExitComplete:jt,custom:a,presenceAffectsLayout:tt,mode:rt,children:Lt},getChildKey(Lt)),ot.set(kt,zt)}st.splice(Nt,0,zt)}),st=st.map(Tt=>{const kt=Tt.key;return ot.has(kt)?Tt:jsxRuntimeExports.jsx(PresenceChild,{isPresent:!0,presenceAffectsLayout:tt,mode:rt,children:Tt},getChildKey(Tt))}),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ot.size?st:st.map(Tt=>reactExports.cloneElement(Tt))})};var toastMotionVariants={initial:_=>{const{position:a}=_,$=["top","bottom"].includes(a)?"y":"x";let j=["top-right","bottom-right"].includes(a)?1:-1;return a==="bottom"&&(j=1),{opacity:0,[$]:j*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},ToastComponent=reactExports.memo(_=>{const{id:a,message:$,onCloseComplete:j,onRequestRemove:et,requestClose:tt=!1,position:rt="bottom",duration:nt=5e3,containerStyle:it,motionVariants:at=toastMotionVariants,toastSpacing:st="0.5rem"}=_,[ot,ut]=reactExports.useState(nt),dt=useIsPresent();useUpdateEffect(()=>{dt||j==null||j()},[dt]),useUpdateEffect(()=>{ut(nt)},[nt]);const mt=()=>ut(null),xt=()=>ut(nt),Ct=()=>{dt&&et()};reactExports.useEffect(()=>{dt&&tt&&et()},[dt,tt,et]),useTimeout(Ct,ot);const Pt=reactExports.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:st,...it}),[it,st]),Tt=reactExports.useMemo(()=>getToastStyle(rt),[rt]);return jsxRuntimeExports.jsx(motion.div,{layout:!0,className:"chakra-toast",variants:at,initial:"initial",animate:"animate",exit:"exit",onHoverStart:mt,onHoverEnd:xt,custom:{position:rt},style:Tt,children:jsxRuntimeExports.jsx(chakra.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:Pt,children:runIfFn$2($,{id:a,onClose:Ct})})})});ToastComponent.displayName="ToastComponent";function getToastPlacement(_,a){var $;const j=_??"bottom",tt={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[j];return($=tt==null?void 0:tt[a])!=null?$:j}var fallbackIcon={path:jsxRuntimeExports.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntimeExports.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),jsxRuntimeExports.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),jsxRuntimeExports.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Icon=forwardRef((_,a)=>{const{as:$,viewBox:j,color:et="currentColor",focusable:tt=!1,children:rt,className:nt,__css:it,...at}=_,st=cx("chakra-icon",nt),ot=useStyleConfig("Icon",_),ut={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:et,...it,...ot},dt={ref:a,focusable:tt,className:st,__css:ut},mt=j??fallbackIcon.viewBox;if($&&typeof $!="string")return jsxRuntimeExports.jsx(chakra.svg,{as:$,...dt,...at});const xt=rt??fallbackIcon.path;return jsxRuntimeExports.jsx(chakra.svg,{verticalAlign:"middle",viewBox:mt,...dt,...at,children:xt})});Icon.displayName="Icon";function createIcon(_){const{viewBox:a="0 0 24 24",d:$,displayName:j,defaultProps:et={}}=_,tt=reactExports.Children.toArray(_.path),rt=forwardRef((nt,it)=>jsxRuntimeExports.jsx(Icon,{ref:it,viewBox:a,...et,...nt,children:tt.length?tt:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:$})}));return rt.displayName=j,rt}function CheckIcon$3(_){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function InfoIcon(_){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function WarningIcon$1(_){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var spin=keyframes$1({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Spinner=forwardRef((_,a)=>{const $=useStyleConfig("Spinner",_),{label:j="Loading...",thickness:et="2px",speed:tt="0.45s",emptyColor:rt="transparent",className:nt,...it}=omitThemingProps(_),at=cx("chakra-spinner",nt),st={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:et,borderBottomColor:rt,borderLeftColor:rt,animation:`${spin} ${tt} linear infinite`,...$};return jsxRuntimeExports.jsx(chakra.div,{ref:a,__css:st,className:at,...it,children:j&&jsxRuntimeExports.jsx(chakra.span,{srOnly:!0,children:j})})});Spinner.displayName="Spinner";var[AlertProvider,useAlertContext]=createContext$1({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[AlertStylesProvider,useAlertStyles]=createContext$1({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),STATUSES={info:{icon:InfoIcon,colorScheme:"blue"},warning:{icon:WarningIcon$1,colorScheme:"orange"},success:{icon:CheckIcon$3,colorScheme:"green"},error:{icon:WarningIcon$1,colorScheme:"red"},loading:{icon:Spinner,colorScheme:"blue"}};function getStatusColorScheme(_){return STATUSES[_].colorScheme}function getStatusIcon(_){return STATUSES[_].icon}var AlertDescription=forwardRef(function(a,$){const j=useAlertStyles(),{status:et}=useAlertContext(),tt={display:"inline",...j.description};return jsxRuntimeExports.jsx(chakra.div,{ref:$,"data-status":et,...a,className:cx("chakra-alert__desc",a.className),__css:tt})});AlertDescription.displayName="AlertDescription";function AlertIcon(_){const{status:a}=useAlertContext(),$=getStatusIcon(a),j=useAlertStyles(),et=a==="loading"?j.spinner:j.icon;return jsxRuntimeExports.jsx(chakra.span,{display:"inherit","data-status":a,..._,className:cx("chakra-alert__icon",_.className),__css:et,children:_.children||jsxRuntimeExports.jsx($,{h:"100%",w:"100%"})})}AlertIcon.displayName="AlertIcon";var AlertTitle=forwardRef(function(a,$){const j=useAlertStyles(),{status:et}=useAlertContext();return jsxRuntimeExports.jsx(chakra.div,{ref:$,"data-status":et,...a,className:cx("chakra-alert__title",a.className),__css:j.title})});AlertTitle.displayName="AlertTitle";var Alert=forwardRef(function(a,$){var j;const{status:et="info",addRole:tt=!0,...rt}=omitThemingProps(a),nt=(j=a.colorScheme)!=null?j:getStatusColorScheme(et),it=useMultiStyleConfig("Alert",{...a,colorScheme:nt}),at={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...it.container};return jsxRuntimeExports.jsx(AlertProvider,{value:{status:et},children:jsxRuntimeExports.jsx(AlertStylesProvider,{value:it,children:jsxRuntimeExports.jsx(chakra.div,{"data-status":et,role:tt?"alert":void 0,ref:$,...rt,className:cx("chakra-alert",a.className),__css:at})})})});Alert.displayName="Alert";function CloseIcon(_){return jsxRuntimeExports.jsx(Icon,{focusable:"false","aria-hidden":!0,..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var CloseButton=forwardRef(function(a,$){const j=useStyleConfig("CloseButton",a),{children:et,isDisabled:tt,__css:rt,...nt}=omitThemingProps(a),it={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return jsxRuntimeExports.jsx(chakra.button,{type:"button","aria-label":"Close",ref:$,disabled:tt,__css:{...it,...j,...rt},...nt,children:et||jsxRuntimeExports.jsx(CloseIcon,{width:"1em",height:"1em"})})});CloseButton.displayName="CloseButton";var initialState$b={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},toastStore=createStore$1(initialState$b);function createStore$1(_){let a=_;const $=new Set,j=et=>{a=et(a),$.forEach(tt=>tt())};return{getState:()=>a,subscribe:et=>($.add(et),()=>{j(()=>_),$.delete(et)}),removeToast:(et,tt)=>{j(rt=>({...rt,[tt]:rt[tt].filter(nt=>nt.id!=et)}))},notify:(et,tt)=>{const rt=createToast(et,tt),{position:nt,id:it}=rt;return j(at=>{var st,ot;const dt=nt.includes("top")?[rt,...(st=at[nt])!=null?st:[]]:[...(ot=at[nt])!=null?ot:[],rt];return{...at,[nt]:dt}}),it},update:(et,tt)=>{et&&j(rt=>{const nt={...rt},{position:it,index:at}=findToast(nt,et);return it&&at!==-1&&(nt[it][at]={...nt[it][at],...tt,message:createRenderToast(tt)}),nt})},closeAll:({positions:et}={})=>{j(tt=>(et??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((it,at)=>(it[at]=tt[at].map(st=>({...st,requestClose:!0})),it),{...tt}))},close:et=>{j(tt=>{const rt=getToastPosition(tt,et);return rt?{...tt,[rt]:tt[rt].map(nt=>nt.id==et?{...nt,requestClose:!0}:nt)}:tt})},isActive:et=>!!findToast(toastStore.getState(),et).position}}var counter=0;function createToast(_,a={}){var $,j;counter+=1;const et=($=a.id)!=null?$:counter,tt=(j=a.position)!=null?j:"bottom";return{id:et,message:_,position:tt,duration:a.duration,onCloseComplete:a.onCloseComplete,onRequestRemove:()=>toastStore.removeToast(String(et),tt),status:a.status,requestClose:!1,containerStyle:a.containerStyle}}var Toast=_=>{const{status:a,variant:$="solid",id:j,title:et,isClosable:tt,onClose:rt,description:nt,colorScheme:it,icon:at}=_,st=j?{root:`toast-${j}`,title:`toast-${j}-title`,description:`toast-${j}-description`}:void 0;return jsxRuntimeExports.jsxs(Alert,{addRole:!1,status:a,variant:$,id:st==null?void 0:st.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:it,children:[jsxRuntimeExports.jsx(AlertIcon,{children:at}),jsxRuntimeExports.jsxs(chakra.div,{flex:"1",maxWidth:"100%",children:[et&&jsxRuntimeExports.jsx(AlertTitle,{id:st==null?void 0:st.title,children:et}),nt&&jsxRuntimeExports.jsx(AlertDescription,{id:st==null?void 0:st.description,display:"block",children:nt})]}),tt&&jsxRuntimeExports.jsx(CloseButton,{size:"sm",onClick:rt,position:"absolute",insetEnd:1,top:1})]})};function createRenderToast(_={}){const{render:a,toastComponent:$=Toast}=_;return et=>typeof a=="function"?a({...et,..._}):jsxRuntimeExports.jsx($,{...et,..._})}function createToastFn(_,a){const $=et=>{var tt;return{...a,...et,position:getToastPlacement((tt=et==null?void 0:et.position)!=null?tt:a==null?void 0:a.position,_)}},j=et=>{const tt=$(et),rt=createRenderToast(tt);return toastStore.notify(rt,tt)};return j.update=(et,tt)=>{toastStore.update(et,$(tt))},j.promise=(et,tt)=>{const rt=j({...tt.loading,status:"loading",duration:null});et.then(nt=>j.update(rt,{status:"success",duration:5e3,...runIfFn$2(tt.success,nt)})).catch(nt=>j.update(rt,{status:"error",duration:5e3,...runIfFn$2(tt.error,nt)}))},j.closeAll=toastStore.closeAll,j.close=toastStore.close,j.isActive=toastStore.isActive,j}var[ToastOptionProvider,useToastOptionContext]=createContext$1({name:"ToastOptionsContext",strict:!1}),ToastProvider=_=>{const a=reactExports.useSyncExternalStore(toastStore.subscribe,toastStore.getState,toastStore.getState),{motionVariants:$,component:j=ToastComponent,portalProps:et}=_,rt=Object.keys(a).map(nt=>{const it=a[nt];return jsxRuntimeExports.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${nt}`,id:`chakra-toast-manager-${nt}`,style:getToastListStyle(nt),children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:it.map(at=>jsxRuntimeExports.jsx(j,{motionVariants:$,...at},at.id))})},nt)});return jsxRuntimeExports.jsx(Portal,{...et,children:rt})};function useToast(_){const{theme:a}=useChakra(),$=useToastOptionContext();return reactExports.useMemo(()=>createToastFn(a.direction,{...$,..._}),[_,a.direction,$])}var createChakraProvider=_=>function({children:$,theme:j=_,toastOptions:et,...tt}){return jsxRuntimeExports.jsxs(ChakraProvider$1,{theme:j,...tt,children:[jsxRuntimeExports.jsx(ToastOptionProvider,{value:et==null?void 0:et.defaultOptions,children:$}),jsxRuntimeExports.jsx(ToastProvider,{...et})]})},ChakraProvider=createChakraProvider(theme$1),__defProp$8=Object.defineProperty,__defNormalProp$3=(_,a,$)=>a in _?__defProp$8(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__publicField$3=(_,a,$)=>(__defNormalProp$3(_,typeof a!="symbol"?a+"":a,$),$);function sortNodes(_){return _.sort((a,$)=>{const j=a.compareDocumentPosition($);if(j&Node.DOCUMENT_POSITION_FOLLOWING||j&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(j&Node.DOCUMENT_POSITION_PRECEDING||j&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(j&Node.DOCUMENT_POSITION_DISCONNECTED||j&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var isElement$3=_=>typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE;function getNextIndex(_,a,$){let j=_+1;return $&&j>=a&&(j=0),j}function getPrevIndex(_,a,$){let j=_-1;return $&&j<0&&(j=a),j}var useSafeLayoutEffect$1=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,cast=_=>_,DescendantsManager=class{constructor(){__publicField$3(this,"descendants",new Map),__publicField$3(this,"register",_=>{if(_!=null)return isElement$3(_)?this.registerNode(_):a=>{this.registerNode(a,_)}}),__publicField$3(this,"unregister",_=>{this.descendants.delete(_);const a=sortNodes(Array.from(this.descendants.keys()));this.assignIndex(a)}),__publicField$3(this,"destroy",()=>{this.descendants.clear()}),__publicField$3(this,"assignIndex",_=>{this.descendants.forEach(a=>{const $=_.indexOf(a.node);a.index=$,a.node.dataset.index=a.index.toString()})}),__publicField$3(this,"count",()=>this.descendants.size),__publicField$3(this,"enabledCount",()=>this.enabledValues().length),__publicField$3(this,"values",()=>Array.from(this.descendants.values()).sort((a,$)=>a.index-$.index)),__publicField$3(this,"enabledValues",()=>this.values().filter(_=>!_.disabled)),__publicField$3(this,"item",_=>{if(this.count()!==0)return this.values()[_]}),__publicField$3(this,"enabledItem",_=>{if(this.enabledCount()!==0)return this.enabledValues()[_]}),__publicField$3(this,"first",()=>this.item(0)),__publicField$3(this,"firstEnabled",()=>this.enabledItem(0)),__publicField$3(this,"last",()=>this.item(this.descendants.size-1)),__publicField$3(this,"lastEnabled",()=>{const _=this.enabledValues().length-1;return this.enabledItem(_)}),__publicField$3(this,"indexOf",_=>{var a,$;return _&&($=(a=this.descendants.get(_))==null?void 0:a.index)!=null?$:-1}),__publicField$3(this,"enabledIndexOf",_=>_==null?-1:this.enabledValues().findIndex(a=>a.node.isSameNode(_))),__publicField$3(this,"next",(_,a=!0)=>{const $=getNextIndex(_,this.count(),a);return this.item($)}),__publicField$3(this,"nextEnabled",(_,a=!0)=>{const $=this.item(_);if(!$)return;const j=this.enabledIndexOf($.node),et=getNextIndex(j,this.enabledCount(),a);return this.enabledItem(et)}),__publicField$3(this,"prev",(_,a=!0)=>{const $=getPrevIndex(_,this.count()-1,a);return this.item($)}),__publicField$3(this,"prevEnabled",(_,a=!0)=>{const $=this.item(_);if(!$)return;const j=this.enabledIndexOf($.node),et=getPrevIndex(j,this.enabledCount()-1,a);return this.enabledItem(et)}),__publicField$3(this,"registerNode",(_,a)=>{if(!_||this.descendants.has(_))return;const $=Array.from(this.descendants.keys()).concat(_),j=sortNodes($);a!=null&&a.disabled&&(a.disabled=!!a.disabled);const et={node:_,index:-1,...a};this.descendants.set(_,et),this.assignIndex(j)})}};function assignRef$1(_,a){if(_!=null){if(typeof _=="function"){_(a);return}try{_.current=a}catch{throw new Error(`Cannot assign value '${a}' to ref '${_}'`)}}}function mergeRefs(..._){return a=>{_.forEach($=>{assignRef$1($,a)})}}function useMergeRefs$1(..._){return reactExports.useMemo(()=>mergeRefs(..._),_)}function useDescendants(){const _=reactExports.useRef(new DescendantsManager);return useSafeLayoutEffect$1(()=>()=>_.current.destroy()),_.current}var[DescendantsContextProvider,useDescendantsContext]=createContext$1({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function useDescendant(_){const a=useDescendantsContext(),[$,j]=reactExports.useState(-1),et=reactExports.useRef(null);useSafeLayoutEffect$1(()=>()=>{et.current&&a.unregister(et.current)},[]),useSafeLayoutEffect$1(()=>{if(!et.current)return;const rt=Number(et.current.dataset.index);$!=rt&&!Number.isNaN(rt)&&j(rt)});const tt=cast(_?a.register(_):a.register);return{descendants:a,index:$,enabledIndex:a.enabledIndexOf(et.current),register:mergeRefs(tt,et)}}function createDescendantContext(){return[cast(DescendantsContextProvider),()=>cast(useDescendantsContext()),()=>useDescendants(),et=>useDescendant(et)]}var[AccordionStylesProvider,useAccordionStyles]=createContext$1({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[AccordionItemProvider,useAccordionItemContext]=createContext$1({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[AccordionDescendantsProvider,useAccordionDescendantsContext,useAccordionDescendants,useAccordionDescendant]=createDescendantContext(),AccordionButton=forwardRef(function(a,$){const{getButtonProps:j}=useAccordionItemContext(),et=j(a,$),rt={display:"flex",alignItems:"center",width:"100%",outline:0,...useAccordionStyles().button};return jsxRuntimeExports.jsx(chakra.button,{...et,className:cx("chakra-accordion__button",a.className),__css:rt})});AccordionButton.displayName="AccordionButton";function useControllableState(_){const{value:a,defaultValue:$,onChange:j,shouldUpdate:et=(ut,dt)=>ut!==dt}=_,tt=useCallbackRef$2(j),rt=useCallbackRef$2(et),[nt,it]=reactExports.useState($),at=a!==void 0,st=at?a:nt,ot=useCallbackRef$2(ut=>{const mt=typeof ut=="function"?ut(st):ut;rt(st,mt)&&(at||it(mt),tt(mt))},[at,tt,st,rt]);return[st,ot]}function useAccordion(_){const{onChange:a,defaultIndex:$,index:j,allowMultiple:et,allowToggle:tt,...rt}=_;allowMultipleWarning(_),allowMultipleAndAllowToggleWarning(_);const nt=useAccordionDescendants(),[it,at]=reactExports.useState(-1);reactExports.useEffect(()=>()=>{at(-1)},[]);const[st,ot]=useControllableState({value:j,defaultValue(){return et?$??[]:$??-1},onChange:a});return{index:st,setIndex:ot,htmlProps:rt,getAccordionItemProps:dt=>{let mt=!1;return dt!==null&&(mt=Array.isArray(st)?st.includes(dt):st===dt),{isOpen:mt,onChange:Ct=>{if(dt!==null)if(et&&Array.isArray(st)){const Pt=Ct?st.concat(dt):st.filter(Tt=>Tt!==dt);ot(Pt)}else Ct?ot(dt):tt&&ot(-1)}}},focusedIndex:it,setFocusedIndex:at,descendants:nt}}var[AccordionProvider,useAccordionContext]=createContext$1({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function useAccordionItem(_){const{isDisabled:a,isFocusable:$,id:j,...et}=_,{getAccordionItemProps:tt,setFocusedIndex:rt}=useAccordionContext(),nt=reactExports.useRef(null),it=reactExports.useId(),at=j??it,st=`accordion-button-${at}`,ot=`accordion-panel-${at}`;focusableNotDisabledWarning(_);const{register:ut,index:dt,descendants:mt}=useAccordionDescendant({disabled:a&&!$}),{isOpen:xt,onChange:Ct}=tt(dt===-1?null:dt);warnIfOpenAndDisabled({isOpen:xt,isDisabled:a});const Pt=()=>{Ct==null||Ct(!0)},Tt=()=>{Ct==null||Ct(!1)},kt=reactExports.useCallback(()=>{Ct==null||Ct(!xt),rt(dt)},[dt,rt,xt,Ct]),Lt=reactExports.useCallback(Mt=>{const Ft={ArrowDown:()=>{const Bt=mt.nextEnabled(dt);Bt==null||Bt.node.focus()},ArrowUp:()=>{const Bt=mt.prevEnabled(dt);Bt==null||Bt.node.focus()},Home:()=>{const Bt=mt.firstEnabled();Bt==null||Bt.node.focus()},End:()=>{const Bt=mt.lastEnabled();Bt==null||Bt.node.focus()}}[Mt.key];Ft&&(Mt.preventDefault(),Ft(Mt))},[mt,dt]),Nt=reactExports.useCallback(()=>{rt(dt)},[rt,dt]),zt=reactExports.useCallback(function(Dt={},Ft=null){return{...Dt,type:"button",ref:mergeRefs(ut,nt,Ft),id:st,disabled:!!a,"aria-expanded":!!xt,"aria-controls":ot,onClick:callAllHandlers$1(Dt.onClick,kt),onFocus:callAllHandlers$1(Dt.onFocus,Nt),onKeyDown:callAllHandlers$1(Dt.onKeyDown,Lt)}},[st,a,xt,kt,Nt,Lt,ot,ut]),jt=reactExports.useCallback(function(Dt={},Ft=null){return{...Dt,ref:Ft,role:"region",id:ot,"aria-labelledby":st,hidden:!xt}},[st,xt,ot]);return{isOpen:xt,isDisabled:a,isFocusable:$,onOpen:Pt,onClose:Tt,getButtonProps:zt,getPanelProps:jt,htmlProps:et}}function allowMultipleWarning(_){const a=_.index||_.defaultIndex,$=a!=null&&!Array.isArray(a)&&_.allowMultiple;warn({condition:!!$,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof a},`})}function allowMultipleAndAllowToggleWarning(_){warn({condition:!!(_.allowMultiple&&_.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function focusableNotDisabledWarning(_){warn({condition:!!(_.isFocusable&&!_.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. + `})}function warnIfOpenAndDisabled(_){warn({condition:_.isOpen&&!!_.isDisabled,message:"Cannot open a disabled accordion item"})}function AccordionIcon(_){const{isOpen:a,isDisabled:$}=useAccordionItemContext(),{reduceMotion:j}=useAccordionContext(),et=cx("chakra-accordion__icon",_.className),tt=useAccordionStyles(),rt={opacity:$?.4:1,transform:a?"rotate(-180deg)":void 0,transition:j?void 0:"transform 0.2s",transformOrigin:"center",...tt.icon};return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24","aria-hidden":!0,className:et,__css:rt,..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}AccordionIcon.displayName="AccordionIcon";var AccordionItem=forwardRef(function(a,$){const{children:j,className:et}=a,{htmlProps:tt,...rt}=useAccordionItem(a),it={...useAccordionStyles().container,overflowAnchor:"none"},at=reactExports.useMemo(()=>rt,[rt]);return jsxRuntimeExports.jsx(AccordionItemProvider,{value:at,children:jsxRuntimeExports.jsx(chakra.div,{ref:$,...tt,className:cx("chakra-accordion__item",et),__css:it,children:typeof j=="function"?j({isExpanded:!!rt.isOpen,isDisabled:!!rt.isDisabled}):j})})});AccordionItem.displayName="AccordionItem";var TRANSITION_EASINGS={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},TRANSITION_VARIANTS={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function getSlideTransition(_){var a;switch((a=_==null?void 0:_.direction)!=null?a:"right"){case"right":return TRANSITION_VARIANTS.slideRight;case"left":return TRANSITION_VARIANTS.slideLeft;case"bottom":return TRANSITION_VARIANTS.slideDown;case"top":return TRANSITION_VARIANTS.slideUp;default:return TRANSITION_VARIANTS.slideRight}}var TRANSITION_DEFAULTS={enter:{duration:.2,ease:TRANSITION_EASINGS.easeOut},exit:{duration:.1,ease:TRANSITION_EASINGS.easeIn}},withDelay={enter:(_,a)=>({..._,delay:typeof a=="number"?a:a==null?void 0:a.enter}),exit:(_,a)=>({..._,delay:typeof a=="number"?a:a==null?void 0:a.exit})},isNumeric$1=_=>_!=null&&parseInt(_.toString(),10)>0,defaultTransitions={exit:{height:{duration:.2,ease:TRANSITION_EASINGS.ease},opacity:{duration:.3,ease:TRANSITION_EASINGS.ease}},enter:{height:{duration:.3,ease:TRANSITION_EASINGS.ease},opacity:{duration:.4,ease:TRANSITION_EASINGS.ease}}},variants$4={exit:({animateOpacity:_,startingHeight:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{..._&&{opacity:isNumeric$1(a)?1:0},height:a,transitionEnd:j==null?void 0:j.exit,transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(defaultTransitions.exit,et)}},enter:({animateOpacity:_,endingHeight:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{..._&&{opacity:1},height:a,transitionEnd:j==null?void 0:j.enter,transition:(tt=$==null?void 0:$.enter)!=null?tt:withDelay.enter(defaultTransitions.enter,et)}}},Collapse=reactExports.forwardRef((_,a)=>{const{in:$,unmountOnExit:j,animateOpacity:et=!0,startingHeight:tt=0,endingHeight:rt="auto",style:nt,className:it,transition:at,transitionEnd:st,...ot}=_,[ut,dt]=reactExports.useState(!1);reactExports.useEffect(()=>{const Tt=setTimeout(()=>{dt(!0)});return()=>clearTimeout(Tt)},[]),warn({condition:Number(tt)>0&&!!j,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const mt=parseFloat(tt.toString())>0,xt={startingHeight:tt,endingHeight:rt,animateOpacity:et,transition:ut?at:{enter:{duration:0}},transitionEnd:{enter:st==null?void 0:st.enter,exit:j?st==null?void 0:st.exit:{...st==null?void 0:st.exit,display:mt?"block":"none"}}},Ct=j?$:!0,Pt=$||j?"enter":"exit";return jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,custom:xt,children:Ct&&jsxRuntimeExports.jsx(motion.div,{ref:a,...ot,className:cx("chakra-collapse",it),style:{overflow:"hidden",display:"block",...nt},custom:xt,variants:variants$4,initial:j?"exit":!1,animate:Pt,exit:"exit"})})});Collapse.displayName="Collapse";var variants$3={enter:({transition:_,transitionEnd:a,delay:$}={})=>{var j;return{opacity:1,transition:(j=_==null?void 0:_.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:a==null?void 0:a.enter}},exit:({transition:_,transitionEnd:a,delay:$}={})=>{var j;return{opacity:0,transition:(j=_==null?void 0:_.exit)!=null?j:withDelay.exit(TRANSITION_DEFAULTS.exit,$),transitionEnd:a==null?void 0:a.exit}}},fadeConfig={initial:"exit",animate:"enter",exit:"exit",variants:variants$3},Fade=reactExports.forwardRef(function(a,$){const{unmountOnExit:j,in:et,className:tt,transition:rt,transitionEnd:nt,delay:it,...at}=a,st=et||j?"enter":"exit",ot=j?et&&j:!0,ut={transition:rt,transitionEnd:nt,delay:it};return jsxRuntimeExports.jsx(AnimatePresence,{custom:ut,children:ot&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-fade",tt),custom:ut,...fadeConfig,animate:st,...at})})});Fade.displayName="Fade";var variants$2={exit:({reverse:_,initialScale:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{opacity:0,..._?{scale:a,transitionEnd:j==null?void 0:j.exit}:{transitionEnd:{scale:a,...j==null?void 0:j.exit}},transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(TRANSITION_DEFAULTS.exit,et)}},enter:({transitionEnd:_,transition:a,delay:$})=>{var j;return{opacity:1,scale:1,transition:(j=a==null?void 0:a.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:_==null?void 0:_.enter}}},scaleFadeConfig={initial:"exit",animate:"enter",exit:"exit",variants:variants$2},ScaleFade=reactExports.forwardRef(function(a,$){const{unmountOnExit:j,in:et,reverse:tt=!0,initialScale:rt=.95,className:nt,transition:it,transitionEnd:at,delay:st,...ot}=a,ut=j?et&&j:!0,dt=et||j?"enter":"exit",mt={initialScale:rt,reverse:tt,transition:it,transitionEnd:at,delay:st};return jsxRuntimeExports.jsx(AnimatePresence,{custom:mt,children:ut&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-offset-slide",nt),...scaleFadeConfig,animate:dt,custom:mt,...ot})})});ScaleFade.displayName="ScaleFade";var variants$1={initial:({offsetX:_,offsetY:a,transition:$,transitionEnd:j,delay:et})=>{var tt;return{opacity:0,x:_,y:a,transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(TRANSITION_DEFAULTS.exit,et),transitionEnd:j==null?void 0:j.exit}},enter:({transition:_,transitionEnd:a,delay:$})=>{var j;return{opacity:1,x:0,y:0,transition:(j=_==null?void 0:_.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:a==null?void 0:a.enter}},exit:({offsetY:_,offsetX:a,transition:$,transitionEnd:j,reverse:et,delay:tt})=>{var rt;const nt={x:a,y:_};return{opacity:0,transition:(rt=$==null?void 0:$.exit)!=null?rt:withDelay.exit(TRANSITION_DEFAULTS.exit,tt),...et?{...nt,transitionEnd:j==null?void 0:j.exit}:{transitionEnd:{...nt,...j==null?void 0:j.exit}}}}},slideFadeConfig={initial:"initial",animate:"enter",exit:"exit",variants:variants$1},SlideFade=reactExports.forwardRef(function(a,$){const{unmountOnExit:j,in:et,reverse:tt=!0,className:rt,offsetX:nt=0,offsetY:it=8,transition:at,transitionEnd:st,delay:ot,...ut}=a,dt=j?et&&j:!0,mt=et||j?"enter":"exit",xt={offsetX:nt,offsetY:it,reverse:tt,transition:at,transitionEnd:st,delay:ot};return jsxRuntimeExports.jsx(AnimatePresence,{custom:xt,children:dt&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-offset-slide",rt),custom:xt,...slideFadeConfig,animate:mt,...ut})})});SlideFade.displayName="SlideFade";var defaultTransition={exit:{duration:.15,ease:TRANSITION_EASINGS.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},variants={exit:({direction:_,transition:a,transitionEnd:$,delay:j})=>{var et;const{exit:tt}=getSlideTransition({direction:_});return{...tt,transition:(et=a==null?void 0:a.exit)!=null?et:withDelay.exit(defaultTransition.exit,j),transitionEnd:$==null?void 0:$.exit}},enter:({direction:_,transitionEnd:a,transition:$,delay:j})=>{var et;const{enter:tt}=getSlideTransition({direction:_});return{...tt,transition:(et=$==null?void 0:$.enter)!=null?et:withDelay.enter(defaultTransition.enter,j),transitionEnd:a==null?void 0:a.enter}}},Slide=reactExports.forwardRef(function(a,$){const{direction:j="right",style:et,unmountOnExit:tt,in:rt,className:nt,transition:it,transitionEnd:at,delay:st,motionProps:ot,...ut}=a,dt=getSlideTransition({direction:j}),mt=Object.assign({position:"fixed"},dt.position,et),xt=tt?rt&&tt:!0,Ct=rt||tt?"enter":"exit",Pt={transitionEnd:at,transition:it,direction:j,delay:st};return jsxRuntimeExports.jsx(AnimatePresence,{custom:Pt,children:xt&&jsxRuntimeExports.jsx(motion.div,{...ut,ref:$,initial:"exit",className:cx("chakra-slide",nt),animate:Ct,exit:"exit",custom:Pt,variants,style:mt,...ot})})});Slide.displayName="Slide";var AccordionPanel=forwardRef(function(a,$){const{className:j,motionProps:et,...tt}=a,{reduceMotion:rt}=useAccordionContext(),{getPanelProps:nt,isOpen:it}=useAccordionItemContext(),at=nt(tt,$),st=cx("chakra-accordion__panel",j),ot=useAccordionStyles();rt||delete at.hidden;const ut=jsxRuntimeExports.jsx(chakra.div,{...at,__css:ot.panel,className:st});return rt?ut:jsxRuntimeExports.jsx(Collapse,{in:it,...et,children:ut})});AccordionPanel.displayName="AccordionPanel";var Accordion=forwardRef(function({children:a,reduceMotion:$,...j},et){const tt=useMultiStyleConfig("Accordion",j),rt=omitThemingProps(j),{htmlProps:nt,descendants:it,...at}=useAccordion(rt),st=reactExports.useMemo(()=>({...at,reduceMotion:!!$}),[at,$]);return jsxRuntimeExports.jsx(AccordionDescendantsProvider,{value:it,children:jsxRuntimeExports.jsx(AccordionProvider,{value:st,children:jsxRuntimeExports.jsx(AccordionStylesProvider,{value:tt,children:jsxRuntimeExports.jsx(chakra.div,{ref:et,...nt,className:cx("chakra-accordion",j.className),__css:tt.root,children:a})})})})});Accordion.displayName="Accordion";var NativeImage=forwardRef(function(a,$){const{htmlWidth:j,htmlHeight:et,alt:tt,...rt}=a;return jsxRuntimeExports.jsx("img",{width:j,height:et,ref:$,alt:tt,...rt})});NativeImage.displayName="NativeImage";function useImage(_){const{loading:a,src:$,srcSet:j,onLoad:et,onError:tt,crossOrigin:rt,sizes:nt,ignoreFallback:it}=_,[at,st]=reactExports.useState("pending");reactExports.useEffect(()=>{st($?"loading":"pending")},[$]);const ot=reactExports.useRef(),ut=reactExports.useCallback(()=>{if(!$)return;dt();const mt=new Image;mt.src=$,rt&&(mt.crossOrigin=rt),j&&(mt.srcset=j),nt&&(mt.sizes=nt),a&&(mt.loading=a),mt.onload=xt=>{dt(),st("loaded"),et==null||et(xt)},mt.onerror=xt=>{dt(),st("failed"),tt==null||tt(xt)},ot.current=mt},[$,rt,j,nt,et,tt,a]),dt=()=>{ot.current&&(ot.current.onload=null,ot.current.onerror=null,ot.current=null)};return useSafeLayoutEffect$2(()=>{if(!it)return at==="loading"&&ut(),()=>{dt()}},[at,ut,it]),it?"loaded":at}var shouldShowFallbackImage=(_,a)=>_!=="loaded"&&a==="beforeLoadOrError"||_==="failed"&&a==="onError";function omit$4(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}var Image$1=forwardRef(function(a,$){const{fallbackSrc:j,fallback:et,src:tt,srcSet:rt,align:nt,fit:it,loading:at,ignoreFallback:st,crossOrigin:ot,fallbackStrategy:ut="beforeLoadOrError",referrerPolicy:dt,...mt}=a,xt=j!==void 0||et!==void 0,Ct=at!=null||st||!xt,Pt=useImage({...a,crossOrigin:ot,ignoreFallback:Ct}),Tt=shouldShowFallbackImage(Pt,ut),kt={ref:$,objectFit:it,objectPosition:nt,...Ct?mt:omit$4(mt,["onError","onLoad"])};return Tt?et||jsxRuntimeExports.jsx(chakra.img,{as:NativeImage,className:"chakra-image__placeholder",src:j,...kt}):jsxRuntimeExports.jsx(chakra.img,{as:NativeImage,src:tt,srcSet:rt,crossOrigin:ot,loading:at,referrerPolicy:dt,className:"chakra-image",...kt})});Image$1.displayName="Image";function getValidChildren(_){return reactExports.Children.toArray(_).filter(a=>reactExports.isValidElement(a))}var[ButtonGroupProvider,useButtonGroup]=createContext$1({strict:!1,name:"ButtonGroupContext"});function useButtonType(_){const[a,$]=reactExports.useState(!_);return{ref:reactExports.useCallback(tt=>{tt&&$(tt.tagName==="BUTTON")},[]),type:a?"button":void 0}}function ButtonIcon(_){const{children:a,className:$,...j}=_,et=reactExports.isValidElement(a)?reactExports.cloneElement(a,{"aria-hidden":!0,focusable:!1}):a,tt=cx("chakra-button__icon",$);return jsxRuntimeExports.jsx(chakra.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...j,className:tt,children:et})}ButtonIcon.displayName="ButtonIcon";function ButtonSpinner(_){const{label:a,placement:$,spacing:j="0.5rem",children:et=jsxRuntimeExports.jsx(Spinner,{color:"currentColor",width:"1em",height:"1em"}),className:tt,__css:rt,...nt}=_,it=cx("chakra-button__spinner",tt),at=$==="start"?"marginEnd":"marginStart",st=reactExports.useMemo(()=>({display:"flex",alignItems:"center",position:a?"relative":"absolute",[at]:a?j:0,fontSize:"1em",lineHeight:"normal",...rt}),[rt,a,at,j]);return jsxRuntimeExports.jsx(chakra.div,{className:it,...nt,__css:st,children:et})}ButtonSpinner.displayName="ButtonSpinner";var Button=forwardRef((_,a)=>{const $=useButtonGroup(),j=useStyleConfig("Button",{...$,..._}),{isDisabled:et=$==null?void 0:$.isDisabled,isLoading:tt,isActive:rt,children:nt,leftIcon:it,rightIcon:at,loadingText:st,iconSpacing:ot="0.5rem",type:ut,spinner:dt,spinnerPlacement:mt="start",className:xt,as:Ct,...Pt}=omitThemingProps(_),Tt=reactExports.useMemo(()=>{const zt={...j==null?void 0:j._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...j,...!!$&&{_focus:zt}}},[j,$]),{ref:kt,type:Lt}=useButtonType(Ct),Nt={rightIcon:at,leftIcon:it,iconSpacing:ot,children:nt};return jsxRuntimeExports.jsxs(chakra.button,{ref:useMergeRefs$1(a,kt),as:Ct,type:ut??Lt,"data-active":dataAttr(rt),"data-loading":dataAttr(tt),__css:Tt,className:cx("chakra-button",xt),...Pt,disabled:et||tt,children:[tt&&mt==="start"&&jsxRuntimeExports.jsx(ButtonSpinner,{className:"chakra-button__spinner--start",label:st,placement:"start",spacing:ot,children:dt}),tt?st||jsxRuntimeExports.jsx(chakra.span,{opacity:0,children:jsxRuntimeExports.jsx(ButtonContent,{...Nt})}):jsxRuntimeExports.jsx(ButtonContent,{...Nt}),tt&&mt==="end"&&jsxRuntimeExports.jsx(ButtonSpinner,{className:"chakra-button__spinner--end",label:st,placement:"end",spacing:ot,children:dt})]})});Button.displayName="Button";function ButtonContent(_){const{leftIcon:a,rightIcon:$,children:j,iconSpacing:et}=_;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[a&&jsxRuntimeExports.jsx(ButtonIcon,{marginEnd:et,children:a}),j,$&&jsxRuntimeExports.jsx(ButtonIcon,{marginStart:et,children:$})]})}var IconButton=forwardRef((_,a)=>{const{icon:$,children:j,isRound:et,"aria-label":tt,...rt}=_,nt=$||j,it=reactExports.isValidElement(nt)?reactExports.cloneElement(nt,{"aria-hidden":!0,focusable:!1}):null;return jsxRuntimeExports.jsx(Button,{padding:"0",borderRadius:et?"full":void 0,ref:a,"aria-label":tt,...rt,children:it})});IconButton.displayName="IconButton";var[CardStylesProvider,useCardStyles]=createStylesContext("Card"),CardBody=forwardRef(function(a,$){const{className:j,...et}=a,tt=useCardStyles();return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-card__body",j),__css:tt.body,...et})}),Card=forwardRef(function(a,$){const{className:j,children:et,direction:tt="column",justify:rt,align:nt,...it}=omitThemingProps(a),at=useMultiStyleConfig("Card",a);return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-card",j),__css:{display:"flex",flexDirection:tt,justifyContent:rt,alignItems:nt,position:"relative",minWidth:0,wordWrap:"break-word",...at.container},...it,children:jsxRuntimeExports.jsx(CardStylesProvider,{value:at,children:et})})}),[CheckboxGroupProvider,useCheckboxGroupContext]=createContext$1({name:"CheckboxGroupContext",strict:!1});function useInitialAnimationState(_){const[a,$]=reactExports.useState(_),[j,et]=reactExports.useState(!1);return _!==a&&(et(!0),$(_)),j}function CheckIcon$2(_){return jsxRuntimeExports.jsx(chakra.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},..._,children:jsxRuntimeExports.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function IndeterminateIcon(_){return jsxRuntimeExports.jsx(chakra.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},..._,children:jsxRuntimeExports.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function CheckboxIcon(_){const{isIndeterminate:a,isChecked:$,...j}=_,et=a?IndeterminateIcon:CheckIcon$2;return $||a?jsxRuntimeExports.jsx(chakra.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:jsxRuntimeExports.jsx(et,{...j})}):null}var[FormControlStylesProvider,useFormControlStyles]=createContext$1({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[FormControlProvider,useFormControlContext]=createContext$1({strict:!1,name:"FormControlContext"});function useFormControlProvider(_){const{id:a,isRequired:$,isInvalid:j,isDisabled:et,isReadOnly:tt,...rt}=_,nt=reactExports.useId(),it=a||`field-${nt}`,at=`${it}-label`,st=`${it}-feedback`,ot=`${it}-helptext`,[ut,dt]=reactExports.useState(!1),[mt,xt]=reactExports.useState(!1),[Ct,Pt]=reactExports.useState(!1),Tt=reactExports.useCallback((jt={},Mt=null)=>({id:ot,...jt,ref:mergeRefs(Mt,Dt=>{Dt&&xt(!0)})}),[ot]),kt=reactExports.useCallback((jt={},Mt=null)=>({...jt,ref:Mt,"data-focus":dataAttr(Ct),"data-disabled":dataAttr(et),"data-invalid":dataAttr(j),"data-readonly":dataAttr(tt),id:jt.id!==void 0?jt.id:at,htmlFor:jt.htmlFor!==void 0?jt.htmlFor:it}),[it,et,Ct,j,tt,at]),Lt=reactExports.useCallback((jt={},Mt=null)=>({id:st,...jt,ref:mergeRefs(Mt,Dt=>{Dt&&dt(!0)}),"aria-live":"polite"}),[st]),Nt=reactExports.useCallback((jt={},Mt=null)=>({...jt,...rt,ref:Mt,role:"group","data-focus":dataAttr(Ct),"data-disabled":dataAttr(et),"data-invalid":dataAttr(j),"data-readonly":dataAttr(tt)}),[rt,et,Ct,j,tt]),zt=reactExports.useCallback((jt={},Mt=null)=>({...jt,ref:Mt,role:"presentation","aria-hidden":!0,children:jt.children||"*"}),[]);return{isRequired:!!$,isInvalid:!!j,isReadOnly:!!tt,isDisabled:!!et,isFocused:!!Ct,onFocus:()=>Pt(!0),onBlur:()=>Pt(!1),hasFeedbackText:ut,setHasFeedbackText:dt,hasHelpText:mt,setHasHelpText:xt,id:it,labelId:at,feedbackId:st,helpTextId:ot,htmlProps:rt,getHelpTextProps:Tt,getErrorMessageProps:Lt,getRootProps:Nt,getLabelProps:kt,getRequiredIndicatorProps:zt}}var FormControl=forwardRef(function(a,$){const j=useMultiStyleConfig("Form",a),et=omitThemingProps(a),{getRootProps:tt,htmlProps:rt,...nt}=useFormControlProvider(et),it=cx("chakra-form-control",a.className);return jsxRuntimeExports.jsx(FormControlProvider,{value:nt,children:jsxRuntimeExports.jsx(FormControlStylesProvider,{value:j,children:jsxRuntimeExports.jsx(chakra.div,{...tt({},$),className:it,__css:j.container})})})});FormControl.displayName="FormControl";var FormHelperText=forwardRef(function(a,$){const j=useFormControlContext(),et=useFormControlStyles(),tt=cx("chakra-form__helper-text",a.className);return jsxRuntimeExports.jsx(chakra.div,{...j==null?void 0:j.getHelpTextProps(a,$),__css:et.helperText,className:tt})});FormHelperText.displayName="FormHelperText";var[FormErrorStylesProvider,useFormErrorStyles]=createContext$1({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),FormErrorMessage$1=forwardRef((_,a)=>{const $=useMultiStyleConfig("FormError",_),j=omitThemingProps(_),et=useFormControlContext();return et!=null&&et.isInvalid?jsxRuntimeExports.jsx(FormErrorStylesProvider,{value:$,children:jsxRuntimeExports.jsx(chakra.div,{...et==null?void 0:et.getErrorMessageProps(j,a),className:cx("chakra-form__error-message",_.className),__css:{display:"flex",alignItems:"center",...$.text}})}):null});FormErrorMessage$1.displayName="FormErrorMessage";var FormErrorIcon=forwardRef((_,a)=>{const $=useFormErrorStyles(),j=useFormControlContext();if(!(j!=null&&j.isInvalid))return null;const et=cx("chakra-form__error-icon",_.className);return jsxRuntimeExports.jsx(Icon,{ref:a,"aria-hidden":!0,..._,__css:$.icon,className:et,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});FormErrorIcon.displayName="FormErrorIcon";var FormLabel=forwardRef(function(a,$){var j;const et=useStyleConfig("FormLabel",a),tt=omitThemingProps(a),{className:rt,children:nt,requiredIndicator:it=jsxRuntimeExports.jsx(RequiredIndicator,{}),optionalIndicator:at=null,...st}=tt,ot=useFormControlContext(),ut=(j=ot==null?void 0:ot.getLabelProps(st,$))!=null?j:{ref:$,...st};return jsxRuntimeExports.jsxs(chakra.label,{...ut,className:cx("chakra-form__label",tt.className),__css:{display:"block",textAlign:"start",...et},children:[nt,ot!=null&&ot.isRequired?it:at]})});FormLabel.displayName="FormLabel";var RequiredIndicator=forwardRef(function(a,$){const j=useFormControlContext(),et=useFormControlStyles();if(!(j!=null&&j.isRequired))return null;const tt=cx("chakra-form__required-indicator",a.className);return jsxRuntimeExports.jsx(chakra.span,{...j==null?void 0:j.getRequiredIndicatorProps(a,$),__css:et.requiredIndicator,className:tt})});RequiredIndicator.displayName="RequiredIndicator";function useFormControl(_){const{isDisabled:a,isInvalid:$,isReadOnly:j,isRequired:et,...tt}=useFormControlProps(_);return{...tt,disabled:a,readOnly:j,required:et,"aria-invalid":ariaAttr($),"aria-required":ariaAttr(et),"aria-readonly":ariaAttr(j)}}function useFormControlProps(_){var a,$,j;const et=useFormControlContext(),{id:tt,disabled:rt,readOnly:nt,required:it,isRequired:at,isInvalid:st,isReadOnly:ot,isDisabled:ut,onFocus:dt,onBlur:mt,...xt}=_,Ct=_["aria-describedby"]?[_["aria-describedby"]]:[];return et!=null&&et.hasFeedbackText&&(et!=null&&et.isInvalid)&&Ct.push(et.feedbackId),et!=null&&et.hasHelpText&&Ct.push(et.helpTextId),{...xt,"aria-describedby":Ct.join(" ")||void 0,id:tt??(et==null?void 0:et.id),isDisabled:(a=rt??ut)!=null?a:et==null?void 0:et.isDisabled,isReadOnly:($=nt??ot)!=null?$:et==null?void 0:et.isReadOnly,isRequired:(j=it??at)!=null?j:et==null?void 0:et.isRequired,isInvalid:st??(et==null?void 0:et.isInvalid),onFocus:callAllHandlers$1(et==null?void 0:et.onFocus,dt),onBlur:callAllHandlers$1(et==null?void 0:et.onBlur,mt)}}var visuallyHiddenStyle$1={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},isDom$1=()=>typeof document<"u",hasSetup=!1,modality=null,hasEventBeforeFocus=!1,hasBlurredWindowRecently=!1,handlers=new Set;function trigger(_,a){handlers.forEach($=>$(_,a))}var isMac=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function isValidKey(_){return!(_.metaKey||!isMac&&_.altKey||_.ctrlKey||_.key==="Control"||_.key==="Shift"||_.key==="Meta")}function onKeyboardEvent(_){hasEventBeforeFocus=!0,isValidKey(_)&&(modality="keyboard",trigger("keyboard",_))}function onPointerEvent(_){if(modality="pointer",_.type==="mousedown"||_.type==="pointerdown"){hasEventBeforeFocus=!0;const a=_.composedPath?_.composedPath()[0]:_.target;let $=!1;try{$=a.matches(":focus-visible")}catch{}if($)return;trigger("pointer",_)}}function isVirtualClick(_){return _.mozInputSource===0&&_.isTrusted?!0:_.detail===0&&!_.pointerType}function onClickEvent(_){isVirtualClick(_)&&(hasEventBeforeFocus=!0,modality="virtual")}function onWindowFocus(_){_.target===window||_.target===document||(!hasEventBeforeFocus&&!hasBlurredWindowRecently&&(modality="virtual",trigger("virtual",_)),hasEventBeforeFocus=!1,hasBlurredWindowRecently=!1)}function onWindowBlur$1(){hasEventBeforeFocus=!1,hasBlurredWindowRecently=!0}function isFocusVisible(){return modality!=="pointer"}function setupGlobalFocusEvents(){if(!isDom$1()||hasSetup)return;const{focus:_}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...$){hasEventBeforeFocus=!0,_.apply(this,$)},document.addEventListener("keydown",onKeyboardEvent,!0),document.addEventListener("keyup",onKeyboardEvent,!0),document.addEventListener("click",onClickEvent,!0),window.addEventListener("focus",onWindowFocus,!0),window.addEventListener("blur",onWindowBlur$1,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",onPointerEvent,!0),document.addEventListener("pointermove",onPointerEvent,!0),document.addEventListener("pointerup",onPointerEvent,!0)):(document.addEventListener("mousedown",onPointerEvent,!0),document.addEventListener("mousemove",onPointerEvent,!0),document.addEventListener("mouseup",onPointerEvent,!0)),hasSetup=!0}function trackFocusVisible(_){setupGlobalFocusEvents(),_(isFocusVisible());const a=()=>_(isFocusVisible());return handlers.add(a),()=>{handlers.delete(a)}}function omit$3(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}function useCheckbox(_={}){const a=useFormControlProps(_),{isDisabled:$,isReadOnly:j,isRequired:et,isInvalid:tt,id:rt,onBlur:nt,onFocus:it,"aria-describedby":at}=a,{defaultChecked:st,isChecked:ot,isFocusable:ut,onChange:dt,isIndeterminate:mt,name:xt,value:Ct,tabIndex:Pt=void 0,"aria-label":Tt,"aria-labelledby":kt,"aria-invalid":Lt,...Nt}=_,zt=omit$3(Nt,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),jt=useCallbackRef$2(dt),Mt=useCallbackRef$2(nt),Dt=useCallbackRef$2(it),[Ft,Bt]=reactExports.useState(!1),[yt,bt]=reactExports.useState(!1),[ct,ht]=reactExports.useState(!1),[vt,St]=reactExports.useState(!1);reactExports.useEffect(()=>trackFocusVisible(Bt),[]);const Rt=reactExports.useRef(null),[$t,Et]=reactExports.useState(!0),[At,wt]=reactExports.useState(!!st),Ot=ot!==void 0,tr=Ot?ot:At,nr=reactExports.useCallback(pr=>{if(j||$){pr.preventDefault();return}Ot||wt(tr?pr.target.checked:mt?!0:pr.target.checked),jt==null||jt(pr)},[j,$,tr,Ot,mt,jt]);useSafeLayoutEffect$2(()=>{Rt.current&&(Rt.current.indeterminate=!!mt)},[mt]),useUpdateEffect(()=>{$&&bt(!1)},[$,bt]),useSafeLayoutEffect$2(()=>{const pr=Rt.current;if(!(pr!=null&&pr.form))return;const Ir=()=>{wt(!!st)};return pr.form.addEventListener("reset",Ir),()=>{var kr;return(kr=pr.form)==null?void 0:kr.removeEventListener("reset",Ir)}},[]);const ir=$&&!ut,Wt=reactExports.useCallback(pr=>{pr.key===" "&&St(!0)},[St]),Kt=reactExports.useCallback(pr=>{pr.key===" "&&St(!1)},[St]);useSafeLayoutEffect$2(()=>{if(!Rt.current)return;Rt.current.checked!==tr&&wt(Rt.current.checked)},[Rt.current]);const Jt=reactExports.useCallback((pr={},Ir=null)=>{const kr=lr=>{yt&&lr.preventDefault(),St(!0)};return{...pr,ref:Ir,"data-active":dataAttr(vt),"data-hover":dataAttr(ct),"data-checked":dataAttr(tr),"data-focus":dataAttr(yt),"data-focus-visible":dataAttr(yt&&Ft),"data-indeterminate":dataAttr(mt),"data-disabled":dataAttr($),"data-invalid":dataAttr(tt),"data-readonly":dataAttr(j),"aria-hidden":!0,onMouseDown:callAllHandlers$1(pr.onMouseDown,kr),onMouseUp:callAllHandlers$1(pr.onMouseUp,()=>St(!1)),onMouseEnter:callAllHandlers$1(pr.onMouseEnter,()=>ht(!0)),onMouseLeave:callAllHandlers$1(pr.onMouseLeave,()=>ht(!1))}},[vt,tr,$,yt,Ft,ct,mt,tt,j]),Ht=reactExports.useCallback((pr={},Ir=null)=>({...pr,ref:Ir,"data-active":dataAttr(vt),"data-hover":dataAttr(ct),"data-checked":dataAttr(tr),"data-focus":dataAttr(yt),"data-focus-visible":dataAttr(yt&&Ft),"data-indeterminate":dataAttr(mt),"data-disabled":dataAttr($),"data-invalid":dataAttr(tt),"data-readonly":dataAttr(j)}),[vt,tr,$,yt,Ft,ct,mt,tt,j]),Vt=reactExports.useCallback((pr={},Ir=null)=>({...zt,...pr,ref:mergeRefs(Ir,kr=>{kr&&Et(kr.tagName==="LABEL")}),onClick:callAllHandlers$1(pr.onClick,()=>{var kr;$t||((kr=Rt.current)==null||kr.click(),requestAnimationFrame(()=>{var lr;(lr=Rt.current)==null||lr.focus({preventScroll:!0})}))}),"data-disabled":dataAttr($),"data-checked":dataAttr(tr),"data-invalid":dataAttr(tt)}),[zt,$,tr,tt,$t]),Qt=reactExports.useCallback((pr={},Ir=null)=>({...pr,ref:mergeRefs(Rt,Ir),type:"checkbox",name:xt,value:Ct,id:rt,tabIndex:Pt,onChange:callAllHandlers$1(pr.onChange,nr),onBlur:callAllHandlers$1(pr.onBlur,Mt,()=>bt(!1)),onFocus:callAllHandlers$1(pr.onFocus,Dt,()=>bt(!0)),onKeyDown:callAllHandlers$1(pr.onKeyDown,Wt),onKeyUp:callAllHandlers$1(pr.onKeyUp,Kt),required:et,checked:tr,disabled:ir,readOnly:j,"aria-label":Tt,"aria-labelledby":kt,"aria-invalid":Lt?!!Lt:tt,"aria-describedby":at,"aria-disabled":$,style:visuallyHiddenStyle$1}),[xt,Ct,rt,nr,Mt,Dt,Wt,Kt,et,tr,ir,j,Tt,kt,Lt,tt,at,$,Pt]),dr=reactExports.useCallback((pr={},Ir=null)=>({...pr,ref:Ir,onMouseDown:callAllHandlers$1(pr.onMouseDown,stopEvent$1),"data-disabled":dataAttr($),"data-checked":dataAttr(tr),"data-invalid":dataAttr(tt)}),[tr,$,tt]);return{state:{isInvalid:tt,isFocused:yt,isChecked:tr,isActive:vt,isHovered:ct,isIndeterminate:mt,isDisabled:$,isReadOnly:j,isRequired:et},getRootProps:Vt,getCheckboxProps:Jt,getIndicatorProps:Ht,getInputProps:Qt,getLabelProps:dr,htmlProps:zt}}function stopEvent$1(_){_.preventDefault(),_.stopPropagation()}var controlStyles={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},rootStyles={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},checkAnim=keyframes$1({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),indeterminateOpacityAnim=keyframes$1({from:{opacity:0},to:{opacity:1}}),indeterminateScaleAnim=keyframes$1({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),Checkbox=forwardRef(function(a,$){const j=useCheckboxGroupContext(),et={...j,...a},tt=useMultiStyleConfig("Checkbox",et),rt=omitThemingProps(a),{spacing:nt="0.5rem",className:it,children:at,iconColor:st,iconSize:ot,icon:ut=jsxRuntimeExports.jsx(CheckboxIcon,{}),isChecked:dt,isDisabled:mt=j==null?void 0:j.isDisabled,onChange:xt,inputProps:Ct,...Pt}=rt;let Tt=dt;j!=null&&j.value&&rt.value&&(Tt=j.value.includes(rt.value));let kt=xt;j!=null&&j.onChange&&rt.value&&(kt=callAll(j.onChange,xt));const{state:Lt,getInputProps:Nt,getCheckboxProps:zt,getLabelProps:jt,getRootProps:Mt}=useCheckbox({...Pt,isDisabled:mt,isChecked:Tt,onChange:kt}),Dt=useInitialAnimationState(Lt.isChecked),Ft=reactExports.useMemo(()=>({animation:Dt?Lt.isIndeterminate?`${indeterminateOpacityAnim} 20ms linear, ${indeterminateScaleAnim} 200ms linear`:`${checkAnim} 200ms linear`:void 0,fontSize:ot,color:st,...tt.icon}),[st,ot,Dt,Lt.isIndeterminate,tt.icon]),Bt=reactExports.cloneElement(ut,{__css:Ft,isIndeterminate:Lt.isIndeterminate,isChecked:Lt.isChecked});return jsxRuntimeExports.jsxs(chakra.label,{__css:{...rootStyles,...tt.container},className:cx("chakra-checkbox",it),...Mt(),children:[jsxRuntimeExports.jsx("input",{className:"chakra-checkbox__input",...Nt(Ct,$)}),jsxRuntimeExports.jsx(chakra.span,{__css:{...controlStyles,...tt.control},className:"chakra-checkbox__control",...zt(),children:Bt}),at&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-checkbox__label",...jt(),__css:{marginStart:nt,...tt.label},children:at})]})});Checkbox.displayName="Checkbox";function useEventListener(_,a,$,j){const et=useCallbackRef$2($);return reactExports.useEffect(()=>{const tt=typeof _=="function"?_():_??document;if(!(!$||!tt))return tt.addEventListener(a,et,j),()=>{tt.removeEventListener(a,et,j)}},[a,_,j,et,$]),()=>{const tt=typeof _=="function"?_():_??document;tt==null||tt.removeEventListener(a,et,j)}}function isRefObject$1(_){return"current"in _}var isDom=()=>typeof window<"u";function getPlatform(){var _;const a=navigator.userAgentData;return(_=a==null?void 0:a.platform)!=null?_:navigator.platform}var vn=_=>isDom()&&_.test(navigator.vendor),pt=_=>isDom()&&_.test(getPlatform()),isApple=()=>pt(/mac|iphone|ipad|ipod/i),isSafari=()=>isApple()&&vn(/apple/i);function useFocusOnPointerDown(_){const{ref:a,elements:$,enabled:j}=_,et=()=>{var tt,rt;return(rt=(tt=a.current)==null?void 0:tt.ownerDocument)!=null?rt:document};useEventListener(et,"pointerdown",tt=>{if(!isSafari()||!j)return;const rt=tt.target,it=($??[a]).some(at=>{const st=isRefObject$1(at)?at.current:at;return(st==null?void 0:st.contains(rt))||st===rt});et().activeElement!==rt&&it&&(tt.preventDefault(),rt.focus())})}function _objectWithoutPropertiesLoose$3(_,a){if(_==null)return{};var $={},j=Object.keys(_),et,tt;for(tt=0;tt=0)&&($[et]=_[et]);return $}function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(_){for(var a=1;a0&&tt[tt.length-1])&&(at[0]===6||at[0]===2)){$=0;continue}if(at[0]===3&&(!tt||at[1]>tt[0]&&at[1]=_.length&&(_=void 0),{value:_&&_[j++],done:!_}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(_,a){var $=typeof Symbol=="function"&&_[Symbol.iterator];if(!$)return _;var j=$.call(_),et,tt=[],rt;try{for(;(a===void 0||a-- >0)&&!(et=j.next()).done;)tt.push(et.value)}catch(nt){rt={error:nt}}finally{try{et&&!et.done&&($=j.return)&&$.call(j)}finally{if(rt)throw rt.error}}return tt}function __spreadArray(_,a,$){if($||arguments.length===2)for(var j=0,et=a.length,tt;j1||nt(ut,dt)})})}function nt(ut,dt){try{it(j[ut](dt))}catch(mt){ot(tt[0][3],mt)}}function it(ut){ut.value instanceof __await?Promise.resolve(ut.value.v).then(at,st):ot(tt[0][2],ut)}function at(ut){nt("next",ut)}function st(ut){nt("throw",ut)}function ot(ut,dt){ut(dt),tt.shift(),tt.length&&nt(tt[0][0],tt[0][1])}}function __asyncValues(_){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=_[Symbol.asyncIterator],$;return a?a.call(_):(_=typeof __values=="function"?__values(_):_[Symbol.iterator](),$={},j("next"),j("throw"),j("return"),$[Symbol.asyncIterator]=function(){return this},$);function j(tt){$[tt]=_[tt]&&function(rt){return new Promise(function(nt,it){rt=_[tt](rt),et(nt,it,rt.done,rt.value)})}}function et(tt,rt,nt,it){Promise.resolve(it).then(function(at){tt({value:at,done:nt})},rt)}}typeof SuppressedError=="function"&&SuppressedError;function ItoI(_){return _}function innerCreateMedium(_,a){a===void 0&&(a=ItoI);var $=[],j=!1,et={read:function(){if(j)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return $.length?$[$.length-1]:_},useMedium:function(tt){var rt=a(tt,j);return $.push(rt),function(){$=$.filter(function(nt){return nt!==rt})}},assignSyncMedium:function(tt){for(j=!0;$.length;){var rt=$;$=[],rt.forEach(tt)}$={push:function(nt){return tt(nt)},filter:function(){return $}}},assignMedium:function(tt){j=!0;var rt=[];if($.length){var nt=$;$=[],nt.forEach(tt),rt=$}var it=function(){var st=rt;rt=[],st.forEach(tt)},at=function(){return Promise.resolve().then(it)};at(),$={push:function(st){rt.push(st),at()},filter:function(st){return rt=rt.filter(st),$}}}};return et}function createMedium(_,a){return a===void 0&&(a=ItoI),innerCreateMedium(_,a)}function createSidecarMedium(_){_===void 0&&(_={});var a=innerCreateMedium(null);return a.options=__assign({async:!0,ssr:!1},_),a}var SideCar$2=function(_){var a=_.sideCar,$=__rest$3(_,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var j=a.read();if(!j)throw new Error("Sidecar medium not found");return reactExports.createElement(j,__assign({},$))};SideCar$2.isSideCarExport=!0;function exportSidecar(_,a){return _.useMedium(a),SideCar$2}var mediumFocus=createMedium({},function(_){var a=_.target,$=_.currentTarget;return{target:a,currentTarget:$}}),mediumBlur=createMedium(),mediumEffect=createMedium(),mediumSidecar=createSidecarMedium({async:!0}),emptyArray=[],FocusLock$1=reactExports.forwardRef(function(a,$){var j,et=reactExports.useState(),tt=et[0],rt=et[1],nt=reactExports.useRef(),it=reactExports.useRef(!1),at=reactExports.useRef(null),st=a.children,ot=a.disabled,ut=a.noFocusGuards,dt=a.persistentFocus,mt=a.crossFrame,xt=a.autoFocus;a.allowTextSelection;var Ct=a.group,Pt=a.className,Tt=a.whiteList,kt=a.hasPositiveIndices,Lt=a.shards,Nt=Lt===void 0?emptyArray:Lt,zt=a.as,jt=zt===void 0?"div":zt,Mt=a.lockProps,Dt=Mt===void 0?{}:Mt,Ft=a.sideCar,Bt=a.returnFocus,yt=a.focusOptions,bt=a.onActivation,ct=a.onDeactivation,ht=reactExports.useState({}),vt=ht[0],St=reactExports.useCallback(function(){at.current=at.current||document&&document.activeElement,nt.current&&bt&&bt(nt.current),it.current=!0},[bt]),Rt=reactExports.useCallback(function(){it.current=!1,ct&&ct(nt.current)},[ct]);reactExports.useEffect(function(){ot||(at.current=null)},[]);var $t=reactExports.useCallback(function(Wt){var Kt=at.current;if(Kt&&Kt.focus){var Jt=typeof Bt=="function"?Bt(Kt):Bt;if(Jt){var Ht=typeof Jt=="object"?Jt:void 0;at.current=null,Wt?Promise.resolve().then(function(){return Kt.focus(Ht)}):Kt.focus(Ht)}}},[Bt]),Et=reactExports.useCallback(function(Wt){it.current&&mediumFocus.useMedium(Wt)},[]),At=mediumBlur.useMedium,wt=reactExports.useCallback(function(Wt){nt.current!==Wt&&(nt.current=Wt,rt(Wt))},[]),Ot=_extends$5((j={},j[FOCUS_DISABLED]=ot&&"disabled",j[FOCUS_GROUP]=Ct,j),Dt),tr=ut!==!0,nr=tr&&ut!=="tail",ir=useMergeRefs([$,wt]);return reactExports.createElement(reactExports.Fragment,null,tr&&[reactExports.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:ot?-1:0,style:hiddenGuard}),kt?reactExports.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:ot?-1:1,style:hiddenGuard}):null],!ot&&reactExports.createElement(Ft,{id:vt,sideCar:mediumSidecar,observed:tt,disabled:ot,persistentFocus:dt,crossFrame:mt,autoFocus:xt,whiteList:Tt,shards:Nt,onActivation:St,onDeactivation:Rt,returnFocus:$t,focusOptions:yt}),reactExports.createElement(jt,_extends$5({ref:ir},Ot,{className:Pt,onBlur:At,onFocus:Et}),st),nr&&reactExports.createElement("div",{"data-focus-guard":!0,tabIndex:ot?-1:0,style:hiddenGuard}))});FocusLock$1.propTypes={};FocusLock$1.defaultProps={children:void 0,disabled:!1,returnFocus:!1,focusOptions:void 0,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,hasPositiveIndices:void 0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};function _setPrototypeOf$2(_,a){return _setPrototypeOf$2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,et){return j.__proto__=et,j},_setPrototypeOf$2(_,a)}function _inheritsLoose$1(_,a){_.prototype=Object.create(a.prototype),_.prototype.constructor=_,_setPrototypeOf$2(_,a)}function _typeof$6(_){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof$6(_)}function _toPrimitive(_,a){if(_typeof$6(_)!=="object"||_===null)return _;var $=_[Symbol.toPrimitive];if($!==void 0){var j=$.call(_,a||"default");if(_typeof$6(j)!=="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(_)}function _toPropertyKey(_){var a=_toPrimitive(_,"string");return _typeof$6(a)==="symbol"?a:String(a)}function _defineProperty$8(_,a,$){return a=_toPropertyKey(a),a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}function withSideEffect(_,a){function $(j){return j.displayName||j.name||"Component"}return function(et){var tt=[],rt;function nt(){rt=_(tt.map(function(at){return at.props})),a(rt)}var it=function(at){_inheritsLoose$1(st,at);function st(){return at.apply(this,arguments)||this}st.peek=function(){return rt};var ot=st.prototype;return ot.componentDidMount=function(){tt.push(this),nt()},ot.componentDidUpdate=function(){nt()},ot.componentWillUnmount=function(){var dt=tt.indexOf(this);tt.splice(dt,1),nt()},ot.render=function(){return React$2.createElement(et,this.props)},st}(reactExports.PureComponent);return _defineProperty$8(it,"displayName","SideEffect("+$(et)+")"),it}}var toArray$4=function(_){for(var a=Array(_.length),$=0;$<_.length;++$)a[$]=_[$];return a},asArray=function(_){return Array.isArray(_)?_:[_]},getFirst=function(_){return Array.isArray(_)?_[0]:_},isElementHidden=function(_){if(_.nodeType!==Node.ELEMENT_NODE)return!1;var a=window.getComputedStyle(_,null);return!a||!a.getPropertyValue?!1:a.getPropertyValue("display")==="none"||a.getPropertyValue("visibility")==="hidden"},getParentNode$1=function(_){return _.parentNode&&_.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.parentNode.host:_.parentNode},isTopNode=function(_){return _===document||_&&_.nodeType===Node.DOCUMENT_NODE},isVisibleUncached=function(_,a){return!_||isTopNode(_)||!isElementHidden(_)&&a(getParentNode$1(_))},isVisibleCached=function(_,a){var $=_.get(a);if($!==void 0)return $;var j=isVisibleUncached(a,isVisibleCached.bind(void 0,_));return _.set(a,j),j},isAutoFocusAllowedUncached=function(_,a){return _&&!isTopNode(_)?isAutoFocusAllowed(_)?a(getParentNode$1(_)):!1:!0},isAutoFocusAllowedCached=function(_,a){var $=_.get(a);if($!==void 0)return $;var j=isAutoFocusAllowedUncached(a,isAutoFocusAllowedCached.bind(void 0,_));return _.set(a,j),j},getDataset=function(_){return _.dataset},isHTMLButtonElement=function(_){return _.tagName==="BUTTON"},isHTMLInputElement=function(_){return _.tagName==="INPUT"},isRadioElement=function(_){return isHTMLInputElement(_)&&_.type==="radio"},notHiddenInput=function(_){return!((isHTMLInputElement(_)||isHTMLButtonElement(_))&&(_.type==="hidden"||_.disabled))},isAutoFocusAllowed=function(_){var a=_.getAttribute(FOCUS_NO_AUTOFOCUS);return![!0,"true",""].includes(a)},isGuard=function(_){var a;return!!(_&&(!((a=getDataset(_))===null||a===void 0)&&a.focusGuard))},isNotAGuard=function(_){return!isGuard(_)},isDefined=function(_){return!!_},tabSort=function(_,a){var $=_.tabIndex-a.tabIndex,j=_.index-a.index;if($){if(!_.tabIndex)return 1;if(!a.tabIndex)return-1}return $||j},orderByTabIndex=function(_,a,$){return toArray$4(_).map(function(j,et){return{node:j,index:et,tabIndex:$&&j.tabIndex===-1?(j.dataset||{}).focusGuard?0:-1:j.tabIndex}}).filter(function(j){return!a||j.tabIndex>=0}).sort(tabSort)},tabbables=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],queryTabbables=tabbables.join(","),queryGuardTabbables="".concat(queryTabbables,", [data-focus-guard]"),getFocusablesWithShadowDom=function(_,a){return toArray$4((_.shadowRoot||_).children).reduce(function($,j){return $.concat(j.matches(a?queryGuardTabbables:queryTabbables)?[j]:[],getFocusablesWithShadowDom(j))},[])},getFocusablesWithIFrame=function(_,a){var $;return _ instanceof HTMLIFrameElement&&(!(($=_.contentDocument)===null||$===void 0)&&$.body)?getFocusables([_.contentDocument.body],a):[_]},getFocusables=function(_,a){return _.reduce(function($,j){var et,tt=getFocusablesWithShadowDom(j,a),rt=(et=[]).concat.apply(et,tt.map(function(nt){return getFocusablesWithIFrame(nt,a)}));return $.concat(rt,j.parentNode?toArray$4(j.parentNode.querySelectorAll(queryTabbables)).filter(function(nt){return nt===j}):[])},[])},getParentAutofocusables=function(_){var a=_.querySelectorAll("[".concat(FOCUS_AUTO,"]"));return toArray$4(a).map(function($){return getFocusables([$])}).reduce(function($,j){return $.concat(j)},[])},filterFocusable=function(_,a){return toArray$4(_).filter(function($){return isVisibleCached(a,$)}).filter(function($){return notHiddenInput($)})},filterAutoFocusable=function(_,a){return a===void 0&&(a=new Map),toArray$4(_).filter(function($){return isAutoFocusAllowedCached(a,$)})},getTabbableNodes=function(_,a,$){return orderByTabIndex(filterFocusable(getFocusables(_,$),a),!0,$)},getFocusableNodes=function(_,a){return orderByTabIndex(filterFocusable(getFocusables(_),a),!1)},parentAutofocusables=function(_,a){return filterFocusable(getParentAutofocusables(_),a)},contains$2=function(_,a){return _.shadowRoot?contains$2(_.shadowRoot,a):Object.getPrototypeOf(_).contains!==void 0&&Object.getPrototypeOf(_).contains.call(_,a)?!0:toArray$4(_.children).some(function($){var j;if($ instanceof HTMLIFrameElement){var et=(j=$.contentDocument)===null||j===void 0?void 0:j.body;return et?contains$2(et,a):!1}return contains$2($,a)})},filterNested=function(_){for(var a=new Set,$=_.length,j=0;j<$;j+=1)for(var et=j+1;et<$;et+=1){var tt=_[j].compareDocumentPosition(_[et]);(tt&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&a.add(et),(tt&Node.DOCUMENT_POSITION_CONTAINS)>0&&a.add(j)}return _.filter(function(rt,nt){return!a.has(nt)})},getTopParent=function(_){return _.parentNode?getTopParent(_.parentNode):_},getAllAffectedNodes=function(_){var a=asArray(_);return a.filter(Boolean).reduce(function($,j){var et=j.getAttribute(FOCUS_GROUP);return $.push.apply($,et?filterNested(toArray$4(getTopParent(j).querySelectorAll("[".concat(FOCUS_GROUP,'="').concat(et,'"]:not([').concat(FOCUS_DISABLED,'="disabled"])')))):[j]),$},[])},safeProbe=function(_){try{return _()}catch{return}},getActiveElement$1=function(_){if(_===void 0&&(_=document),!(!_||!_.activeElement)){var a=_.activeElement;return a.shadowRoot?getActiveElement$1(a.shadowRoot):a instanceof HTMLIFrameElement&&safeProbe(function(){return a.contentWindow.document})?getActiveElement$1(a.contentWindow.document):a}},focusInFrame=function(_,a){return _===a},focusInsideIframe=function(_,a){return!!toArray$4(_.querySelectorAll("iframe")).some(function($){return focusInFrame($,a)})},focusInside=function(_,a){return a===void 0&&(a=getActiveElement$1(getFirst(_).ownerDocument)),!a||a.dataset&&a.dataset.focusGuard?!1:getAllAffectedNodes(_).some(function($){return contains$2($,a)||focusInsideIframe($,a)})},focusIsHidden=function(_){_===void 0&&(_=document);var a=getActiveElement$1(_);return a?toArray$4(_.querySelectorAll("[".concat(FOCUS_ALLOW,"]"))).some(function($){return contains$2($,a)}):!1},findSelectedRadio=function(_,a){return a.filter(isRadioElement).filter(function($){return $.name===_.name}).filter(function($){return $.checked})[0]||_},correctNode=function(_,a){return isRadioElement(_)&&_.name?findSelectedRadio(_,a):_},correctNodes=function(_){var a=new Set;return _.forEach(function($){return a.add(correctNode($,_))}),_.filter(function($){return a.has($)})},pickFirstFocus=function(_){return _[0]&&_.length>1?correctNode(_[0],_):_[0]},pickFocusable=function(_,a){return _.length>1?_.indexOf(correctNode(_[a],_)):a},NEW_FOCUS="NEW_FOCUS",newFocus=function(_,a,$,j){var et=_.length,tt=_[0],rt=_[et-1],nt=isGuard($);if(!($&&_.indexOf($)>=0)){var it=$!==void 0?a.indexOf($):-1,at=j?a.indexOf(j):it,st=j?_.indexOf(j):-1,ot=it-at,ut=a.indexOf(tt),dt=a.indexOf(rt),mt=correctNodes(a),xt=$!==void 0?mt.indexOf($):-1,Ct=xt-(j?mt.indexOf(j):it),Pt=pickFocusable(_,0),Tt=pickFocusable(_,et-1);if(it===-1||st===-1)return NEW_FOCUS;if(!ot&&st>=0)return st;if(it<=ut&&nt&&Math.abs(ot)>1)return Tt;if(it>=dt&&nt&&Math.abs(ot)>1)return Pt;if(ot&&Math.abs(Ct)>1)return st;if(it<=ut)return Tt;if(it>dt)return Pt;if(ot)return Math.abs(ot)>1?st:(et+st+ot)%et}},findAutoFocused=function(_){return function(a){var $,j=($=getDataset(a))===null||$===void 0?void 0:$.autofocus;return a.autofocus||j!==void 0&&j!=="false"||_.indexOf(a)>=0}},pickAutofocus=function(_,a,$){var j=_.map(function(tt){var rt=tt.node;return rt}),et=filterAutoFocusable(j.filter(findAutoFocused($)));return et&&et.length?pickFirstFocus(et):pickFirstFocus(filterAutoFocusable(a))},getParents=function(_,a){return a===void 0&&(a=[]),a.push(_),_.parentNode&&getParents(_.parentNode.host||_.parentNode,a),a},getCommonParent=function(_,a){for(var $=getParents(_),j=getParents(a),et=0;et<$.length;et+=1){var tt=$[et];if(j.indexOf(tt)>=0)return tt}return!1},getTopCommonParent=function(_,a,$){var j=asArray(_),et=asArray(a),tt=j[0],rt=!1;return et.filter(Boolean).forEach(function(nt){rt=getCommonParent(rt||nt,nt)||rt,$.filter(Boolean).forEach(function(it){var at=getCommonParent(tt,it);at&&(!rt||contains$2(at,rt)?rt=at:rt=getCommonParent(at,rt))})}),rt},allParentAutofocusables=function(_,a){return _.reduce(function($,j){return $.concat(parentAutofocusables(j,a))},[])},reorderNodes=function(_,a){var $=new Map;return a.forEach(function(j){return $.set(j.node,j)}),_.map(function(j){return $.get(j)}).filter(isDefined)},focusSolver=function(_,a){var $=getActiveElement$1(asArray(_).length>0?document:getFirst(_).ownerDocument),j=getAllAffectedNodes(_).filter(isNotAGuard),et=getTopCommonParent($||_,_,j),tt=new Map,rt=getFocusableNodes(j,tt),nt=getTabbableNodes(j,tt).filter(function(dt){var mt=dt.node;return isNotAGuard(mt)});if(!(!nt[0]&&(nt=rt,!nt[0]))){var it=getFocusableNodes([et],tt).map(function(dt){var mt=dt.node;return mt}),at=reorderNodes(it,nt),st=at.map(function(dt){var mt=dt.node;return mt}),ot=newFocus(st,it,$,a);if(ot===NEW_FOCUS){var ut=pickAutofocus(rt,st,allParentAutofocusables(j,tt));if(ut)return{node:ut};console.warn("focus-lock: cannot find any node to move focus into");return}return ot===void 0?ot:at[ot]}},expandFocusableNodes=function(_){var a=getAllAffectedNodes(_).filter(isNotAGuard),$=getTopCommonParent(_,_,a),j=new Map,et=getTabbableNodes([$],j,!0),tt=getTabbableNodes(a,j).filter(function(rt){var nt=rt.node;return isNotAGuard(nt)}).map(function(rt){var nt=rt.node;return nt});return et.map(function(rt){var nt=rt.node,it=rt.index;return{node:nt,index:it,lockItem:tt.indexOf(nt)>=0,guard:isGuard(nt)}})},focusOn=function(_,a){"focus"in _&&_.focus(a),"contentWindow"in _&&_.contentWindow&&_.contentWindow.focus()},guardCount=0,lockDisabled=!1,moveFocusInside=function(_,a,$){$===void 0&&($={});var j=focusSolver(_,a);if(!lockDisabled&&j){if(guardCount>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),lockDisabled=!0,setTimeout(function(){lockDisabled=!1},1);return}guardCount++,focusOn(j.node,$.focusOptions),guardCount--}};function deferAction(_){setTimeout(_,1)}var focusOnBody=function(){return document&&document.activeElement===document.body},isFreeFocus=function(){return focusOnBody()||focusIsHidden()},lastActiveTrap=null,lastActiveFocus=null,lastPortaledElement=null,focusWasOutsideWindow=!1,defaultWhitelist=function(){return!0},focusWhitelisted=function(a){return(lastActiveTrap.whiteList||defaultWhitelist)(a)},recordPortal=function(a,$){lastPortaledElement={observerNode:a,portaledElement:$}},focusIsPortaledPair=function(a){return lastPortaledElement&&lastPortaledElement.portaledElement===a};function autoGuard(_,a,$,j){var et=null,tt=_;do{var rt=j[tt];if(rt.guard)rt.node.dataset.focusAutoGuard&&(et=rt);else if(rt.lockItem){if(tt!==_)return;et=null}else break}while((tt+=$)!==a);et&&(et.node.tabIndex=0)}var extractRef$2=function(a){return a&&"current"in a?a.current:a},focusWasOutside=function(a){return a?!!focusWasOutsideWindow:focusWasOutsideWindow==="meanwhile"},checkInHost=function _(a,$,j){return $&&($.host===a&&(!$.activeElement||j.contains($.activeElement))||$.parentNode&&_(a,$.parentNode,j))},withinHost=function(a,$){return $.some(function(j){return checkInHost(a,j,j)})},activateTrap=function(){var a=!1;if(lastActiveTrap){var $=lastActiveTrap,j=$.observed,et=$.persistentFocus,tt=$.autoFocus,rt=$.shards,nt=$.crossFrame,it=$.focusOptions,at=j||lastPortaledElement&&lastPortaledElement.portaledElement,st=document&&document.activeElement;if(at){var ot=[at].concat(rt.map(extractRef$2).filter(Boolean));if((!st||focusWhitelisted(st))&&(et||focusWasOutside(nt)||!isFreeFocus()||!lastActiveFocus&&tt)&&(at&&!(focusInside(ot)||st&&withinHost(st,ot)||focusIsPortaledPair(st))&&(document&&!lastActiveFocus&&st&&!tt?(st.blur&&st.blur(),document.body.focus()):(a=moveFocusInside(ot,lastActiveFocus,{focusOptions:it}),lastPortaledElement={})),focusWasOutsideWindow=!1,lastActiveFocus=document&&document.activeElement),document){var ut=document&&document.activeElement,dt=expandFocusableNodes(ot),mt=dt.map(function(xt){var Ct=xt.node;return Ct}).indexOf(ut);mt>-1&&(dt.filter(function(xt){var Ct=xt.guard,Pt=xt.node;return Ct&&Pt.dataset.focusAutoGuard}).forEach(function(xt){var Ct=xt.node;return Ct.removeAttribute("tabIndex")}),autoGuard(mt,dt.length,1,dt),autoGuard(mt,-1,-1,dt))}}}return a},onTrap=function(a){activateTrap()&&a&&(a.stopPropagation(),a.preventDefault())},onBlur=function(){return deferAction(activateTrap)},onFocus=function(a){var $=a.target,j=a.currentTarget;j.contains($)||recordPortal(j,$)},FocusWatcher=function(){return null},onWindowBlur=function(){focusWasOutsideWindow="just",deferAction(function(){focusWasOutsideWindow="meanwhile"})},attachHandler=function(){document.addEventListener("focusin",onTrap),document.addEventListener("focusout",onBlur),window.addEventListener("blur",onWindowBlur)},detachHandler=function(){document.removeEventListener("focusin",onTrap),document.removeEventListener("focusout",onBlur),window.removeEventListener("blur",onWindowBlur)};function reducePropsToState(_){return _.filter(function(a){var $=a.disabled;return!$})}function handleStateChangeOnClient(_){var a=_.slice(-1)[0];a&&!lastActiveTrap&&attachHandler();var $=lastActiveTrap,j=$&&a&&a.id===$.id;lastActiveTrap=a,$&&!j&&($.onDeactivation(),_.filter(function(et){var tt=et.id;return tt===$.id}).length||$.returnFocus(!a)),a?(lastActiveFocus=null,(!j||$.observed!==a.observed)&&a.onActivation(),activateTrap(),deferAction(activateTrap)):(detachHandler(),lastActiveFocus=null)}mediumFocus.assignSyncMedium(onFocus);mediumBlur.assignMedium(onBlur);mediumEffect.assignMedium(function(_){return _({moveFocusInside,focusInside})});const FocusTrap$1=withSideEffect(reducePropsToState,handleStateChangeOnClient)(FocusWatcher);var FocusLockCombination=reactExports.forwardRef(function(a,$){return reactExports.createElement(FocusLock$1,_extends$5({sideCar:FocusTrap$1,ref:$},a))}),_ref=FocusLock$1.propTypes||{};_ref.sideCar;_objectWithoutPropertiesLoose$3(_ref,["sideCar"]);FocusLockCombination.propTypes={};function isElement$2(_){return _!=null&&typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE}function isHTMLElement$3(_){var a;if(!isElement$2(_))return!1;const $=(a=_.ownerDocument.defaultView)!=null?a:window;return _ instanceof $.HTMLElement}function getOwnerWindow(_){var a,$;return($=(a=getOwnerDocument$2(_))==null?void 0:a.defaultView)!=null?$:window}function getOwnerDocument$2(_){return isElement$2(_)?_.ownerDocument:document}function getActiveElement(_){return getOwnerDocument$2(_).activeElement}function isScrollParent$1(_){const a=_.ownerDocument.defaultView||window,{overflow:$,overflowX:j,overflowY:et}=a.getComputedStyle(_);return/auto|scroll|overlay|hidden/.test($+et+j)}function getParent(_){return _.localName==="html"?_:_.assignedSlot||_.parentElement||_.ownerDocument.documentElement}function getScrollParent$1(_){return["html","body","#document"].includes(_.localName)?_.ownerDocument.body:isHTMLElement$3(_)&&isScrollParent$1(_)?_:getScrollParent$1(getParent(_))}var hasTabIndex=_=>_.hasAttribute("tabindex"),hasNegativeTabIndex=_=>hasTabIndex(_)&&_.tabIndex===-1;function isDisabled(_){return!!_.getAttribute("disabled")||!!_.getAttribute("aria-disabled")}function isHidden(_){return _.parentElement&&isHidden(_.parentElement)?!0:_.hidden}function isContentEditable(_){const a=_.getAttribute("contenteditable");return a!=="false"&&a!=null}function isFocusable(_){if(!isHTMLElement$3(_)||isHidden(_)||isDisabled(_))return!1;const{localName:a}=_;if(["input","select","textarea","button"].indexOf(a)>=0)return!0;const j={a:()=>_.hasAttribute("href"),audio:()=>_.hasAttribute("controls"),video:()=>_.hasAttribute("controls")};return a in j?j[a]():isContentEditable(_)?!0:hasTabIndex(_)}function isTabbable(_){return _?isHTMLElement$3(_)&&isFocusable(_)&&!hasNegativeTabIndex(_):!1}var focusableElList=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],focusableElSelector=focusableElList.join(),isVisible=_=>_.offsetWidth>0&&_.offsetHeight>0;function getAllFocusable(_){const a=Array.from(_.querySelectorAll(focusableElSelector));return a.unshift(_),a.filter($=>isFocusable($)&&isVisible($))}var _a$3,FocusTrap=(_a$3=FocusLockCombination.default)!=null?_a$3:FocusLockCombination,FocusLock=_=>{const{initialFocusRef:a,finalFocusRef:$,contentRef:j,restoreFocus:et,children:tt,isDisabled:rt,autoFocus:nt,persistentFocus:it,lockFocusAcrossFrames:at}=_,st=reactExports.useCallback(()=>{a!=null&&a.current?a.current.focus():j!=null&&j.current&&getAllFocusable(j.current).length===0&&requestAnimationFrame(()=>{var mt;(mt=j.current)==null||mt.focus()})},[a,j]),ot=reactExports.useCallback(()=>{var dt;(dt=$==null?void 0:$.current)==null||dt.focus()},[$]),ut=et&&!$;return jsxRuntimeExports.jsx(FocusTrap,{crossFrame:at,persistentFocus:it,autoFocus:nt,disabled:rt,onActivation:st,onDeactivation:ot,returnFocus:ut,children:tt})};FocusLock.displayName="FocusLock";var useSafeLayoutEffect=isBrowser$2?reactExports.useLayoutEffect:reactExports.useEffect;function useCallbackRef(_,a=[]){const $=reactExports.useRef(_);return useSafeLayoutEffect(()=>{$.current=_}),reactExports.useCallback((...j)=>{var et;return(et=$.current)==null?void 0:et.call($,...j)},a)}function useOutsideClick$1(_){const{ref:a,handler:$,enabled:j=!0}=_,et=useCallbackRef($),rt=reactExports.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;reactExports.useEffect(()=>{if(!j)return;const nt=ot=>{isValidEvent$1(ot,a)&&(rt.isPointerDown=!0)},it=ot=>{if(rt.ignoreEmulatedMouseEvents){rt.ignoreEmulatedMouseEvents=!1;return}rt.isPointerDown&&$&&isValidEvent$1(ot,a)&&(rt.isPointerDown=!1,et(ot))},at=ot=>{rt.ignoreEmulatedMouseEvents=!0,$&&rt.isPointerDown&&isValidEvent$1(ot,a)&&(rt.isPointerDown=!1,et(ot))},st=getOwnerDocument$3(a.current);return st.addEventListener("mousedown",nt,!0),st.addEventListener("mouseup",it,!0),st.addEventListener("touchstart",nt,!0),st.addEventListener("touchend",at,!0),()=>{st.removeEventListener("mousedown",nt,!0),st.removeEventListener("mouseup",it,!0),st.removeEventListener("touchstart",nt,!0),st.removeEventListener("touchend",at,!0)}},[$,a,et,rt,j])}function isValidEvent$1(_,a){var $;const j=_.target;return j&&!getOwnerDocument$3(j).contains(j)?!1:!(($=a.current)!=null&&$.contains(j))}function useId(_,a){const $=reactExports.useId();return reactExports.useMemo(()=>_||[a,$].filter(Boolean).join("-"),[_,a,$])}function useControllableProp(_,a){const $=_!==void 0;return[$,$&&typeof _<"u"?_:a]}function useDisclosure$1(_={}){const{onClose:a,onOpen:$,isOpen:j,id:et}=_,tt=useCallbackRef($),rt=useCallbackRef(a),[nt,it]=reactExports.useState(_.defaultIsOpen||!1),[at,st]=useControllableProp(j,nt),ot=useId(et,"disclosure"),ut=reactExports.useCallback(()=>{at||it(!1),rt==null||rt()},[at,rt]),dt=reactExports.useCallback(()=>{at||it(!0),tt==null||tt()},[at,tt]),mt=reactExports.useCallback(()=>{(st?ut:dt)()},[st,dt,ut]);return{isOpen:!!st,onOpen:dt,onClose:ut,onToggle:mt,isControlled:at,getButtonProps:(xt={})=>({...xt,"aria-expanded":st,"aria-controls":ot,onClick:callAllHandlers(xt.onClick,mt)}),getDisclosureProps:(xt={})=>({...xt,hidden:!st,id:ot})}}var[InputGroupStylesProvider,useInputGroupStyles]=createContext$1({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),InputGroup=forwardRef(function(a,$){const j=useMultiStyleConfig("Input",a),{children:et,className:tt,...rt}=omitThemingProps(a),nt=cx("chakra-input__group",tt),it={},at=getValidChildren(et),st=j.field;at.forEach(ut=>{var dt,mt;j&&(st&&ut.type.id==="InputLeftElement"&&(it.paddingStart=(dt=st.height)!=null?dt:st.h),st&&ut.type.id==="InputRightElement"&&(it.paddingEnd=(mt=st.height)!=null?mt:st.h),ut.type.id==="InputRightAddon"&&(it.borderEndRadius=0),ut.type.id==="InputLeftAddon"&&(it.borderStartRadius=0))});const ot=at.map(ut=>{var dt,mt;const xt=compact$1({size:((dt=ut.props)==null?void 0:dt.size)||a.size,variant:((mt=ut.props)==null?void 0:mt.variant)||a.variant});return ut.type.id!=="Input"?reactExports.cloneElement(ut,xt):reactExports.cloneElement(ut,Object.assign(xt,it,ut.props))});return jsxRuntimeExports.jsx(chakra.div,{className:nt,ref:$,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...j.group},"data-group":!0,...rt,children:jsxRuntimeExports.jsx(InputGroupStylesProvider,{value:j,children:ot})})});InputGroup.displayName="InputGroup";var StyledInputElement=chakra("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),InputElement=forwardRef(function(a,$){var j,et;const{placement:tt="left",...rt}=a,nt=useInputGroupStyles(),it=nt.field,st={[tt==="left"?"insetStart":"insetEnd"]:"0",width:(j=it==null?void 0:it.height)!=null?j:it==null?void 0:it.h,height:(et=it==null?void 0:it.height)!=null?et:it==null?void 0:it.h,fontSize:it==null?void 0:it.fontSize,...nt.element};return jsxRuntimeExports.jsx(StyledInputElement,{ref:$,__css:st,...rt})});InputElement.id="InputElement";InputElement.displayName="InputElement";var InputLeftElement=forwardRef(function(a,$){const{className:j,...et}=a,tt=cx("chakra-input__left-element",j);return jsxRuntimeExports.jsx(InputElement,{ref:$,placement:"left",className:tt,...et})});InputLeftElement.id="InputLeftElement";InputLeftElement.displayName="InputLeftElement";var InputRightElement=forwardRef(function(a,$){const{className:j,...et}=a,tt=cx("chakra-input__right-element",j);return jsxRuntimeExports.jsx(InputElement,{ref:$,placement:"right",className:tt,...et})});InputRightElement.id="InputRightElement";InputRightElement.displayName="InputRightElement";var Input=forwardRef(function(a,$){const{htmlSize:j,...et}=a,tt=useMultiStyleConfig("Input",et),rt=omitThemingProps(et),nt=useFormControl(rt),it=cx("chakra-input",a.className);return jsxRuntimeExports.jsx(chakra.input,{size:j,...nt,__css:tt.field,ref:$,className:it})});Input.displayName="Input";Input.id="Input";var Link$1=forwardRef(function(a,$){const j=useStyleConfig("Link",a),{className:et,isExternal:tt,...rt}=omitThemingProps(a);return jsxRuntimeExports.jsx(chakra.a,{target:tt?"_blank":void 0,rel:tt?"noopener":void 0,ref:$,className:cx("chakra-link",et),...rt,__css:j})});Link$1.displayName="Link";var[ListStylesProvider,useListStyles]=createContext$1({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),List=forwardRef(function(a,$){const j=useMultiStyleConfig("List",a),{children:et,styleType:tt="none",stylePosition:rt,spacing:nt,...it}=omitThemingProps(a),at=getValidChildren(et),ot=nt?{["& > *:not(style) ~ *:not(style)"]:{mt:nt}}:{};return jsxRuntimeExports.jsx(ListStylesProvider,{value:j,children:jsxRuntimeExports.jsx(chakra.ul,{ref:$,listStyleType:tt,listStylePosition:rt,role:"list",__css:{...j.container,...ot},...it,children:at})})});List.displayName="List";var OrderedList=forwardRef((_,a)=>{const{as:$,...j}=_;return jsxRuntimeExports.jsx(List,{ref:a,as:"ol",styleType:"decimal",marginStart:"1em",...j})});OrderedList.displayName="OrderedList";var UnorderedList=forwardRef(function(a,$){const{as:j,...et}=a;return jsxRuntimeExports.jsx(List,{ref:$,as:"ul",styleType:"initial",marginStart:"1em",...et})});UnorderedList.displayName="UnorderedList";var ListItem=forwardRef(function(a,$){const j=useListStyles();return jsxRuntimeExports.jsx(chakra.li,{ref:$,...a,__css:j.item})});ListItem.displayName="ListItem";var ListIcon=forwardRef(function(a,$){const j=useListStyles();return jsxRuntimeExports.jsx(Icon,{ref:$,role:"presentation",...a,__css:j.icon})});ListIcon.displayName="ListIcon";var Grid=forwardRef(function(a,$){const{templateAreas:j,gap:et,rowGap:tt,columnGap:rt,column:nt,row:it,autoFlow:at,autoRows:st,templateRows:ot,autoColumns:ut,templateColumns:dt,...mt}=a,xt={display:"grid",gridTemplateAreas:j,gridGap:et,gridRowGap:tt,gridColumnGap:rt,gridAutoColumns:ut,gridColumn:nt,gridRow:it,gridAutoFlow:at,gridAutoRows:st,gridTemplateRows:ot,gridTemplateColumns:dt};return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:xt,...mt})});Grid.displayName="Grid";function mapResponsive(_,a){return Array.isArray(_)?_.map($=>$===null?null:a($)):isObject$5(_)?Object.keys(_).reduce(($,j)=>($[j]=a(_[j]),$),{}):_!=null?a(_):null}var SimpleGrid=forwardRef(function(a,$){const{columns:j,spacingX:et,spacingY:tt,spacing:rt,minChildWidth:nt,...it}=a,at=useTheme(),st=nt?widthToColumns(nt,at):countToColumns(j);return jsxRuntimeExports.jsx(Grid,{ref:$,gap:rt,columnGap:et,rowGap:tt,templateColumns:st,...it})});SimpleGrid.displayName="SimpleGrid";function toPx(_){return typeof _=="number"?`${_}px`:_}function widthToColumns(_,a){return mapResponsive(_,$=>{const j=getToken("sizes",$,toPx($))(a);return $===null?null:`repeat(auto-fit, minmax(${j}, 1fr))`})}function countToColumns(_){return mapResponsive(_,a=>a===null?null:`repeat(${a}, minmax(0, 1fr))`)}var Text=forwardRef(function(a,$){const j=useStyleConfig("Text",a),{className:et,align:tt,decoration:rt,casing:nt,...it}=omitThemingProps(a),at=compact$1({textAlign:a.align,textDecoration:a.decoration,textTransform:a.casing});return jsxRuntimeExports.jsx(chakra.p,{ref:$,className:cx("chakra-text",a.className),...at,...it,__css:j})});Text.displayName="Text";var Wrap=forwardRef(function(a,$){const{spacing:j="0.5rem",spacingX:et,spacingY:tt,children:rt,justify:nt,direction:it,align:at,className:st,shouldWrapChildren:ot,...ut}=a,dt=reactExports.useMemo(()=>ot?reactExports.Children.map(rt,(mt,xt)=>jsxRuntimeExports.jsx(WrapItem,{children:mt},xt)):rt,[rt,ot]);return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-wrap",st),...ut,children:jsxRuntimeExports.jsx(chakra.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:nt,alignItems:at,flexDirection:it,listStyleType:"none",gap:j,columnGap:et,rowGap:tt,padding:"0"},children:dt})})});Wrap.displayName="Wrap";var WrapItem=forwardRef(function(a,$){const{className:j,...et}=a;return jsxRuntimeExports.jsx(chakra.li,{ref:$,__css:{display:"flex",alignItems:"flex-start"},className:cx("chakra-wrap__listitem",j),...et})});WrapItem.displayName="WrapItem";var StackItem=_=>jsxRuntimeExports.jsx(chakra.div,{className:"chakra-stack__item",..._,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,..._.__css}});StackItem.displayName="StackItem";function getDividerStyles(_){const{spacing:a,direction:$}=_,j={column:{my:a,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:a,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:a,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:a,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":mapResponsive($,et=>j[et])}}var Stack=forwardRef((_,a)=>{const{isInline:$,direction:j,align:et,justify:tt,spacing:rt="0.5rem",wrap:nt,children:it,divider:at,className:st,shouldWrapChildren:ot,...ut}=_,dt=$?"row":j??"column",mt=reactExports.useMemo(()=>getDividerStyles({spacing:rt,direction:dt}),[rt,dt]),xt=!!at,Ct=!ot&&!xt,Pt=reactExports.useMemo(()=>{const kt=getValidChildren(it);return Ct?kt:kt.map((Lt,Nt)=>{const zt=typeof Lt.key<"u"?Lt.key:Nt,jt=Nt+1===kt.length,Dt=ot?jsxRuntimeExports.jsx(StackItem,{children:Lt},zt):Lt;if(!xt)return Dt;const Ft=reactExports.cloneElement(at,{__css:mt}),Bt=jt?null:Ft;return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[Dt,Bt]},zt)})},[at,mt,xt,Ct,ot,it]),Tt=cx("chakra-stack",st);return jsxRuntimeExports.jsx(chakra.div,{ref:a,display:"flex",alignItems:et,justifyContent:tt,flexDirection:dt,flexWrap:nt,gap:xt?void 0:rt,className:Tt,...ut,children:Pt})});Stack.displayName="Stack";var VStack=forwardRef((_,a)=>jsxRuntimeExports.jsx(Stack,{align:"center",..._,direction:"column",ref:a}));VStack.displayName="VStack";function spanFn(_){return mapResponsive(_,a=>a==="auto"?"auto":`span ${a}/span ${a}`)}var GridItem=forwardRef(function(a,$){const{area:j,colSpan:et,colStart:tt,colEnd:rt,rowEnd:nt,rowSpan:it,rowStart:at,...st}=a,ot=compact$1({gridArea:j,gridColumn:spanFn(et),gridRow:spanFn(it),gridColumnStart:tt,gridColumnEnd:rt,gridRowStart:at,gridRowEnd:nt});return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:ot,...st})});GridItem.displayName="GridItem";var Heading=forwardRef(function(a,$){const j=useStyleConfig("Heading",a),{className:et,...tt}=omitThemingProps(a);return jsxRuntimeExports.jsx(chakra.h2,{ref:$,className:cx("chakra-heading",a.className),...tt,__css:j})});Heading.displayName="Heading";var Box=chakra("div");Box.displayName="Box";var Square=forwardRef(function(a,$){const{size:j,centerContent:et=!0,...tt}=a,rt=et?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return jsxRuntimeExports.jsx(Box,{ref:$,boxSize:j,__css:{...rt,flexShrink:0,flexGrow:0},...tt})});Square.displayName="Square";var Circle=forwardRef(function(a,$){const{size:j,...et}=a;return jsxRuntimeExports.jsx(Square,{size:j,ref:$,borderRadius:"9999px",...et})});Circle.displayName="Circle";var AspectRatio=forwardRef(function(_,a){const{ratio:$=4/3,children:j,className:et,...tt}=_,rt=reactExports.Children.only(j),nt=cx("chakra-aspect-ratio",et);return jsxRuntimeExports.jsx(chakra.div,{ref:a,position:"relative",className:nt,_before:{height:0,content:'""',display:"block",paddingBottom:mapResponsive($,it=>`${1/it*100}%`)},__css:{"& > *:not(style)":{overflow:"hidden",position:"absolute",top:"0",right:"0",bottom:"0",left:"0",display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},"& > img, & > video":{objectFit:"cover"}},...tt,children:rt})});AspectRatio.displayName="AspectRatio";var Center=chakra("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});Center.displayName="Center";var centerStyles={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};forwardRef(function(a,$){const{axis:j="both",...et}=a;return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:centerStyles[j],...et,position:"absolute"})});var Divider=forwardRef(function(a,$){const{borderLeftWidth:j,borderBottomWidth:et,borderTopWidth:tt,borderRightWidth:rt,borderWidth:nt,borderStyle:it,borderColor:at,...st}=useStyleConfig("Divider",a),{className:ot,orientation:ut="horizontal",__css:dt,...mt}=omitThemingProps(a),xt={vertical:{borderLeftWidth:j||rt||nt||"1px",height:"100%"},horizontal:{borderBottomWidth:et||tt||nt||"1px",width:"100%"}};return jsxRuntimeExports.jsx(chakra.hr,{ref:$,"aria-orientation":ut,...mt,__css:{...st,border:"0",borderColor:at,borderStyle:it,...xt[ut],...dt},className:cx("chakra-divider",ot)})});Divider.displayName="Divider";var Flex=forwardRef(function(a,$){const{direction:j,align:et,justify:tt,wrap:rt,basis:nt,grow:it,shrink:at,...st}=a,ot={display:"flex",flexDirection:j,alignItems:et,justifyContent:tt,flexWrap:rt,flexBasis:nt,flexGrow:it,flexShrink:at};return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:ot,...st})});Flex.displayName="Flex";function useMediaQuery(_,a={}){const{ssr:$=!0,fallback:j}=a,{getWindow:et}=useEnvironment(),tt=Array.isArray(_)?_:[_];let rt=Array.isArray(j)?j:[j];rt=rt.filter(at=>at!=null);const[nt,it]=reactExports.useState(()=>tt.map((at,st)=>({media:at,matches:$?!!rt[st]:et().matchMedia(at).matches})));return reactExports.useEffect(()=>{const at=et();it(tt.map(ut=>({media:ut,matches:at.matchMedia(ut).matches})));const st=tt.map(ut=>at.matchMedia(ut)),ot=ut=>{it(dt=>dt.slice().map(mt=>mt.media===ut.media?{...mt,matches:ut.matches}:mt))};return st.forEach(ut=>{typeof ut.addListener=="function"?ut.addListener(ot):ut.addEventListener("change",ot)}),()=>{st.forEach(ut=>{typeof ut.removeListener=="function"?ut.removeListener(ot):ut.removeEventListener("change",ot)})}},[et]),nt.map(at=>at.matches)}function isPrintableCharacter(_){const{key:a}=_;return a.length===1||a.length>1&&/[^a-zA-Z0-9]/.test(a)}function useShortcut(_={}){const{timeout:a=300,preventDefault:$=()=>!0}=_,[j,et]=reactExports.useState([]),tt=reactExports.useRef(),rt=()=>{tt.current&&(clearTimeout(tt.current),tt.current=null)},nt=()=>{rt(),tt.current=setTimeout(()=>{et([]),tt.current=null},a)};reactExports.useEffect(()=>rt,[]);function it(at){return st=>{if(st.key==="Backspace"){const ot=[...j];ot.pop(),et(ot);return}if(isPrintableCharacter(st)){const ot=j.concat(st.key);$(st)&&(st.preventDefault(),st.stopPropagation()),et(ot),at(ot.join("")),nt()}}}return it}function getNextItemFromSearch(_,a,$,j){if(a==null)return j;if(!j)return _.find(rt=>$(rt).toLowerCase().startsWith(a.toLowerCase()));const et=_.filter(tt=>$(tt).toLowerCase().startsWith(a.toLowerCase()));if(et.length>0){let tt;return et.includes(j)?(tt=et.indexOf(j)+1,tt===et.length&&(tt=0),et[tt]):(tt=_.indexOf(et[0]),_[tt])}return j}function useEventListeners(){const _=reactExports.useRef(new Map),a=_.current,$=reactExports.useCallback((et,tt,rt,nt)=>{_.current.set(rt,{type:tt,el:et,options:nt}),et.addEventListener(tt,rt,nt)},[]),j=reactExports.useCallback((et,tt,rt,nt)=>{et.removeEventListener(tt,rt,nt),_.current.delete(rt)},[]);return reactExports.useEffect(()=>()=>{a.forEach((et,tt)=>{j(et.el,et.type,tt,et.options)})},[j,a]),{add:$,remove:j}}function isValidElement(_){const a=_.target,{tagName:$,isContentEditable:j}=a;return $!=="INPUT"&&$!=="TEXTAREA"&&j!==!0}function useClickable(_={}){const{ref:a,isDisabled:$,isFocusable:j,clickOnEnter:et=!0,clickOnSpace:tt=!0,onMouseDown:rt,onMouseUp:nt,onClick:it,onKeyDown:at,onKeyUp:st,tabIndex:ot,onMouseOver:ut,onMouseLeave:dt,...mt}=_,[xt,Ct]=reactExports.useState(!0),[Pt,Tt]=reactExports.useState(!1),kt=useEventListeners(),Lt=St=>{St&&St.tagName!=="BUTTON"&&Ct(!1)},Nt=xt?ot:ot||0,zt=$&&!j,jt=reactExports.useCallback(St=>{if($){St.stopPropagation(),St.preventDefault();return}St.currentTarget.focus(),it==null||it(St)},[$,it]),Mt=reactExports.useCallback(St=>{Pt&&isValidElement(St)&&(St.preventDefault(),St.stopPropagation(),Tt(!1),kt.remove(document,"keyup",Mt,!1))},[Pt,kt]),Dt=reactExports.useCallback(St=>{if(at==null||at(St),$||St.defaultPrevented||St.metaKey||!isValidElement(St.nativeEvent)||xt)return;const Rt=et&&St.key==="Enter";tt&&St.key===" "&&(St.preventDefault(),Tt(!0)),Rt&&(St.preventDefault(),St.currentTarget.click()),kt.add(document,"keyup",Mt,!1)},[$,xt,at,et,tt,kt,Mt]),Ft=reactExports.useCallback(St=>{if(st==null||st(St),$||St.defaultPrevented||St.metaKey||!isValidElement(St.nativeEvent)||xt)return;tt&&St.key===" "&&(St.preventDefault(),Tt(!1),St.currentTarget.click())},[tt,xt,$,st]),Bt=reactExports.useCallback(St=>{St.button===0&&(Tt(!1),kt.remove(document,"mouseup",Bt,!1))},[kt]),yt=reactExports.useCallback(St=>{if(St.button!==0)return;if($){St.stopPropagation(),St.preventDefault();return}xt||Tt(!0),St.currentTarget.focus({preventScroll:!0}),kt.add(document,"mouseup",Bt,!1),rt==null||rt(St)},[$,xt,rt,kt,Bt]),bt=reactExports.useCallback(St=>{St.button===0&&(xt||Tt(!1),nt==null||nt(St))},[nt,xt]),ct=reactExports.useCallback(St=>{if($){St.preventDefault();return}ut==null||ut(St)},[$,ut]),ht=reactExports.useCallback(St=>{Pt&&(St.preventDefault(),Tt(!1)),dt==null||dt(St)},[Pt,dt]),vt=mergeRefs(a,Lt);return xt?{...mt,ref:vt,type:"button","aria-disabled":zt?void 0:$,disabled:zt,onClick:jt,onMouseDown:rt,onMouseUp:nt,onKeyUp:st,onKeyDown:at,onMouseOver:ut,onMouseLeave:dt}:{...mt,ref:vt,role:"button","data-active":dataAttr(Pt),"aria-disabled":$?"true":void 0,tabIndex:zt?void 0:Nt,onClick:jt,onMouseDown:yt,onMouseUp:bt,onKeyUp:Ft,onKeyDown:Dt,onMouseOver:ct,onMouseLeave:ht}}function preventReturnFocus(_){const a=_.current;if(!a)return!1;const $=getActiveElement(a);return!$||a.contains($)?!1:!!isTabbable($)}function useFocusOnHide(_,a){const{shouldFocus:$,visible:j,focusRef:et}=a,tt=$&&!j;useUpdateEffect(()=>{if(!tt||preventReturnFocus(_))return;const rt=(et==null?void 0:et.current)||_.current;let nt;if(rt)return nt=requestAnimationFrame(()=>{rt.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(nt)}},[tt,_,et])}var defaultOptions$2={preventScroll:!0,shouldFocus:!1};function useFocusOnShow(_,a=defaultOptions$2){const{focusRef:$,preventScroll:j,shouldFocus:et,visible:tt}=a,rt=isRefObject(_)?_.current:_,nt=et&&tt,it=reactExports.useRef(nt),at=reactExports.useRef(tt);useSafeLayoutEffect$2(()=>{!at.current&&tt&&(it.current=nt),at.current=tt},[tt,nt]);const st=reactExports.useCallback(()=>{if(!(!tt||!rt||!it.current)&&(it.current=!1,!rt.contains(document.activeElement)))if($!=null&&$.current)requestAnimationFrame(()=>{var ot;(ot=$.current)==null||ot.focus({preventScroll:j})});else{const ot=getAllFocusable(rt);ot.length>0&&requestAnimationFrame(()=>{ot[0].focus({preventScroll:j})})}},[tt,j,rt,$]);useUpdateEffect(()=>{st()},[st]),useEventListener(rt,"transitionend",st)}function isRefObject(_){return"current"in _}var toVar=(_,a)=>({var:_,varRef:a?`var(${_}, ${a})`:`var(${_})`}),cssVars={arrowShadowColor:toVar("--popper-arrow-shadow-color"),arrowSize:toVar("--popper-arrow-size","8px"),arrowSizeHalf:toVar("--popper-arrow-size-half"),arrowBg:toVar("--popper-arrow-bg"),transformOrigin:toVar("--popper-transform-origin"),arrowOffset:toVar("--popper-arrow-offset")};function getBoxShadow(_){if(_.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(_.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(_.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(_.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var transforms={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},toTransformOrigin=_=>transforms[_],defaultEventListeners={scroll:!0,resize:!0};function getEventListenerOptions(_){let a;return typeof _=="object"?a={enabled:!0,options:{...defaultEventListeners,..._}}:a={enabled:_,options:defaultEventListeners},a}var matchWidth={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:_})=>{_.styles.popper.width=`${_.rects.reference.width}px`},effect:({state:_})=>()=>{const a=_.elements.reference;_.elements.popper.style.width=`${a.offsetWidth}px`}},transformOrigin={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:_})=>{setTransformOrigin(_)},effect:({state:_})=>()=>{setTransformOrigin(_)}},setTransformOrigin=_=>{_.elements.popper.style.setProperty(cssVars.transformOrigin.var,toTransformOrigin(_.placement))},positionArrow={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:_})=>{setArrowStyles(_)}},setArrowStyles=_=>{var a;if(!_.placement)return;const $=getArrowStyle$1(_.placement);if((a=_.elements)!=null&&a.arrow&&$){Object.assign(_.elements.arrow.style,{[$.property]:$.value,width:cssVars.arrowSize.varRef,height:cssVars.arrowSize.varRef,zIndex:-1});const j={[cssVars.arrowSizeHalf.var]:`calc(${cssVars.arrowSize.varRef} / 2 - 1px)`,[cssVars.arrowOffset.var]:`calc(${cssVars.arrowSizeHalf.varRef} * -1)`};for(const et in j)_.elements.arrow.style.setProperty(et,j[et])}},getArrowStyle$1=_=>{if(_.startsWith("top"))return{property:"bottom",value:cssVars.arrowOffset.varRef};if(_.startsWith("bottom"))return{property:"top",value:cssVars.arrowOffset.varRef};if(_.startsWith("left"))return{property:"right",value:cssVars.arrowOffset.varRef};if(_.startsWith("right"))return{property:"left",value:cssVars.arrowOffset.varRef}},innerArrow={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:_})=>{setInnerArrowStyles(_)},effect:({state:_})=>()=>{setInnerArrowStyles(_)}},setInnerArrowStyles=_=>{if(!_.elements.arrow)return;const a=_.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!a)return;const $=getBoxShadow(_.placement);$&&a.style.setProperty("--popper-arrow-default-shadow",$),Object.assign(a.style,{transform:"rotate(45deg)",background:cssVars.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},logicals={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},opposites={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function getPopperPlacement(_,a="ltr"){var $,j;const et=(($=logicals[_])==null?void 0:$[a])||_;return a==="ltr"?et:(j=opposites[_])!=null?j:et}var top="top",bottom="bottom",right="right",left="left",auto="auto",basePlacements=[top,bottom,right,left],start="start",end="end",clippingParents="clippingParents",viewport="viewport",popper="popper",reference="reference",variationPlacements=basePlacements.reduce(function(_,a){return _.concat([a+"-"+start,a+"-"+end])},[]),placements=[].concat(basePlacements,[auto]).reduce(function(_,a){return _.concat([a,a+"-"+start,a+"-"+end])},[]),beforeRead="beforeRead",read="read",afterRead="afterRead",beforeMain="beforeMain",main$6="main",afterMain="afterMain",beforeWrite="beforeWrite",write="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read,afterRead,beforeMain,main$6,afterMain,beforeWrite,write,afterWrite];function getNodeName(_){return _?(_.nodeName||"").toLowerCase():null}function getWindow(_){if(_==null)return window;if(_.toString()!=="[object Window]"){var a=_.ownerDocument;return a&&a.defaultView||window}return _}function isElement$1(_){var a=getWindow(_).Element;return _ instanceof a||_ instanceof Element}function isHTMLElement$2(_){var a=getWindow(_).HTMLElement;return _ instanceof a||_ instanceof HTMLElement}function isShadowRoot(_){if(typeof ShadowRoot>"u")return!1;var a=getWindow(_).ShadowRoot;return _ instanceof a||_ instanceof ShadowRoot}function applyStyles(_){var a=_.state;Object.keys(a.elements).forEach(function($){var j=a.styles[$]||{},et=a.attributes[$]||{},tt=a.elements[$];!isHTMLElement$2(tt)||!getNodeName(tt)||(Object.assign(tt.style,j),Object.keys(et).forEach(function(rt){var nt=et[rt];nt===!1?tt.removeAttribute(rt):tt.setAttribute(rt,nt===!0?"":nt)}))})}function effect$2(_){var a=_.state,$={popper:{position:a.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(a.elements.popper.style,$.popper),a.styles=$,a.elements.arrow&&Object.assign(a.elements.arrow.style,$.arrow),function(){Object.keys(a.elements).forEach(function(j){var et=a.elements[j],tt=a.attributes[j]||{},rt=Object.keys(a.styles.hasOwnProperty(j)?a.styles[j]:$[j]),nt=rt.reduce(function(it,at){return it[at]="",it},{});!isHTMLElement$2(et)||!getNodeName(et)||(Object.assign(et.style,nt),Object.keys(tt).forEach(function(it){et.removeAttribute(it)}))})}}const applyStyles$1={name:"applyStyles",enabled:!0,phase:"write",fn:applyStyles,effect:effect$2,requires:["computeStyles"]};function getBasePlacement(_){return _.split("-")[0]}var max$1=Math.max,min=Math.min,round=Math.round;function getUAString(){var _=navigator.userAgentData;return _!=null&&_.brands&&Array.isArray(_.brands)?_.brands.map(function(a){return a.brand+"/"+a.version}).join(" "):navigator.userAgent}function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString())}function getBoundingClientRect(_,a,$){a===void 0&&(a=!1),$===void 0&&($=!1);var j=_.getBoundingClientRect(),et=1,tt=1;a&&isHTMLElement$2(_)&&(et=_.offsetWidth>0&&round(j.width)/_.offsetWidth||1,tt=_.offsetHeight>0&&round(j.height)/_.offsetHeight||1);var rt=isElement$1(_)?getWindow(_):window,nt=rt.visualViewport,it=!isLayoutViewport()&&$,at=(j.left+(it&&nt?nt.offsetLeft:0))/et,st=(j.top+(it&&nt?nt.offsetTop:0))/tt,ot=j.width/et,ut=j.height/tt;return{width:ot,height:ut,top:st,right:at+ot,bottom:st+ut,left:at,x:at,y:st}}function getLayoutRect(_){var a=getBoundingClientRect(_),$=_.offsetWidth,j=_.offsetHeight;return Math.abs(a.width-$)<=1&&($=a.width),Math.abs(a.height-j)<=1&&(j=a.height),{x:_.offsetLeft,y:_.offsetTop,width:$,height:j}}function contains$1(_,a){var $=a.getRootNode&&a.getRootNode();if(_.contains(a))return!0;if($&&isShadowRoot($)){var j=a;do{if(j&&_.isSameNode(j))return!0;j=j.parentNode||j.host}while(j)}return!1}function getComputedStyle$1(_){return getWindow(_).getComputedStyle(_)}function isTableElement(_){return["table","td","th"].indexOf(getNodeName(_))>=0}function getDocumentElement(_){return((isElement$1(_)?_.ownerDocument:_.document)||window.document).documentElement}function getParentNode(_){return getNodeName(_)==="html"?_:_.assignedSlot||_.parentNode||(isShadowRoot(_)?_.host:null)||getDocumentElement(_)}function getTrueOffsetParent(_){return!isHTMLElement$2(_)||getComputedStyle$1(_).position==="fixed"?null:_.offsetParent}function getContainingBlock(_){var a=/firefox/i.test(getUAString()),$=/Trident/i.test(getUAString());if($&&isHTMLElement$2(_)){var j=getComputedStyle$1(_);if(j.position==="fixed")return null}var et=getParentNode(_);for(isShadowRoot(et)&&(et=et.host);isHTMLElement$2(et)&&["html","body"].indexOf(getNodeName(et))<0;){var tt=getComputedStyle$1(et);if(tt.transform!=="none"||tt.perspective!=="none"||tt.contain==="paint"||["transform","perspective"].indexOf(tt.willChange)!==-1||a&&tt.willChange==="filter"||a&&tt.filter&&tt.filter!=="none")return et;et=et.parentNode}return null}function getOffsetParent(_){for(var a=getWindow(_),$=getTrueOffsetParent(_);$&&isTableElement($)&&getComputedStyle$1($).position==="static";)$=getTrueOffsetParent($);return $&&(getNodeName($)==="html"||getNodeName($)==="body"&&getComputedStyle$1($).position==="static")?a:$||getContainingBlock(_)||a}function getMainAxisFromPlacement(_){return["top","bottom"].indexOf(_)>=0?"x":"y"}function within(_,a,$){return max$1(_,min(a,$))}function withinMaxClamp(_,a,$){var j=within(_,a,$);return j>$?$:j}function getFreshSideObject(){return{top:0,right:0,bottom:0,left:0}}function mergePaddingObject(_){return Object.assign({},getFreshSideObject(),_)}function expandToHashMap(_,a){return a.reduce(function($,j){return $[j]=_,$},{})}var toPaddingObject=function(a,$){return a=typeof a=="function"?a(Object.assign({},$.rects,{placement:$.placement})):a,mergePaddingObject(typeof a!="number"?a:expandToHashMap(a,basePlacements))};function arrow(_){var a,$=_.state,j=_.name,et=_.options,tt=$.elements.arrow,rt=$.modifiersData.popperOffsets,nt=getBasePlacement($.placement),it=getMainAxisFromPlacement(nt),at=[left,right].indexOf(nt)>=0,st=at?"height":"width";if(!(!tt||!rt)){var ot=toPaddingObject(et.padding,$),ut=getLayoutRect(tt),dt=it==="y"?top:left,mt=it==="y"?bottom:right,xt=$.rects.reference[st]+$.rects.reference[it]-rt[it]-$.rects.popper[st],Ct=rt[it]-$.rects.reference[it],Pt=getOffsetParent(tt),Tt=Pt?it==="y"?Pt.clientHeight||0:Pt.clientWidth||0:0,kt=xt/2-Ct/2,Lt=ot[dt],Nt=Tt-ut[st]-ot[mt],zt=Tt/2-ut[st]/2+kt,jt=within(Lt,zt,Nt),Mt=it;$.modifiersData[j]=(a={},a[Mt]=jt,a.centerOffset=jt-zt,a)}}function effect$1(_){var a=_.state,$=_.options,j=$.element,et=j===void 0?"[data-popper-arrow]":j;et!=null&&(typeof et=="string"&&(et=a.elements.popper.querySelector(et),!et)||contains$1(a.elements.popper,et)&&(a.elements.arrow=et))}const arrow$1={name:"arrow",enabled:!0,phase:"main",fn:arrow,effect:effect$1,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function getVariation(_){return _.split("-")[1]}var unsetSides={top:"auto",right:"auto",bottom:"auto",left:"auto"};function roundOffsetsByDPR(_,a){var $=_.x,j=_.y,et=a.devicePixelRatio||1;return{x:round($*et)/et||0,y:round(j*et)/et||0}}function mapToStyles(_){var a,$=_.popper,j=_.popperRect,et=_.placement,tt=_.variation,rt=_.offsets,nt=_.position,it=_.gpuAcceleration,at=_.adaptive,st=_.roundOffsets,ot=_.isFixed,ut=rt.x,dt=ut===void 0?0:ut,mt=rt.y,xt=mt===void 0?0:mt,Ct=typeof st=="function"?st({x:dt,y:xt}):{x:dt,y:xt};dt=Ct.x,xt=Ct.y;var Pt=rt.hasOwnProperty("x"),Tt=rt.hasOwnProperty("y"),kt=left,Lt=top,Nt=window;if(at){var zt=getOffsetParent($),jt="clientHeight",Mt="clientWidth";if(zt===getWindow($)&&(zt=getDocumentElement($),getComputedStyle$1(zt).position!=="static"&&nt==="absolute"&&(jt="scrollHeight",Mt="scrollWidth")),zt=zt,et===top||(et===left||et===right)&&tt===end){Lt=bottom;var Dt=ot&&zt===Nt&&Nt.visualViewport?Nt.visualViewport.height:zt[jt];xt-=Dt-j.height,xt*=it?1:-1}if(et===left||(et===top||et===bottom)&&tt===end){kt=right;var Ft=ot&&zt===Nt&&Nt.visualViewport?Nt.visualViewport.width:zt[Mt];dt-=Ft-j.width,dt*=it?1:-1}}var Bt=Object.assign({position:nt},at&&unsetSides),yt=st===!0?roundOffsetsByDPR({x:dt,y:xt},getWindow($)):{x:dt,y:xt};if(dt=yt.x,xt=yt.y,it){var bt;return Object.assign({},Bt,(bt={},bt[Lt]=Tt?"0":"",bt[kt]=Pt?"0":"",bt.transform=(Nt.devicePixelRatio||1)<=1?"translate("+dt+"px, "+xt+"px)":"translate3d("+dt+"px, "+xt+"px, 0)",bt))}return Object.assign({},Bt,(a={},a[Lt]=Tt?xt+"px":"",a[kt]=Pt?dt+"px":"",a.transform="",a))}function computeStyles(_){var a=_.state,$=_.options,j=$.gpuAcceleration,et=j===void 0?!0:j,tt=$.adaptive,rt=tt===void 0?!0:tt,nt=$.roundOffsets,it=nt===void 0?!0:nt,at={placement:getBasePlacement(a.placement),variation:getVariation(a.placement),popper:a.elements.popper,popperRect:a.rects.popper,gpuAcceleration:et,isFixed:a.options.strategy==="fixed"};a.modifiersData.popperOffsets!=null&&(a.styles.popper=Object.assign({},a.styles.popper,mapToStyles(Object.assign({},at,{offsets:a.modifiersData.popperOffsets,position:a.options.strategy,adaptive:rt,roundOffsets:it})))),a.modifiersData.arrow!=null&&(a.styles.arrow=Object.assign({},a.styles.arrow,mapToStyles(Object.assign({},at,{offsets:a.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:it})))),a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-placement":a.placement})}const computeStyles$1={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:computeStyles,data:{}};var passive={passive:!0};function effect(_){var a=_.state,$=_.instance,j=_.options,et=j.scroll,tt=et===void 0?!0:et,rt=j.resize,nt=rt===void 0?!0:rt,it=getWindow(a.elements.popper),at=[].concat(a.scrollParents.reference,a.scrollParents.popper);return tt&&at.forEach(function(st){st.addEventListener("scroll",$.update,passive)}),nt&&it.addEventListener("resize",$.update,passive),function(){tt&&at.forEach(function(st){st.removeEventListener("scroll",$.update,passive)}),nt&&it.removeEventListener("resize",$.update,passive)}}const eventListeners={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect,data:{}};var hash$b={left:"right",right:"left",bottom:"top",top:"bottom"};function getOppositePlacement(_){return _.replace(/left|right|bottom|top/g,function(a){return hash$b[a]})}var hash$a={start:"end",end:"start"};function getOppositeVariationPlacement(_){return _.replace(/start|end/g,function(a){return hash$a[a]})}function getWindowScroll(_){var a=getWindow(_),$=a.pageXOffset,j=a.pageYOffset;return{scrollLeft:$,scrollTop:j}}function getWindowScrollBarX(_){return getBoundingClientRect(getDocumentElement(_)).left+getWindowScroll(_).scrollLeft}function getViewportRect(_,a){var $=getWindow(_),j=getDocumentElement(_),et=$.visualViewport,tt=j.clientWidth,rt=j.clientHeight,nt=0,it=0;if(et){tt=et.width,rt=et.height;var at=isLayoutViewport();(at||!at&&a==="fixed")&&(nt=et.offsetLeft,it=et.offsetTop)}return{width:tt,height:rt,x:nt+getWindowScrollBarX(_),y:it}}function getDocumentRect(_){var a,$=getDocumentElement(_),j=getWindowScroll(_),et=(a=_.ownerDocument)==null?void 0:a.body,tt=max$1($.scrollWidth,$.clientWidth,et?et.scrollWidth:0,et?et.clientWidth:0),rt=max$1($.scrollHeight,$.clientHeight,et?et.scrollHeight:0,et?et.clientHeight:0),nt=-j.scrollLeft+getWindowScrollBarX(_),it=-j.scrollTop;return getComputedStyle$1(et||$).direction==="rtl"&&(nt+=max$1($.clientWidth,et?et.clientWidth:0)-tt),{width:tt,height:rt,x:nt,y:it}}function isScrollParent(_){var a=getComputedStyle$1(_),$=a.overflow,j=a.overflowX,et=a.overflowY;return/auto|scroll|overlay|hidden/.test($+et+j)}function getScrollParent(_){return["html","body","#document"].indexOf(getNodeName(_))>=0?_.ownerDocument.body:isHTMLElement$2(_)&&isScrollParent(_)?_:getScrollParent(getParentNode(_))}function listScrollParents(_,a){var $;a===void 0&&(a=[]);var j=getScrollParent(_),et=j===(($=_.ownerDocument)==null?void 0:$.body),tt=getWindow(j),rt=et?[tt].concat(tt.visualViewport||[],isScrollParent(j)?j:[]):j,nt=a.concat(rt);return et?nt:nt.concat(listScrollParents(getParentNode(rt)))}function rectToClientRect(_){return Object.assign({},_,{left:_.x,top:_.y,right:_.x+_.width,bottom:_.y+_.height})}function getInnerBoundingClientRect(_,a){var $=getBoundingClientRect(_,!1,a==="fixed");return $.top=$.top+_.clientTop,$.left=$.left+_.clientLeft,$.bottom=$.top+_.clientHeight,$.right=$.left+_.clientWidth,$.width=_.clientWidth,$.height=_.clientHeight,$.x=$.left,$.y=$.top,$}function getClientRectFromMixedType(_,a,$){return a===viewport?rectToClientRect(getViewportRect(_,$)):isElement$1(a)?getInnerBoundingClientRect(a,$):rectToClientRect(getDocumentRect(getDocumentElement(_)))}function getClippingParents(_){var a=listScrollParents(getParentNode(_)),$=["absolute","fixed"].indexOf(getComputedStyle$1(_).position)>=0,j=$&&isHTMLElement$2(_)?getOffsetParent(_):_;return isElement$1(j)?a.filter(function(et){return isElement$1(et)&&contains$1(et,j)&&getNodeName(et)!=="body"}):[]}function getClippingRect(_,a,$,j){var et=a==="clippingParents"?getClippingParents(_):[].concat(a),tt=[].concat(et,[$]),rt=tt[0],nt=tt.reduce(function(it,at){var st=getClientRectFromMixedType(_,at,j);return it.top=max$1(st.top,it.top),it.right=min(st.right,it.right),it.bottom=min(st.bottom,it.bottom),it.left=max$1(st.left,it.left),it},getClientRectFromMixedType(_,rt,j));return nt.width=nt.right-nt.left,nt.height=nt.bottom-nt.top,nt.x=nt.left,nt.y=nt.top,nt}function computeOffsets(_){var a=_.reference,$=_.element,j=_.placement,et=j?getBasePlacement(j):null,tt=j?getVariation(j):null,rt=a.x+a.width/2-$.width/2,nt=a.y+a.height/2-$.height/2,it;switch(et){case top:it={x:rt,y:a.y-$.height};break;case bottom:it={x:rt,y:a.y+a.height};break;case right:it={x:a.x+a.width,y:nt};break;case left:it={x:a.x-$.width,y:nt};break;default:it={x:a.x,y:a.y}}var at=et?getMainAxisFromPlacement(et):null;if(at!=null){var st=at==="y"?"height":"width";switch(tt){case start:it[at]=it[at]-(a[st]/2-$[st]/2);break;case end:it[at]=it[at]+(a[st]/2-$[st]/2);break}}return it}function detectOverflow(_,a){a===void 0&&(a={});var $=a,j=$.placement,et=j===void 0?_.placement:j,tt=$.strategy,rt=tt===void 0?_.strategy:tt,nt=$.boundary,it=nt===void 0?clippingParents:nt,at=$.rootBoundary,st=at===void 0?viewport:at,ot=$.elementContext,ut=ot===void 0?popper:ot,dt=$.altBoundary,mt=dt===void 0?!1:dt,xt=$.padding,Ct=xt===void 0?0:xt,Pt=mergePaddingObject(typeof Ct!="number"?Ct:expandToHashMap(Ct,basePlacements)),Tt=ut===popper?reference:popper,kt=_.rects.popper,Lt=_.elements[mt?Tt:ut],Nt=getClippingRect(isElement$1(Lt)?Lt:Lt.contextElement||getDocumentElement(_.elements.popper),it,st,rt),zt=getBoundingClientRect(_.elements.reference),jt=computeOffsets({reference:zt,element:kt,strategy:"absolute",placement:et}),Mt=rectToClientRect(Object.assign({},kt,jt)),Dt=ut===popper?Mt:zt,Ft={top:Nt.top-Dt.top+Pt.top,bottom:Dt.bottom-Nt.bottom+Pt.bottom,left:Nt.left-Dt.left+Pt.left,right:Dt.right-Nt.right+Pt.right},Bt=_.modifiersData.offset;if(ut===popper&&Bt){var yt=Bt[et];Object.keys(Ft).forEach(function(bt){var ct=[right,bottom].indexOf(bt)>=0?1:-1,ht=[top,bottom].indexOf(bt)>=0?"y":"x";Ft[bt]+=yt[ht]*ct})}return Ft}function computeAutoPlacement(_,a){a===void 0&&(a={});var $=a,j=$.placement,et=$.boundary,tt=$.rootBoundary,rt=$.padding,nt=$.flipVariations,it=$.allowedAutoPlacements,at=it===void 0?placements:it,st=getVariation(j),ot=st?nt?variationPlacements:variationPlacements.filter(function(mt){return getVariation(mt)===st}):basePlacements,ut=ot.filter(function(mt){return at.indexOf(mt)>=0});ut.length===0&&(ut=ot);var dt=ut.reduce(function(mt,xt){return mt[xt]=detectOverflow(_,{placement:xt,boundary:et,rootBoundary:tt,padding:rt})[getBasePlacement(xt)],mt},{});return Object.keys(dt).sort(function(mt,xt){return dt[mt]-dt[xt]})}function getExpandedFallbackPlacements(_){if(getBasePlacement(_)===auto)return[];var a=getOppositePlacement(_);return[getOppositeVariationPlacement(_),a,getOppositeVariationPlacement(a)]}function flip(_){var a=_.state,$=_.options,j=_.name;if(!a.modifiersData[j]._skip){for(var et=$.mainAxis,tt=et===void 0?!0:et,rt=$.altAxis,nt=rt===void 0?!0:rt,it=$.fallbackPlacements,at=$.padding,st=$.boundary,ot=$.rootBoundary,ut=$.altBoundary,dt=$.flipVariations,mt=dt===void 0?!0:dt,xt=$.allowedAutoPlacements,Ct=a.options.placement,Pt=getBasePlacement(Ct),Tt=Pt===Ct,kt=it||(Tt||!mt?[getOppositePlacement(Ct)]:getExpandedFallbackPlacements(Ct)),Lt=[Ct].concat(kt).reduce(function(tr,nr){return tr.concat(getBasePlacement(nr)===auto?computeAutoPlacement(a,{placement:nr,boundary:st,rootBoundary:ot,padding:at,flipVariations:mt,allowedAutoPlacements:xt}):nr)},[]),Nt=a.rects.reference,zt=a.rects.popper,jt=new Map,Mt=!0,Dt=Lt[0],Ft=0;Ft=0,ht=ct?"width":"height",vt=detectOverflow(a,{placement:Bt,boundary:st,rootBoundary:ot,altBoundary:ut,padding:at}),St=ct?bt?right:left:bt?bottom:top;Nt[ht]>zt[ht]&&(St=getOppositePlacement(St));var Rt=getOppositePlacement(St),$t=[];if(tt&&$t.push(vt[yt]<=0),nt&&$t.push(vt[St]<=0,vt[Rt]<=0),$t.every(function(tr){return tr})){Dt=Bt,Mt=!1;break}jt.set(Bt,$t)}if(Mt)for(var Et=mt?3:1,At=function(nr){var ir=Lt.find(function(Wt){var Kt=jt.get(Wt);if(Kt)return Kt.slice(0,nr).every(function(Jt){return Jt})});if(ir)return Dt=ir,"break"},wt=Et;wt>0;wt--){var Ot=At(wt);if(Ot==="break")break}a.placement!==Dt&&(a.modifiersData[j]._skip=!0,a.placement=Dt,a.reset=!0)}}const flip$1={name:"flip",enabled:!0,phase:"main",fn:flip,requiresIfExists:["offset"],data:{_skip:!1}};function getSideOffsets(_,a,$){return $===void 0&&($={x:0,y:0}),{top:_.top-a.height-$.y,right:_.right-a.width+$.x,bottom:_.bottom-a.height+$.y,left:_.left-a.width-$.x}}function isAnySideFullyClipped(_){return[top,right,bottom,left].some(function(a){return _[a]>=0})}function hide(_){var a=_.state,$=_.name,j=a.rects.reference,et=a.rects.popper,tt=a.modifiersData.preventOverflow,rt=detectOverflow(a,{elementContext:"reference"}),nt=detectOverflow(a,{altBoundary:!0}),it=getSideOffsets(rt,j),at=getSideOffsets(nt,et,tt),st=isAnySideFullyClipped(it),ot=isAnySideFullyClipped(at);a.modifiersData[$]={referenceClippingOffsets:it,popperEscapeOffsets:at,isReferenceHidden:st,hasPopperEscaped:ot},a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-reference-hidden":st,"data-popper-escaped":ot})}const hide$1={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hide};function distanceAndSkiddingToXY(_,a,$){var j=getBasePlacement(_),et=[left,top].indexOf(j)>=0?-1:1,tt=typeof $=="function"?$(Object.assign({},a,{placement:_})):$,rt=tt[0],nt=tt[1];return rt=rt||0,nt=(nt||0)*et,[left,right].indexOf(j)>=0?{x:nt,y:rt}:{x:rt,y:nt}}function offset(_){var a=_.state,$=_.options,j=_.name,et=$.offset,tt=et===void 0?[0,0]:et,rt=placements.reduce(function(st,ot){return st[ot]=distanceAndSkiddingToXY(ot,a.rects,tt),st},{}),nt=rt[a.placement],it=nt.x,at=nt.y;a.modifiersData.popperOffsets!=null&&(a.modifiersData.popperOffsets.x+=it,a.modifiersData.popperOffsets.y+=at),a.modifiersData[j]=rt}const offset$1={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset};function popperOffsets(_){var a=_.state,$=_.name;a.modifiersData[$]=computeOffsets({reference:a.rects.reference,element:a.rects.popper,strategy:"absolute",placement:a.placement})}const popperOffsets$1={name:"popperOffsets",enabled:!0,phase:"read",fn:popperOffsets,data:{}};function getAltAxis(_){return _==="x"?"y":"x"}function preventOverflow(_){var a=_.state,$=_.options,j=_.name,et=$.mainAxis,tt=et===void 0?!0:et,rt=$.altAxis,nt=rt===void 0?!1:rt,it=$.boundary,at=$.rootBoundary,st=$.altBoundary,ot=$.padding,ut=$.tether,dt=ut===void 0?!0:ut,mt=$.tetherOffset,xt=mt===void 0?0:mt,Ct=detectOverflow(a,{boundary:it,rootBoundary:at,padding:ot,altBoundary:st}),Pt=getBasePlacement(a.placement),Tt=getVariation(a.placement),kt=!Tt,Lt=getMainAxisFromPlacement(Pt),Nt=getAltAxis(Lt),zt=a.modifiersData.popperOffsets,jt=a.rects.reference,Mt=a.rects.popper,Dt=typeof xt=="function"?xt(Object.assign({},a.rects,{placement:a.placement})):xt,Ft=typeof Dt=="number"?{mainAxis:Dt,altAxis:Dt}:Object.assign({mainAxis:0,altAxis:0},Dt),Bt=a.modifiersData.offset?a.modifiersData.offset[a.placement]:null,yt={x:0,y:0};if(zt){if(tt){var bt,ct=Lt==="y"?top:left,ht=Lt==="y"?bottom:right,vt=Lt==="y"?"height":"width",St=zt[Lt],Rt=St+Ct[ct],$t=St-Ct[ht],Et=dt?-Mt[vt]/2:0,At=Tt===start?jt[vt]:Mt[vt],wt=Tt===start?-Mt[vt]:-jt[vt],Ot=a.elements.arrow,tr=dt&&Ot?getLayoutRect(Ot):{width:0,height:0},nr=a.modifiersData["arrow#persistent"]?a.modifiersData["arrow#persistent"].padding:getFreshSideObject(),ir=nr[ct],Wt=nr[ht],Kt=within(0,jt[vt],tr[vt]),Jt=kt?jt[vt]/2-Et-Kt-ir-Ft.mainAxis:At-Kt-ir-Ft.mainAxis,Ht=kt?-jt[vt]/2+Et+Kt+Wt+Ft.mainAxis:wt+Kt+Wt+Ft.mainAxis,Vt=a.elements.arrow&&getOffsetParent(a.elements.arrow),Qt=Vt?Lt==="y"?Vt.clientTop||0:Vt.clientLeft||0:0,dr=(bt=Bt==null?void 0:Bt[Lt])!=null?bt:0,xr=St+Jt-dr-Qt,pr=St+Ht-dr,Ir=within(dt?min(Rt,xr):Rt,St,dt?max$1($t,pr):$t);zt[Lt]=Ir,yt[Lt]=Ir-St}if(nt){var kr,lr=Lt==="x"?top:left,fr=Lt==="x"?bottom:right,Er=zt[Nt],$r=Nt==="y"?"height":"width",Pr=Er+Ct[lr],Rr=Er-Ct[fr],Ar=[top,left].indexOf(Pt)!==-1,Or=(kr=Bt==null?void 0:Bt[Nt])!=null?kr:0,Lr=Ar?Pr:Er-jt[$r]-Mt[$r]-Or+Ft.altAxis,ar=Ar?Er+jt[$r]+Mt[$r]-Or-Ft.altAxis:Rr,Yt=dt&&Ar?withinMaxClamp(Lr,Er,ar):within(dt?Lr:Pr,Er,dt?ar:Rr);zt[Nt]=Yt,yt[Nt]=Yt-Er}a.modifiersData[j]=yt}}const preventOverflow$1={name:"preventOverflow",enabled:!0,phase:"main",fn:preventOverflow,requiresIfExists:["offset"]};function getHTMLElementScroll(_){return{scrollLeft:_.scrollLeft,scrollTop:_.scrollTop}}function getNodeScroll(_){return _===getWindow(_)||!isHTMLElement$2(_)?getWindowScroll(_):getHTMLElementScroll(_)}function isElementScaled(_){var a=_.getBoundingClientRect(),$=round(a.width)/_.offsetWidth||1,j=round(a.height)/_.offsetHeight||1;return $!==1||j!==1}function getCompositeRect(_,a,$){$===void 0&&($=!1);var j=isHTMLElement$2(a),et=isHTMLElement$2(a)&&isElementScaled(a),tt=getDocumentElement(a),rt=getBoundingClientRect(_,et,$),nt={scrollLeft:0,scrollTop:0},it={x:0,y:0};return(j||!j&&!$)&&((getNodeName(a)!=="body"||isScrollParent(tt))&&(nt=getNodeScroll(a)),isHTMLElement$2(a)?(it=getBoundingClientRect(a,!0),it.x+=a.clientLeft,it.y+=a.clientTop):tt&&(it.x=getWindowScrollBarX(tt))),{x:rt.left+nt.scrollLeft-it.x,y:rt.top+nt.scrollTop-it.y,width:rt.width,height:rt.height}}function order(_){var a=new Map,$=new Set,j=[];_.forEach(function(tt){a.set(tt.name,tt)});function et(tt){$.add(tt.name);var rt=[].concat(tt.requires||[],tt.requiresIfExists||[]);rt.forEach(function(nt){if(!$.has(nt)){var it=a.get(nt);it&&et(it)}}),j.push(tt)}return _.forEach(function(tt){$.has(tt.name)||et(tt)}),j}function orderModifiers(_){var a=order(_);return modifierPhases.reduce(function($,j){return $.concat(a.filter(function(et){return et.phase===j}))},[])}function debounce(_){var a;return function(){return a||(a=new Promise(function($){Promise.resolve().then(function(){a=void 0,$(_())})})),a}}function mergeByName(_){var a=_.reduce(function($,j){var et=$[j.name];return $[j.name]=et?Object.assign({},et,j,{options:Object.assign({},et.options,j.options),data:Object.assign({},et.data,j.data)}):j,$},{});return Object.keys(a).map(function($){return a[$]})}var DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var _=arguments.length,a=new Array(_),$=0;$<_;$++)a[$]=arguments[$];return!a.some(function(j){return!(j&&typeof j.getBoundingClientRect=="function")})}function popperGenerator(_){_===void 0&&(_={});var a=_,$=a.defaultModifiers,j=$===void 0?[]:$,et=a.defaultOptions,tt=et===void 0?DEFAULT_OPTIONS:et;return function(nt,it,at){at===void 0&&(at=tt);var st={placement:"bottom",orderedModifiers:[],options:Object.assign({},DEFAULT_OPTIONS,tt),modifiersData:{},elements:{reference:nt,popper:it},attributes:{},styles:{}},ot=[],ut=!1,dt={state:st,setOptions:function(Pt){var Tt=typeof Pt=="function"?Pt(st.options):Pt;xt(),st.options=Object.assign({},tt,st.options,Tt),st.scrollParents={reference:isElement$1(nt)?listScrollParents(nt):nt.contextElement?listScrollParents(nt.contextElement):[],popper:listScrollParents(it)};var kt=orderModifiers(mergeByName([].concat(j,st.options.modifiers)));return st.orderedModifiers=kt.filter(function(Lt){return Lt.enabled}),mt(),dt.update()},forceUpdate:function(){if(!ut){var Pt=st.elements,Tt=Pt.reference,kt=Pt.popper;if(areValidElements(Tt,kt)){st.rects={reference:getCompositeRect(Tt,getOffsetParent(kt),st.options.strategy==="fixed"),popper:getLayoutRect(kt)},st.reset=!1,st.placement=st.options.placement,st.orderedModifiers.forEach(function(Ft){return st.modifiersData[Ft.name]=Object.assign({},Ft.data)});for(var Lt=0;Lt{}),kt=reactExports.useCallback(()=>{var Ft;!a||!mt.current||!xt.current||((Ft=Tt.current)==null||Ft.call(Tt),Ct.current=createPopper(mt.current,xt.current,{placement:Pt,modifiers:[innerArrow,positionArrow,transformOrigin,{...matchWidth,enabled:!!ut},{name:"eventListeners",...getEventListenerOptions(rt)},{name:"arrow",options:{padding:tt}},{name:"offset",options:{offset:nt??[0,it]}},{name:"flip",enabled:!!at,options:{padding:8}},{name:"preventOverflow",enabled:!!ot,options:{boundary:st}},...$??[]],strategy:et}),Ct.current.forceUpdate(),Tt.current=Ct.current.destroy)},[Pt,a,$,ut,rt,tt,nt,it,at,ot,st,et]);reactExports.useEffect(()=>()=>{var Ft;!mt.current&&!xt.current&&((Ft=Ct.current)==null||Ft.destroy(),Ct.current=null)},[]);const Lt=reactExports.useCallback(Ft=>{mt.current=Ft,kt()},[kt]),Nt=reactExports.useCallback((Ft={},Bt=null)=>({...Ft,ref:mergeRefs(Lt,Bt)}),[Lt]),zt=reactExports.useCallback(Ft=>{xt.current=Ft,kt()},[kt]),jt=reactExports.useCallback((Ft={},Bt=null)=>({...Ft,ref:mergeRefs(zt,Bt),style:{...Ft.style,position:et,minWidth:ut?void 0:"max-content",inset:"0 auto auto 0"}}),[et,zt,ut]),Mt=reactExports.useCallback((Ft={},Bt=null)=>{const{size:yt,shadowColor:bt,bg:ct,style:ht,...vt}=Ft;return{...vt,ref:Bt,"data-popper-arrow":"",style:getArrowStyle(Ft)}},[]),Dt=reactExports.useCallback((Ft={},Bt=null)=>({...Ft,ref:Bt,"data-popper-arrow-inner":""}),[]);return{update(){var Ft;(Ft=Ct.current)==null||Ft.update()},forceUpdate(){var Ft;(Ft=Ct.current)==null||Ft.forceUpdate()},transformOrigin:cssVars.transformOrigin.varRef,referenceRef:Lt,popperRef:zt,getPopperProps:jt,getArrowProps:Mt,getArrowInnerProps:Dt,getReferenceProps:Nt}}function getArrowStyle(_){const{size:a,shadowColor:$,bg:j,style:et}=_,tt={...et,position:"absolute"};return a&&(tt["--popper-arrow-size"]=a),$&&(tt["--popper-arrow-shadow-color"]=$),j&&(tt["--popper-arrow-bg"]=j),tt}function useDisclosure(_={}){const{onClose:a,onOpen:$,isOpen:j,id:et}=_,tt=useCallbackRef$2($),rt=useCallbackRef$2(a),[nt,it]=reactExports.useState(_.defaultIsOpen||!1),at=j!==void 0?j:nt,st=j!==void 0,ot=reactExports.useId(),ut=et??`disclosure-${ot}`,dt=reactExports.useCallback(()=>{st||it(!1),rt==null||rt()},[st,rt]),mt=reactExports.useCallback(()=>{st||it(!0),tt==null||tt()},[st,tt]),xt=reactExports.useCallback(()=>{at?dt():mt()},[at,mt,dt]);function Ct(Tt={}){return{...Tt,"aria-expanded":at,"aria-controls":ut,onClick(kt){var Lt;(Lt=Tt.onClick)==null||Lt.call(Tt,kt),xt()}}}function Pt(Tt={}){return{...Tt,hidden:!at,id:ut}}return{isOpen:at,onOpen:mt,onClose:dt,onToggle:xt,isControlled:st,getButtonProps:Ct,getDisclosureProps:Pt}}function useOutsideClick(_){const{ref:a,handler:$,enabled:j=!0}=_,et=useCallbackRef$2($),rt=reactExports.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;reactExports.useEffect(()=>{if(!j)return;const nt=ot=>{isValidEvent(ot,a)&&(rt.isPointerDown=!0)},it=ot=>{if(rt.ignoreEmulatedMouseEvents){rt.ignoreEmulatedMouseEvents=!1;return}rt.isPointerDown&&$&&isValidEvent(ot,a)&&(rt.isPointerDown=!1,et(ot))},at=ot=>{rt.ignoreEmulatedMouseEvents=!0,$&&rt.isPointerDown&&isValidEvent(ot,a)&&(rt.isPointerDown=!1,et(ot))},st=getOwnerDocument$1(a.current);return st.addEventListener("mousedown",nt,!0),st.addEventListener("mouseup",it,!0),st.addEventListener("touchstart",nt,!0),st.addEventListener("touchend",at,!0),()=>{st.removeEventListener("mousedown",nt,!0),st.removeEventListener("mouseup",it,!0),st.removeEventListener("touchstart",nt,!0),st.removeEventListener("touchend",at,!0)}},[$,a,et,rt,j])}function isValidEvent(_,a){var $;const j=_.target;return j&&!getOwnerDocument$1(j).contains(j)?!1:!(($=a.current)!=null&&$.contains(j))}function getOwnerDocument$1(_){var a;return(a=_==null?void 0:_.ownerDocument)!=null?a:document}function useAnimationState(_){const{isOpen:a,ref:$}=_,[j,et]=reactExports.useState(a),[tt,rt]=reactExports.useState(!1);return reactExports.useEffect(()=>{tt||(et(a),rt(!0))},[a,tt,j]),useEventListener(()=>$.current,"animationend",()=>{et(a)}),{present:!(a?!1:!j),onComplete(){var it;const at=getOwnerWindow($.current),st=new at.CustomEvent("animationend",{bubbles:!0});(it=$.current)==null||it.dispatchEvent(st)}}}function lazyDisclosure(_){const{wasSelected:a,enabled:$,isSelected:j,mode:et="unmount"}=_;return!!(!$||j||et==="keepMounted"&&a)}var[MenuDescendantsProvider,useMenuDescendantsContext,useMenuDescendants,useMenuDescendant]=createDescendantContext(),[MenuProvider,useMenuContext]=createContext$1({strict:!1,name:"MenuContext"});function useIds$1(_,...a){const $=reactExports.useId(),j=_||$;return reactExports.useMemo(()=>a.map(et=>`${et}-${j}`),[j,a])}function getOwnerDocument(_){var a;return(a=_==null?void 0:_.ownerDocument)!=null?a:document}function isActiveElement(_){return getOwnerDocument(_).activeElement===_}function useMenu(_={}){const{id:a,closeOnSelect:$=!0,closeOnBlur:j=!0,initialFocusRef:et,autoSelect:tt=!0,isLazy:rt,isOpen:nt,defaultIsOpen:it,onClose:at,onOpen:st,placement:ot="bottom-start",lazyBehavior:ut="unmount",direction:dt,computePositionOnMount:mt=!1,...xt}=_,Ct=reactExports.useRef(null),Pt=reactExports.useRef(null),Tt=useMenuDescendants(),kt=reactExports.useCallback(()=>{requestAnimationFrame(()=>{var Ot;(Ot=Ct.current)==null||Ot.focus({preventScroll:!1})})},[]),Lt=reactExports.useCallback(()=>{const Ot=setTimeout(()=>{var tr;if(et)(tr=et.current)==null||tr.focus();else{const nr=Tt.firstEnabled();nr&&bt(nr.index)}});Rt.current.add(Ot)},[Tt,et]),Nt=reactExports.useCallback(()=>{const Ot=setTimeout(()=>{const tr=Tt.lastEnabled();tr&&bt(tr.index)});Rt.current.add(Ot)},[Tt]),zt=reactExports.useCallback(()=>{st==null||st(),tt?Lt():kt()},[tt,Lt,kt,st]),{isOpen:jt,onOpen:Mt,onClose:Dt,onToggle:Ft}=useDisclosure({isOpen:nt,defaultIsOpen:it,onClose:at,onOpen:zt});useOutsideClick({enabled:jt&&j,ref:Ct,handler:Ot=>{var tr;(tr=Pt.current)!=null&&tr.contains(Ot.target)||Dt()}});const Bt=usePopper({...xt,enabled:jt||mt,placement:ot,direction:dt}),[yt,bt]=reactExports.useState(-1);useUpdateEffect(()=>{jt||bt(-1)},[jt]),useFocusOnHide(Ct,{focusRef:Pt,visible:jt,shouldFocus:!0});const ct=useAnimationState({isOpen:jt,ref:Ct}),[ht,vt]=useIds$1(a,"menu-button","menu-list"),St=reactExports.useCallback(()=>{Mt(),kt()},[Mt,kt]),Rt=reactExports.useRef(new Set([]));reactExports.useEffect(()=>{const Ot=Rt.current;return()=>{Ot.forEach(tr=>clearTimeout(tr)),Ot.clear()}},[]);const $t=reactExports.useCallback(()=>{Mt(),Lt()},[Lt,Mt]),Et=reactExports.useCallback(()=>{Mt(),Nt()},[Mt,Nt]),At=reactExports.useCallback(()=>{var Ot,tr;const nr=getOwnerDocument(Ct.current),ir=(Ot=Ct.current)==null?void 0:Ot.contains(nr.activeElement);if(!(jt&&!ir))return;const Kt=(tr=Tt.item(yt))==null?void 0:tr.node;Kt==null||Kt.focus({preventScroll:!0})},[jt,yt,Tt]),wt=reactExports.useRef(null);return{openAndFocusMenu:St,openAndFocusFirstItem:$t,openAndFocusLastItem:Et,onTransitionEnd:At,unstable__animationState:ct,descendants:Tt,popper:Bt,buttonId:ht,menuId:vt,forceUpdate:Bt.forceUpdate,orientation:"vertical",isOpen:jt,onToggle:Ft,onOpen:Mt,onClose:Dt,menuRef:Ct,buttonRef:Pt,focusedIndex:yt,closeOnSelect:$,closeOnBlur:j,autoSelect:tt,setFocusedIndex:bt,isLazy:rt,lazyBehavior:ut,initialFocusRef:et,rafId:wt}}function useMenuButton(_={},a=null){const $=useMenuContext(),{onToggle:j,popper:et,openAndFocusFirstItem:tt,openAndFocusLastItem:rt}=$,nt=reactExports.useCallback(it=>{const at=it.key,ot={Enter:tt,ArrowDown:tt,ArrowUp:rt}[at];ot&&(it.preventDefault(),it.stopPropagation(),ot(it))},[tt,rt]);return{..._,ref:mergeRefs($.buttonRef,a,et.referenceRef),id:$.buttonId,"data-active":dataAttr($.isOpen),"aria-expanded":$.isOpen,"aria-haspopup":"menu","aria-controls":$.menuId,onClick:callAllHandlers$1(_.onClick,j),onKeyDown:callAllHandlers$1(_.onKeyDown,nt)}}function isTargetMenuItem(_){var a;return isHTMLElement$1(_)&&!!((a=_==null?void 0:_.getAttribute("role"))!=null&&a.startsWith("menuitem"))}function useMenuList(_={},a=null){const $=useMenuContext();if(!$)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:j,setFocusedIndex:et,menuRef:tt,isOpen:rt,onClose:nt,menuId:it,isLazy:at,lazyBehavior:st,unstable__animationState:ot}=$,ut=useMenuDescendantsContext(),dt=useShortcut({preventDefault:Pt=>Pt.key!==" "&&isTargetMenuItem(Pt.target)}),mt=reactExports.useCallback(Pt=>{if(!Pt.currentTarget.contains(Pt.target))return;const Tt=Pt.key,Lt={Tab:zt=>zt.preventDefault(),Escape:nt,ArrowDown:()=>{const zt=ut.nextEnabled(j);zt&&et(zt.index)},ArrowUp:()=>{const zt=ut.prevEnabled(j);zt&&et(zt.index)}}[Tt];if(Lt){Pt.preventDefault(),Lt(Pt);return}const Nt=dt(zt=>{const jt=getNextItemFromSearch(ut.values(),zt,Mt=>{var Dt,Ft;return(Ft=(Dt=Mt==null?void 0:Mt.node)==null?void 0:Dt.textContent)!=null?Ft:""},ut.item(j));if(jt){const Mt=ut.indexOf(jt.node);et(Mt)}});isTargetMenuItem(Pt.target)&&Nt(Pt)},[ut,j,dt,nt,et]),xt=reactExports.useRef(!1);rt&&(xt.current=!0);const Ct=lazyDisclosure({wasSelected:xt.current,enabled:at,mode:st,isSelected:ot.present});return{..._,ref:mergeRefs(tt,a),children:Ct?_.children:null,tabIndex:-1,role:"menu",id:it,style:{..._.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:callAllHandlers$1(_.onKeyDown,mt)}}function useMenuPositioner(_={}){const{popper:a,isOpen:$}=useMenuContext();return a.getPopperProps({..._,style:{visibility:$?"visible":"hidden",..._.style}})}function useMenuItem(_={},a=null){const{onMouseEnter:$,onMouseMove:j,onMouseLeave:et,onClick:tt,onFocus:rt,isDisabled:nt,isFocusable:it,closeOnSelect:at,type:st,...ot}=_,ut=useMenuContext(),{setFocusedIndex:dt,focusedIndex:mt,closeOnSelect:xt,onClose:Ct,menuRef:Pt,isOpen:Tt,menuId:kt,rafId:Lt}=ut,Nt=reactExports.useRef(null),zt=`${kt}-menuitem-${reactExports.useId()}`,{index:jt,register:Mt}=useMenuDescendant({disabled:nt&&!it}),Dt=reactExports.useCallback(St=>{$==null||$(St),!nt&&dt(jt)},[dt,jt,nt,$]),Ft=reactExports.useCallback(St=>{j==null||j(St),Nt.current&&!isActiveElement(Nt.current)&&Dt(St)},[Dt,j]),Bt=reactExports.useCallback(St=>{et==null||et(St),!nt&&dt(-1)},[dt,nt,et]),yt=reactExports.useCallback(St=>{tt==null||tt(St),isTargetMenuItem(St.currentTarget)&&(at??xt)&&Ct()},[Ct,tt,xt,at]),bt=reactExports.useCallback(St=>{rt==null||rt(St),dt(jt)},[dt,rt,jt]),ct=jt===mt,ht=nt&&!it;useUpdateEffect(()=>{if(Tt)return ct&&!ht&&Nt.current?(Lt.current&&cancelAnimationFrame(Lt.current),Lt.current=requestAnimationFrame(()=>{var St;(St=Nt.current)==null||St.focus({preventScroll:!0}),Lt.current=null})):Pt.current&&!isActiveElement(Pt.current)&&Pt.current.focus({preventScroll:!0}),()=>{Lt.current&&cancelAnimationFrame(Lt.current)}},[ct,ht,Pt,Tt]);const vt=useClickable({onClick:yt,onFocus:bt,onMouseEnter:Dt,onMouseMove:Ft,onMouseLeave:Bt,ref:mergeRefs(Mt,Nt,a),isDisabled:nt,isFocusable:it});return{...ot,...vt,type:st??vt.type,id:zt,role:"menuitem",tabIndex:ct?0:-1}}function isHTMLElement$1(_){var a;if(!isElement(_))return!1;const $=(a=_.ownerDocument.defaultView)!=null?a:window;return _ instanceof $.HTMLElement}function isElement(_){return _!=null&&typeof _=="object"&&"nodeType"in _&&_.nodeType===Node.ELEMENT_NODE}var[MenuStylesProvider,useMenuStyles]=createContext$1({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Menu=_=>{const{children:a}=_,$=useMultiStyleConfig("Menu",_),j=omitThemingProps(_),{direction:et}=useTheme(),{descendants:tt,...rt}=useMenu({...j,direction:et}),nt=reactExports.useMemo(()=>rt,[rt]),{isOpen:it,onClose:at,forceUpdate:st}=nt;return jsxRuntimeExports.jsx(MenuDescendantsProvider,{value:tt,children:jsxRuntimeExports.jsx(MenuProvider,{value:nt,children:jsxRuntimeExports.jsx(MenuStylesProvider,{value:$,children:runIfFn$2(a,{isOpen:it,onClose:at,forceUpdate:st})})})})};Menu.displayName="Menu";var MenuCommand=forwardRef((_,a)=>{const $=useMenuStyles();return jsxRuntimeExports.jsx(chakra.span,{ref:a,..._,__css:$.command,className:"chakra-menu__command"})});MenuCommand.displayName="MenuCommand";var StyledMenuItem=forwardRef((_,a)=>{const{type:$,...j}=_,et=useMenuStyles(),tt=j.as||$?$??void 0:"button",rt=reactExports.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...et.item}),[et.item]);return jsxRuntimeExports.jsx(chakra.button,{ref:a,type:tt,...j,__css:rt})}),MenuIcon=_=>{const{className:a,children:$,...j}=_,et=useMenuStyles(),tt=reactExports.Children.only($),rt=reactExports.isValidElement(tt)?reactExports.cloneElement(tt,{focusable:"false","aria-hidden":!0,className:cx("chakra-menu__icon",tt.props.className)}):null,nt=cx("chakra-menu__icon-wrapper",a);return jsxRuntimeExports.jsx(chakra.span,{className:nt,...j,__css:et.icon,children:rt})};MenuIcon.displayName="MenuIcon";var MenuItem$1=forwardRef((_,a)=>{const{icon:$,iconSpacing:j="0.75rem",command:et,commandSpacing:tt="0.75rem",children:rt,...nt}=_,it=useMenuItem(nt,a),st=$||et?jsxRuntimeExports.jsx("span",{style:{pointerEvents:"none",flex:1},children:rt}):rt;return jsxRuntimeExports.jsxs(StyledMenuItem,{...it,className:cx("chakra-menu__menuitem",it.className),children:[$&&jsxRuntimeExports.jsx(MenuIcon,{fontSize:"0.8em",marginEnd:j,children:$}),st,et&&jsxRuntimeExports.jsx(MenuCommand,{marginStart:tt,children:et})]})});MenuItem$1.displayName="MenuItem";var motionVariants={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},MenuTransition=chakra(motion.div),MenuList=forwardRef(function(a,$){var j,et;const{rootProps:tt,motionProps:rt,...nt}=a,{isOpen:it,onTransitionEnd:at,unstable__animationState:st}=useMenuContext(),ot=useMenuList(nt,$),ut=useMenuPositioner(tt),dt=useMenuStyles();return jsxRuntimeExports.jsx(chakra.div,{...ut,__css:{zIndex:(et=a.zIndex)!=null?et:(j=dt.list)==null?void 0:j.zIndex},children:jsxRuntimeExports.jsx(MenuTransition,{variants:motionVariants,initial:!1,animate:it?"enter":"exit",__css:{outline:0,...dt.list},...rt,className:cx("chakra-menu__menu-list",ot.className),...ot,onUpdate:at,onAnimationComplete:callAll(st.onComplete,ot.onAnimationComplete)})})});MenuList.displayName="MenuList";var StyledMenuButton=forwardRef((_,a)=>{const $=useMenuStyles();return jsxRuntimeExports.jsx(chakra.button,{ref:a,..._,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...$.button}})}),MenuButton=forwardRef((_,a)=>{const{children:$,as:j,...et}=_,tt=useMenuButton(et,a),rt=j||StyledMenuButton;return jsxRuntimeExports.jsx(rt,{...tt,className:cx("chakra-menu__menu-button",_.className),children:jsxRuntimeExports.jsx(chakra.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:_.children})})});MenuButton.displayName="MenuButton";var transitions={slideInBottom:{...slideFadeConfig,custom:{offsetY:16,reverse:!0}},slideInRight:{...slideFadeConfig,custom:{offsetX:16,reverse:!0}},slideInTop:{...slideFadeConfig,custom:{offsetY:-16,reverse:!0}},slideInLeft:{...slideFadeConfig,custom:{offsetX:-16,reverse:!0}},scale:{...scaleFadeConfig,custom:{initialScale:.95,reverse:!0}},none:{}},MotionSection$1=chakra(motion.section),getMotionProps=_=>transitions[_||"none"],ModalTransition=reactExports.forwardRef((_,a)=>{const{preset:$,motionProps:j=getMotionProps($),...et}=_;return jsxRuntimeExports.jsx(MotionSection$1,{ref:a,...j,...et})});ModalTransition.displayName="ModalTransition";var __defProp$7=Object.defineProperty,__defNormalProp$2=(_,a,$)=>a in _?__defProp$7(_,a,{enumerable:!0,configurable:!0,writable:!0,value:$}):_[a]=$,__publicField$2=(_,a,$)=>(__defNormalProp$2(_,a+"",$),$),ModalManager=class{constructor(){__publicField$2(this,"modals"),this.modals=new Map}add(_){return this.modals.set(_,this.modals.size+1),this.modals.size}remove(_){this.modals.delete(_)}isTopModal(_){return _?this.modals.get(_)===this.modals.size:!1}},modalManager=new ModalManager;function useModalManager(_,a){const[$,j]=reactExports.useState(0);return reactExports.useEffect(()=>{const et=_.current;if(et){if(a){const tt=modalManager.add(et);j(tt)}return()=>{modalManager.remove(et),j(0)}}},[a,_]),$}var getDefaultParent=function(_){if(typeof document>"u")return null;var a=Array.isArray(_)?_[0]:_;return a.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(_){return _&&(_.host||unwrapHost(_.parentNode))},correctTargets=function(_,a){return a.map(function($){if(_.contains($))return $;var j=unwrapHost($);return j&&_.contains(j)?j:(console.error("aria-hidden",$,"in not contained inside",_,". Doing nothing"),null)}).filter(function($){return!!$})},applyAttributeToOthers=function(_,a,$,j){var et=correctTargets(a,Array.isArray(_)?_:[_]);markerMap[$]||(markerMap[$]=new WeakMap);var tt=markerMap[$],rt=[],nt=new Set,it=new Set(et),at=function(ot){!ot||nt.has(ot)||(nt.add(ot),at(ot.parentNode))};et.forEach(at);var st=function(ot){!ot||it.has(ot)||Array.prototype.forEach.call(ot.children,function(ut){if(nt.has(ut))st(ut);else{var dt=ut.getAttribute(j),mt=dt!==null&&dt!=="false",xt=(counterMap.get(ut)||0)+1,Ct=(tt.get(ut)||0)+1;counterMap.set(ut,xt),tt.set(ut,Ct),rt.push(ut),xt===1&&mt&&uncontrolledNodes.set(ut,!0),Ct===1&&ut.setAttribute($,"true"),mt||ut.setAttribute(j,"true")}})};return st(a),nt.clear(),lockCount++,function(){rt.forEach(function(ot){var ut=counterMap.get(ot)-1,dt=tt.get(ot)-1;counterMap.set(ot,ut),tt.set(ot,dt),ut||(uncontrolledNodes.has(ot)||ot.removeAttribute(j),uncontrolledNodes.delete(ot)),dt||ot.removeAttribute($)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(_,a,$){$===void 0&&($="data-aria-hidden");var j=Array.from(Array.isArray(_)?_:[_]),et=getDefaultParent(_);return et?(j.push.apply(j,Array.from(et.querySelectorAll("[aria-live]"))),applyAttributeToOthers(j,et,$,"aria-hidden")):function(){return null}};function useModal(_){const{isOpen:a,onClose:$,id:j,closeOnOverlayClick:et=!0,closeOnEsc:tt=!0,useInert:rt=!0,onOverlayClick:nt,onEsc:it}=_,at=reactExports.useRef(null),st=reactExports.useRef(null),[ot,ut,dt]=useIds(j,"chakra-modal","chakra-modal--header","chakra-modal--body");useAriaHidden(at,a&&rt);const mt=useModalManager(at,a),xt=reactExports.useRef(null),Ct=reactExports.useCallback(Dt=>{xt.current=Dt.target},[]),Pt=reactExports.useCallback(Dt=>{Dt.key==="Escape"&&(Dt.stopPropagation(),tt&&($==null||$()),it==null||it())},[tt,$,it]),[Tt,kt]=reactExports.useState(!1),[Lt,Nt]=reactExports.useState(!1),zt=reactExports.useCallback((Dt={},Ft=null)=>({role:"dialog",...Dt,ref:mergeRefs(Ft,at),id:ot,tabIndex:-1,"aria-modal":!0,"aria-labelledby":Tt?ut:void 0,"aria-describedby":Lt?dt:void 0,onClick:callAllHandlers$1(Dt.onClick,Bt=>Bt.stopPropagation())}),[dt,Lt,ot,ut,Tt]),jt=reactExports.useCallback(Dt=>{Dt.stopPropagation(),xt.current===Dt.target&&modalManager.isTopModal(at.current)&&(et&&($==null||$()),nt==null||nt())},[$,et,nt]),Mt=reactExports.useCallback((Dt={},Ft=null)=>({...Dt,ref:mergeRefs(Ft,st),onClick:callAllHandlers$1(Dt.onClick,jt),onKeyDown:callAllHandlers$1(Dt.onKeyDown,Pt),onMouseDown:callAllHandlers$1(Dt.onMouseDown,Ct)}),[Pt,Ct,jt]);return{isOpen:a,onClose:$,headerId:ut,bodyId:dt,setBodyMounted:Nt,setHeaderMounted:kt,dialogRef:at,overlayRef:st,getDialogProps:zt,getDialogContainerProps:Mt,index:mt}}function useAriaHidden(_,a){const $=_.current;reactExports.useEffect(()=>{if(!(!_.current||!a))return hideOthers(_.current)},[a,_,$])}function useIds(_,...a){const $=reactExports.useId(),j=_||$;return reactExports.useMemo(()=>a.map(et=>`${et}-${j}`),[j,a])}var[ModalStylesProvider,useModalStyles]=createContext$1({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[ModalContextProvider,useModalContext]=createContext$1({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),Modal=_=>{const a={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,..._},{portalProps:$,children:j,autoFocus:et,trapFocus:tt,initialFocusRef:rt,finalFocusRef:nt,returnFocusOnClose:it,blockScrollOnMount:at,allowPinchZoom:st,preserveScrollBarGap:ot,motionPreset:ut,lockFocusAcrossFrames:dt,onCloseComplete:mt}=a,xt=useMultiStyleConfig("Modal",a),Pt={...useModal(a),autoFocus:et,trapFocus:tt,initialFocusRef:rt,finalFocusRef:nt,returnFocusOnClose:it,blockScrollOnMount:at,allowPinchZoom:st,preserveScrollBarGap:ot,motionPreset:ut,lockFocusAcrossFrames:dt};return jsxRuntimeExports.jsx(ModalContextProvider,{value:Pt,children:jsxRuntimeExports.jsx(ModalStylesProvider,{value:xt,children:jsxRuntimeExports.jsx(AnimatePresence,{onExitComplete:mt,children:Pt.isOpen&&jsxRuntimeExports.jsx(Portal,{...$,children:j})})})})};Modal.displayName="Modal";var zeroRightClassName$1="right-scroll-bar-position",fullWidthClassName$1="width-before-scroll-bar",noScrollbarsClassName$1="with-scroll-bars-hidden",removedBarSizeVariable$1="--removed-body-scroll-bar-size",effectCar$1=createSidecarMedium(),nothing$1=function(){},RemoveScroll$1=reactExports.forwardRef(function(_,a){var $=reactExports.useRef(null),j=reactExports.useState({onScrollCapture:nothing$1,onWheelCapture:nothing$1,onTouchMoveCapture:nothing$1}),et=j[0],tt=j[1],rt=_.forwardProps,nt=_.children,it=_.className,at=_.removeScrollBar,st=_.enabled,ot=_.shards,ut=_.sideCar,dt=_.noIsolation,mt=_.inert,xt=_.allowPinchZoom,Ct=_.as,Pt=Ct===void 0?"div":Ct,Tt=_.gapMode,kt=__rest$3(_,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Lt=ut,Nt=useMergeRefs([$,a]),zt=__assign(__assign({},kt),et);return reactExports.createElement(reactExports.Fragment,null,st&&reactExports.createElement(Lt,{sideCar:effectCar$1,removeScrollBar:at,shards:ot,noIsolation:dt,inert:mt,setCallbacks:tt,allowPinchZoom:!!xt,lockRef:$,gapMode:Tt}),rt?reactExports.cloneElement(reactExports.Children.only(nt),__assign(__assign({},zt),{ref:Nt})):reactExports.createElement(Pt,__assign({},zt,{className:it,ref:Nt}),nt))});RemoveScroll$1.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll$1.classNames={fullWidth:fullWidthClassName$1,zeroRight:zeroRightClassName$1};var getNonce$1=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var _=document.createElement("style");_.type="text/css";var a=getNonce$1();return a&&_.setAttribute("nonce",a),_}function injectStyles(_,a){_.styleSheet?_.styleSheet.cssText=a:_.appendChild(document.createTextNode(a))}function insertStyleTag(_){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(_)}var stylesheetSingleton=function(){var _=0,a=null;return{add:function($){_==0&&(a=makeStyleTag())&&(injectStyles(a,$),insertStyleTag(a)),_++},remove:function(){_--,!_&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},styleHookSingleton=function(){var _=stylesheetSingleton();return function(a,$){reactExports.useEffect(function(){return _.add(a),function(){_.remove()}},[a&&$])}},styleSingleton=function(){var _=styleHookSingleton(),a=function($){var j=$.styles,et=$.dynamic;return _(j,et),null};return a},zeroGap$1={left:0,top:0,right:0,gap:0},parse$b=function(_){return parseInt(_||"",10)||0},getOffset$1=function(_){var a=window.getComputedStyle(document.body),$=a[_==="padding"?"paddingLeft":"marginLeft"],j=a[_==="padding"?"paddingTop":"marginTop"],et=a[_==="padding"?"paddingRight":"marginRight"];return[parse$b($),parse$b(j),parse$b(et)]},getGapWidth$1=function(_){if(_===void 0&&(_="margin"),typeof window>"u")return zeroGap$1;var a=getOffset$1(_),$=document.documentElement.clientWidth,j=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,j-$+a[2]-a[0])}},Style$1=styleSingleton(),getStyles$1=function(_,a,$,j){var et=_.left,tt=_.top,rt=_.right,nt=_.gap;return $===void 0&&($="margin"),` .`.concat(noScrollbarsClassName$1,` { overflow: hidden `).concat(j,`; padding-right: `).concat(nt,"px ").concat(j,`; @@ -385,27 +385,27 @@ Error generating stack: `+tt.message+` body { `).concat(removedBarSizeVariable$1,": ").concat(nt,`px; } -`)},RemoveScrollBar$1=function(_){var a=_.noRelative,$=_.noImportant,j=_.gapMode,et=j===void 0?"margin":j,tt=reactExports.useMemo(function(){return getGapWidth$1(et)},[et]);return reactExports.createElement(Style$1,{styles:getStyles$1(tt,!a,et,$?"":"!important")})},passiveSupported$1=!1;if(typeof window<"u")try{var options$1=Object.defineProperty({},"passive",{get:function(){return passiveSupported$1=!0,!0}});window.addEventListener("test",options$1,options$1),window.removeEventListener("test",options$1,options$1)}catch{passiveSupported$1=!1}var nonPassive$1=passiveSupported$1?{passive:!1}:!1,alwaysContainsScroll$1=function(_){return _.tagName==="TEXTAREA"},elementCanBeScrolled$1=function(_,a){var $=window.getComputedStyle(_);return $[a]!=="hidden"&&!($.overflowY===$.overflowX&&!alwaysContainsScroll$1(_)&&$[a]==="visible")},elementCouldBeVScrolled$1=function(_){return elementCanBeScrolled$1(_,"overflowY")},elementCouldBeHScrolled$1=function(_){return elementCanBeScrolled$1(_,"overflowX")},locationCouldBeScrolled$1=function(_,a){var $=a.ownerDocument,j=a;do{typeof ShadowRoot<"u"&&j instanceof ShadowRoot&&(j=j.host);var et=elementCouldBeScrolled$1(_,j);if(et){var tt=getScrollVariables$1(_,j),rt=tt[1],nt=tt[2];if(rt>nt)return!0}j=j.parentNode}while(j&&j!==$.body);return!1},getVScrollVariables$1=function(_){var a=_.scrollTop,$=_.scrollHeight,j=_.clientHeight;return[a,$,j]},getHScrollVariables$1=function(_){var a=_.scrollLeft,$=_.scrollWidth,j=_.clientWidth;return[a,$,j]},elementCouldBeScrolled$1=function(_,a){return _==="v"?elementCouldBeVScrolled$1(a):elementCouldBeHScrolled$1(a)},getScrollVariables$1=function(_,a){return _==="v"?getVScrollVariables$1(a):getHScrollVariables$1(a)},getDirectionFactor$1=function(_,a){return _==="h"&&a==="rtl"?-1:1},handleScroll$1=function(_,a,$,j,et){var tt=getDirectionFactor$1(_,window.getComputedStyle(a).direction),rt=tt*j,nt=$.target,it=a.contains(nt),ot=!1,st=rt>0,at=0,ut=0;do{var ht=getScrollVariables$1(_,nt),bt=ht[0],Et=ht[1],Ct=ht[2],Pt=Et-Ct-tt*bt;(bt||Pt)&&elementCouldBeScrolled$1(_,nt)&&(at+=Pt,ut+=bt),nt instanceof ShadowRoot?nt=nt.host:nt=nt.parentNode}while(!it&&nt!==document.body||it&&(a.contains(nt)||a===nt));return(st&&(Math.abs(at)<1||!et)||!st&&(Math.abs(ut)<1||!et))&&(ot=!0),ot},getTouchXY$1=function(_){return"changedTouches"in _?[_.changedTouches[0].clientX,_.changedTouches[0].clientY]:[0,0]},getDeltaXY$1=function(_){return[_.deltaX,_.deltaY]},extractRef$1=function(_){return _&&"current"in _?_.current:_},deltaCompare$1=function(_,a){return _[0]===a[0]&&_[1]===a[1]},generateStyle$1=function(_){return` +`)},RemoveScrollBar$1=function(_){var a=_.noRelative,$=_.noImportant,j=_.gapMode,et=j===void 0?"margin":j,tt=reactExports.useMemo(function(){return getGapWidth$1(et)},[et]);return reactExports.createElement(Style$1,{styles:getStyles$1(tt,!a,et,$?"":"!important")})},passiveSupported$1=!1;if(typeof window<"u")try{var options$1=Object.defineProperty({},"passive",{get:function(){return passiveSupported$1=!0,!0}});window.addEventListener("test",options$1,options$1),window.removeEventListener("test",options$1,options$1)}catch{passiveSupported$1=!1}var nonPassive$1=passiveSupported$1?{passive:!1}:!1,alwaysContainsScroll$1=function(_){return _.tagName==="TEXTAREA"},elementCanBeScrolled$1=function(_,a){var $=window.getComputedStyle(_);return $[a]!=="hidden"&&!($.overflowY===$.overflowX&&!alwaysContainsScroll$1(_)&&$[a]==="visible")},elementCouldBeVScrolled$1=function(_){return elementCanBeScrolled$1(_,"overflowY")},elementCouldBeHScrolled$1=function(_){return elementCanBeScrolled$1(_,"overflowX")},locationCouldBeScrolled$1=function(_,a){var $=a.ownerDocument,j=a;do{typeof ShadowRoot<"u"&&j instanceof ShadowRoot&&(j=j.host);var et=elementCouldBeScrolled$1(_,j);if(et){var tt=getScrollVariables$1(_,j),rt=tt[1],nt=tt[2];if(rt>nt)return!0}j=j.parentNode}while(j&&j!==$.body);return!1},getVScrollVariables$1=function(_){var a=_.scrollTop,$=_.scrollHeight,j=_.clientHeight;return[a,$,j]},getHScrollVariables$1=function(_){var a=_.scrollLeft,$=_.scrollWidth,j=_.clientWidth;return[a,$,j]},elementCouldBeScrolled$1=function(_,a){return _==="v"?elementCouldBeVScrolled$1(a):elementCouldBeHScrolled$1(a)},getScrollVariables$1=function(_,a){return _==="v"?getVScrollVariables$1(a):getHScrollVariables$1(a)},getDirectionFactor$1=function(_,a){return _==="h"&&a==="rtl"?-1:1},handleScroll$1=function(_,a,$,j,et){var tt=getDirectionFactor$1(_,window.getComputedStyle(a).direction),rt=tt*j,nt=$.target,it=a.contains(nt),at=!1,st=rt>0,ot=0,ut=0;do{var dt=getScrollVariables$1(_,nt),mt=dt[0],xt=dt[1],Ct=dt[2],Pt=xt-Ct-tt*mt;(mt||Pt)&&elementCouldBeScrolled$1(_,nt)&&(ot+=Pt,ut+=mt),nt instanceof ShadowRoot?nt=nt.host:nt=nt.parentNode}while(!it&&nt!==document.body||it&&(a.contains(nt)||a===nt));return(st&&(Math.abs(ot)<1||!et)||!st&&(Math.abs(ut)<1||!et))&&(at=!0),at},getTouchXY$1=function(_){return"changedTouches"in _?[_.changedTouches[0].clientX,_.changedTouches[0].clientY]:[0,0]},getDeltaXY$1=function(_){return[_.deltaX,_.deltaY]},extractRef$1=function(_){return _&&"current"in _?_.current:_},deltaCompare$1=function(_,a){return _[0]===a[0]&&_[1]===a[1]},generateStyle$1=function(_){return` .block-interactivity-`.concat(_,` {pointer-events: none;} .allow-interactivity-`).concat(_,` {pointer-events: all;} -`)},idCounter$1=0,lockStack$1=[];function RemoveScrollSideCar$1(_){var a=reactExports.useRef([]),$=reactExports.useRef([0,0]),j=reactExports.useRef(),et=reactExports.useState(idCounter$1++)[0],tt=reactExports.useState(styleSingleton)[0],rt=reactExports.useRef(_);reactExports.useEffect(function(){rt.current=_},[_]),reactExports.useEffect(function(){if(_.inert){document.body.classList.add("block-interactivity-".concat(et));var Et=__spreadArray([_.lockRef.current],(_.shards||[]).map(extractRef$1),!0).filter(Boolean);return Et.forEach(function(Ct){return Ct.classList.add("allow-interactivity-".concat(et))}),function(){document.body.classList.remove("block-interactivity-".concat(et)),Et.forEach(function(Ct){return Ct.classList.remove("allow-interactivity-".concat(et))})}}},[_.inert,_.lockRef.current,_.shards]);var nt=reactExports.useCallback(function(Et,Ct){if("touches"in Et&&Et.touches.length===2)return!rt.current.allowPinchZoom;var Pt=getTouchXY$1(Et),Tt=$.current,It="deltaX"in Et?Et.deltaX:Tt[0]-Pt[0],Lt="deltaY"in Et?Et.deltaY:Tt[1]-Pt[1],Nt,Ut=Et.target,jt=Math.abs(It)>Math.abs(Lt)?"h":"v";if("touches"in Et&&jt==="h"&&Ut.type==="range")return!1;var Mt=locationCouldBeScrolled$1(jt,Ut);if(!Mt)return!0;if(Mt?Nt=jt:(Nt=jt==="v"?"h":"v",Mt=locationCouldBeScrolled$1(jt,Ut)),!Mt)return!1;if(!j.current&&"changedTouches"in Et&&(It||Lt)&&(j.current=Nt),!Nt)return!0;var Dt=j.current||Nt;return handleScroll$1(Dt,Ct,Et,Dt==="h"?It:Lt,!0)},[]),it=reactExports.useCallback(function(Et){var Ct=Et;if(!(!lockStack$1.length||lockStack$1[lockStack$1.length-1]!==tt)){var Pt="deltaY"in Ct?getDeltaXY$1(Ct):getTouchXY$1(Ct),Tt=a.current.filter(function(Nt){return Nt.name===Ct.type&&(Nt.target===Ct.target||Ct.target===Nt.shadowParent)&&deltaCompare$1(Nt.delta,Pt)})[0];if(Tt&&Tt.should){Ct.cancelable&&Ct.preventDefault();return}if(!Tt){var It=(rt.current.shards||[]).map(extractRef$1).filter(Boolean).filter(function(Nt){return Nt.contains(Ct.target)}),Lt=It.length>0?nt(Ct,It[0]):!rt.current.noIsolation;Lt&&Ct.cancelable&&Ct.preventDefault()}}},[]),ot=reactExports.useCallback(function(Et,Ct,Pt,Tt){var It={name:Et,delta:Ct,target:Pt,should:Tt,shadowParent:getOutermostShadowParent$1(Pt)};a.current.push(It),setTimeout(function(){a.current=a.current.filter(function(Lt){return Lt!==It})},1)},[]),st=reactExports.useCallback(function(Et){$.current=getTouchXY$1(Et),j.current=void 0},[]),at=reactExports.useCallback(function(Et){ot(Et.type,getDeltaXY$1(Et),Et.target,nt(Et,_.lockRef.current))},[]),ut=reactExports.useCallback(function(Et){ot(Et.type,getTouchXY$1(Et),Et.target,nt(Et,_.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack$1.push(tt),_.setCallbacks({onScrollCapture:at,onWheelCapture:at,onTouchMoveCapture:ut}),document.addEventListener("wheel",it,nonPassive$1),document.addEventListener("touchmove",it,nonPassive$1),document.addEventListener("touchstart",st,nonPassive$1),function(){lockStack$1=lockStack$1.filter(function(Et){return Et!==tt}),document.removeEventListener("wheel",it,nonPassive$1),document.removeEventListener("touchmove",it,nonPassive$1),document.removeEventListener("touchstart",st,nonPassive$1)}},[]);var ht=_.removeScrollBar,bt=_.inert;return reactExports.createElement(reactExports.Fragment,null,bt?reactExports.createElement(tt,{styles:generateStyle$1(et)}):null,ht?reactExports.createElement(RemoveScrollBar$1,{gapMode:_.gapMode}):null)}function getOutermostShadowParent$1(_){for(var a=null;_!==null;)_ instanceof ShadowRoot&&(a=_.host,_=_.host),_=_.parentNode;return a}const SideCar$1=exportSidecar(effectCar$1,RemoveScrollSideCar$1);var ReactRemoveScroll$1=reactExports.forwardRef(function(_,a){return reactExports.createElement(RemoveScroll$1,__assign({},_,{ref:a,sideCar:SideCar$1}))});ReactRemoveScroll$1.classNames=RemoveScroll$1.classNames;function ModalFocusScope(_){const{autoFocus:a,trapFocus:$,dialogRef:j,initialFocusRef:et,blockScrollOnMount:tt,allowPinchZoom:rt,finalFocusRef:nt,returnFocusOnClose:it,preserveScrollBarGap:ot,lockFocusAcrossFrames:st,isOpen:at}=useModalContext(),[ut,ht]=usePresence();reactExports.useEffect(()=>{!ut&&ht&&setTimeout(ht)},[ut,ht]);const bt=useModalManager(j,at);return jsxRuntimeExports.jsx(FocusLock,{autoFocus:a,isDisabled:!$,initialFocusRef:et,finalFocusRef:nt,restoreFocus:it,contentRef:j,lockFocusAcrossFrames:st,children:jsxRuntimeExports.jsx(ReactRemoveScroll$1,{removeScrollBar:!ot,allowPinchZoom:rt,enabled:bt===1&&tt,forwardProps:!0,children:_.children})})}var ModalContent=forwardRef((_,a)=>{const{className:$,children:j,containerProps:et,motionProps:tt,...rt}=_,{getDialogProps:nt,getDialogContainerProps:it}=useModalContext(),ot=nt(rt,a),st=it(et),at=cx("chakra-modal__content",$),ut=useModalStyles(),ht={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...ut.dialog},bt={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...ut.dialogContainer},{motionPreset:Et}=useModalContext();return jsxRuntimeExports.jsx(ModalFocusScope,{children:jsxRuntimeExports.jsx(chakra.div,{...st,className:"chakra-modal__content-container",tabIndex:-1,__css:bt,children:jsxRuntimeExports.jsx(ModalTransition,{preset:Et,motionProps:tt,className:at,...ot,__css:ht,children:j})})})});ModalContent.displayName="ModalContent";var[DrawerContextProvider,useDrawerContext]=createContext$1(),placementMap={start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}};function getDrawerPlacement(_,a){var $,j;if(_)return(j=($=placementMap[_])==null?void 0:$[a])!=null?j:_}function Drawer(_){var a;const{isOpen:$,onClose:j,placement:et="right",children:tt,...rt}=_,nt=useTheme(),it=(a=nt.components)==null?void 0:a.Drawer,ot=getDrawerPlacement(et,nt.direction);return jsxRuntimeExports.jsx(DrawerContextProvider,{value:{placement:ot},children:jsxRuntimeExports.jsx(Modal,{isOpen:$,onClose:j,styleConfig:it,...rt,children:tt})})}var MotionDiv$2=chakra(Slide),DrawerContent=forwardRef((_,a)=>{const{className:$,children:j,motionProps:et,containerProps:tt,...rt}=_,{getDialogProps:nt,getDialogContainerProps:it,isOpen:ot}=useModalContext(),st=nt(rt,a),at=it(tt),ut=cx("chakra-modal__content",$),ht=useModalStyles(),bt={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...ht.dialog},Et={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...ht.dialogContainer},{placement:Ct}=useDrawerContext();return jsxRuntimeExports.jsx(ModalFocusScope,{children:jsxRuntimeExports.jsx(chakra.div,{...at,className:"chakra-modal__content-container",__css:Et,children:jsxRuntimeExports.jsx(MotionDiv$2,{motionProps:et,direction:Ct,in:ot,className:ut,...st,__css:bt,children:j})})})});DrawerContent.displayName="DrawerContent";var ModalFooter=forwardRef((_,a)=>{const{className:$,...j}=_,et=cx("chakra-modal__footer",$),rt={display:"flex",alignItems:"center",justifyContent:"flex-end",...useModalStyles().footer};return jsxRuntimeExports.jsx(chakra.footer,{ref:a,...j,__css:rt,className:et})});ModalFooter.displayName="ModalFooter";var ModalHeader=forwardRef((_,a)=>{const{className:$,...j}=_,{headerId:et,setHeaderMounted:tt}=useModalContext();reactExports.useEffect(()=>(tt(!0),()=>tt(!1)),[tt]);const rt=cx("chakra-modal__header",$),it={flex:0,...useModalStyles().header};return jsxRuntimeExports.jsx(chakra.header,{ref:a,className:rt,id:et,...j,__css:it})});ModalHeader.displayName="ModalHeader";var MotionDiv$1=chakra(motion.div),ModalOverlay=forwardRef((_,a)=>{const{className:$,transition:j,motionProps:et,...tt}=_,rt=cx("chakra-modal__overlay",$),it={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...useModalStyles().overlay},{motionPreset:ot}=useModalContext(),at=et||(ot==="none"?{}:fadeConfig);return jsxRuntimeExports.jsx(MotionDiv$1,{...at,__css:it,ref:a,className:rt,...tt})});ModalOverlay.displayName="ModalOverlay";var ModalBody=forwardRef((_,a)=>{const{className:$,...j}=_,{bodyId:et,setBodyMounted:tt}=useModalContext();reactExports.useEffect(()=>(tt(!0),()=>tt(!1)),[tt]);const rt=cx("chakra-modal__body",$),nt=useModalStyles();return jsxRuntimeExports.jsx(chakra.div,{ref:a,className:rt,id:et,...j,__css:nt.body})});ModalBody.displayName="ModalBody";var ModalCloseButton=forwardRef((_,a)=>{const{onClick:$,className:j,...et}=_,{onClose:tt}=useModalContext(),rt=cx("chakra-modal__close-btn",j),nt=useModalStyles();return jsxRuntimeExports.jsx(CloseButton,{ref:a,__css:nt.closeButton,className:rt,onClick:callAllHandlers$1($,it=>{it.stopPropagation(),tt()}),...et})});ModalCloseButton.displayName="ModalCloseButton";var[PopoverProvider,usePopoverContext]=createContext$1({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[PopoverStylesProvider,usePopoverStyles]=createContext$1({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function PopoverTrigger(_){const a=reactExports.Children.only(_.children),{getTriggerProps:$}=usePopoverContext();return reactExports.cloneElement(a,$(a.props,a.ref))}PopoverTrigger.displayName="PopoverTrigger";var TRIGGER={click:"click",hover:"hover"};function usePopover(_={}){const{closeOnBlur:a=!0,closeOnEsc:$=!0,initialFocusRef:j,id:et,returnFocusOnClose:tt=!0,autoFocus:rt=!0,arrowSize:nt,arrowShadowColor:it,trigger:ot=TRIGGER.click,openDelay:st=200,closeDelay:at=200,isLazy:ut,lazyBehavior:ht="unmount",computePositionOnMount:bt,...Et}=_,{isOpen:Ct,onClose:Pt,onOpen:Tt,onToggle:It}=useDisclosure(_),Lt=reactExports.useRef(null),Nt=reactExports.useRef(null),Ut=reactExports.useRef(null),jt=reactExports.useRef(!1),Mt=reactExports.useRef(!1);Ct&&(Mt.current=!0);const[Dt,Ft]=reactExports.useState(!1),[Bt,yt]=reactExports.useState(!1),mt=reactExports.useId(),ct=et??mt,[dt,vt,St,Rt]=["popover-trigger","popover-content","popover-header","popover-body"].map(pr=>`${pr}-${ct}`),{referenceRef:$t,getArrowProps:xt,getPopperProps:At,getArrowInnerProps:wt,forceUpdate:Ot}=usePopper({...Et,enabled:Ct||!!bt}),tr=useAnimationState({isOpen:Ct,ref:Ut});useFocusOnPointerDown({enabled:Ct,ref:Nt}),useFocusOnHide(Ut,{focusRef:Nt,visible:Ct,shouldFocus:tt&&ot===TRIGGER.click}),useFocusOnShow(Ut,{focusRef:j,visible:Ct,shouldFocus:rt&&ot===TRIGGER.click});const nr=lazyDisclosure({wasSelected:Mt.current,enabled:ut,mode:ht,isSelected:tr.present}),ir=reactExports.useCallback((pr={},kr=null)=>{const Ir={...pr,style:{...pr.style,transformOrigin:cssVars.transformOrigin.varRef,[cssVars.arrowSize.var]:nt?`${nt}px`:void 0,[cssVars.arrowShadowColor.var]:it},ref:mergeRefs(Ut,kr),children:nr?pr.children:null,id:vt,tabIndex:-1,role:"dialog",onKeyDown:callAllHandlers$1(pr.onKeyDown,lr=>{$&&lr.key==="Escape"&&Pt()}),onBlur:callAllHandlers$1(pr.onBlur,lr=>{const fr=getRelatedTarget(lr),Er=contains(Ut.current,fr),$r=contains(Nt.current,fr);Ct&&a&&(!Er&&!$r)&&Pt()}),"aria-labelledby":Dt?St:void 0,"aria-describedby":Bt?Rt:void 0};return ot===TRIGGER.hover&&(Ir.role="tooltip",Ir.onMouseEnter=callAllHandlers$1(pr.onMouseEnter,()=>{jt.current=!0}),Ir.onMouseLeave=callAllHandlers$1(pr.onMouseLeave,lr=>{lr.nativeEvent.relatedTarget!==null&&(jt.current=!1,setTimeout(()=>Pt(),at))})),Ir},[nr,vt,Dt,St,Bt,Rt,ot,$,Pt,Ct,a,at,it,nt]),Wt=reactExports.useCallback((pr={},kr=null)=>At({...pr,style:{visibility:Ct?"visible":"hidden",...pr.style}},kr),[Ct,At]),Kt=reactExports.useCallback((pr,kr=null)=>({...pr,ref:mergeRefs(kr,Lt,$t)}),[Lt,$t]),Jt=reactExports.useRef(),Ht=reactExports.useRef(),qt=reactExports.useCallback(pr=>{Lt.current==null&&$t(pr)},[$t]),Qt=reactExports.useCallback((pr={},kr=null)=>{const Ir={...pr,ref:mergeRefs(Nt,kr,qt),id:dt,"aria-haspopup":"dialog","aria-expanded":Ct,"aria-controls":vt};return ot===TRIGGER.click&&(Ir.onClick=callAllHandlers$1(pr.onClick,It)),ot===TRIGGER.hover&&(Ir.onFocus=callAllHandlers$1(pr.onFocus,()=>{Jt.current===void 0&&Tt()}),Ir.onBlur=callAllHandlers$1(pr.onBlur,lr=>{const fr=getRelatedTarget(lr),Er=!contains(Ut.current,fr);Ct&&a&&Er&&Pt()}),Ir.onKeyDown=callAllHandlers$1(pr.onKeyDown,lr=>{lr.key==="Escape"&&Pt()}),Ir.onMouseEnter=callAllHandlers$1(pr.onMouseEnter,()=>{jt.current=!0,Jt.current=window.setTimeout(()=>Tt(),st)}),Ir.onMouseLeave=callAllHandlers$1(pr.onMouseLeave,()=>{jt.current=!1,Jt.current&&(clearTimeout(Jt.current),Jt.current=void 0),Ht.current=window.setTimeout(()=>{jt.current===!1&&Pt()},at)})),Ir},[dt,Ct,vt,ot,qt,It,Tt,a,Pt,st,at]);reactExports.useEffect(()=>()=>{Jt.current&&clearTimeout(Jt.current),Ht.current&&clearTimeout(Ht.current)},[]);const dr=reactExports.useCallback((pr={},kr=null)=>({...pr,id:St,ref:mergeRefs(kr,Ir=>{Ft(!!Ir)})}),[St]),xr=reactExports.useCallback((pr={},kr=null)=>({...pr,id:Rt,ref:mergeRefs(kr,Ir=>{yt(!!Ir)})}),[Rt]);return{forceUpdate:Ot,isOpen:Ct,onAnimationComplete:tr.onComplete,onClose:Pt,getAnchorProps:Kt,getArrowProps:xt,getArrowInnerProps:wt,getPopoverPositionerProps:Wt,getPopoverProps:ir,getTriggerProps:Qt,getHeaderProps:dr,getBodyProps:xr}}function contains(_,a){return _===a||(_==null?void 0:_.contains(a))}function getRelatedTarget(_){var a;const $=_.currentTarget.ownerDocument.activeElement;return(a=_.relatedTarget)!=null?a:$}function Popover(_){const a=useMultiStyleConfig("Popover",_),{children:$,...j}=omitThemingProps(_),et=useTheme(),tt=usePopover({...j,direction:et.direction});return jsxRuntimeExports.jsx(PopoverProvider,{value:tt,children:jsxRuntimeExports.jsx(PopoverStylesProvider,{value:a,children:runIfFn$2($,{isOpen:tt.isOpen,onClose:tt.onClose,forceUpdate:tt.forceUpdate})})})}Popover.displayName="Popover";var resolveVar=(_,a)=>a?`${_}.${a}, ${a}`:void 0;function PopoverArrow(_){var a;const{bg:$,bgColor:j,backgroundColor:et,shadow:tt,boxShadow:rt,shadowColor:nt}=_,{getArrowProps:it,getArrowInnerProps:ot}=usePopoverContext(),st=usePopoverStyles(),at=(a=$??j)!=null?a:et,ut=tt??rt;return jsxRuntimeExports.jsx(chakra.div,{...it(),className:"chakra-popover__arrow-positioner",children:jsxRuntimeExports.jsx(chakra.div,{className:cx("chakra-popover__arrow",_.className),...ot(_),__css:{"--popper-arrow-shadow-color":resolveVar("colors",nt),"--popper-arrow-bg":resolveVar("colors",at),"--popper-arrow-shadow":resolveVar("shadows",ut),...st.arrow}})})}PopoverArrow.displayName="PopoverArrow";var PopoverBody=forwardRef(function(a,$){const{getBodyProps:j}=usePopoverContext(),et=usePopoverStyles();return jsxRuntimeExports.jsx(chakra.div,{...j(a,$),className:cx("chakra-popover__body",a.className),__css:et.body})});PopoverBody.displayName="PopoverBody";function mergeVariants(_){if(_)return{enter:{..._.enter,visibility:"visible"},exit:{..._.exit,transitionEnd:{visibility:"hidden"}}}}var scaleFade={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},MotionSection=chakra(motion.section),PopoverTransition=forwardRef(function(a,$){const{variants:j=scaleFade,...et}=a,{isOpen:tt}=usePopoverContext();return jsxRuntimeExports.jsx(MotionSection,{ref:$,variants:mergeVariants(j),initial:!1,animate:tt?"enter":"exit",...et})});PopoverTransition.displayName="PopoverTransition";var PopoverContent=forwardRef(function(a,$){const{rootProps:j,motionProps:et,...tt}=a,{getPopoverProps:rt,getPopoverPositionerProps:nt,onAnimationComplete:it}=usePopoverContext(),ot=usePopoverStyles(),st={position:"relative",display:"flex",flexDirection:"column",...ot.content};return jsxRuntimeExports.jsx(chakra.div,{...nt(j),__css:ot.popper,className:"chakra-popover__popper",children:jsxRuntimeExports.jsx(PopoverTransition,{...et,...rt(tt,$),onAnimationComplete:callAll(it,tt.onAnimationComplete),className:cx("chakra-popover__content",a.className),__css:st})})});PopoverContent.displayName="PopoverContent";function isInputEvent(_){return _&&isObject$5(_)&&isObject$5(_.target)}function useRadioGroup(_={}){const{onChange:a,value:$,defaultValue:j,name:et,isDisabled:tt,isFocusable:rt,isNative:nt,...it}=_,[ot,st]=reactExports.useState(j||""),at=typeof $<"u",ut=at?$:ot,ht=reactExports.useRef(null),bt=reactExports.useCallback(()=>{const Nt=ht.current;if(!Nt)return;let Ut="input:not(:disabled):checked";const jt=Nt.querySelector(Ut);if(jt){jt.focus();return}Ut="input:not(:disabled)";const Mt=Nt.querySelector(Ut);Mt==null||Mt.focus()},[]),Ct=`radio-${reactExports.useId()}`,Pt=et||Ct,Tt=reactExports.useCallback(Nt=>{const Ut=isInputEvent(Nt)?Nt.target.value:Nt;at||st(Ut),a==null||a(String(Ut))},[a,at]),It=reactExports.useCallback((Nt={},Ut=null)=>({...Nt,ref:mergeRefs(Ut,ht),role:"radiogroup"}),[]),Lt=reactExports.useCallback((Nt={},Ut=null)=>({...Nt,ref:Ut,name:Pt,[nt?"checked":"isChecked"]:ut!=null?Nt.value===ut:void 0,onChange(Mt){Tt(Mt)},"data-radiogroup":!0}),[nt,Pt,Tt,ut]);return{getRootProps:It,getRadioProps:Lt,name:Pt,ref:ht,focus:bt,setValue:st,value:ut,onChange:Tt,isDisabled:tt,isFocusable:rt,htmlProps:it}}var[RadioGroupProvider,useRadioGroupContext]=createContext$1({name:"RadioGroupContext",strict:!1}),RadioGroup=forwardRef((_,a)=>{const{colorScheme:$,size:j,variant:et,children:tt,className:rt,isDisabled:nt,isFocusable:it,...ot}=_,{value:st,onChange:at,getRootProps:ut,name:ht,htmlProps:bt}=useRadioGroup(ot),Et=reactExports.useMemo(()=>({name:ht,size:j,onChange:at,colorScheme:$,value:st,variant:et,isDisabled:nt,isFocusable:it}),[ht,j,at,$,st,et,nt,it]);return jsxRuntimeExports.jsx(RadioGroupProvider,{value:Et,children:jsxRuntimeExports.jsx(chakra.div,{...ut(bt,a),className:cx("chakra-radio-group",rt),children:tt})})});RadioGroup.displayName="RadioGroup";var visuallyHiddenStyle={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function useRadio(_={}){const{defaultChecked:a,isChecked:$,isFocusable:j,isDisabled:et,isReadOnly:tt,isRequired:rt,onChange:nt,isInvalid:it,name:ot,value:st,id:at,"data-radiogroup":ut,"aria-describedby":ht,...bt}=_,Et=`radio-${reactExports.useId()}`,Ct=useFormControlContext(),Tt=!!useRadioGroupContext()||!!ut;let Lt=!!Ct&&!Tt?Ct.id:Et;Lt=at??Lt;const Nt=et??(Ct==null?void 0:Ct.isDisabled),Ut=tt??(Ct==null?void 0:Ct.isReadOnly),jt=rt??(Ct==null?void 0:Ct.isRequired),Mt=it??(Ct==null?void 0:Ct.isInvalid),[Dt,Ft]=reactExports.useState(!1),[Bt,yt]=reactExports.useState(!1),[mt,ct]=reactExports.useState(!1),[dt,vt]=reactExports.useState(!1),[St,Rt]=reactExports.useState(!!a),$t=typeof $<"u",xt=$t?$:St;reactExports.useEffect(()=>trackFocusVisible(Ft),[]);const At=reactExports.useCallback(qt=>{if(Ut||Nt){qt.preventDefault();return}$t||Rt(qt.target.checked),nt==null||nt(qt)},[$t,Nt,Ut,nt]),wt=reactExports.useCallback(qt=>{qt.key===" "&&vt(!0)},[vt]),Ot=reactExports.useCallback(qt=>{qt.key===" "&&vt(!1)},[vt]),tr=reactExports.useCallback((qt={},Qt=null)=>({...qt,ref:Qt,"data-active":dataAttr(dt),"data-hover":dataAttr(mt),"data-disabled":dataAttr(Nt),"data-invalid":dataAttr(Mt),"data-checked":dataAttr(xt),"data-focus":dataAttr(Bt),"data-focus-visible":dataAttr(Bt&&Dt),"data-readonly":dataAttr(Ut),"aria-hidden":!0,onMouseDown:callAllHandlers$1(qt.onMouseDown,()=>vt(!0)),onMouseUp:callAllHandlers$1(qt.onMouseUp,()=>vt(!1)),onMouseEnter:callAllHandlers$1(qt.onMouseEnter,()=>ct(!0)),onMouseLeave:callAllHandlers$1(qt.onMouseLeave,()=>ct(!1))}),[dt,mt,Nt,Mt,xt,Bt,Ut,Dt]),{onFocus:nr,onBlur:ir}=Ct??{},Wt=reactExports.useCallback((qt={},Qt=null)=>{const dr=Nt&&!j;return{...qt,id:Lt,ref:Qt,type:"radio",name:ot,value:st,onChange:callAllHandlers$1(qt.onChange,At),onBlur:callAllHandlers$1(ir,qt.onBlur,()=>yt(!1)),onFocus:callAllHandlers$1(nr,qt.onFocus,()=>yt(!0)),onKeyDown:callAllHandlers$1(qt.onKeyDown,wt),onKeyUp:callAllHandlers$1(qt.onKeyUp,Ot),checked:xt,disabled:dr,readOnly:Ut,required:jt,"aria-invalid":ariaAttr(Mt),"aria-disabled":ariaAttr(dr),"aria-required":ariaAttr(jt),"data-readonly":dataAttr(Ut),"aria-describedby":ht,style:visuallyHiddenStyle}},[Nt,j,Lt,ot,st,At,ir,nr,wt,Ot,xt,Ut,jt,Mt,ht]);return{state:{isInvalid:Mt,isFocused:Bt,isChecked:xt,isActive:dt,isHovered:mt,isDisabled:Nt,isReadOnly:Ut,isRequired:jt},getCheckboxProps:tr,getRadioProps:tr,getInputProps:Wt,getLabelProps:(qt={},Qt=null)=>({...qt,ref:Qt,onMouseDown:callAllHandlers$1(qt.onMouseDown,stopEvent),"data-disabled":dataAttr(Nt),"data-checked":dataAttr(xt),"data-invalid":dataAttr(Mt)}),getRootProps:(qt,Qt=null)=>({...qt,ref:Qt,"data-disabled":dataAttr(Nt),"data-checked":dataAttr(xt),"data-invalid":dataAttr(Mt)}),htmlProps:bt}}function stopEvent(_){_.preventDefault(),_.stopPropagation()}function split$2(_,a){const $={},j={};for(const[et,tt]of Object.entries(_))a.includes(et)?$[et]=tt:j[et]=tt;return[$,j]}var Radio=forwardRef((_,a)=>{var $;const j=useRadioGroupContext(),{onChange:et,value:tt}=_,rt=useMultiStyleConfig("Radio",{...j,..._}),nt=omitThemingProps(_),{spacing:it="0.5rem",children:ot,isDisabled:st=j==null?void 0:j.isDisabled,isFocusable:at=j==null?void 0:j.isFocusable,inputProps:ut,...ht}=nt;let bt=_.isChecked;(j==null?void 0:j.value)!=null&&tt!=null&&(bt=j.value===tt);let Et=et;j!=null&&j.onChange&&tt!=null&&(Et=callAll(j.onChange,et));const Ct=($=_==null?void 0:_.name)!=null?$:j==null?void 0:j.name,{getInputProps:Pt,getCheckboxProps:Tt,getLabelProps:It,getRootProps:Lt,htmlProps:Nt}=useRadio({...ht,isChecked:bt,isFocusable:at,isDisabled:st,onChange:Et,name:Ct}),[Ut,jt]=split$2(Nt,layoutPropNames),Mt=Tt(jt),Dt=Pt(ut,a),Ft=It(),Bt=Object.assign({},Ut,Lt()),yt={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...rt.container},mt={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...rt.control},ct={userSelect:"none",marginStart:it,...rt.label};return jsxRuntimeExports.jsxs(chakra.label,{className:"chakra-radio",...Bt,__css:yt,children:[jsxRuntimeExports.jsx("input",{className:"chakra-radio__input",...Dt}),jsxRuntimeExports.jsx(chakra.span,{className:"chakra-radio__control",...Mt,__css:mt}),ot&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-radio__label",...Ft,__css:ct,children:ot})]})});Radio.displayName="Radio";var SelectField=forwardRef(function(a,$){const{children:j,placeholder:et,className:tt,...rt}=a;return jsxRuntimeExports.jsxs(chakra.select,{...rt,ref:$,className:cx("chakra-select",tt),children:[et&&jsxRuntimeExports.jsx("option",{value:"",children:et}),j]})});SelectField.displayName="SelectField";function split$1(_,a){const $={},j={};for(const[et,tt]of Object.entries(_))a.includes(et)?$[et]=tt:j[et]=tt;return[$,j]}var Select$1=forwardRef((_,a)=>{var $;const j=useMultiStyleConfig("Select",_),{rootProps:et,placeholder:tt,icon:rt,color:nt,height:it,h:ot,minH:st,minHeight:at,iconColor:ut,iconSize:ht,...bt}=omitThemingProps(_),[Et,Ct]=split$1(bt,layoutPropNames),Pt=useFormControl(Ct),Tt={width:"100%",height:"fit-content",position:"relative",color:nt},It={paddingEnd:"2rem",...j.field,_focus:{zIndex:"unset",...($=j.field)==null?void 0:$._focus}};return jsxRuntimeExports.jsxs(chakra.div,{className:"chakra-select__wrapper",__css:Tt,...Et,...et,children:[jsxRuntimeExports.jsx(SelectField,{ref:a,height:ot??it,minH:st??at,placeholder:tt,...Pt,__css:It,children:_.children}),jsxRuntimeExports.jsx(SelectIcon,{"data-disabled":dataAttr(Pt.disabled),...(ut||nt)&&{color:ut||nt},__css:j.icon,...ht&&{fontSize:ht},children:rt})]})});Select$1.displayName="Select";var DefaultIcon=_=>jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),IconWrapper=chakra("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),SelectIcon=_=>{const{children:a=jsxRuntimeExports.jsx(DefaultIcon,{}),...$}=_,j=reactExports.cloneElement(a,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return jsxRuntimeExports.jsx(IconWrapper,{...$,className:"chakra-select__icon-wrapper",children:reactExports.isValidElement(a)?j:null})};SelectIcon.displayName="SelectIcon";var Switch=forwardRef(function(a,$){const j=useMultiStyleConfig("Switch",a),{spacing:et="0.5rem",children:tt,...rt}=omitThemingProps(a),{getIndicatorProps:nt,getInputProps:it,getCheckboxProps:ot,getRootProps:st,getLabelProps:at}=useCheckbox(rt),ut=reactExports.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...j.container}),[j.container]),ht=reactExports.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...j.track}),[j.track]),bt=reactExports.useMemo(()=>({userSelect:"none",marginStart:et,...j.label}),[et,j.label]);return jsxRuntimeExports.jsxs(chakra.label,{...st(),className:cx("chakra-switch",a.className),__css:ut,children:[jsxRuntimeExports.jsx("input",{className:"chakra-switch__input",...it({},$)}),jsxRuntimeExports.jsx(chakra.span,{...ot(),className:"chakra-switch__track",__css:ht,children:jsxRuntimeExports.jsx(chakra.span,{__css:j.thumb,className:"chakra-switch__thumb",...nt()})}),tt&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-switch__label",...at(),__css:bt,children:tt})]})});Switch.displayName="Switch";var[TableStylesProvider,useTableStyles]=createContext$1({name:"TableStylesContext",errorMessage:`useTableStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Table=forwardRef((_,a)=>{const $=useMultiStyleConfig("Table",_),{className:j,layout:et,...tt}=omitThemingProps(_);return jsxRuntimeExports.jsx(TableStylesProvider,{value:$,children:jsxRuntimeExports.jsx(chakra.table,{ref:a,__css:{tableLayout:et,...$.table},className:cx("chakra-table",j),...tt})})});Table.displayName="Table";var Tr=forwardRef((_,a)=>{const $=useTableStyles();return jsxRuntimeExports.jsx(chakra.tr,{..._,ref:a,__css:$.tr})}),TableContainer=forwardRef((_,a)=>{var $;const{overflow:j,overflowX:et,className:tt,...rt}=_;return jsxRuntimeExports.jsx(chakra.div,{ref:a,className:cx("chakra-table__container",tt),...rt,__css:{display:"block",whiteSpace:"nowrap",WebkitOverflowScrolling:"touch",overflowX:($=j??et)!=null?$:"auto",overflowY:"hidden",maxWidth:"100%"}})}),Tbody=forwardRef((_,a)=>{const $=useTableStyles();return jsxRuntimeExports.jsx(chakra.tbody,{..._,ref:a,__css:$.tbody})}),Td=forwardRef(({isNumeric:_,...a},$)=>{const j=useTableStyles();return jsxRuntimeExports.jsx(chakra.td,{...a,ref:$,__css:j.td,"data-is-numeric":_})}),[TabsDescendantsProvider,useTabsDescendantsContext,useTabsDescendants,useTabsDescendant]=createDescendantContext();function useTabs(_){var a;const{defaultIndex:$,onChange:j,index:et,isManual:tt,isLazy:rt,lazyBehavior:nt="unmount",orientation:it="horizontal",direction:ot="ltr",...st}=_,[at,ut]=reactExports.useState($??0),[ht,bt]=useControllableState({defaultValue:$??0,value:et,onChange:j});reactExports.useEffect(()=>{et!=null&&ut(et)},[et]);const Et=useTabsDescendants(),Ct=reactExports.useId();return{id:`tabs-${(a=_.id)!=null?a:Ct}`,selectedIndex:ht,focusedIndex:at,setSelectedIndex:bt,setFocusedIndex:ut,isManual:tt,isLazy:rt,lazyBehavior:nt,orientation:it,descendants:Et,direction:ot,htmlProps:st}}var[TabsProvider,useTabsContext]=createContext$1({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function useTabList(_){const{focusedIndex:a,orientation:$,direction:j}=useTabsContext(),et=useTabsDescendantsContext(),tt=reactExports.useCallback(rt=>{const nt=()=>{var Tt;const It=et.nextEnabled(a);It&&((Tt=It.node)==null||Tt.focus())},it=()=>{var Tt;const It=et.prevEnabled(a);It&&((Tt=It.node)==null||Tt.focus())},ot=()=>{var Tt;const It=et.firstEnabled();It&&((Tt=It.node)==null||Tt.focus())},st=()=>{var Tt;const It=et.lastEnabled();It&&((Tt=It.node)==null||Tt.focus())},at=$==="horizontal",ut=$==="vertical",ht=rt.key,bt=j==="ltr"?"ArrowLeft":"ArrowRight",Et=j==="ltr"?"ArrowRight":"ArrowLeft",Pt={[bt]:()=>at&&it(),[Et]:()=>at&&nt(),ArrowDown:()=>ut&&nt(),ArrowUp:()=>ut&&it(),Home:ot,End:st}[ht];Pt&&(rt.preventDefault(),Pt(rt))},[et,a,$,j]);return{..._,role:"tablist","aria-orientation":$,onKeyDown:callAllHandlers$1(_.onKeyDown,tt)}}function useTab(_){const{isDisabled:a=!1,isFocusable:$=!1,...j}=_,{setSelectedIndex:et,isManual:tt,id:rt,setFocusedIndex:nt,selectedIndex:it}=useTabsContext(),{index:ot,register:st}=useTabsDescendant({disabled:a&&!$}),at=ot===it,ut=()=>{et(ot)},ht=()=>{nt(ot),!tt&&!(a&&$)&&et(ot)};return{...useClickable({...j,ref:mergeRefs(st,_.ref),isDisabled:a,isFocusable:$,onClick:callAllHandlers$1(_.onClick,ut)}),id:makeTabId(rt,ot),role:"tab",tabIndex:at?0:-1,type:"button","aria-selected":at,"aria-controls":makeTabPanelId(rt,ot),onFocus:a?void 0:callAllHandlers$1(_.onFocus,ht)}}var[TabPanelProvider,useTabPanelContext]=createContext$1({});function useTabPanels(_){const a=useTabsContext(),{id:$,selectedIndex:j}=a,tt=getValidChildren(_.children).map((rt,nt)=>reactExports.createElement(TabPanelProvider,{key:nt,value:{isSelected:nt===j,id:makeTabPanelId($,nt),tabId:makeTabId($,nt),selectedIndex:j}},rt));return{..._,children:tt}}function useTabPanel(_){const{children:a,...$}=_,{isLazy:j,lazyBehavior:et}=useTabsContext(),{isSelected:tt,id:rt,tabId:nt}=useTabPanelContext(),it=reactExports.useRef(!1);tt&&(it.current=!0);const ot=lazyDisclosure({wasSelected:it.current,isSelected:tt,enabled:j,mode:et});return{tabIndex:0,...$,children:ot?a:null,role:"tabpanel","aria-labelledby":nt,hidden:!tt,id:rt}}function makeTabId(_,a){return`${_}--tab-${a}`}function makeTabPanelId(_,a){return`${_}--tabpanel-${a}`}var[TabsStylesProvider,useTabsStyles]=createContext$1({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Tabs=forwardRef(function(a,$){const j=useMultiStyleConfig("Tabs",a),{children:et,className:tt,...rt}=omitThemingProps(a),{htmlProps:nt,descendants:it,...ot}=useTabs(rt),st=reactExports.useMemo(()=>ot,[ot]),{isFitted:at,...ut}=nt,ht={position:"relative",...j.root};return jsxRuntimeExports.jsx(TabsDescendantsProvider,{value:it,children:jsxRuntimeExports.jsx(TabsProvider,{value:st,children:jsxRuntimeExports.jsx(TabsStylesProvider,{value:j,children:jsxRuntimeExports.jsx(chakra.div,{className:cx("chakra-tabs",tt),ref:$,...ut,__css:ht,children:et})})})})});Tabs.displayName="Tabs";var TabList=forwardRef(function(a,$){const j=useTabList({...a,ref:$}),tt={display:"flex",...useTabsStyles().tablist};return jsxRuntimeExports.jsx(chakra.div,{...j,className:cx("chakra-tabs__tablist",a.className),__css:tt})});TabList.displayName="TabList";var TabPanel=forwardRef(function(a,$){const j=useTabPanel({...a,ref:$}),et=useTabsStyles();return jsxRuntimeExports.jsx(chakra.div,{outline:"0",...j,className:cx("chakra-tabs__tab-panel",a.className),__css:et.tabpanel})});TabPanel.displayName="TabPanel";var TabPanels=forwardRef(function(a,$){const j=useTabPanels(a),et=useTabsStyles();return jsxRuntimeExports.jsx(chakra.div,{...j,width:"100%",ref:$,className:cx("chakra-tabs__tab-panels",a.className),__css:et.tabpanels})});TabPanels.displayName="TabPanels";var Tab=forwardRef(function(a,$){const j=useTabsStyles(),et=useTab({...a,ref:$}),tt={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...j.tab};return jsxRuntimeExports.jsx(chakra.button,{...et,className:cx("chakra-tabs__tab",a.className),__css:tt})});Tab.displayName="Tab";function omit$2(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}var omitted=["h","minH","height","minHeight"],Textarea=forwardRef((_,a)=>{const $=useStyleConfig("Textarea",_),{className:j,rows:et,...tt}=omitThemingProps(_),rt=useFormControl(tt),nt=et?omit$2($,omitted):$;return jsxRuntimeExports.jsx(chakra.textarea,{ref:a,rows:et,...rt,className:cx("chakra-textarea",j),__css:nt})});Textarea.displayName="Textarea";var scale={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},getDoc=_=>{var a;return((a=_.current)==null?void 0:a.ownerDocument)||document},getWin=_=>{var a,$;return(($=(a=_.current)==null?void 0:a.ownerDocument)==null?void 0:$.defaultView)||window};function useTooltip(_={}){const{openDelay:a=0,closeDelay:$=0,closeOnClick:j=!0,closeOnMouseDown:et,closeOnScroll:tt,closeOnPointerDown:rt=et,closeOnEsc:nt=!0,onOpen:it,onClose:ot,placement:st,id:at,isOpen:ut,defaultIsOpen:ht,arrowSize:bt=10,arrowShadowColor:Et,arrowPadding:Ct,modifiers:Pt,isDisabled:Tt,gutter:It,offset:Lt,direction:Nt,...Ut}=_,{isOpen:jt,onOpen:Mt,onClose:Dt}=useDisclosure({isOpen:ut,defaultIsOpen:ht,onOpen:it,onClose:ot}),{referenceRef:Ft,getPopperProps:Bt,getArrowInnerProps:yt,getArrowProps:mt}=usePopper({enabled:jt,placement:st,arrowPadding:Ct,modifiers:Pt,gutter:It,offset:Lt,direction:Nt}),ct=reactExports.useId(),vt=`tooltip-${at??ct}`,St=reactExports.useRef(null),Rt=reactExports.useRef(),$t=reactExports.useCallback(()=>{Rt.current&&(clearTimeout(Rt.current),Rt.current=void 0)},[]),xt=reactExports.useRef(),At=reactExports.useCallback(()=>{xt.current&&(clearTimeout(xt.current),xt.current=void 0)},[]),wt=reactExports.useCallback(()=>{At(),Dt()},[Dt,At]),Ot=useCloseEvent(St,wt),tr=reactExports.useCallback(()=>{if(!Tt&&!Rt.current){jt&&Ot();const Qt=getWin(St);Rt.current=Qt.setTimeout(Mt,a)}},[Ot,Tt,jt,Mt,a]),nr=reactExports.useCallback(()=>{$t();const Qt=getWin(St);xt.current=Qt.setTimeout(wt,$)},[$,wt,$t]),ir=reactExports.useCallback(()=>{jt&&j&&nr()},[j,nr,jt]),Wt=reactExports.useCallback(()=>{jt&&rt&&nr()},[rt,nr,jt]),Kt=reactExports.useCallback(Qt=>{jt&&Qt.key==="Escape"&&nr()},[jt,nr]);useEventListener(()=>getDoc(St),"keydown",nt?Kt:void 0),useEventListener(()=>{if(!tt)return null;const Qt=St.current;if(!Qt)return null;const dr=getScrollParent$1(Qt);return dr.localName==="body"?getWin(St):dr},"scroll",()=>{jt&&tt&&wt()},{passive:!0,capture:!0}),reactExports.useEffect(()=>{Tt&&($t(),jt&&Dt())},[Tt,jt,Dt,$t]),reactExports.useEffect(()=>()=>{$t(),At()},[$t,At]),useEventListener(()=>St.current,"pointerleave",nr);const Jt=reactExports.useCallback((Qt={},dr=null)=>({...Qt,ref:mergeRefs(St,dr,Ft),onPointerEnter:callAllHandlers$1(Qt.onPointerEnter,pr=>{pr.pointerType!=="touch"&&tr()}),onClick:callAllHandlers$1(Qt.onClick,ir),onPointerDown:callAllHandlers$1(Qt.onPointerDown,Wt),onFocus:callAllHandlers$1(Qt.onFocus,tr),onBlur:callAllHandlers$1(Qt.onBlur,nr),"aria-describedby":jt?vt:void 0}),[tr,nr,Wt,jt,vt,ir,Ft]),Ht=reactExports.useCallback((Qt={},dr=null)=>Bt({...Qt,style:{...Qt.style,[cssVars.arrowSize.var]:bt?`${bt}px`:void 0,[cssVars.arrowShadowColor.var]:Et}},dr),[Bt,bt,Et]),qt=reactExports.useCallback((Qt={},dr=null)=>{const xr={...Qt.style,position:"relative",transformOrigin:cssVars.transformOrigin.varRef};return{ref:dr,...Ut,...Qt,id:vt,role:"tooltip",style:xr}},[Ut,vt]);return{isOpen:jt,show:tr,hide:nr,getTriggerProps:Jt,getTooltipProps:qt,getTooltipPositionerProps:Ht,getArrowProps:mt,getArrowInnerProps:yt}}var closeEventName="chakra-ui:close-tooltip";function useCloseEvent(_,a){return reactExports.useEffect(()=>{const $=getDoc(_);return $.addEventListener(closeEventName,a),()=>$.removeEventListener(closeEventName,a)},[a,_]),()=>{const $=getDoc(_),j=getWin(_);$.dispatchEvent(new j.CustomEvent(closeEventName))}}function omit$1(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}function pick$1(_,a){const $={};for(const j of a)j in _&&($[j]=_[j]);return $}var MotionDiv=chakra(motion.div),Tooltip=forwardRef((_,a)=>{var $,j;const et=useStyleConfig("Tooltip",_),tt=omitThemingProps(_),rt=useTheme(),{children:nt,label:it,shouldWrapChildren:ot,"aria-label":st,hasArrow:at,bg:ut,portalProps:ht,background:bt,backgroundColor:Et,bgColor:Ct,motionProps:Pt,...Tt}=tt,It=(j=($=bt??Et)!=null?$:ut)!=null?j:Ct;if(It){et.bg=It;const Bt=getCSSVar(rt,"colors",It);et[cssVars.arrowBg.var]=Bt}const Lt=useTooltip({...Tt,direction:rt.direction}),Nt=typeof nt=="string"||ot;let Ut;if(Nt)Ut=jsxRuntimeExports.jsx(chakra.span,{display:"inline-block",tabIndex:0,...Lt.getTriggerProps(),children:nt});else{const Bt=reactExports.Children.only(nt);Ut=reactExports.cloneElement(Bt,Lt.getTriggerProps(Bt.props,Bt.ref))}const jt=!!st,Mt=Lt.getTooltipProps({},a),Dt=jt?omit$1(Mt,["role","id"]):Mt,Ft=pick$1(Mt,["role","id"]);return it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Ut,jsxRuntimeExports.jsx(AnimatePresence,{children:Lt.isOpen&&jsxRuntimeExports.jsx(Portal,{...ht,children:jsxRuntimeExports.jsx(chakra.div,{...Lt.getTooltipPositionerProps(),__css:{zIndex:et.zIndex,pointerEvents:"none"},children:jsxRuntimeExports.jsxs(MotionDiv,{variants:scale,initial:"exit",animate:"enter",exit:"exit",...Pt,...Dt,__css:et,children:[it,jt&&jsxRuntimeExports.jsx(chakra.span,{srOnly:!0,...Ft,children:st}),at&&jsxRuntimeExports.jsx(chakra.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:jsxRuntimeExports.jsx(chakra.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:et.bg}})})]})})})})]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:nt})});Tooltip.displayName="Tooltip";var lodash={exports:{}};/** +`)},idCounter$1=0,lockStack$1=[];function RemoveScrollSideCar$1(_){var a=reactExports.useRef([]),$=reactExports.useRef([0,0]),j=reactExports.useRef(),et=reactExports.useState(idCounter$1++)[0],tt=reactExports.useState(styleSingleton)[0],rt=reactExports.useRef(_);reactExports.useEffect(function(){rt.current=_},[_]),reactExports.useEffect(function(){if(_.inert){document.body.classList.add("block-interactivity-".concat(et));var xt=__spreadArray([_.lockRef.current],(_.shards||[]).map(extractRef$1),!0).filter(Boolean);return xt.forEach(function(Ct){return Ct.classList.add("allow-interactivity-".concat(et))}),function(){document.body.classList.remove("block-interactivity-".concat(et)),xt.forEach(function(Ct){return Ct.classList.remove("allow-interactivity-".concat(et))})}}},[_.inert,_.lockRef.current,_.shards]);var nt=reactExports.useCallback(function(xt,Ct){if("touches"in xt&&xt.touches.length===2)return!rt.current.allowPinchZoom;var Pt=getTouchXY$1(xt),Tt=$.current,kt="deltaX"in xt?xt.deltaX:Tt[0]-Pt[0],Lt="deltaY"in xt?xt.deltaY:Tt[1]-Pt[1],Nt,zt=xt.target,jt=Math.abs(kt)>Math.abs(Lt)?"h":"v";if("touches"in xt&&jt==="h"&&zt.type==="range")return!1;var Mt=locationCouldBeScrolled$1(jt,zt);if(!Mt)return!0;if(Mt?Nt=jt:(Nt=jt==="v"?"h":"v",Mt=locationCouldBeScrolled$1(jt,zt)),!Mt)return!1;if(!j.current&&"changedTouches"in xt&&(kt||Lt)&&(j.current=Nt),!Nt)return!0;var Dt=j.current||Nt;return handleScroll$1(Dt,Ct,xt,Dt==="h"?kt:Lt,!0)},[]),it=reactExports.useCallback(function(xt){var Ct=xt;if(!(!lockStack$1.length||lockStack$1[lockStack$1.length-1]!==tt)){var Pt="deltaY"in Ct?getDeltaXY$1(Ct):getTouchXY$1(Ct),Tt=a.current.filter(function(Nt){return Nt.name===Ct.type&&(Nt.target===Ct.target||Ct.target===Nt.shadowParent)&&deltaCompare$1(Nt.delta,Pt)})[0];if(Tt&&Tt.should){Ct.cancelable&&Ct.preventDefault();return}if(!Tt){var kt=(rt.current.shards||[]).map(extractRef$1).filter(Boolean).filter(function(Nt){return Nt.contains(Ct.target)}),Lt=kt.length>0?nt(Ct,kt[0]):!rt.current.noIsolation;Lt&&Ct.cancelable&&Ct.preventDefault()}}},[]),at=reactExports.useCallback(function(xt,Ct,Pt,Tt){var kt={name:xt,delta:Ct,target:Pt,should:Tt,shadowParent:getOutermostShadowParent$1(Pt)};a.current.push(kt),setTimeout(function(){a.current=a.current.filter(function(Lt){return Lt!==kt})},1)},[]),st=reactExports.useCallback(function(xt){$.current=getTouchXY$1(xt),j.current=void 0},[]),ot=reactExports.useCallback(function(xt){at(xt.type,getDeltaXY$1(xt),xt.target,nt(xt,_.lockRef.current))},[]),ut=reactExports.useCallback(function(xt){at(xt.type,getTouchXY$1(xt),xt.target,nt(xt,_.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack$1.push(tt),_.setCallbacks({onScrollCapture:ot,onWheelCapture:ot,onTouchMoveCapture:ut}),document.addEventListener("wheel",it,nonPassive$1),document.addEventListener("touchmove",it,nonPassive$1),document.addEventListener("touchstart",st,nonPassive$1),function(){lockStack$1=lockStack$1.filter(function(xt){return xt!==tt}),document.removeEventListener("wheel",it,nonPassive$1),document.removeEventListener("touchmove",it,nonPassive$1),document.removeEventListener("touchstart",st,nonPassive$1)}},[]);var dt=_.removeScrollBar,mt=_.inert;return reactExports.createElement(reactExports.Fragment,null,mt?reactExports.createElement(tt,{styles:generateStyle$1(et)}):null,dt?reactExports.createElement(RemoveScrollBar$1,{gapMode:_.gapMode}):null)}function getOutermostShadowParent$1(_){for(var a=null;_!==null;)_ instanceof ShadowRoot&&(a=_.host,_=_.host),_=_.parentNode;return a}const SideCar$1=exportSidecar(effectCar$1,RemoveScrollSideCar$1);var ReactRemoveScroll$1=reactExports.forwardRef(function(_,a){return reactExports.createElement(RemoveScroll$1,__assign({},_,{ref:a,sideCar:SideCar$1}))});ReactRemoveScroll$1.classNames=RemoveScroll$1.classNames;function ModalFocusScope(_){const{autoFocus:a,trapFocus:$,dialogRef:j,initialFocusRef:et,blockScrollOnMount:tt,allowPinchZoom:rt,finalFocusRef:nt,returnFocusOnClose:it,preserveScrollBarGap:at,lockFocusAcrossFrames:st,isOpen:ot}=useModalContext(),[ut,dt]=usePresence();reactExports.useEffect(()=>{!ut&&dt&&setTimeout(dt)},[ut,dt]);const mt=useModalManager(j,ot);return jsxRuntimeExports.jsx(FocusLock,{autoFocus:a,isDisabled:!$,initialFocusRef:et,finalFocusRef:nt,restoreFocus:it,contentRef:j,lockFocusAcrossFrames:st,children:jsxRuntimeExports.jsx(ReactRemoveScroll$1,{removeScrollBar:!at,allowPinchZoom:rt,enabled:mt===1&&tt,forwardProps:!0,children:_.children})})}var ModalContent=forwardRef((_,a)=>{const{className:$,children:j,containerProps:et,motionProps:tt,...rt}=_,{getDialogProps:nt,getDialogContainerProps:it}=useModalContext(),at=nt(rt,a),st=it(et),ot=cx("chakra-modal__content",$),ut=useModalStyles(),dt={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...ut.dialog},mt={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...ut.dialogContainer},{motionPreset:xt}=useModalContext();return jsxRuntimeExports.jsx(ModalFocusScope,{children:jsxRuntimeExports.jsx(chakra.div,{...st,className:"chakra-modal__content-container",tabIndex:-1,__css:mt,children:jsxRuntimeExports.jsx(ModalTransition,{preset:xt,motionProps:tt,className:ot,...at,__css:dt,children:j})})})});ModalContent.displayName="ModalContent";var[DrawerContextProvider,useDrawerContext]=createContext$1(),placementMap={start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}};function getDrawerPlacement(_,a){var $,j;if(_)return(j=($=placementMap[_])==null?void 0:$[a])!=null?j:_}function Drawer(_){var a;const{isOpen:$,onClose:j,placement:et="right",children:tt,...rt}=_,nt=useTheme(),it=(a=nt.components)==null?void 0:a.Drawer,at=getDrawerPlacement(et,nt.direction);return jsxRuntimeExports.jsx(DrawerContextProvider,{value:{placement:at},children:jsxRuntimeExports.jsx(Modal,{isOpen:$,onClose:j,styleConfig:it,...rt,children:tt})})}var MotionDiv$2=chakra(Slide),DrawerContent=forwardRef((_,a)=>{const{className:$,children:j,motionProps:et,containerProps:tt,...rt}=_,{getDialogProps:nt,getDialogContainerProps:it,isOpen:at}=useModalContext(),st=nt(rt,a),ot=it(tt),ut=cx("chakra-modal__content",$),dt=useModalStyles(),mt={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...dt.dialog},xt={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...dt.dialogContainer},{placement:Ct}=useDrawerContext();return jsxRuntimeExports.jsx(ModalFocusScope,{children:jsxRuntimeExports.jsx(chakra.div,{...ot,className:"chakra-modal__content-container",__css:xt,children:jsxRuntimeExports.jsx(MotionDiv$2,{motionProps:et,direction:Ct,in:at,className:ut,...st,__css:mt,children:j})})})});DrawerContent.displayName="DrawerContent";var ModalFooter=forwardRef((_,a)=>{const{className:$,...j}=_,et=cx("chakra-modal__footer",$),rt={display:"flex",alignItems:"center",justifyContent:"flex-end",...useModalStyles().footer};return jsxRuntimeExports.jsx(chakra.footer,{ref:a,...j,__css:rt,className:et})});ModalFooter.displayName="ModalFooter";var ModalHeader=forwardRef((_,a)=>{const{className:$,...j}=_,{headerId:et,setHeaderMounted:tt}=useModalContext();reactExports.useEffect(()=>(tt(!0),()=>tt(!1)),[tt]);const rt=cx("chakra-modal__header",$),it={flex:0,...useModalStyles().header};return jsxRuntimeExports.jsx(chakra.header,{ref:a,className:rt,id:et,...j,__css:it})});ModalHeader.displayName="ModalHeader";var MotionDiv$1=chakra(motion.div),ModalOverlay=forwardRef((_,a)=>{const{className:$,transition:j,motionProps:et,...tt}=_,rt=cx("chakra-modal__overlay",$),it={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...useModalStyles().overlay},{motionPreset:at}=useModalContext(),ot=et||(at==="none"?{}:fadeConfig);return jsxRuntimeExports.jsx(MotionDiv$1,{...ot,__css:it,ref:a,className:rt,...tt})});ModalOverlay.displayName="ModalOverlay";var ModalBody=forwardRef((_,a)=>{const{className:$,...j}=_,{bodyId:et,setBodyMounted:tt}=useModalContext();reactExports.useEffect(()=>(tt(!0),()=>tt(!1)),[tt]);const rt=cx("chakra-modal__body",$),nt=useModalStyles();return jsxRuntimeExports.jsx(chakra.div,{ref:a,className:rt,id:et,...j,__css:nt.body})});ModalBody.displayName="ModalBody";var ModalCloseButton=forwardRef((_,a)=>{const{onClick:$,className:j,...et}=_,{onClose:tt}=useModalContext(),rt=cx("chakra-modal__close-btn",j),nt=useModalStyles();return jsxRuntimeExports.jsx(CloseButton,{ref:a,__css:nt.closeButton,className:rt,onClick:callAllHandlers$1($,it=>{it.stopPropagation(),tt()}),...et})});ModalCloseButton.displayName="ModalCloseButton";var[PopoverProvider,usePopoverContext]=createContext$1({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[PopoverStylesProvider,usePopoverStyles]=createContext$1({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function PopoverTrigger(_){const a=reactExports.Children.only(_.children),{getTriggerProps:$}=usePopoverContext();return reactExports.cloneElement(a,$(a.props,a.ref))}PopoverTrigger.displayName="PopoverTrigger";var TRIGGER={click:"click",hover:"hover"};function usePopover(_={}){const{closeOnBlur:a=!0,closeOnEsc:$=!0,initialFocusRef:j,id:et,returnFocusOnClose:tt=!0,autoFocus:rt=!0,arrowSize:nt,arrowShadowColor:it,trigger:at=TRIGGER.click,openDelay:st=200,closeDelay:ot=200,isLazy:ut,lazyBehavior:dt="unmount",computePositionOnMount:mt,...xt}=_,{isOpen:Ct,onClose:Pt,onOpen:Tt,onToggle:kt}=useDisclosure(_),Lt=reactExports.useRef(null),Nt=reactExports.useRef(null),zt=reactExports.useRef(null),jt=reactExports.useRef(!1),Mt=reactExports.useRef(!1);Ct&&(Mt.current=!0);const[Dt,Ft]=reactExports.useState(!1),[Bt,yt]=reactExports.useState(!1),bt=reactExports.useId(),ct=et??bt,[ht,vt,St,Rt]=["popover-trigger","popover-content","popover-header","popover-body"].map(pr=>`${pr}-${ct}`),{referenceRef:$t,getArrowProps:Et,getPopperProps:At,getArrowInnerProps:wt,forceUpdate:Ot}=usePopper({...xt,enabled:Ct||!!mt}),tr=useAnimationState({isOpen:Ct,ref:zt});useFocusOnPointerDown({enabled:Ct,ref:Nt}),useFocusOnHide(zt,{focusRef:Nt,visible:Ct,shouldFocus:tt&&at===TRIGGER.click}),useFocusOnShow(zt,{focusRef:j,visible:Ct,shouldFocus:rt&&at===TRIGGER.click});const nr=lazyDisclosure({wasSelected:Mt.current,enabled:ut,mode:dt,isSelected:tr.present}),ir=reactExports.useCallback((pr={},Ir=null)=>{const kr={...pr,style:{...pr.style,transformOrigin:cssVars.transformOrigin.varRef,[cssVars.arrowSize.var]:nt?`${nt}px`:void 0,[cssVars.arrowShadowColor.var]:it},ref:mergeRefs(zt,Ir),children:nr?pr.children:null,id:vt,tabIndex:-1,role:"dialog",onKeyDown:callAllHandlers$1(pr.onKeyDown,lr=>{$&&lr.key==="Escape"&&Pt()}),onBlur:callAllHandlers$1(pr.onBlur,lr=>{const fr=getRelatedTarget(lr),Er=contains(zt.current,fr),$r=contains(Nt.current,fr);Ct&&a&&(!Er&&!$r)&&Pt()}),"aria-labelledby":Dt?St:void 0,"aria-describedby":Bt?Rt:void 0};return at===TRIGGER.hover&&(kr.role="tooltip",kr.onMouseEnter=callAllHandlers$1(pr.onMouseEnter,()=>{jt.current=!0}),kr.onMouseLeave=callAllHandlers$1(pr.onMouseLeave,lr=>{lr.nativeEvent.relatedTarget!==null&&(jt.current=!1,setTimeout(()=>Pt(),ot))})),kr},[nr,vt,Dt,St,Bt,Rt,at,$,Pt,Ct,a,ot,it,nt]),Wt=reactExports.useCallback((pr={},Ir=null)=>At({...pr,style:{visibility:Ct?"visible":"hidden",...pr.style}},Ir),[Ct,At]),Kt=reactExports.useCallback((pr,Ir=null)=>({...pr,ref:mergeRefs(Ir,Lt,$t)}),[Lt,$t]),Jt=reactExports.useRef(),Ht=reactExports.useRef(),Vt=reactExports.useCallback(pr=>{Lt.current==null&&$t(pr)},[$t]),Qt=reactExports.useCallback((pr={},Ir=null)=>{const kr={...pr,ref:mergeRefs(Nt,Ir,Vt),id:ht,"aria-haspopup":"dialog","aria-expanded":Ct,"aria-controls":vt};return at===TRIGGER.click&&(kr.onClick=callAllHandlers$1(pr.onClick,kt)),at===TRIGGER.hover&&(kr.onFocus=callAllHandlers$1(pr.onFocus,()=>{Jt.current===void 0&&Tt()}),kr.onBlur=callAllHandlers$1(pr.onBlur,lr=>{const fr=getRelatedTarget(lr),Er=!contains(zt.current,fr);Ct&&a&&Er&&Pt()}),kr.onKeyDown=callAllHandlers$1(pr.onKeyDown,lr=>{lr.key==="Escape"&&Pt()}),kr.onMouseEnter=callAllHandlers$1(pr.onMouseEnter,()=>{jt.current=!0,Jt.current=window.setTimeout(()=>Tt(),st)}),kr.onMouseLeave=callAllHandlers$1(pr.onMouseLeave,()=>{jt.current=!1,Jt.current&&(clearTimeout(Jt.current),Jt.current=void 0),Ht.current=window.setTimeout(()=>{jt.current===!1&&Pt()},ot)})),kr},[ht,Ct,vt,at,Vt,kt,Tt,a,Pt,st,ot]);reactExports.useEffect(()=>()=>{Jt.current&&clearTimeout(Jt.current),Ht.current&&clearTimeout(Ht.current)},[]);const dr=reactExports.useCallback((pr={},Ir=null)=>({...pr,id:St,ref:mergeRefs(Ir,kr=>{Ft(!!kr)})}),[St]),xr=reactExports.useCallback((pr={},Ir=null)=>({...pr,id:Rt,ref:mergeRefs(Ir,kr=>{yt(!!kr)})}),[Rt]);return{forceUpdate:Ot,isOpen:Ct,onAnimationComplete:tr.onComplete,onClose:Pt,getAnchorProps:Kt,getArrowProps:Et,getArrowInnerProps:wt,getPopoverPositionerProps:Wt,getPopoverProps:ir,getTriggerProps:Qt,getHeaderProps:dr,getBodyProps:xr}}function contains(_,a){return _===a||(_==null?void 0:_.contains(a))}function getRelatedTarget(_){var a;const $=_.currentTarget.ownerDocument.activeElement;return(a=_.relatedTarget)!=null?a:$}function Popover(_){const a=useMultiStyleConfig("Popover",_),{children:$,...j}=omitThemingProps(_),et=useTheme(),tt=usePopover({...j,direction:et.direction});return jsxRuntimeExports.jsx(PopoverProvider,{value:tt,children:jsxRuntimeExports.jsx(PopoverStylesProvider,{value:a,children:runIfFn$2($,{isOpen:tt.isOpen,onClose:tt.onClose,forceUpdate:tt.forceUpdate})})})}Popover.displayName="Popover";var resolveVar=(_,a)=>a?`${_}.${a}, ${a}`:void 0;function PopoverArrow(_){var a;const{bg:$,bgColor:j,backgroundColor:et,shadow:tt,boxShadow:rt,shadowColor:nt}=_,{getArrowProps:it,getArrowInnerProps:at}=usePopoverContext(),st=usePopoverStyles(),ot=(a=$??j)!=null?a:et,ut=tt??rt;return jsxRuntimeExports.jsx(chakra.div,{...it(),className:"chakra-popover__arrow-positioner",children:jsxRuntimeExports.jsx(chakra.div,{className:cx("chakra-popover__arrow",_.className),...at(_),__css:{"--popper-arrow-shadow-color":resolveVar("colors",nt),"--popper-arrow-bg":resolveVar("colors",ot),"--popper-arrow-shadow":resolveVar("shadows",ut),...st.arrow}})})}PopoverArrow.displayName="PopoverArrow";var PopoverBody=forwardRef(function(a,$){const{getBodyProps:j}=usePopoverContext(),et=usePopoverStyles();return jsxRuntimeExports.jsx(chakra.div,{...j(a,$),className:cx("chakra-popover__body",a.className),__css:et.body})});PopoverBody.displayName="PopoverBody";function mergeVariants(_){if(_)return{enter:{..._.enter,visibility:"visible"},exit:{..._.exit,transitionEnd:{visibility:"hidden"}}}}var scaleFade={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},MotionSection=chakra(motion.section),PopoverTransition=forwardRef(function(a,$){const{variants:j=scaleFade,...et}=a,{isOpen:tt}=usePopoverContext();return jsxRuntimeExports.jsx(MotionSection,{ref:$,variants:mergeVariants(j),initial:!1,animate:tt?"enter":"exit",...et})});PopoverTransition.displayName="PopoverTransition";var PopoverContent=forwardRef(function(a,$){const{rootProps:j,motionProps:et,...tt}=a,{getPopoverProps:rt,getPopoverPositionerProps:nt,onAnimationComplete:it}=usePopoverContext(),at=usePopoverStyles(),st={position:"relative",display:"flex",flexDirection:"column",...at.content};return jsxRuntimeExports.jsx(chakra.div,{...nt(j),__css:at.popper,className:"chakra-popover__popper",children:jsxRuntimeExports.jsx(PopoverTransition,{...et,...rt(tt,$),onAnimationComplete:callAll(it,tt.onAnimationComplete),className:cx("chakra-popover__content",a.className),__css:st})})});PopoverContent.displayName="PopoverContent";function isInputEvent(_){return _&&isObject$5(_)&&isObject$5(_.target)}function useRadioGroup(_={}){const{onChange:a,value:$,defaultValue:j,name:et,isDisabled:tt,isFocusable:rt,isNative:nt,...it}=_,[at,st]=reactExports.useState(j||""),ot=typeof $<"u",ut=ot?$:at,dt=reactExports.useRef(null),mt=reactExports.useCallback(()=>{const Nt=dt.current;if(!Nt)return;let zt="input:not(:disabled):checked";const jt=Nt.querySelector(zt);if(jt){jt.focus();return}zt="input:not(:disabled)";const Mt=Nt.querySelector(zt);Mt==null||Mt.focus()},[]),Ct=`radio-${reactExports.useId()}`,Pt=et||Ct,Tt=reactExports.useCallback(Nt=>{const zt=isInputEvent(Nt)?Nt.target.value:Nt;ot||st(zt),a==null||a(String(zt))},[a,ot]),kt=reactExports.useCallback((Nt={},zt=null)=>({...Nt,ref:mergeRefs(zt,dt),role:"radiogroup"}),[]),Lt=reactExports.useCallback((Nt={},zt=null)=>({...Nt,ref:zt,name:Pt,[nt?"checked":"isChecked"]:ut!=null?Nt.value===ut:void 0,onChange(Mt){Tt(Mt)},"data-radiogroup":!0}),[nt,Pt,Tt,ut]);return{getRootProps:kt,getRadioProps:Lt,name:Pt,ref:dt,focus:mt,setValue:st,value:ut,onChange:Tt,isDisabled:tt,isFocusable:rt,htmlProps:it}}var[RadioGroupProvider,useRadioGroupContext]=createContext$1({name:"RadioGroupContext",strict:!1}),RadioGroup=forwardRef((_,a)=>{const{colorScheme:$,size:j,variant:et,children:tt,className:rt,isDisabled:nt,isFocusable:it,...at}=_,{value:st,onChange:ot,getRootProps:ut,name:dt,htmlProps:mt}=useRadioGroup(at),xt=reactExports.useMemo(()=>({name:dt,size:j,onChange:ot,colorScheme:$,value:st,variant:et,isDisabled:nt,isFocusable:it}),[dt,j,ot,$,st,et,nt,it]);return jsxRuntimeExports.jsx(RadioGroupProvider,{value:xt,children:jsxRuntimeExports.jsx(chakra.div,{...ut(mt,a),className:cx("chakra-radio-group",rt),children:tt})})});RadioGroup.displayName="RadioGroup";var visuallyHiddenStyle={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function useRadio(_={}){const{defaultChecked:a,isChecked:$,isFocusable:j,isDisabled:et,isReadOnly:tt,isRequired:rt,onChange:nt,isInvalid:it,name:at,value:st,id:ot,"data-radiogroup":ut,"aria-describedby":dt,...mt}=_,xt=`radio-${reactExports.useId()}`,Ct=useFormControlContext(),Tt=!!useRadioGroupContext()||!!ut;let Lt=!!Ct&&!Tt?Ct.id:xt;Lt=ot??Lt;const Nt=et??(Ct==null?void 0:Ct.isDisabled),zt=tt??(Ct==null?void 0:Ct.isReadOnly),jt=rt??(Ct==null?void 0:Ct.isRequired),Mt=it??(Ct==null?void 0:Ct.isInvalid),[Dt,Ft]=reactExports.useState(!1),[Bt,yt]=reactExports.useState(!1),[bt,ct]=reactExports.useState(!1),[ht,vt]=reactExports.useState(!1),[St,Rt]=reactExports.useState(!!a),$t=typeof $<"u",Et=$t?$:St;reactExports.useEffect(()=>trackFocusVisible(Ft),[]);const At=reactExports.useCallback(Vt=>{if(zt||Nt){Vt.preventDefault();return}$t||Rt(Vt.target.checked),nt==null||nt(Vt)},[$t,Nt,zt,nt]),wt=reactExports.useCallback(Vt=>{Vt.key===" "&&vt(!0)},[vt]),Ot=reactExports.useCallback(Vt=>{Vt.key===" "&&vt(!1)},[vt]),tr=reactExports.useCallback((Vt={},Qt=null)=>({...Vt,ref:Qt,"data-active":dataAttr(ht),"data-hover":dataAttr(bt),"data-disabled":dataAttr(Nt),"data-invalid":dataAttr(Mt),"data-checked":dataAttr(Et),"data-focus":dataAttr(Bt),"data-focus-visible":dataAttr(Bt&&Dt),"data-readonly":dataAttr(zt),"aria-hidden":!0,onMouseDown:callAllHandlers$1(Vt.onMouseDown,()=>vt(!0)),onMouseUp:callAllHandlers$1(Vt.onMouseUp,()=>vt(!1)),onMouseEnter:callAllHandlers$1(Vt.onMouseEnter,()=>ct(!0)),onMouseLeave:callAllHandlers$1(Vt.onMouseLeave,()=>ct(!1))}),[ht,bt,Nt,Mt,Et,Bt,zt,Dt]),{onFocus:nr,onBlur:ir}=Ct??{},Wt=reactExports.useCallback((Vt={},Qt=null)=>{const dr=Nt&&!j;return{...Vt,id:Lt,ref:Qt,type:"radio",name:at,value:st,onChange:callAllHandlers$1(Vt.onChange,At),onBlur:callAllHandlers$1(ir,Vt.onBlur,()=>yt(!1)),onFocus:callAllHandlers$1(nr,Vt.onFocus,()=>yt(!0)),onKeyDown:callAllHandlers$1(Vt.onKeyDown,wt),onKeyUp:callAllHandlers$1(Vt.onKeyUp,Ot),checked:Et,disabled:dr,readOnly:zt,required:jt,"aria-invalid":ariaAttr(Mt),"aria-disabled":ariaAttr(dr),"aria-required":ariaAttr(jt),"data-readonly":dataAttr(zt),"aria-describedby":dt,style:visuallyHiddenStyle}},[Nt,j,Lt,at,st,At,ir,nr,wt,Ot,Et,zt,jt,Mt,dt]);return{state:{isInvalid:Mt,isFocused:Bt,isChecked:Et,isActive:ht,isHovered:bt,isDisabled:Nt,isReadOnly:zt,isRequired:jt},getCheckboxProps:tr,getRadioProps:tr,getInputProps:Wt,getLabelProps:(Vt={},Qt=null)=>({...Vt,ref:Qt,onMouseDown:callAllHandlers$1(Vt.onMouseDown,stopEvent),"data-disabled":dataAttr(Nt),"data-checked":dataAttr(Et),"data-invalid":dataAttr(Mt)}),getRootProps:(Vt,Qt=null)=>({...Vt,ref:Qt,"data-disabled":dataAttr(Nt),"data-checked":dataAttr(Et),"data-invalid":dataAttr(Mt)}),htmlProps:mt}}function stopEvent(_){_.preventDefault(),_.stopPropagation()}function split$2(_,a){const $={},j={};for(const[et,tt]of Object.entries(_))a.includes(et)?$[et]=tt:j[et]=tt;return[$,j]}var Radio=forwardRef((_,a)=>{var $;const j=useRadioGroupContext(),{onChange:et,value:tt}=_,rt=useMultiStyleConfig("Radio",{...j,..._}),nt=omitThemingProps(_),{spacing:it="0.5rem",children:at,isDisabled:st=j==null?void 0:j.isDisabled,isFocusable:ot=j==null?void 0:j.isFocusable,inputProps:ut,...dt}=nt;let mt=_.isChecked;(j==null?void 0:j.value)!=null&&tt!=null&&(mt=j.value===tt);let xt=et;j!=null&&j.onChange&&tt!=null&&(xt=callAll(j.onChange,et));const Ct=($=_==null?void 0:_.name)!=null?$:j==null?void 0:j.name,{getInputProps:Pt,getCheckboxProps:Tt,getLabelProps:kt,getRootProps:Lt,htmlProps:Nt}=useRadio({...dt,isChecked:mt,isFocusable:ot,isDisabled:st,onChange:xt,name:Ct}),[zt,jt]=split$2(Nt,layoutPropNames),Mt=Tt(jt),Dt=Pt(ut,a),Ft=kt(),Bt=Object.assign({},zt,Lt()),yt={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...rt.container},bt={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...rt.control},ct={userSelect:"none",marginStart:it,...rt.label};return jsxRuntimeExports.jsxs(chakra.label,{className:"chakra-radio",...Bt,__css:yt,children:[jsxRuntimeExports.jsx("input",{className:"chakra-radio__input",...Dt}),jsxRuntimeExports.jsx(chakra.span,{className:"chakra-radio__control",...Mt,__css:bt}),at&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-radio__label",...Ft,__css:ct,children:at})]})});Radio.displayName="Radio";var SelectField=forwardRef(function(a,$){const{children:j,placeholder:et,className:tt,...rt}=a;return jsxRuntimeExports.jsxs(chakra.select,{...rt,ref:$,className:cx("chakra-select",tt),children:[et&&jsxRuntimeExports.jsx("option",{value:"",children:et}),j]})});SelectField.displayName="SelectField";function split$1(_,a){const $={},j={};for(const[et,tt]of Object.entries(_))a.includes(et)?$[et]=tt:j[et]=tt;return[$,j]}var Select$1=forwardRef((_,a)=>{var $;const j=useMultiStyleConfig("Select",_),{rootProps:et,placeholder:tt,icon:rt,color:nt,height:it,h:at,minH:st,minHeight:ot,iconColor:ut,iconSize:dt,...mt}=omitThemingProps(_),[xt,Ct]=split$1(mt,layoutPropNames),Pt=useFormControl(Ct),Tt={width:"100%",height:"fit-content",position:"relative",color:nt},kt={paddingEnd:"2rem",...j.field,_focus:{zIndex:"unset",...($=j.field)==null?void 0:$._focus}};return jsxRuntimeExports.jsxs(chakra.div,{className:"chakra-select__wrapper",__css:Tt,...xt,...et,children:[jsxRuntimeExports.jsx(SelectField,{ref:a,height:at??it,minH:st??ot,placeholder:tt,...Pt,__css:kt,children:_.children}),jsxRuntimeExports.jsx(SelectIcon,{"data-disabled":dataAttr(Pt.disabled),...(ut||nt)&&{color:ut||nt},__css:j.icon,...dt&&{fontSize:dt},children:rt})]})});Select$1.displayName="Select";var DefaultIcon=_=>jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",..._,children:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),IconWrapper=chakra("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),SelectIcon=_=>{const{children:a=jsxRuntimeExports.jsx(DefaultIcon,{}),...$}=_,j=reactExports.cloneElement(a,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return jsxRuntimeExports.jsx(IconWrapper,{...$,className:"chakra-select__icon-wrapper",children:reactExports.isValidElement(a)?j:null})};SelectIcon.displayName="SelectIcon";var Switch=forwardRef(function(a,$){const j=useMultiStyleConfig("Switch",a),{spacing:et="0.5rem",children:tt,...rt}=omitThemingProps(a),{getIndicatorProps:nt,getInputProps:it,getCheckboxProps:at,getRootProps:st,getLabelProps:ot}=useCheckbox(rt),ut=reactExports.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...j.container}),[j.container]),dt=reactExports.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...j.track}),[j.track]),mt=reactExports.useMemo(()=>({userSelect:"none",marginStart:et,...j.label}),[et,j.label]);return jsxRuntimeExports.jsxs(chakra.label,{...st(),className:cx("chakra-switch",a.className),__css:ut,children:[jsxRuntimeExports.jsx("input",{className:"chakra-switch__input",...it({},$)}),jsxRuntimeExports.jsx(chakra.span,{...at(),className:"chakra-switch__track",__css:dt,children:jsxRuntimeExports.jsx(chakra.span,{__css:j.thumb,className:"chakra-switch__thumb",...nt()})}),tt&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-switch__label",...ot(),__css:mt,children:tt})]})});Switch.displayName="Switch";var[TableStylesProvider,useTableStyles]=createContext$1({name:"TableStylesContext",errorMessage:`useTableStyles returned is 'undefined'. Seems you forgot to wrap the components in "
" `}),Table=forwardRef((_,a)=>{const $=useMultiStyleConfig("Table",_),{className:j,layout:et,...tt}=omitThemingProps(_);return jsxRuntimeExports.jsx(TableStylesProvider,{value:$,children:jsxRuntimeExports.jsx(chakra.table,{ref:a,__css:{tableLayout:et,...$.table},className:cx("chakra-table",j),...tt})})});Table.displayName="Table";var Tr=forwardRef((_,a)=>{const $=useTableStyles();return jsxRuntimeExports.jsx(chakra.tr,{..._,ref:a,__css:$.tr})}),TableContainer=forwardRef((_,a)=>{var $;const{overflow:j,overflowX:et,className:tt,...rt}=_;return jsxRuntimeExports.jsx(chakra.div,{ref:a,className:cx("chakra-table__container",tt),...rt,__css:{display:"block",whiteSpace:"nowrap",WebkitOverflowScrolling:"touch",overflowX:($=j??et)!=null?$:"auto",overflowY:"hidden",maxWidth:"100%"}})}),Tbody=forwardRef((_,a)=>{const $=useTableStyles();return jsxRuntimeExports.jsx(chakra.tbody,{..._,ref:a,__css:$.tbody})}),Td=forwardRef(({isNumeric:_,...a},$)=>{const j=useTableStyles();return jsxRuntimeExports.jsx(chakra.td,{...a,ref:$,__css:j.td,"data-is-numeric":_})}),[TabsDescendantsProvider,useTabsDescendantsContext,useTabsDescendants,useTabsDescendant]=createDescendantContext();function useTabs(_){var a;const{defaultIndex:$,onChange:j,index:et,isManual:tt,isLazy:rt,lazyBehavior:nt="unmount",orientation:it="horizontal",direction:at="ltr",...st}=_,[ot,ut]=reactExports.useState($??0),[dt,mt]=useControllableState({defaultValue:$??0,value:et,onChange:j});reactExports.useEffect(()=>{et!=null&&ut(et)},[et]);const xt=useTabsDescendants(),Ct=reactExports.useId();return{id:`tabs-${(a=_.id)!=null?a:Ct}`,selectedIndex:dt,focusedIndex:ot,setSelectedIndex:mt,setFocusedIndex:ut,isManual:tt,isLazy:rt,lazyBehavior:nt,orientation:it,descendants:xt,direction:at,htmlProps:st}}var[TabsProvider,useTabsContext]=createContext$1({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function useTabList(_){const{focusedIndex:a,orientation:$,direction:j}=useTabsContext(),et=useTabsDescendantsContext(),tt=reactExports.useCallback(rt=>{const nt=()=>{var Tt;const kt=et.nextEnabled(a);kt&&((Tt=kt.node)==null||Tt.focus())},it=()=>{var Tt;const kt=et.prevEnabled(a);kt&&((Tt=kt.node)==null||Tt.focus())},at=()=>{var Tt;const kt=et.firstEnabled();kt&&((Tt=kt.node)==null||Tt.focus())},st=()=>{var Tt;const kt=et.lastEnabled();kt&&((Tt=kt.node)==null||Tt.focus())},ot=$==="horizontal",ut=$==="vertical",dt=rt.key,mt=j==="ltr"?"ArrowLeft":"ArrowRight",xt=j==="ltr"?"ArrowRight":"ArrowLeft",Pt={[mt]:()=>ot&&it(),[xt]:()=>ot&&nt(),ArrowDown:()=>ut&&nt(),ArrowUp:()=>ut&&it(),Home:at,End:st}[dt];Pt&&(rt.preventDefault(),Pt(rt))},[et,a,$,j]);return{..._,role:"tablist","aria-orientation":$,onKeyDown:callAllHandlers$1(_.onKeyDown,tt)}}function useTab(_){const{isDisabled:a=!1,isFocusable:$=!1,...j}=_,{setSelectedIndex:et,isManual:tt,id:rt,setFocusedIndex:nt,selectedIndex:it}=useTabsContext(),{index:at,register:st}=useTabsDescendant({disabled:a&&!$}),ot=at===it,ut=()=>{et(at)},dt=()=>{nt(at),!tt&&!(a&&$)&&et(at)};return{...useClickable({...j,ref:mergeRefs(st,_.ref),isDisabled:a,isFocusable:$,onClick:callAllHandlers$1(_.onClick,ut)}),id:makeTabId(rt,at),role:"tab",tabIndex:ot?0:-1,type:"button","aria-selected":ot,"aria-controls":makeTabPanelId(rt,at),onFocus:a?void 0:callAllHandlers$1(_.onFocus,dt)}}var[TabPanelProvider,useTabPanelContext]=createContext$1({});function useTabPanels(_){const a=useTabsContext(),{id:$,selectedIndex:j}=a,tt=getValidChildren(_.children).map((rt,nt)=>reactExports.createElement(TabPanelProvider,{key:nt,value:{isSelected:nt===j,id:makeTabPanelId($,nt),tabId:makeTabId($,nt),selectedIndex:j}},rt));return{..._,children:tt}}function useTabPanel(_){const{children:a,...$}=_,{isLazy:j,lazyBehavior:et}=useTabsContext(),{isSelected:tt,id:rt,tabId:nt}=useTabPanelContext(),it=reactExports.useRef(!1);tt&&(it.current=!0);const at=lazyDisclosure({wasSelected:it.current,isSelected:tt,enabled:j,mode:et});return{tabIndex:0,...$,children:at?a:null,role:"tabpanel","aria-labelledby":nt,hidden:!tt,id:rt}}function makeTabId(_,a){return`${_}--tab-${a}`}function makeTabPanelId(_,a){return`${_}--tabpanel-${a}`}var[TabsStylesProvider,useTabsStyles]=createContext$1({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Tabs=forwardRef(function(a,$){const j=useMultiStyleConfig("Tabs",a),{children:et,className:tt,...rt}=omitThemingProps(a),{htmlProps:nt,descendants:it,...at}=useTabs(rt),st=reactExports.useMemo(()=>at,[at]),{isFitted:ot,...ut}=nt,dt={position:"relative",...j.root};return jsxRuntimeExports.jsx(TabsDescendantsProvider,{value:it,children:jsxRuntimeExports.jsx(TabsProvider,{value:st,children:jsxRuntimeExports.jsx(TabsStylesProvider,{value:j,children:jsxRuntimeExports.jsx(chakra.div,{className:cx("chakra-tabs",tt),ref:$,...ut,__css:dt,children:et})})})})});Tabs.displayName="Tabs";var TabList=forwardRef(function(a,$){const j=useTabList({...a,ref:$}),tt={display:"flex",...useTabsStyles().tablist};return jsxRuntimeExports.jsx(chakra.div,{...j,className:cx("chakra-tabs__tablist",a.className),__css:tt})});TabList.displayName="TabList";var TabPanel=forwardRef(function(a,$){const j=useTabPanel({...a,ref:$}),et=useTabsStyles();return jsxRuntimeExports.jsx(chakra.div,{outline:"0",...j,className:cx("chakra-tabs__tab-panel",a.className),__css:et.tabpanel})});TabPanel.displayName="TabPanel";var TabPanels=forwardRef(function(a,$){const j=useTabPanels(a),et=useTabsStyles();return jsxRuntimeExports.jsx(chakra.div,{...j,width:"100%",ref:$,className:cx("chakra-tabs__tab-panels",a.className),__css:et.tabpanels})});TabPanels.displayName="TabPanels";var Tab=forwardRef(function(a,$){const j=useTabsStyles(),et=useTab({...a,ref:$}),tt={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...j.tab};return jsxRuntimeExports.jsx(chakra.button,{...et,className:cx("chakra-tabs__tab",a.className),__css:tt})});Tab.displayName="Tab";function omit$2(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}var omitted=["h","minH","height","minHeight"],Textarea=forwardRef((_,a)=>{const $=useStyleConfig("Textarea",_),{className:j,rows:et,...tt}=omitThemingProps(_),rt=useFormControl(tt),nt=et?omit$2($,omitted):$;return jsxRuntimeExports.jsx(chakra.textarea,{ref:a,rows:et,...rt,className:cx("chakra-textarea",j),__css:nt})});Textarea.displayName="Textarea";var scale={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},getDoc=_=>{var a;return((a=_.current)==null?void 0:a.ownerDocument)||document},getWin=_=>{var a,$;return(($=(a=_.current)==null?void 0:a.ownerDocument)==null?void 0:$.defaultView)||window};function useTooltip(_={}){const{openDelay:a=0,closeDelay:$=0,closeOnClick:j=!0,closeOnMouseDown:et,closeOnScroll:tt,closeOnPointerDown:rt=et,closeOnEsc:nt=!0,onOpen:it,onClose:at,placement:st,id:ot,isOpen:ut,defaultIsOpen:dt,arrowSize:mt=10,arrowShadowColor:xt,arrowPadding:Ct,modifiers:Pt,isDisabled:Tt,gutter:kt,offset:Lt,direction:Nt,...zt}=_,{isOpen:jt,onOpen:Mt,onClose:Dt}=useDisclosure({isOpen:ut,defaultIsOpen:dt,onOpen:it,onClose:at}),{referenceRef:Ft,getPopperProps:Bt,getArrowInnerProps:yt,getArrowProps:bt}=usePopper({enabled:jt,placement:st,arrowPadding:Ct,modifiers:Pt,gutter:kt,offset:Lt,direction:Nt}),ct=reactExports.useId(),vt=`tooltip-${ot??ct}`,St=reactExports.useRef(null),Rt=reactExports.useRef(),$t=reactExports.useCallback(()=>{Rt.current&&(clearTimeout(Rt.current),Rt.current=void 0)},[]),Et=reactExports.useRef(),At=reactExports.useCallback(()=>{Et.current&&(clearTimeout(Et.current),Et.current=void 0)},[]),wt=reactExports.useCallback(()=>{At(),Dt()},[Dt,At]),Ot=useCloseEvent(St,wt),tr=reactExports.useCallback(()=>{if(!Tt&&!Rt.current){jt&&Ot();const Qt=getWin(St);Rt.current=Qt.setTimeout(Mt,a)}},[Ot,Tt,jt,Mt,a]),nr=reactExports.useCallback(()=>{$t();const Qt=getWin(St);Et.current=Qt.setTimeout(wt,$)},[$,wt,$t]),ir=reactExports.useCallback(()=>{jt&&j&&nr()},[j,nr,jt]),Wt=reactExports.useCallback(()=>{jt&&rt&&nr()},[rt,nr,jt]),Kt=reactExports.useCallback(Qt=>{jt&&Qt.key==="Escape"&&nr()},[jt,nr]);useEventListener(()=>getDoc(St),"keydown",nt?Kt:void 0),useEventListener(()=>{if(!tt)return null;const Qt=St.current;if(!Qt)return null;const dr=getScrollParent$1(Qt);return dr.localName==="body"?getWin(St):dr},"scroll",()=>{jt&&tt&&wt()},{passive:!0,capture:!0}),reactExports.useEffect(()=>{Tt&&($t(),jt&&Dt())},[Tt,jt,Dt,$t]),reactExports.useEffect(()=>()=>{$t(),At()},[$t,At]),useEventListener(()=>St.current,"pointerleave",nr);const Jt=reactExports.useCallback((Qt={},dr=null)=>({...Qt,ref:mergeRefs(St,dr,Ft),onPointerEnter:callAllHandlers$1(Qt.onPointerEnter,pr=>{pr.pointerType!=="touch"&&tr()}),onClick:callAllHandlers$1(Qt.onClick,ir),onPointerDown:callAllHandlers$1(Qt.onPointerDown,Wt),onFocus:callAllHandlers$1(Qt.onFocus,tr),onBlur:callAllHandlers$1(Qt.onBlur,nr),"aria-describedby":jt?vt:void 0}),[tr,nr,Wt,jt,vt,ir,Ft]),Ht=reactExports.useCallback((Qt={},dr=null)=>Bt({...Qt,style:{...Qt.style,[cssVars.arrowSize.var]:mt?`${mt}px`:void 0,[cssVars.arrowShadowColor.var]:xt}},dr),[Bt,mt,xt]),Vt=reactExports.useCallback((Qt={},dr=null)=>{const xr={...Qt.style,position:"relative",transformOrigin:cssVars.transformOrigin.varRef};return{ref:dr,...zt,...Qt,id:vt,role:"tooltip",style:xr}},[zt,vt]);return{isOpen:jt,show:tr,hide:nr,getTriggerProps:Jt,getTooltipProps:Vt,getTooltipPositionerProps:Ht,getArrowProps:bt,getArrowInnerProps:yt}}var closeEventName="chakra-ui:close-tooltip";function useCloseEvent(_,a){return reactExports.useEffect(()=>{const $=getDoc(_);return $.addEventListener(closeEventName,a),()=>$.removeEventListener(closeEventName,a)},[a,_]),()=>{const $=getDoc(_),j=getWin(_);$.dispatchEvent(new j.CustomEvent(closeEventName))}}function omit$1(_,a=[]){const $=Object.assign({},_);for(const j of a)j in $&&delete $[j];return $}function pick$1(_,a){const $={};for(const j of a)j in _&&($[j]=_[j]);return $}var MotionDiv=chakra(motion.div),Tooltip=forwardRef((_,a)=>{var $,j;const et=useStyleConfig("Tooltip",_),tt=omitThemingProps(_),rt=useTheme(),{children:nt,label:it,shouldWrapChildren:at,"aria-label":st,hasArrow:ot,bg:ut,portalProps:dt,background:mt,backgroundColor:xt,bgColor:Ct,motionProps:Pt,...Tt}=tt,kt=(j=($=mt??xt)!=null?$:ut)!=null?j:Ct;if(kt){et.bg=kt;const Bt=getCSSVar(rt,"colors",kt);et[cssVars.arrowBg.var]=Bt}const Lt=useTooltip({...Tt,direction:rt.direction}),Nt=typeof nt=="string"||at;let zt;if(Nt)zt=jsxRuntimeExports.jsx(chakra.span,{display:"inline-block",tabIndex:0,...Lt.getTriggerProps(),children:nt});else{const Bt=reactExports.Children.only(nt);zt=reactExports.cloneElement(Bt,Lt.getTriggerProps(Bt.props,Bt.ref))}const jt=!!st,Mt=Lt.getTooltipProps({},a),Dt=jt?omit$1(Mt,["role","id"]):Mt,Ft=pick$1(Mt,["role","id"]);return it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[zt,jsxRuntimeExports.jsx(AnimatePresence,{children:Lt.isOpen&&jsxRuntimeExports.jsx(Portal,{...dt,children:jsxRuntimeExports.jsx(chakra.div,{...Lt.getTooltipPositionerProps(),__css:{zIndex:et.zIndex,pointerEvents:"none"},children:jsxRuntimeExports.jsxs(MotionDiv,{variants:scale,initial:"exit",animate:"enter",exit:"exit",...Pt,...Dt,__css:et,children:[it,jt&&jsxRuntimeExports.jsx(chakra.span,{srOnly:!0,...Ft,children:st}),ot&&jsxRuntimeExports.jsx(chakra.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:jsxRuntimeExports.jsx(chakra.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:et.bg}})})]})})})})]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:nt})});Tooltip.displayName="Tooltip";var lodash={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */lodash.exports;(function(_,a){(function(){var $,j="4.17.21",et=200,tt="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",rt="Expected a function",nt="Invalid `variable` option passed into `_.template`",it="__lodash_hash_undefined__",ot=500,st="__lodash_placeholder__",at=1,ut=2,ht=4,bt=1,Et=2,Ct=1,Pt=2,Tt=4,It=8,Lt=16,Nt=32,Ut=64,jt=128,Mt=256,Dt=512,Ft=30,Bt="...",yt=800,mt=16,ct=1,dt=2,vt=3,St=1/0,Rt=9007199254740991,$t=17976931348623157e292,xt=NaN,At=4294967295,wt=At-1,Ot=At>>>1,tr=[["ary",jt],["bind",Ct],["bindKey",Pt],["curry",It],["curryRight",Lt],["flip",Dt],["partial",Nt],["partialRight",Ut],["rearg",Mt]],nr="[object Arguments]",ir="[object Array]",Wt="[object AsyncFunction]",Kt="[object Boolean]",Jt="[object Date]",Ht="[object DOMException]",qt="[object Error]",Qt="[object Function]",dr="[object GeneratorFunction]",xr="[object Map]",pr="[object Number]",kr="[object Null]",Ir="[object Object]",lr="[object Promise]",fr="[object Proxy]",Er="[object RegExp]",$r="[object Set]",Pr="[object String]",Rr="[object Symbol]",Ar="[object Undefined]",Or="[object WeakMap]",Lr="[object WeakSet]",or="[object ArrayBuffer]",Yt="[object DataView]",er="[object Float32Array]",Zt="[object Float64Array]",Vt="[object Int8Array]",Gt="[object Int16Array]",ar="[object Int32Array]",br="[object Uint8Array]",wr="[object Uint8ClampedArray]",Sr="[object Uint16Array]",Wr="[object Uint32Array]",Hr=/\b__p \+= '';/g,Fr=/\b(__p \+=) '' \+/g,pn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Jr=/&(?:amp|lt|gt|quot|#39);/g,Qr=/[&<>"']/g,mn=RegExp(Jr.source),ln=RegExp(Qr.source),qr=/<%-([\s\S]+?)%>/g,wn=/<%([\s\S]+?)%>/g,un=/<%=([\s\S]+?)%>/g,Vr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hn=/^\w*$/,fn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/[\\^$.*+?()[\]{}|]/g,$n=RegExp(Kr.source),dn=/^\s+/,Gr=/\s/,gn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,Zr=/,? & /,Rn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Sn=/[()=,{}\[\]\/\s]/,nn=/\\(\\)?/g,Tn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yn=/\w*$/,En=/^[-+]0x[0-9a-f]+$/i,ds=/^0b[01]+$/i,fs=/^\[object .+?Constructor\]$/,hs=/^0o[0-7]+$/i,ps=/^(?:0|[1-9]\d*)$/,Vn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ss=/($^)/,Jn=/['\n\r\u2028\u2029\\]/g,Yn="\\ud800-\\udfff",ms="\\u0300-\\u036f",Qn="\\ufe20-\\ufe2f",es="\\u20d0-\\u20ff",ls=ms+Qn+es,us="\\u2700-\\u27bf",Wn="a-z\\xdf-\\xf6\\xf8-\\xff",as="\\xac\\xb1\\xd7\\xf7",gs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vs="\\u2000-\\u206f",Ps=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",As="A-Z\\xc0-\\xd6\\xd8-\\xde",yl="\\ufe0e\\ufe0f",wo=as+gs+vs+Ps,Wo="['’]",_o="["+Yn+"]",Go="["+wo+"]",So="["+ls+"]",Zs="\\d+",$o="["+us+"]",xl="["+Wn+"]",El="[^"+Yn+wo+Zs+us+Wn+As+"]",lo="\\ud83c[\\udffb-\\udfff]",Yl="(?:"+So+"|"+lo+")",wl="[^"+Yn+"]",jo="(?:\\ud83c[\\udde6-\\uddff]){2}",Ys="[\\ud800-\\udbff][\\udc00-\\udfff]",Ns="["+As+"]",_l="\\u200d",Sl="(?:"+xl+"|"+El+")",Is="(?:"+Ns+"|"+El+")",$l="(?:"+Wo+"(?:d|ll|m|re|s|t|ve))?",Rl="(?:"+Wo+"(?:D|LL|M|RE|S|T|VE))?",Al=Yl+"?",Xs="["+yl+"]?",Ro="(?:"+_l+"(?:"+[wl,jo,Ys].join("|")+")"+Xs+Al+")*",Ls="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Pl=Xs+Al+Ro,fo="(?:"+[$o,jo,Ys].join("|")+")"+Pl,Ao="(?:"+[wl+So+"?",So,jo,Ys,_o].join("|")+")",Po=RegExp(Wo,"g"),Ts=RegExp(So,"g"),Ms=RegExp(lo+"(?="+lo+")|"+Ao+Pl,"g"),Tl=RegExp([Ns+"?"+xl+"+"+$l+"(?="+[Go,Ns,"$"].join("|")+")",Is+"+"+Rl+"(?="+[Go,Ns+Sl,"$"].join("|")+")",Ns+"?"+Sl+"+"+$l,Ns+"+"+Rl,uo,Ls,Zs,fo].join("|"),"g"),Bo=RegExp("["+_l+Yn+ls+yl+"]"),To=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,No=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xl=-1,rs={};rs[er]=rs[Zt]=rs[Vt]=rs[Gt]=rs[ar]=rs[br]=rs[wr]=rs[Sr]=rs[Wr]=!0,rs[nr]=rs[ir]=rs[or]=rs[Kt]=rs[Yt]=rs[Jt]=rs[qt]=rs[Qt]=rs[xr]=rs[pr]=rs[Ir]=rs[Er]=rs[$r]=rs[Pr]=rs[Or]=!1;var Xn={};Xn[nr]=Xn[ir]=Xn[or]=Xn[Yt]=Xn[Kt]=Xn[Jt]=Xn[er]=Xn[Zt]=Xn[Vt]=Xn[Gt]=Xn[ar]=Xn[xr]=Xn[pr]=Xn[Ir]=Xn[Er]=Xn[$r]=Xn[Pr]=Xn[Rr]=Xn[br]=Xn[wr]=Xn[Sr]=Xn[Wr]=!0,Xn[qt]=Xn[Qt]=Xn[Or]=!1;var _r={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Xt={"&":"&","<":"<",">":">",'"':""","'":"'"},cr={"&":"&","<":"<",">":">",""":'"',"'":"'"},gr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dr=parseFloat,rn=parseInt,xn=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Pn=typeof self=="object"&&self&&self.Object===Object&&self,cn=xn||Pn||Function("return this")(),_n=a&&!a.nodeType&&a,Nn=_n&&!0&&_&&!_.nodeType&&_,Fn=Nn&&Nn.exports===_n,ts=Fn&&xn.process,_i=function(){try{var jr=Nn&&Nn.require&&Nn.require("util").types;return jr||ts&&ts.binding&&ts.binding("util")}catch{}}(),Es=_i&&_i.isArrayBuffer,Ds=_i&&_i.isDate,ho=_i&&_i.isMap,Lo=_i&&_i.isRegExp,zu=_i&&_i.isSet,Jl=_i&&_i.isTypedArray;function Os(jr,Xr,Ur){switch(Ur.length){case 0:return jr.call(Xr);case 1:return jr.call(Xr,Ur[0]);case 2:return jr.call(Xr,Ur[0],Ur[1]);case 3:return jr.call(Xr,Ur[0],Ur[1],Ur[2])}return jr.apply(Xr,Ur)}function Pv(jr,Xr,Ur,Cn){for(var Ln=-1,ns=jr==null?0:jr.length;++Ln-1}function s0(jr,Xr,Ur){for(var Cn=-1,Ln=jr==null?0:jr.length;++Cn-1;);return Ur}function Sm(jr,Xr){for(var Ur=jr.length;Ur--&&mu(Xr,jr[Ur],0)>-1;);return Ur}function Nv(jr,Xr){for(var Ur=jr.length,Cn=0;Ur--;)jr[Ur]===Xr&&++Cn;return Cn}var Lv=l0(_r),Dv=l0(Xt);function Fv(jr){return"\\"+gr[jr]}function Uv(jr,Xr){return jr==null?$:jr[Xr]}function gu(jr){return Bo.test(jr)}function zv(jr){return To.test(jr)}function Hv(jr){for(var Xr,Ur=[];!(Xr=jr.next()).done;)Ur.push(Xr.value);return Ur}function h0(jr){var Xr=-1,Ur=Array(jr.size);return jr.forEach(function(Cn,Ln){Ur[++Xr]=[Ln,Cn]}),Ur}function $m(jr,Xr){return function(Ur){return jr(Xr(Ur))}}function Ml(jr,Xr){for(var Ur=-1,Cn=jr.length,Ln=0,ns=[];++Ur-1}function Cy(_t,kt){var zt=this.__data__,rr=Op(zt,_t);return rr<0?(++this.size,zt.push([_t,kt])):zt[rr][1]=kt,this}Zo.prototype.clear=Ry,Zo.prototype.delete=Ay,Zo.prototype.get=Py,Zo.prototype.has=Ty,Zo.prototype.set=Cy;function Yo(_t){var kt=-1,zt=_t==null?0:_t.length;for(this.clear();++kt=kt?_t:kt)),_t}function vo(_t,kt,zt,rr,ur,yr){var Cr,Mr=kt&at,Br=kt&ut,en=kt&ht;if(zt&&(Cr=ur?zt(_t,rr,ur,yr):zt(_t)),Cr!==$)return Cr;if(!ws(_t))return _t;var tn=Dn(_t);if(tn){if(Cr=Bx(_t),!Mr)return Js(_t,Cr)}else{var sn=zs(_t),An=sn==Qt||sn==dr;if(Fl(_t))return a1(_t,Mr);if(sn==Ir||sn==nr||An&&!ur){if(Cr=Br||An?{}:A1(_t),!Mr)return Br?$x(_t,Ky(Cr,_t)):Sx(_t,Nm(Cr,_t))}else{if(!Xn[sn])return ur?_t:{};Cr=Nx(_t,sn,Mr)}}yr||(yr=new ko);var In=yr.get(_t);if(In)return In;yr.set(_t,Cr),rv(_t)?_t.forEach(function(Bn){Cr.add(vo(Bn,kt,zt,Bn,_t,yr))}):ev(_t)&&_t.forEach(function(Bn,qn){Cr.set(qn,vo(Bn,kt,zt,qn,_t,yr))});var jn=en?Br?D0:L0:Br?eo:Bs,zn=tn?$:jn(_t);return po(zn||_t,function(Bn,qn){zn&&(qn=Bn,Bn=_t[qn]),Zu(Cr,qn,vo(Bn,kt,zt,qn,_t,yr))}),Cr}function Wy(_t){var kt=Bs(_t);return function(zt){return Lm(zt,_t,kt)}}function Lm(_t,kt,zt){var rr=zt.length;if(_t==null)return!rr;for(_t=bs(_t);rr--;){var ur=zt[rr],yr=kt[ur],Cr=_t[ur];if(Cr===$&&!(ur in _t)||!yr(Cr))return!1}return!0}function Dm(_t,kt,zt){if(typeof _t!="function")throw new mo(rt);return rp(function(){_t.apply($,zt)},kt)}function Yu(_t,kt,zt,rr){var ur=-1,yr=vp,Cr=!0,Mr=_t.length,Br=[],en=kt.length;if(!Mr)return Br;zt&&(kt=xs(kt,no(zt))),rr?(yr=s0,Cr=!1):kt.length>=et&&(yr=Hu,Cr=!1,kt=new tu(kt));e:for(;++urur?0:ur+zt),rr=rr===$||rr>ur?ur:Un(rr),rr<0&&(rr+=ur),rr=zt>rr?0:iv(rr);zt0&&zt(Mr)?kt>1?Fs(Mr,kt-1,zt,rr,ur):Il(ur,Mr):rr||(ur[ur.length]=Mr)}return ur}var x0=h1(),zm=h1(!0);function Do(_t,kt){return _t&&x0(_t,kt,Bs)}function E0(_t,kt){return _t&&zm(_t,kt,Bs)}function Bp(_t,kt){return Cl(kt,function(zt){return ga(_t[zt])})}function nu(_t,kt){kt=Ll(kt,_t);for(var zt=0,rr=kt.length;_t!=null&&ztkt}function Yy(_t,kt){return _t!=null&&cs.call(_t,kt)}function Xy(_t,kt){return _t!=null&&kt in bs(_t)}function Jy(_t,kt,zt){return _t>=Us(kt,zt)&&_t=120&&tn.length>=120)?new tu(Cr&&tn):$}tn=_t[0];var sn=-1,An=Mr[0];e:for(;++sn-1;)Mr!==_t&&Ap.call(Mr,Br,1),Ap.call(_t,Br,1);return _t}function Qm(_t,kt){for(var zt=_t?kt.length:0,rr=zt-1;zt--;){var ur=kt[zt];if(zt==rr||ur!==yr){var yr=ur;na(ur)?Ap.call(_t,ur,1):k0(_t,ur)}}return _t}function P0(_t,kt){return _t+Cp(Mm()*(kt-_t+1))}function fx(_t,kt,zt,rr){for(var ur=-1,yr=ks(Tp((kt-_t)/(zt||1)),0),Cr=Ur(yr);yr--;)Cr[rr?yr:++ur]=_t,_t+=zt;return Cr}function T0(_t,kt){var zt="";if(!_t||kt<1||kt>Rt)return zt;do kt%2&&(zt+=_t),kt=Cp(kt/2),kt&&(_t+=_t);while(kt);return zt}function Hn(_t,kt){return K0(C1(_t,kt,to),_t+"")}function hx(_t){return Bm(Au(_t))}function mx(_t,kt){var zt=Au(_t);return Wp(zt,ru(kt,0,zt.length))}function Qu(_t,kt,zt,rr){if(!ws(_t))return _t;kt=Ll(kt,_t);for(var ur=-1,yr=kt.length,Cr=yr-1,Mr=_t;Mr!=null&&++urur?0:ur+kt),zt=zt>ur?ur:zt,zt<0&&(zt+=ur),ur=kt>zt?0:zt-kt>>>0,kt>>>=0;for(var yr=Ur(ur);++rr>>1,Cr=_t[yr];Cr!==null&&!so(Cr)&&(zt?Cr<=kt:Cr=et){var en=kt?null:Tx(_t);if(en)return yp(en);Cr=!1,ur=Hu,Br=new tu}else Br=kt?[]:Mr;e:for(;++rr=rr?_t:bo(_t,kt,zt)}var o1=iy||function(_t){return cn.clearTimeout(_t)};function a1(_t,kt){if(kt)return _t.slice();var zt=_t.length,rr=Pm?Pm(zt):new _t.constructor(zt);return _t.copy(rr),rr}function j0(_t){var kt=new _t.constructor(_t.byteLength);return new $p(kt).set(new $p(_t)),kt}function xx(_t,kt){var zt=kt?j0(_t.buffer):_t.buffer;return new _t.constructor(zt,_t.byteOffset,_t.byteLength)}function Ex(_t){var kt=new _t.constructor(_t.source,yn.exec(_t));return kt.lastIndex=_t.lastIndex,kt}function wx(_t){return Gu?bs(Gu.call(_t)):{}}function c1(_t,kt){var zt=kt?j0(_t.buffer):_t.buffer;return new _t.constructor(zt,_t.byteOffset,_t.length)}function l1(_t,kt){if(_t!==kt){var zt=_t!==$,rr=_t===null,ur=_t===_t,yr=so(_t),Cr=kt!==$,Mr=kt===null,Br=kt===kt,en=so(kt);if(!Mr&&!en&&!yr&&_t>kt||yr&&Cr&&Br&&!Mr&&!en||rr&&Cr&&Br||!zt&&Br||!ur)return 1;if(!rr&&!yr&&!en&&_t=Mr)return Br;var en=zt[rr];return Br*(en=="desc"?-1:1)}}return _t.index-kt.index}function u1(_t,kt,zt,rr){for(var ur=-1,yr=_t.length,Cr=zt.length,Mr=-1,Br=kt.length,en=ks(yr-Cr,0),tn=Ur(Br+en),sn=!rr;++Mr1?zt[ur-1]:$,Cr=ur>2?zt[2]:$;for(yr=_t.length>3&&typeof yr=="function"?(ur--,yr):$,Cr&&Vs(zt[0],zt[1],Cr)&&(yr=ur<3?$:yr,ur=1),kt=bs(kt);++rr-1?ur[yr?kt[Cr]:Cr]:$}}function g1(_t){return Qo(function(kt){var zt=kt.length,rr=zt,ur=go.prototype.thru;for(_t&&kt.reverse();rr--;){var yr=kt[rr];if(typeof yr!="function")throw new mo(rt);if(ur&&!Cr&&qp(yr)=="wrapper")var Cr=new go([],!0)}for(rr=Cr?rr:zt;++rr1&&Gn.reverse(),tn&&BrMr))return!1;var en=yr.get(_t),tn=yr.get(kt);if(en&&tn)return en==kt&&tn==_t;var sn=-1,An=!0,In=zt&Et?new tu:$;for(yr.set(_t,kt),yr.set(kt,_t);++sn1?"& ":"")+kt[rr],kt=kt.join(zt>2?", ":" "),_t.replace(gn,`{ -/* [wrapped with `+kt+`] */ -`)}function Dx(_t){return Dn(_t)||ou(_t)||!!(km&&_t&&_t[km])}function na(_t,kt){var zt=typeof _t;return kt=kt??Rt,!!kt&&(zt=="number"||zt!="symbol"&&ps.test(_t))&&_t>-1&&_t%1==0&&_t0){if(++kt>=yt)return arguments[0]}else kt=0;return _t.apply($,arguments)}}function Wp(_t,kt){var zt=-1,rr=_t.length,ur=rr-1;for(kt=kt===$?rr:kt;++zt1?_t[kt-1]:$;return zt=typeof zt=="function"?(_t.pop(),zt):$,z1(_t,zt)});function H1(_t){var kt=vr(_t);return kt.__chain__=!0,kt}function Y2(_t,kt){return kt(_t),_t}function Gp(_t,kt){return kt(_t)}var X2=Qo(function(_t){var kt=_t.length,zt=kt?_t[0]:0,rr=this.__wrapped__,ur=function(yr){return y0(yr,_t)};return kt>1||this.__actions__.length||!(rr instanceof Kn)||!na(zt)?this.thru(ur):(rr=rr.slice(zt,+zt+(kt?1:0)),rr.__actions__.push({func:Gp,args:[ur],thisArg:$}),new go(rr,this.__chain__).thru(function(yr){return kt&&!yr.length&&yr.push($),yr}))});function J2(){return H1(this)}function Q2(){return new go(this.value(),this.__chain__)}function eE(){this.__values__===$&&(this.__values__=nv(this.value()));var _t=this.__index__>=this.__values__.length,kt=_t?$:this.__values__[this.__index__++];return{done:_t,value:kt}}function tE(){return this}function rE(_t){for(var kt,zt=this;zt instanceof Mp;){var rr=B1(zt);rr.__index__=0,rr.__values__=$,kt?ur.__wrapped__=rr:kt=rr;var ur=rr;zt=zt.__wrapped__}return ur.__wrapped__=_t,kt}function nE(){var _t=this.__wrapped__;if(_t instanceof Kn){var kt=_t;return this.__actions__.length&&(kt=new Kn(this)),kt=kt.reverse(),kt.__actions__.push({func:Gp,args:[W0],thisArg:$}),new go(kt,this.__chain__)}return this.thru(W0)}function iE(){return i1(this.__wrapped__,this.__actions__)}var sE=Fp(function(_t,kt,zt){cs.call(_t,zt)?++_t[zt]:Xo(_t,zt,1)});function oE(_t,kt,zt){var rr=Dn(_t)?vm:Gy;return zt&&Vs(_t,kt,zt)&&(kt=$),rr(_t,On(kt,3))}function aE(_t,kt){var zt=Dn(_t)?Cl:Um;return zt(_t,On(kt,3))}var cE=m1(N1),lE=m1(L1);function uE(_t,kt){return Fs(Zp(_t,kt),1)}function dE(_t,kt){return Fs(Zp(_t,kt),St)}function fE(_t,kt,zt){return zt=zt===$?1:Un(zt),Fs(Zp(_t,kt),zt)}function V1(_t,kt){var zt=Dn(_t)?po:Bl;return zt(_t,On(kt,3))}function q1(_t,kt){var zt=Dn(_t)?Tv:Fm;return zt(_t,On(kt,3))}var hE=Fp(function(_t,kt,zt){cs.call(_t,zt)?_t[zt].push(kt):Xo(_t,zt,[kt])});function pE(_t,kt,zt,rr){_t=Qs(_t)?_t:Au(_t),zt=zt&&!rr?Un(zt):0;var ur=_t.length;return zt<0&&(zt=ks(ur+zt,0)),e0(_t)?zt<=ur&&_t.indexOf(kt,zt)>-1:!!ur&&mu(_t,kt,zt)>-1}var mE=Hn(function(_t,kt,zt){var rr=-1,ur=typeof kt=="function",yr=Qs(_t)?Ur(_t.length):[];return Bl(_t,function(Cr){yr[++rr]=ur?Os(kt,Cr,zt):Xu(Cr,kt,zt)}),yr}),gE=Fp(function(_t,kt,zt){Xo(_t,zt,kt)});function Zp(_t,kt){var zt=Dn(_t)?xs:Wm;return zt(_t,On(kt,3))}function vE(_t,kt,zt,rr){return _t==null?[]:(Dn(kt)||(kt=kt==null?[]:[kt]),zt=rr?$:zt,Dn(zt)||(zt=zt==null?[]:[zt]),Xm(_t,kt,zt))}var bE=Fp(function(_t,kt,zt){_t[zt?0:1].push(kt)},function(){return[[],[]]});function yE(_t,kt,zt){var rr=Dn(_t)?o0:Em,ur=arguments.length<3;return rr(_t,On(kt,4),zt,ur,Bl)}function xE(_t,kt,zt){var rr=Dn(_t)?Cv:Em,ur=arguments.length<3;return rr(_t,On(kt,4),zt,ur,Fm)}function wE(_t,kt){var zt=Dn(_t)?Cl:Um;return zt(_t,Jp(On(kt,3)))}function _E(_t){var kt=Dn(_t)?Bm:hx;return kt(_t)}function SE(_t,kt,zt){(zt?Vs(_t,kt,zt):kt===$)?kt=1:kt=Un(kt);var rr=Dn(_t)?Hy:mx;return rr(_t,kt)}function $E(_t){var kt=Dn(_t)?Vy:vx;return kt(_t)}function RE(_t){if(_t==null)return 0;if(Qs(_t))return e0(_t)?vu(_t):_t.length;var kt=zs(_t);return kt==xr||kt==$r?_t.size:$0(_t).length}function AE(_t,kt,zt){var rr=Dn(_t)?a0:bx;return zt&&Vs(_t,kt,zt)&&(kt=$),rr(_t,On(kt,3))}var PE=Hn(function(_t,kt){if(_t==null)return[];var zt=kt.length;return zt>1&&Vs(_t,kt[0],kt[1])?kt=[]:zt>2&&Vs(kt[0],kt[1],kt[2])&&(kt=[kt[0]]),Xm(_t,Fs(kt,1),[])}),Yp=sy||function(){return cn.Date.now()};function TE(_t,kt){if(typeof kt!="function")throw new mo(rt);return _t=Un(_t),function(){if(--_t<1)return kt.apply(this,arguments)}}function K1(_t,kt,zt){return kt=zt?$:kt,kt=_t&&kt==null?_t.length:kt,Jo(_t,jt,$,$,$,$,kt)}function W1(_t,kt){var zt;if(typeof kt!="function")throw new mo(rt);return _t=Un(_t),function(){return--_t>0&&(zt=kt.apply(this,arguments)),_t<=1&&(kt=$),zt}}var Z0=Hn(function(_t,kt,zt){var rr=Ct;if(zt.length){var ur=Ml(zt,$u(Z0));rr|=Nt}return Jo(_t,rr,kt,zt,ur)}),G1=Hn(function(_t,kt,zt){var rr=Ct|Pt;if(zt.length){var ur=Ml(zt,$u(G1));rr|=Nt}return Jo(kt,rr,_t,zt,ur)});function Z1(_t,kt,zt){kt=zt?$:kt;var rr=Jo(_t,It,$,$,$,$,$,kt);return rr.placeholder=Z1.placeholder,rr}function Y1(_t,kt,zt){kt=zt?$:kt;var rr=Jo(_t,Lt,$,$,$,$,$,kt);return rr.placeholder=Y1.placeholder,rr}function X1(_t,kt,zt){var rr,ur,yr,Cr,Mr,Br,en=0,tn=!1,sn=!1,An=!0;if(typeof _t!="function")throw new mo(rt);kt=xo(kt)||0,ws(zt)&&(tn=!!zt.leading,sn="maxWait"in zt,yr=sn?ks(xo(zt.maxWait)||0,kt):yr,An="trailing"in zt?!!zt.trailing:An);function In(Rs){var Mo=rr,xa=ur;return rr=ur=$,en=Rs,Cr=_t.apply(xa,Mo),Cr}function jn(Rs){return en=Rs,Mr=rp(qn,kt),tn?In(Rs):Cr}function zn(Rs){var Mo=Rs-Br,xa=Rs-en,gv=kt-Mo;return sn?Us(gv,yr-xa):gv}function Bn(Rs){var Mo=Rs-Br,xa=Rs-en;return Br===$||Mo>=kt||Mo<0||sn&&xa>=yr}function qn(){var Rs=Yp();if(Bn(Rs))return Gn(Rs);Mr=rp(qn,zn(Rs))}function Gn(Rs){return Mr=$,An&&rr?In(Rs):(rr=ur=$,Cr)}function oo(){Mr!==$&&o1(Mr),en=0,rr=Br=ur=Mr=$}function qs(){return Mr===$?Cr:Gn(Yp())}function ao(){var Rs=Yp(),Mo=Bn(Rs);if(rr=arguments,ur=this,Br=Rs,Mo){if(Mr===$)return jn(Br);if(sn)return o1(Mr),Mr=rp(qn,kt),In(Br)}return Mr===$&&(Mr=rp(qn,kt)),Cr}return ao.cancel=oo,ao.flush=qs,ao}var CE=Hn(function(_t,kt){return Dm(_t,1,kt)}),kE=Hn(function(_t,kt,zt){return Dm(_t,xo(kt)||0,zt)});function IE(_t){return Jo(_t,Dt)}function Xp(_t,kt){if(typeof _t!="function"||kt!=null&&typeof kt!="function")throw new mo(rt);var zt=function(){var rr=arguments,ur=kt?kt.apply(this,rr):rr[0],yr=zt.cache;if(yr.has(ur))return yr.get(ur);var Cr=_t.apply(this,rr);return zt.cache=yr.set(ur,Cr)||yr,Cr};return zt.cache=new(Xp.Cache||Yo),zt}Xp.Cache=Yo;function Jp(_t){if(typeof _t!="function")throw new mo(rt);return function(){var kt=arguments;switch(kt.length){case 0:return!_t.call(this);case 1:return!_t.call(this,kt[0]);case 2:return!_t.call(this,kt[0],kt[1]);case 3:return!_t.call(this,kt[0],kt[1],kt[2])}return!_t.apply(this,kt)}}function ME(_t){return W1(2,_t)}var OE=yx(function(_t,kt){kt=kt.length==1&&Dn(kt[0])?xs(kt[0],no(On())):xs(Fs(kt,1),no(On()));var zt=kt.length;return Hn(function(rr){for(var ur=-1,yr=Us(rr.length,zt);++ur=kt}),ou=Vm(function(){return arguments}())?Vm:function(_t){return _s(_t)&&cs.call(_t,"callee")&&!Cm.call(_t,"callee")},Dn=Ur.isArray,ZE=Es?no(Es):ex;function Qs(_t){return _t!=null&&Qp(_t.length)&&!ga(_t)}function $s(_t){return _s(_t)&&Qs(_t)}function YE(_t){return _t===!0||_t===!1||_s(_t)&&Hs(_t)==Kt}var Fl=ay||am,XE=Ds?no(Ds):tx;function JE(_t){return _s(_t)&&_t.nodeType===1&&!np(_t)}function QE(_t){if(_t==null)return!0;if(Qs(_t)&&(Dn(_t)||typeof _t=="string"||typeof _t.splice=="function"||Fl(_t)||Ru(_t)||ou(_t)))return!_t.length;var kt=zs(_t);if(kt==xr||kt==$r)return!_t.size;if(tp(_t))return!$0(_t).length;for(var zt in _t)if(cs.call(_t,zt))return!1;return!0}function ew(_t,kt){return Ju(_t,kt)}function tw(_t,kt,zt){zt=typeof zt=="function"?zt:$;var rr=zt?zt(_t,kt):$;return rr===$?Ju(_t,kt,$,zt):!!rr}function X0(_t){if(!_s(_t))return!1;var kt=Hs(_t);return kt==qt||kt==Ht||typeof _t.message=="string"&&typeof _t.name=="string"&&!np(_t)}function rw(_t){return typeof _t=="number"&&Im(_t)}function ga(_t){if(!ws(_t))return!1;var kt=Hs(_t);return kt==Qt||kt==dr||kt==Wt||kt==fr}function Q1(_t){return typeof _t=="number"&&_t==Un(_t)}function Qp(_t){return typeof _t=="number"&&_t>-1&&_t%1==0&&_t<=Rt}function ws(_t){var kt=typeof _t;return _t!=null&&(kt=="object"||kt=="function")}function _s(_t){return _t!=null&&typeof _t=="object"}var ev=ho?no(ho):nx;function nw(_t,kt){return _t===kt||S0(_t,kt,U0(kt))}function iw(_t,kt,zt){return zt=typeof zt=="function"?zt:$,S0(_t,kt,U0(kt),zt)}function sw(_t){return tv(_t)&&_t!=+_t}function ow(_t){if(zx(_t))throw new Ln(tt);return qm(_t)}function aw(_t){return _t===null}function cw(_t){return _t==null}function tv(_t){return typeof _t=="number"||_s(_t)&&Hs(_t)==pr}function np(_t){if(!_s(_t)||Hs(_t)!=Ir)return!1;var kt=Rp(_t);if(kt===null)return!0;var zt=cs.call(kt,"constructor")&&kt.constructor;return typeof zt=="function"&&zt instanceof zt&&wp.call(zt)==ty}var J0=Lo?no(Lo):ix;function lw(_t){return Q1(_t)&&_t>=-Rt&&_t<=Rt}var rv=zu?no(zu):sx;function e0(_t){return typeof _t=="string"||!Dn(_t)&&_s(_t)&&Hs(_t)==Pr}function so(_t){return typeof _t=="symbol"||_s(_t)&&Hs(_t)==Rr}var Ru=Jl?no(Jl):ox;function uw(_t){return _t===$}function dw(_t){return _s(_t)&&zs(_t)==Or}function fw(_t){return _s(_t)&&Hs(_t)==Lr}var hw=Vp(R0),pw=Vp(function(_t,kt){return _t<=kt});function nv(_t){if(!_t)return[];if(Qs(_t))return e0(_t)?Co(_t):Js(_t);if(Vu&&_t[Vu])return Hv(_t[Vu]());var kt=zs(_t),zt=kt==xr?h0:kt==$r?yp:Au;return zt(_t)}function ba(_t){if(!_t)return _t===0?_t:0;if(_t=xo(_t),_t===St||_t===-St){var kt=_t<0?-1:1;return kt*$t}return _t===_t?_t:0}function Un(_t){var kt=ba(_t),zt=kt%1;return kt===kt?zt?kt-zt:kt:0}function iv(_t){return _t?ru(Un(_t),0,At):0}function xo(_t){if(typeof _t=="number")return _t;if(so(_t))return xt;if(ws(_t)){var kt=typeof _t.valueOf=="function"?_t.valueOf():_t;_t=ws(kt)?kt+"":kt}if(typeof _t!="string")return _t===0?_t:+_t;_t=wm(_t);var zt=ds.test(_t);return zt||hs.test(_t)?rn(_t.slice(2),zt?2:8):En.test(_t)?xt:+_t}function sv(_t){return Fo(_t,eo(_t))}function mw(_t){return _t?ru(Un(_t),-Rt,Rt):_t===0?_t:0}function os(_t){return _t==null?"":io(_t)}var gw=_u(function(_t,kt){if(tp(kt)||Qs(kt)){Fo(kt,Bs(kt),_t);return}for(var zt in kt)cs.call(kt,zt)&&Zu(_t,zt,kt[zt])}),ov=_u(function(_t,kt){Fo(kt,eo(kt),_t)}),t0=_u(function(_t,kt,zt,rr){Fo(kt,eo(kt),_t,rr)}),bw=_u(function(_t,kt,zt,rr){Fo(kt,Bs(kt),_t,rr)}),yw=Qo(y0);function xw(_t,kt){var zt=wu(_t);return kt==null?zt:Nm(zt,kt)}var Ew=Hn(function(_t,kt){_t=bs(_t);var zt=-1,rr=kt.length,ur=rr>2?kt[2]:$;for(ur&&Vs(kt[0],kt[1],ur)&&(rr=1);++zt1),yr}),Fo(_t,D0(_t),zt),rr&&(zt=vo(zt,at|ut|ht,Cx));for(var ur=kt.length;ur--;)k0(zt,kt[ur]);return zt});function Dw(_t,kt){return cv(_t,Jp(On(kt)))}var Fw=Qo(function(_t,kt){return _t==null?{}:ux(_t,kt)});function cv(_t,kt){if(_t==null)return{};var zt=xs(D0(_t),function(rr){return[rr]});return kt=On(kt),Jm(_t,zt,function(rr,ur){return kt(rr,ur[0])})}function Uw(_t,kt,zt){kt=Ll(kt,_t);var rr=-1,ur=kt.length;for(ur||(ur=1,_t=$);++rrkt){var rr=_t;_t=kt,kt=rr}if(zt||_t%1||kt%1){var ur=Mm();return Us(_t+ur*(kt-_t+Dr("1e-"+((ur+"").length-1))),kt)}return P0(_t,kt)}var Jw=Su(function(_t,kt,zt){return kt=kt.toLowerCase(),_t+(zt?dv(kt):kt)});function dv(_t){return tm(os(_t).toLowerCase())}function fv(_t){return _t=os(_t),_t&&_t.replace(Vn,Lv).replace(Ts,"")}function Qw(_t,kt,zt){_t=os(_t),kt=io(kt);var rr=_t.length;zt=zt===$?rr:ru(Un(zt),0,rr);var ur=zt;return zt-=kt.length,zt>=0&&_t.slice(zt,ur)==kt}function e3(_t){return _t=os(_t),_t&&ln.test(_t)?_t.replace(Qr,Dv):_t}function t3(_t){return _t=os(_t),_t&&$n.test(_t)?_t.replace(Kr,"\\$&"):_t}var r3=Su(function(_t,kt,zt){return _t+(zt?"-":"")+kt.toLowerCase()}),n3=Su(function(_t,kt,zt){return _t+(zt?" ":"")+kt.toLowerCase()}),i3=p1("toLowerCase");function s3(_t,kt,zt){_t=os(_t),kt=Un(kt);var rr=kt?vu(_t):0;if(!kt||rr>=kt)return _t;var ur=(kt-rr)/2;return Hp(Cp(ur),zt)+_t+Hp(Tp(ur),zt)}function o3(_t,kt,zt){_t=os(_t),kt=Un(kt);var rr=kt?vu(_t):0;return kt&&rr>>0,zt?(_t=os(_t),_t&&(typeof kt=="string"||kt!=null&&!J0(kt))&&(kt=io(kt),!kt&&gu(_t))?Dl(Co(_t),0,zt):_t.split(kt,zt)):[]}var h3=Su(function(_t,kt,zt){return _t+(zt?" ":"")+tm(kt)});function p3(_t,kt,zt){return _t=os(_t),zt=zt==null?0:ru(Un(zt),0,_t.length),kt=io(kt),_t.slice(zt,zt+kt.length)==kt}function m3(_t,kt,zt){var rr=vr.templateSettings;zt&&Vs(_t,kt,zt)&&(kt=$),_t=os(_t),kt=t0({},kt,rr,E1);var ur=t0({},kt.imports,rr.imports,E1),yr=Bs(ur),Cr=f0(ur,yr),Mr,Br,en=0,tn=kt.interpolate||ss,sn="__p += '",An=p0((kt.escape||ss).source+"|"+tn.source+"|"+(tn===un?Tn:ss).source+"|"+(kt.evaluate||ss).source+"|$","g"),In="//# sourceURL="+(cs.call(kt,"sourceURL")?(kt.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xl+"]")+` -`;_t.replace(An,function(Bn,qn,Gn,oo,qs,ao){return Gn||(Gn=oo),sn+=_t.slice(en,ao).replace(Jn,Fv),qn&&(Mr=!0,sn+=`' + -__e(`+qn+`) + -'`),qs&&(Br=!0,sn+=`'; -`+qs+`; + */lodash.exports;(function(_,a){(function(){var $,j="4.17.21",et=200,tt="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",rt="Expected a function",nt="Invalid `variable` option passed into `_.template`",it="__lodash_hash_undefined__",at=500,st="__lodash_placeholder__",ot=1,ut=2,dt=4,mt=1,xt=2,Ct=1,Pt=2,Tt=4,kt=8,Lt=16,Nt=32,zt=64,jt=128,Mt=256,Dt=512,Ft=30,Bt="...",yt=800,bt=16,ct=1,ht=2,vt=3,St=1/0,Rt=9007199254740991,$t=17976931348623157e292,Et=NaN,At=4294967295,wt=At-1,Ot=At>>>1,tr=[["ary",jt],["bind",Ct],["bindKey",Pt],["curry",kt],["curryRight",Lt],["flip",Dt],["partial",Nt],["partialRight",zt],["rearg",Mt]],nr="[object Arguments]",ir="[object Array]",Wt="[object AsyncFunction]",Kt="[object Boolean]",Jt="[object Date]",Ht="[object DOMException]",Vt="[object Error]",Qt="[object Function]",dr="[object GeneratorFunction]",xr="[object Map]",pr="[object Number]",Ir="[object Null]",kr="[object Object]",lr="[object Promise]",fr="[object Proxy]",Er="[object RegExp]",$r="[object Set]",Pr="[object String]",Rr="[object Symbol]",Ar="[object Undefined]",Or="[object WeakMap]",Lr="[object WeakSet]",ar="[object ArrayBuffer]",Yt="[object DataView]",er="[object Float32Array]",Zt="[object Float64Array]",qt="[object Int8Array]",Gt="[object Int16Array]",or="[object Int32Array]",vr="[object Uint8Array]",wr="[object Uint8ClampedArray]",Sr="[object Uint16Array]",Wr="[object Uint32Array]",Hr=/\b__p \+= '';/g,Fr=/\b(__p \+=) '' \+/g,pn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Jr=/&(?:amp|lt|gt|quot|#39);/g,Qr=/[&<>"']/g,mn=RegExp(Jr.source),ln=RegExp(Qr.source),Vr=/<%-([\s\S]+?)%>/g,wn=/<%([\s\S]+?)%>/g,un=/<%=([\s\S]+?)%>/g,qr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hn=/^\w*$/,fn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/[\\^$.*+?()[\]{}|]/g,$n=RegExp(Kr.source),dn=/^\s+/,Gr=/\s/,gn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,Zr=/,? & /,Rn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Sn=/[()=,{}\[\]\/\s]/,nn=/\\(\\)?/g,Tn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yn=/\w*$/,En=/^[-+]0x[0-9a-f]+$/i,ds=/^0b[01]+$/i,fs=/^\[object .+?Constructor\]$/,hs=/^0o[0-7]+$/i,ps=/^(?:0|[1-9]\d*)$/,qn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ss=/($^)/,Jn=/['\n\r\u2028\u2029\\]/g,Yn="\\ud800-\\udfff",ms="\\u0300-\\u036f",Qn="\\ufe20-\\ufe2f",es="\\u20d0-\\u20ff",ls=ms+Qn+es,us="\\u2700-\\u27bf",Wn="a-z\\xdf-\\xf6\\xf8-\\xff",os="\\xac\\xb1\\xd7\\xf7",gs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",bs="\\u2000-\\u206f",Ps=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",As="A-Z\\xc0-\\xd6\\xd8-\\xde",yl="\\ufe0e\\ufe0f",bo=os+gs+bs+Ps,Uo="['’]",vo="["+Yn+"]",Ho="["+bo+"]",yo="["+ls+"]",Zs="\\d+",xo="["+us+"]",xl="["+Wn+"]",El="[^"+Yn+bo+Zs+us+Wn+As+"]",io="\\ud83c[\\udffb-\\udfff]",Yl="(?:"+yo+"|"+io+")",wl="[^"+Yn+"]",Co="(?:\\ud83c[\\udde6-\\uddff]){2}",Ys="[\\ud800-\\udbff][\\udc00-\\udfff]",Ns="["+As+"]",_l="\\u200d",Sl="(?:"+xl+"|"+El+")",ks="(?:"+Ns+"|"+El+")",$l="(?:"+Uo+"(?:d|ll|m|re|s|t|ve))?",Rl="(?:"+Uo+"(?:D|LL|M|RE|S|T|VE))?",Al=Yl+"?",Xs="["+yl+"]?",Eo="(?:"+_l+"(?:"+[wl,Co,Ys].join("|")+")"+Xs+Al+")*",Ls="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",so="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Pl=Xs+Al+Eo,ao="(?:"+[xo,Co,Ys].join("|")+")"+Pl,wo="(?:"+[wl+yo+"?",yo,Co,Ys,vo].join("|")+")",_o=RegExp(Uo,"g"),Ts=RegExp(yo,"g"),Ms=RegExp(io+"(?="+io+")|"+wo+Pl,"g"),Tl=RegExp([Ns+"?"+xl+"+"+$l+"(?="+[Ho,Ns,"$"].join("|")+")",ks+"+"+Rl+"(?="+[Ho,Ns+Sl,"$"].join("|")+")",Ns+"?"+Sl+"+"+$l,Ns+"+"+Rl,so,Ls,Zs,ao].join("|"),"g"),Io=RegExp("["+_l+Yn+ls+yl+"]"),So=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ko=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xl=-1,rs={};rs[er]=rs[Zt]=rs[qt]=rs[Gt]=rs[or]=rs[vr]=rs[wr]=rs[Sr]=rs[Wr]=!0,rs[nr]=rs[ir]=rs[ar]=rs[Kt]=rs[Yt]=rs[Jt]=rs[Vt]=rs[Qt]=rs[xr]=rs[pr]=rs[kr]=rs[Er]=rs[$r]=rs[Pr]=rs[Or]=!1;var Xn={};Xn[nr]=Xn[ir]=Xn[ar]=Xn[Yt]=Xn[Kt]=Xn[Jt]=Xn[er]=Xn[Zt]=Xn[qt]=Xn[Gt]=Xn[or]=Xn[xr]=Xn[pr]=Xn[kr]=Xn[Er]=Xn[$r]=Xn[Pr]=Xn[Rr]=Xn[vr]=Xn[wr]=Xn[Sr]=Xn[Wr]=!0,Xn[Vt]=Xn[Qt]=Xn[Or]=!1;var _r={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Xt={"&":"&","<":"<",">":">",'"':""","'":"'"},cr={"&":"&","<":"<",">":">",""":'"',"'":"'"},gr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dr=parseFloat,rn=parseInt,xn=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Pn=typeof self=="object"&&self&&self.Object===Object&&self,cn=xn||Pn||Function("return this")(),_n=a&&!a.nodeType&&a,Nn=_n&&!0&&_&&!_.nodeType&&_,Fn=Nn&&Nn.exports===_n,ts=Fn&&xn.process,_i=function(){try{var jr=Nn&&Nn.require&&Nn.require("util").types;return jr||ts&&ts.binding&&ts.binding("util")}catch{}}(),Es=_i&&_i.isArrayBuffer,Ds=_i&&_i.isDate,oo=_i&&_i.isMap,Mo=_i&&_i.isRegExp,Uu=_i&&_i.isSet,Jl=_i&&_i.isTypedArray;function Os(jr,Xr,Ur){switch(Ur.length){case 0:return jr.call(Xr);case 1:return jr.call(Xr,Ur[0]);case 2:return jr.call(Xr,Ur[0],Ur[1]);case 3:return jr.call(Xr,Ur[0],Ur[1],Ur[2])}return jr.apply(Xr,Ur)}function Pv(jr,Xr,Ur,Cn){for(var Ln=-1,ns=jr==null?0:jr.length;++Ln-1}function s0(jr,Xr,Ur){for(var Cn=-1,Ln=jr==null?0:jr.length;++Cn-1;);return Ur}function Sm(jr,Xr){for(var Ur=jr.length;Ur--&&mu(Xr,jr[Ur],0)>-1;);return Ur}function Nv(jr,Xr){for(var Ur=jr.length,Cn=0;Ur--;)jr[Ur]===Xr&&++Cn;return Cn}var Lv=l0(_r),Dv=l0(Xt);function Fv(jr){return"\\"+gr[jr]}function zv(jr,Xr){return jr==null?$:jr[Xr]}function gu(jr){return Io.test(jr)}function Uv(jr){return So.test(jr)}function Hv(jr){for(var Xr,Ur=[];!(Xr=jr.next()).done;)Ur.push(Xr.value);return Ur}function h0(jr){var Xr=-1,Ur=Array(jr.size);return jr.forEach(function(Cn,Ln){Ur[++Xr]=[Ln,Cn]}),Ur}function $m(jr,Xr){return function(Ur){return jr(Xr(Ur))}}function Ml(jr,Xr){for(var Ur=-1,Cn=jr.length,Ln=0,ns=[];++Ur-1}function Cy(_t,It){var Ut=this.__data__,rr=Op(Ut,_t);return rr<0?(++this.size,Ut.push([_t,It])):Ut[rr][1]=It,this}qo.prototype.clear=Ry,qo.prototype.delete=Ay,qo.prototype.get=Py,qo.prototype.has=Ty,qo.prototype.set=Cy;function Vo(_t){var It=-1,Ut=_t==null?0:_t.length;for(this.clear();++It=It?_t:It)),_t}function fo(_t,It,Ut,rr,ur,yr){var Cr,Mr=It&ot,Br=It&ut,en=It&dt;if(Ut&&(Cr=ur?Ut(_t,rr,ur,yr):Ut(_t)),Cr!==$)return Cr;if(!ws(_t))return _t;var tn=Dn(_t);if(tn){if(Cr=O2(_t),!Mr)return Js(_t,Cr)}else{var sn=Us(_t),An=sn==Qt||sn==dr;if(Fl(_t))return o1(_t,Mr);if(sn==kr||sn==nr||An&&!ur){if(Cr=Br||An?{}:A1(_t),!Mr)return Br?_2(_t,Ky(Cr,_t)):w2(_t,Nm(Cr,_t))}else{if(!Xn[sn])return ur?_t:{};Cr=j2(_t,sn,Mr)}}yr||(yr=new Ro);var kn=yr.get(_t);if(kn)return kn;yr.set(_t,Cr),rv(_t)?_t.forEach(function(Bn){Cr.add(fo(Bn,It,Ut,Bn,_t,yr))}):ev(_t)&&_t.forEach(function(Bn,Vn){Cr.set(Vn,fo(Bn,It,Ut,Vn,_t,yr))});var jn=en?Br?D0:L0:Br?na:Bs,Un=tn?$:jn(_t);return co(Un||_t,function(Bn,Vn){Un&&(Vn=Bn,Bn=_t[Vn]),Zu(Cr,Vn,fo(Bn,It,Ut,Vn,_t,yr))}),Cr}function Wy(_t){var It=Bs(_t);return function(Ut){return Lm(Ut,_t,It)}}function Lm(_t,It,Ut){var rr=Ut.length;if(_t==null)return!rr;for(_t=vs(_t);rr--;){var ur=Ut[rr],yr=It[ur],Cr=_t[ur];if(Cr===$&&!(ur in _t)||!yr(Cr))return!1}return!0}function Dm(_t,It,Ut){if(typeof _t!="function")throw new lo(rt);return rp(function(){_t.apply($,Ut)},It)}function Yu(_t,It,Ut,rr){var ur=-1,yr=bp,Cr=!0,Mr=_t.length,Br=[],en=It.length;if(!Mr)return Br;Ut&&(It=xs(It,xa(Ut))),rr?(yr=s0,Cr=!1):It.length>=et&&(yr=Hu,Cr=!1,It=new tu(It));e:for(;++urur?0:ur+Ut),rr=rr===$||rr>ur?ur:zn(rr),rr<0&&(rr+=ur),rr=Ut>rr?0:iv(rr);Ut0&&Ut(Mr)?It>1?Fs(Mr,It-1,Ut,rr,ur):Il(ur,Mr):rr||(ur[ur.length]=Mr)}return ur}var x0=h1(),Um=h1(!0);function Oo(_t,It){return _t&&x0(_t,It,Bs)}function E0(_t,It){return _t&&Um(_t,It,Bs)}function Bp(_t,It){return Cl(It,function(Ut){return Yo(_t[Ut])})}function nu(_t,It){It=Ll(It,_t);for(var Ut=0,rr=It.length;_t!=null&&UtIt}function Yy(_t,It){return _t!=null&&cs.call(_t,It)}function Xy(_t,It){return _t!=null&&It in vs(_t)}function Jy(_t,It,Ut){return _t>=zs(It,Ut)&&_t=120&&tn.length>=120)?new tu(Cr&&tn):$}tn=_t[0];var sn=-1,An=Mr[0];e:for(;++sn-1;)Mr!==_t&&Ap.call(Mr,Br,1),Ap.call(_t,Br,1);return _t}function Qm(_t,It){for(var Ut=_t?It.length:0,rr=Ut-1;Ut--;){var ur=It[Ut];if(Ut==rr||ur!==yr){var yr=ur;Zo(ur)?Ap.call(_t,ur,1):I0(_t,ur)}}return _t}function P0(_t,It){return _t+Cp(Mm()*(It-_t+1))}function d2(_t,It,Ut,rr){for(var ur=-1,yr=Is(Tp((It-_t)/(Ut||1)),0),Cr=Ur(yr);yr--;)Cr[rr?yr:++ur]=_t,_t+=Ut;return Cr}function T0(_t,It){var Ut="";if(!_t||It<1||It>Rt)return Ut;do It%2&&(Ut+=_t),It=Cp(It/2),It&&(_t+=_t);while(It);return Ut}function Hn(_t,It){return K0(C1(_t,It,ga),_t+"")}function f2(_t){return Bm(Au(_t))}function h2(_t,It){var Ut=Au(_t);return Wp(Ut,ru(It,0,Ut.length))}function Qu(_t,It,Ut,rr){if(!ws(_t))return _t;It=Ll(It,_t);for(var ur=-1,yr=It.length,Cr=yr-1,Mr=_t;Mr!=null&&++urur?0:ur+It),Ut=Ut>ur?ur:Ut,Ut<0&&(Ut+=ur),ur=It>Ut?0:Ut-It>>>0,It>>>=0;for(var yr=Ur(ur);++rr>>1,Cr=_t[yr];Cr!==null&&!eo(Cr)&&(Ut?Cr<=It:Cr=et){var en=It?null:A2(_t);if(en)return yp(en);Cr=!1,ur=Hu,Br=new tu}else Br=It?[]:Mr;e:for(;++rr=rr?_t:ho(_t,It,Ut)}var a1=iy||function(_t){return cn.clearTimeout(_t)};function o1(_t,It){if(It)return _t.slice();var Ut=_t.length,rr=Pm?Pm(Ut):new _t.constructor(Ut);return _t.copy(rr),rr}function j0(_t){var It=new _t.constructor(_t.byteLength);return new $p(It).set(new $p(_t)),It}function v2(_t,It){var Ut=It?j0(_t.buffer):_t.buffer;return new _t.constructor(Ut,_t.byteOffset,_t.byteLength)}function y2(_t){var It=new _t.constructor(_t.source,yn.exec(_t));return It.lastIndex=_t.lastIndex,It}function x2(_t){return Gu?vs(Gu.call(_t)):{}}function c1(_t,It){var Ut=It?j0(_t.buffer):_t.buffer;return new _t.constructor(Ut,_t.byteOffset,_t.length)}function l1(_t,It){if(_t!==It){var Ut=_t!==$,rr=_t===null,ur=_t===_t,yr=eo(_t),Cr=It!==$,Mr=It===null,Br=It===It,en=eo(It);if(!Mr&&!en&&!yr&&_t>It||yr&&Cr&&Br&&!Mr&&!en||rr&&Cr&&Br||!Ut&&Br||!ur)return 1;if(!rr&&!yr&&!en&&_t=Mr)return Br;var en=Ut[rr];return Br*(en=="desc"?-1:1)}}return _t.index-It.index}function u1(_t,It,Ut,rr){for(var ur=-1,yr=_t.length,Cr=Ut.length,Mr=-1,Br=It.length,en=Is(yr-Cr,0),tn=Ur(Br+en),sn=!rr;++Mr1?Ut[ur-1]:$,Cr=ur>2?Ut[2]:$;for(yr=_t.length>3&&typeof yr=="function"?(ur--,yr):$,Cr&&qs(Ut[0],Ut[1],Cr)&&(yr=ur<3?$:yr,ur=1),It=vs(It);++rr-1?ur[yr?It[Cr]:Cr]:$}}function g1(_t){return Go(function(It){var Ut=It.length,rr=Ut,ur=uo.prototype.thru;for(_t&&It.reverse();rr--;){var yr=It[rr];if(typeof yr!="function")throw new lo(rt);if(ur&&!Cr&&Vp(yr)=="wrapper")var Cr=new uo([],!0)}for(rr=Cr?rr:Ut;++rr1&&Gn.reverse(),tn&&BrMr))return!1;var en=yr.get(_t),tn=yr.get(It);if(en&&tn)return en==It&&tn==_t;var sn=-1,An=!0,kn=Ut&xt?new tu:$;for(yr.set(_t,It),yr.set(It,_t);++sn1?"& ":"")+It[rr],It=It.join(Ut>2?", ":" "),_t.replace(gn,`{ +/* [wrapped with `+It+`] */ +`)}function N2(_t){return Dn(_t)||au(_t)||!!(Im&&_t&&_t[Im])}function Zo(_t,It){var Ut=typeof _t;return It=It??Rt,!!It&&(Ut=="number"||Ut!="symbol"&&ps.test(_t))&&_t>-1&&_t%1==0&&_t0){if(++It>=yt)return arguments[0]}else It=0;return _t.apply($,arguments)}}function Wp(_t,It){var Ut=-1,rr=_t.length,ur=rr-1;for(It=It===$?rr:It;++Ut1?_t[It-1]:$;return Ut=typeof Ut=="function"?(_t.pop(),Ut):$,U1(_t,Ut)});function H1(_t){var It=br(_t);return It.__chain__=!0,It}function Yx(_t,It){return It(_t),_t}function Gp(_t,It){return It(_t)}var Xx=Go(function(_t){var It=_t.length,Ut=It?_t[0]:0,rr=this.__wrapped__,ur=function(yr){return y0(yr,_t)};return It>1||this.__actions__.length||!(rr instanceof Kn)||!Zo(Ut)?this.thru(ur):(rr=rr.slice(Ut,+Ut+(It?1:0)),rr.__actions__.push({func:Gp,args:[ur],thisArg:$}),new uo(rr,this.__chain__).thru(function(yr){return It&&!yr.length&&yr.push($),yr}))});function Jx(){return H1(this)}function Qx(){return new uo(this.value(),this.__chain__)}function e3(){this.__values__===$&&(this.__values__=nv(this.value()));var _t=this.__index__>=this.__values__.length,It=_t?$:this.__values__[this.__index__++];return{done:_t,value:It}}function t3(){return this}function r3(_t){for(var It,Ut=this;Ut instanceof Mp;){var rr=B1(Ut);rr.__index__=0,rr.__values__=$,It?ur.__wrapped__=rr:It=rr;var ur=rr;Ut=Ut.__wrapped__}return ur.__wrapped__=_t,It}function n3(){var _t=this.__wrapped__;if(_t instanceof Kn){var It=_t;return this.__actions__.length&&(It=new Kn(this)),It=It.reverse(),It.__actions__.push({func:Gp,args:[W0],thisArg:$}),new uo(It,this.__chain__)}return this.thru(W0)}function i3(){return i1(this.__wrapped__,this.__actions__)}var s3=Fp(function(_t,It,Ut){cs.call(_t,Ut)?++_t[Ut]:Ko(_t,Ut,1)});function a3(_t,It,Ut){var rr=Dn(_t)?bm:Gy;return Ut&&qs(_t,It,Ut)&&(It=$),rr(_t,On(It,3))}function o3(_t,It){var Ut=Dn(_t)?Cl:zm;return Ut(_t,On(It,3))}var c3=m1(N1),l3=m1(L1);function u3(_t,It){return Fs(Zp(_t,It),1)}function d3(_t,It){return Fs(Zp(_t,It),St)}function f3(_t,It,Ut){return Ut=Ut===$?1:zn(Ut),Fs(Zp(_t,It),Ut)}function q1(_t,It){var Ut=Dn(_t)?co:Bl;return Ut(_t,On(It,3))}function V1(_t,It){var Ut=Dn(_t)?Tv:Fm;return Ut(_t,On(It,3))}var h3=Fp(function(_t,It,Ut){cs.call(_t,Ut)?_t[Ut].push(It):Ko(_t,Ut,[It])});function p3(_t,It,Ut,rr){_t=Qs(_t)?_t:Au(_t),Ut=Ut&&!rr?zn(Ut):0;var ur=_t.length;return Ut<0&&(Ut=Is(ur+Ut,0)),e0(_t)?Ut<=ur&&_t.indexOf(It,Ut)>-1:!!ur&&mu(_t,It,Ut)>-1}var m3=Hn(function(_t,It,Ut){var rr=-1,ur=typeof It=="function",yr=Qs(_t)?Ur(_t.length):[];return Bl(_t,function(Cr){yr[++rr]=ur?Os(It,Cr,Ut):Xu(Cr,It,Ut)}),yr}),g3=Fp(function(_t,It,Ut){Ko(_t,Ut,It)});function Zp(_t,It){var Ut=Dn(_t)?xs:Wm;return Ut(_t,On(It,3))}function b3(_t,It,Ut,rr){return _t==null?[]:(Dn(It)||(It=It==null?[]:[It]),Ut=rr?$:Ut,Dn(Ut)||(Ut=Ut==null?[]:[Ut]),Xm(_t,It,Ut))}var v3=Fp(function(_t,It,Ut){_t[Ut?0:1].push(It)},function(){return[[],[]]});function y3(_t,It,Ut){var rr=Dn(_t)?a0:Em,ur=arguments.length<3;return rr(_t,On(It,4),Ut,ur,Bl)}function x3(_t,It,Ut){var rr=Dn(_t)?Cv:Em,ur=arguments.length<3;return rr(_t,On(It,4),Ut,ur,Fm)}function E3(_t,It){var Ut=Dn(_t)?Cl:zm;return Ut(_t,Jp(On(It,3)))}function w3(_t){var It=Dn(_t)?Bm:f2;return It(_t)}function _3(_t,It,Ut){(Ut?qs(_t,It,Ut):It===$)?It=1:It=zn(It);var rr=Dn(_t)?Hy:h2;return rr(_t,It)}function S3(_t){var It=Dn(_t)?qy:m2;return It(_t)}function $3(_t){if(_t==null)return 0;if(Qs(_t))return e0(_t)?bu(_t):_t.length;var It=Us(_t);return It==xr||It==$r?_t.size:$0(_t).length}function R3(_t,It,Ut){var rr=Dn(_t)?o0:g2;return Ut&&qs(_t,It,Ut)&&(It=$),rr(_t,On(It,3))}var A3=Hn(function(_t,It){if(_t==null)return[];var Ut=It.length;return Ut>1&&qs(_t,It[0],It[1])?It=[]:Ut>2&&qs(It[0],It[1],It[2])&&(It=[It[0]]),Xm(_t,Fs(It,1),[])}),Yp=sy||function(){return cn.Date.now()};function P3(_t,It){if(typeof It!="function")throw new lo(rt);return _t=zn(_t),function(){if(--_t<1)return It.apply(this,arguments)}}function K1(_t,It,Ut){return It=Ut?$:It,It=_t&&It==null?_t.length:It,Wo(_t,jt,$,$,$,$,It)}function W1(_t,It){var Ut;if(typeof It!="function")throw new lo(rt);return _t=zn(_t),function(){return--_t>0&&(Ut=It.apply(this,arguments)),_t<=1&&(It=$),Ut}}var Z0=Hn(function(_t,It,Ut){var rr=Ct;if(Ut.length){var ur=Ml(Ut,$u(Z0));rr|=Nt}return Wo(_t,rr,It,Ut,ur)}),G1=Hn(function(_t,It,Ut){var rr=Ct|Pt;if(Ut.length){var ur=Ml(Ut,$u(G1));rr|=Nt}return Wo(It,rr,_t,Ut,ur)});function Z1(_t,It,Ut){It=Ut?$:It;var rr=Wo(_t,kt,$,$,$,$,$,It);return rr.placeholder=Z1.placeholder,rr}function Y1(_t,It,Ut){It=Ut?$:It;var rr=Wo(_t,Lt,$,$,$,$,$,It);return rr.placeholder=Y1.placeholder,rr}function X1(_t,It,Ut){var rr,ur,yr,Cr,Mr,Br,en=0,tn=!1,sn=!1,An=!0;if(typeof _t!="function")throw new lo(rt);It=mo(It)||0,ws(Ut)&&(tn=!!Ut.leading,sn="maxWait"in Ut,yr=sn?Is(mo(Ut.maxWait)||0,It):yr,An="trailing"in Ut?!!Ut.trailing:An);function kn(Rs){var Po=rr,Jo=ur;return rr=ur=$,en=Rs,Cr=_t.apply(Jo,Po),Cr}function jn(Rs){return en=Rs,Mr=rp(Vn,It),tn?kn(Rs):Cr}function Un(Rs){var Po=Rs-Br,Jo=Rs-en,gv=It-Po;return sn?zs(gv,yr-Jo):gv}function Bn(Rs){var Po=Rs-Br,Jo=Rs-en;return Br===$||Po>=It||Po<0||sn&&Jo>=yr}function Vn(){var Rs=Yp();if(Bn(Rs))return Gn(Rs);Mr=rp(Vn,Un(Rs))}function Gn(Rs){return Mr=$,An&&rr?kn(Rs):(rr=ur=$,Cr)}function to(){Mr!==$&&a1(Mr),en=0,rr=Br=ur=Mr=$}function Vs(){return Mr===$?Cr:Gn(Yp())}function ro(){var Rs=Yp(),Po=Bn(Rs);if(rr=arguments,ur=this,Br=Rs,Po){if(Mr===$)return jn(Br);if(sn)return a1(Mr),Mr=rp(Vn,It),kn(Br)}return Mr===$&&(Mr=rp(Vn,It)),Cr}return ro.cancel=to,ro.flush=Vs,ro}var T3=Hn(function(_t,It){return Dm(_t,1,It)}),C3=Hn(function(_t,It,Ut){return Dm(_t,mo(It)||0,Ut)});function I3(_t){return Wo(_t,Dt)}function Xp(_t,It){if(typeof _t!="function"||It!=null&&typeof It!="function")throw new lo(rt);var Ut=function(){var rr=arguments,ur=It?It.apply(this,rr):rr[0],yr=Ut.cache;if(yr.has(ur))return yr.get(ur);var Cr=_t.apply(this,rr);return Ut.cache=yr.set(ur,Cr)||yr,Cr};return Ut.cache=new(Xp.Cache||Vo),Ut}Xp.Cache=Vo;function Jp(_t){if(typeof _t!="function")throw new lo(rt);return function(){var It=arguments;switch(It.length){case 0:return!_t.call(this);case 1:return!_t.call(this,It[0]);case 2:return!_t.call(this,It[0],It[1]);case 3:return!_t.call(this,It[0],It[1],It[2])}return!_t.apply(this,It)}}function k3(_t){return W1(2,_t)}var M3=b2(function(_t,It){It=It.length==1&&Dn(It[0])?xs(It[0],xa(On())):xs(Fs(It,1),xa(On()));var Ut=It.length;return Hn(function(rr){for(var ur=-1,yr=zs(rr.length,Ut);++ur=It}),au=qm(function(){return arguments}())?qm:function(_t){return _s(_t)&&cs.call(_t,"callee")&&!Cm.call(_t,"callee")},Dn=Ur.isArray,G3=Es?xa(Es):e2;function Qs(_t){return _t!=null&&Qp(_t.length)&&!Yo(_t)}function $s(_t){return _s(_t)&&Qs(_t)}function Z3(_t){return _t===!0||_t===!1||_s(_t)&&Hs(_t)==Kt}var Fl=oy||om,Y3=Ds?xa(Ds):t2;function X3(_t){return _s(_t)&&_t.nodeType===1&&!np(_t)}function J3(_t){if(_t==null)return!0;if(Qs(_t)&&(Dn(_t)||typeof _t=="string"||typeof _t.splice=="function"||Fl(_t)||Ru(_t)||au(_t)))return!_t.length;var It=Us(_t);if(It==xr||It==$r)return!_t.size;if(tp(_t))return!$0(_t).length;for(var Ut in _t)if(cs.call(_t,Ut))return!1;return!0}function Q3(_t,It){return Ju(_t,It)}function e4(_t,It,Ut){Ut=typeof Ut=="function"?Ut:$;var rr=Ut?Ut(_t,It):$;return rr===$?Ju(_t,It,$,Ut):!!rr}function X0(_t){if(!_s(_t))return!1;var It=Hs(_t);return It==Vt||It==Ht||typeof _t.message=="string"&&typeof _t.name=="string"&&!np(_t)}function t4(_t){return typeof _t=="number"&&km(_t)}function Yo(_t){if(!ws(_t))return!1;var It=Hs(_t);return It==Qt||It==dr||It==Wt||It==fr}function Q1(_t){return typeof _t=="number"&&_t==zn(_t)}function Qp(_t){return typeof _t=="number"&&_t>-1&&_t%1==0&&_t<=Rt}function ws(_t){var It=typeof _t;return _t!=null&&(It=="object"||It=="function")}function _s(_t){return _t!=null&&typeof _t=="object"}var ev=oo?xa(oo):n2;function r4(_t,It){return _t===It||S0(_t,It,z0(It))}function n4(_t,It,Ut){return Ut=typeof Ut=="function"?Ut:$,S0(_t,It,z0(It),Ut)}function i4(_t){return tv(_t)&&_t!=+_t}function s4(_t){if(F2(_t))throw new Ln(tt);return Vm(_t)}function a4(_t){return _t===null}function o4(_t){return _t==null}function tv(_t){return typeof _t=="number"||_s(_t)&&Hs(_t)==pr}function np(_t){if(!_s(_t)||Hs(_t)!=kr)return!1;var It=Rp(_t);if(It===null)return!0;var Ut=cs.call(It,"constructor")&&It.constructor;return typeof Ut=="function"&&Ut instanceof Ut&&wp.call(Ut)==ty}var J0=Mo?xa(Mo):i2;function c4(_t){return Q1(_t)&&_t>=-Rt&&_t<=Rt}var rv=Uu?xa(Uu):s2;function e0(_t){return typeof _t=="string"||!Dn(_t)&&_s(_t)&&Hs(_t)==Pr}function eo(_t){return typeof _t=="symbol"||_s(_t)&&Hs(_t)==Rr}var Ru=Jl?xa(Jl):a2;function l4(_t){return _t===$}function u4(_t){return _s(_t)&&Us(_t)==Or}function d4(_t){return _s(_t)&&Hs(_t)==Lr}var f4=qp(R0),h4=qp(function(_t,It){return _t<=It});function nv(_t){if(!_t)return[];if(Qs(_t))return e0(_t)?$o(_t):Js(_t);if(qu&&_t[qu])return Hv(_t[qu]());var It=Us(_t),Ut=It==xr?h0:It==$r?yp:Au;return Ut(_t)}function Xo(_t){if(!_t)return _t===0?_t:0;if(_t=mo(_t),_t===St||_t===-St){var It=_t<0?-1:1;return It*$t}return _t===_t?_t:0}function zn(_t){var It=Xo(_t),Ut=It%1;return It===It?Ut?It-Ut:It:0}function iv(_t){return _t?ru(zn(_t),0,At):0}function mo(_t){if(typeof _t=="number")return _t;if(eo(_t))return Et;if(ws(_t)){var It=typeof _t.valueOf=="function"?_t.valueOf():_t;_t=ws(It)?It+"":It}if(typeof _t!="string")return _t===0?_t:+_t;_t=wm(_t);var Ut=ds.test(_t);return Ut||hs.test(_t)?rn(_t.slice(2),Ut?2:8):En.test(_t)?Et:+_t}function sv(_t){return jo(_t,na(_t))}function p4(_t){return _t?ru(zn(_t),-Rt,Rt):_t===0?_t:0}function as(_t){return _t==null?"":$a(_t)}var m4=_u(function(_t,It){if(tp(It)||Qs(It)){jo(It,Bs(It),_t);return}for(var Ut in It)cs.call(It,Ut)&&Zu(_t,Ut,It[Ut])}),av=_u(function(_t,It){jo(It,na(It),_t)}),t0=_u(function(_t,It,Ut,rr){jo(It,na(It),_t,rr)}),g4=_u(function(_t,It,Ut,rr){jo(It,Bs(It),_t,rr)}),b4=Go(y0);function v4(_t,It){var Ut=wu(_t);return It==null?Ut:Nm(Ut,It)}var y4=Hn(function(_t,It){_t=vs(_t);var Ut=-1,rr=It.length,ur=rr>2?It[2]:$;for(ur&&qs(It[0],It[1],ur)&&(rr=1);++Ut1),yr}),jo(_t,D0(_t),Ut),rr&&(Ut=fo(Ut,ot|ut|dt,P2));for(var ur=It.length;ur--;)I0(Ut,It[ur]);return Ut});function N4(_t,It){return cv(_t,Jp(On(It)))}var L4=Go(function(_t,It){return _t==null?{}:l2(_t,It)});function cv(_t,It){if(_t==null)return{};var Ut=xs(D0(_t),function(rr){return[rr]});return It=On(It),Jm(_t,Ut,function(rr,ur){return It(rr,ur[0])})}function D4(_t,It,Ut){It=Ll(It,_t);var rr=-1,ur=It.length;for(ur||(ur=1,_t=$);++rrIt){var rr=_t;_t=It,It=rr}if(Ut||_t%1||It%1){var ur=Mm();return zs(_t+ur*(It-_t+Dr("1e-"+((ur+"").length-1))),It)}return P0(_t,It)}var Y4=Su(function(_t,It,Ut){return It=It.toLowerCase(),_t+(Ut?dv(It):It)});function dv(_t){return tm(as(_t).toLowerCase())}function fv(_t){return _t=as(_t),_t&&_t.replace(qn,Lv).replace(Ts,"")}function X4(_t,It,Ut){_t=as(_t),It=$a(It);var rr=_t.length;Ut=Ut===$?rr:ru(zn(Ut),0,rr);var ur=Ut;return Ut-=It.length,Ut>=0&&_t.slice(Ut,ur)==It}function J4(_t){return _t=as(_t),_t&&ln.test(_t)?_t.replace(Qr,Dv):_t}function Q4(_t){return _t=as(_t),_t&&$n.test(_t)?_t.replace(Kr,"\\$&"):_t}var e6=Su(function(_t,It,Ut){return _t+(Ut?"-":"")+It.toLowerCase()}),t6=Su(function(_t,It,Ut){return _t+(Ut?" ":"")+It.toLowerCase()}),r6=p1("toLowerCase");function n6(_t,It,Ut){_t=as(_t),It=zn(It);var rr=It?bu(_t):0;if(!It||rr>=It)return _t;var ur=(It-rr)/2;return Hp(Cp(ur),Ut)+_t+Hp(Tp(ur),Ut)}function i6(_t,It,Ut){_t=as(_t),It=zn(It);var rr=It?bu(_t):0;return It&&rr>>0,Ut?(_t=as(_t),_t&&(typeof It=="string"||It!=null&&!J0(It))&&(It=$a(It),!It&&gu(_t))?Dl($o(_t),0,Ut):_t.split(It,Ut)):[]}var d6=Su(function(_t,It,Ut){return _t+(Ut?" ":"")+tm(It)});function f6(_t,It,Ut){return _t=as(_t),Ut=Ut==null?0:ru(zn(Ut),0,_t.length),It=$a(It),_t.slice(Ut,Ut+It.length)==It}function h6(_t,It,Ut){var rr=br.templateSettings;Ut&&qs(_t,It,Ut)&&(It=$),_t=as(_t),It=t0({},It,rr,E1);var ur=t0({},It.imports,rr.imports,E1),yr=Bs(ur),Cr=f0(ur,yr),Mr,Br,en=0,tn=It.interpolate||ss,sn="__p += '",An=p0((It.escape||ss).source+"|"+tn.source+"|"+(tn===un?Tn:ss).source+"|"+(It.evaluate||ss).source+"|$","g"),kn="//# sourceURL="+(cs.call(It,"sourceURL")?(It.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xl+"]")+` +`;_t.replace(An,function(Bn,Vn,Gn,to,Vs,ro){return Gn||(Gn=to),sn+=_t.slice(en,ro).replace(Jn,Fv),Vn&&(Mr=!0,sn+=`' + +__e(`+Vn+`) + +'`),Vs&&(Br=!0,sn+=`'; +`+Vs+`; __p += '`),Gn&&(sn+=`' + ((__t = (`+Gn+`)) == null ? '' : __t) + -'`),en=ao+Bn.length,Bn}),sn+=`'; -`;var jn=cs.call(kt,"variable")&&kt.variable;if(!jn)sn=`with (obj) { +'`),en=ro+Bn.length,Bn}),sn+=`'; +`;var jn=cs.call(It,"variable")&&It.variable;if(!jn)sn=`with (obj) { `+sn+` } `;else if(Sn.test(jn))throw new Ln(nt);sn=(Br?sn.replace(Hr,""):sn).replace(Fr,"$1").replace(pn,"$1;"),sn="function("+(jn||"obj")+`) { @@ -414,20 +414,20 @@ __p += '`),Gn&&(sn+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+sn+`return __p -}`;var zn=pv(function(){return ns(yr,In+"return "+sn).apply($,Cr)});if(zn.source=sn,X0(zn))throw zn;return zn}function g3(_t){return os(_t).toLowerCase()}function v3(_t){return os(_t).toUpperCase()}function b3(_t,kt,zt){if(_t=os(_t),_t&&(zt||kt===$))return wm(_t);if(!_t||!(kt=io(kt)))return _t;var rr=Co(_t),ur=Co(kt),yr=_m(rr,ur),Cr=Sm(rr,ur)+1;return Dl(rr,yr,Cr).join("")}function y3(_t,kt,zt){if(_t=os(_t),_t&&(zt||kt===$))return _t.slice(0,Rm(_t)+1);if(!_t||!(kt=io(kt)))return _t;var rr=Co(_t),ur=Sm(rr,Co(kt))+1;return Dl(rr,0,ur).join("")}function x3(_t,kt,zt){if(_t=os(_t),_t&&(zt||kt===$))return _t.replace(dn,"");if(!_t||!(kt=io(kt)))return _t;var rr=Co(_t),ur=_m(rr,Co(kt));return Dl(rr,ur).join("")}function E3(_t,kt){var zt=Ft,rr=Bt;if(ws(kt)){var ur="separator"in kt?kt.separator:ur;zt="length"in kt?Un(kt.length):zt,rr="omission"in kt?io(kt.omission):rr}_t=os(_t);var yr=_t.length;if(gu(_t)){var Cr=Co(_t);yr=Cr.length}if(zt>=yr)return _t;var Mr=zt-vu(rr);if(Mr<1)return rr;var Br=Cr?Dl(Cr,0,Mr).join(""):_t.slice(0,Mr);if(ur===$)return Br+rr;if(Cr&&(Mr+=Br.length-Mr),J0(ur)){if(_t.slice(Mr).search(ur)){var en,tn=Br;for(ur.global||(ur=p0(ur.source,os(yn.exec(ur))+"g")),ur.lastIndex=0;en=ur.exec(tn);)var sn=en.index;Br=Br.slice(0,sn===$?Mr:sn)}}else if(_t.indexOf(io(ur),Mr)!=Mr){var An=Br.lastIndexOf(ur);An>-1&&(Br=Br.slice(0,An))}return Br+rr}function w3(_t){return _t=os(_t),_t&&mn.test(_t)?_t.replace(Jr,Wv):_t}var _3=Su(function(_t,kt,zt){return _t+(zt?" ":"")+kt.toUpperCase()}),tm=p1("toUpperCase");function hv(_t,kt,zt){return _t=os(_t),kt=zt?$:kt,kt===$?zv(_t)?Yv(_t):Mv(_t):_t.match(kt)||[]}var pv=Hn(function(_t,kt){try{return Os(_t,$,kt)}catch(zt){return X0(zt)?zt:new Ln(zt)}}),S3=Qo(function(_t,kt){return po(kt,function(zt){zt=Uo(zt),Xo(_t,zt,Z0(_t[zt],_t))}),_t});function $3(_t){var kt=_t==null?0:_t.length,zt=On();return _t=kt?xs(_t,function(rr){if(typeof rr[1]!="function")throw new mo(rt);return[zt(rr[0]),rr[1]]}):[],Hn(function(rr){for(var ur=-1;++urRt)return[];var zt=At,rr=Us(_t,At);kt=On(kt),_t-=At;for(var ur=d0(rr,kt);++zt<_t;)kt(zt);return ur}function K3(_t){return Dn(_t)?xs(_t,Uo):so(_t)?[_t]:Js(j1(os(_t)))}function W3(_t){var kt=++ey;return os(_t)+kt}var G3=zp(function(_t,kt){return _t+kt},0),Z3=N0("ceil"),Y3=zp(function(_t,kt){return _t/kt},1),X3=N0("floor");function J3(_t){return _t&&_t.length?jp(_t,to,w0):$}function Q3(_t,kt){return _t&&_t.length?jp(_t,On(kt,2),w0):$}function e_(_t){return xm(_t,to)}function t_(_t,kt){return xm(_t,On(kt,2))}function r_(_t){return _t&&_t.length?jp(_t,to,R0):$}function n_(_t,kt){return _t&&_t.length?jp(_t,On(kt,2),R0):$}var i_=zp(function(_t,kt){return _t*kt},1),s_=N0("round"),o_=zp(function(_t,kt){return _t-kt},0);function a_(_t){return _t&&_t.length?u0(_t,to):0}function c_(_t,kt){return _t&&_t.length?u0(_t,On(kt,2)):0}return vr.after=TE,vr.ary=K1,vr.assign=gw,vr.assignIn=ov,vr.assignInWith=t0,vr.assignWith=bw,vr.at=yw,vr.before=W1,vr.bind=Z0,vr.bindAll=S3,vr.bindKey=G1,vr.castArray=UE,vr.chain=H1,vr.chunk=Zx,vr.compact=Yx,vr.concat=Xx,vr.cond=$3,vr.conforms=R3,vr.constant=rm,vr.countBy=sE,vr.create=xw,vr.curry=Z1,vr.curryRight=Y1,vr.debounce=X1,vr.defaults=Ew,vr.defaultsDeep=ww,vr.defer=CE,vr.delay=kE,vr.difference=Jx,vr.differenceBy=Qx,vr.differenceWith=e2,vr.drop=t2,vr.dropRight=r2,vr.dropRightWhile=n2,vr.dropWhile=i2,vr.fill=s2,vr.filter=aE,vr.flatMap=uE,vr.flatMapDeep=dE,vr.flatMapDepth=fE,vr.flatten=D1,vr.flattenDeep=o2,vr.flattenDepth=a2,vr.flip=IE,vr.flow=P3,vr.flowRight=T3,vr.fromPairs=c2,vr.functions=Tw,vr.functionsIn=Cw,vr.groupBy=hE,vr.initial=u2,vr.intersection=d2,vr.intersectionBy=f2,vr.intersectionWith=h2,vr.invert=Iw,vr.invertBy=Mw,vr.invokeMap=mE,vr.iteratee=nm,vr.keyBy=gE,vr.keys=Bs,vr.keysIn=eo,vr.map=Zp,vr.mapKeys=jw,vr.mapValues=Bw,vr.matches=C3,vr.matchesProperty=k3,vr.memoize=Xp,vr.merge=Nw,vr.mergeWith=av,vr.method=I3,vr.methodOf=M3,vr.mixin=im,vr.negate=Jp,vr.nthArg=j3,vr.omit=Lw,vr.omitBy=Dw,vr.once=ME,vr.orderBy=vE,vr.over=B3,vr.overArgs=OE,vr.overEvery=N3,vr.overSome=L3,vr.partial=Y0,vr.partialRight=J1,vr.partition=bE,vr.pick=Fw,vr.pickBy=cv,vr.property=mv,vr.propertyOf=D3,vr.pull=v2,vr.pullAll=U1,vr.pullAllBy=b2,vr.pullAllWith=y2,vr.pullAt=x2,vr.range=F3,vr.rangeRight=U3,vr.rearg=jE,vr.reject=wE,vr.remove=E2,vr.rest=BE,vr.reverse=W0,vr.sampleSize=SE,vr.set=zw,vr.setWith=Hw,vr.shuffle=$E,vr.slice=w2,vr.sortBy=PE,vr.sortedUniq=T2,vr.sortedUniqBy=C2,vr.split=f3,vr.spread=NE,vr.tail=k2,vr.take=I2,vr.takeRight=M2,vr.takeRightWhile=O2,vr.takeWhile=j2,vr.tap=Y2,vr.throttle=LE,vr.thru=Gp,vr.toArray=nv,vr.toPairs=lv,vr.toPairsIn=uv,vr.toPath=K3,vr.toPlainObject=sv,vr.transform=Vw,vr.unary=DE,vr.union=B2,vr.unionBy=N2,vr.unionWith=L2,vr.uniq=D2,vr.uniqBy=F2,vr.uniqWith=U2,vr.unset=qw,vr.unzip=G0,vr.unzipWith=z1,vr.update=Kw,vr.updateWith=Ww,vr.values=Au,vr.valuesIn=Gw,vr.without=z2,vr.words=hv,vr.wrap=FE,vr.xor=H2,vr.xorBy=V2,vr.xorWith=q2,vr.zip=K2,vr.zipObject=W2,vr.zipObjectDeep=G2,vr.zipWith=Z2,vr.entries=lv,vr.entriesIn=uv,vr.extend=ov,vr.extendWith=t0,im(vr,vr),vr.add=G3,vr.attempt=pv,vr.camelCase=Jw,vr.capitalize=dv,vr.ceil=Z3,vr.clamp=Zw,vr.clone=zE,vr.cloneDeep=VE,vr.cloneDeepWith=qE,vr.cloneWith=HE,vr.conformsTo=KE,vr.deburr=fv,vr.defaultTo=A3,vr.divide=Y3,vr.endsWith=Qw,vr.eq=Io,vr.escape=e3,vr.escapeRegExp=t3,vr.every=oE,vr.find=cE,vr.findIndex=N1,vr.findKey=_w,vr.findLast=lE,vr.findLastIndex=L1,vr.findLastKey=Sw,vr.floor=X3,vr.forEach=V1,vr.forEachRight=q1,vr.forIn=$w,vr.forInRight=Rw,vr.forOwn=Aw,vr.forOwnRight=Pw,vr.get=Q0,vr.gt=WE,vr.gte=GE,vr.has=kw,vr.hasIn=em,vr.head=F1,vr.identity=to,vr.includes=pE,vr.indexOf=l2,vr.inRange=Yw,vr.invoke=Ow,vr.isArguments=ou,vr.isArray=Dn,vr.isArrayBuffer=ZE,vr.isArrayLike=Qs,vr.isArrayLikeObject=$s,vr.isBoolean=YE,vr.isBuffer=Fl,vr.isDate=XE,vr.isElement=JE,vr.isEmpty=QE,vr.isEqual=ew,vr.isEqualWith=tw,vr.isError=X0,vr.isFinite=rw,vr.isFunction=ga,vr.isInteger=Q1,vr.isLength=Qp,vr.isMap=ev,vr.isMatch=nw,vr.isMatchWith=iw,vr.isNaN=sw,vr.isNative=ow,vr.isNil=cw,vr.isNull=aw,vr.isNumber=tv,vr.isObject=ws,vr.isObjectLike=_s,vr.isPlainObject=np,vr.isRegExp=J0,vr.isSafeInteger=lw,vr.isSet=rv,vr.isString=e0,vr.isSymbol=so,vr.isTypedArray=Ru,vr.isUndefined=uw,vr.isWeakMap=dw,vr.isWeakSet=fw,vr.join=p2,vr.kebabCase=r3,vr.last=yo,vr.lastIndexOf=m2,vr.lowerCase=n3,vr.lowerFirst=i3,vr.lt=hw,vr.lte=pw,vr.max=J3,vr.maxBy=Q3,vr.mean=e_,vr.meanBy=t_,vr.min=r_,vr.minBy=n_,vr.stubArray=om,vr.stubFalse=am,vr.stubObject=z3,vr.stubString=H3,vr.stubTrue=V3,vr.multiply=i_,vr.nth=g2,vr.noConflict=O3,vr.noop=sm,vr.now=Yp,vr.pad=s3,vr.padEnd=o3,vr.padStart=a3,vr.parseInt=c3,vr.random=Xw,vr.reduce=yE,vr.reduceRight=xE,vr.repeat=l3,vr.replace=u3,vr.result=Uw,vr.round=s_,vr.runInContext=jr,vr.sample=_E,vr.size=RE,vr.snakeCase=d3,vr.some=AE,vr.sortedIndex=_2,vr.sortedIndexBy=S2,vr.sortedIndexOf=$2,vr.sortedLastIndex=R2,vr.sortedLastIndexBy=A2,vr.sortedLastIndexOf=P2,vr.startCase=h3,vr.startsWith=p3,vr.subtract=o_,vr.sum=a_,vr.sumBy=c_,vr.template=m3,vr.times=q3,vr.toFinite=ba,vr.toInteger=Un,vr.toLength=iv,vr.toLower=g3,vr.toNumber=xo,vr.toSafeInteger=mw,vr.toString=os,vr.toUpper=v3,vr.trim=b3,vr.trimEnd=y3,vr.trimStart=x3,vr.truncate=E3,vr.unescape=w3,vr.uniqueId=W3,vr.upperCase=_3,vr.upperFirst=tm,vr.each=V1,vr.eachRight=q1,vr.first=F1,im(vr,function(){var _t={};return Do(vr,function(kt,zt){cs.call(vr.prototype,zt)||(_t[zt]=kt)}),_t}(),{chain:!1}),vr.VERSION=j,po(["bind","bindKey","curry","curryRight","partial","partialRight"],function(_t){vr[_t].placeholder=vr}),po(["drop","take"],function(_t,kt){Kn.prototype[_t]=function(zt){zt=zt===$?1:ks(Un(zt),0);var rr=this.__filtered__&&!kt?new Kn(this):this.clone();return rr.__filtered__?rr.__takeCount__=Us(zt,rr.__takeCount__):rr.__views__.push({size:Us(zt,At),type:_t+(rr.__dir__<0?"Right":"")}),rr},Kn.prototype[_t+"Right"]=function(zt){return this.reverse()[_t](zt).reverse()}}),po(["filter","map","takeWhile"],function(_t,kt){var zt=kt+1,rr=zt==ct||zt==vt;Kn.prototype[_t]=function(ur){var yr=this.clone();return yr.__iteratees__.push({iteratee:On(ur,3),type:zt}),yr.__filtered__=yr.__filtered__||rr,yr}}),po(["head","last"],function(_t,kt){var zt="take"+(kt?"Right":"");Kn.prototype[_t]=function(){return this[zt](1).value()[0]}}),po(["initial","tail"],function(_t,kt){var zt="drop"+(kt?"":"Right");Kn.prototype[_t]=function(){return this.__filtered__?new Kn(this):this[zt](1)}}),Kn.prototype.compact=function(){return this.filter(to)},Kn.prototype.find=function(_t){return this.filter(_t).head()},Kn.prototype.findLast=function(_t){return this.reverse().find(_t)},Kn.prototype.invokeMap=Hn(function(_t,kt){return typeof _t=="function"?new Kn(this):this.map(function(zt){return Xu(zt,_t,kt)})}),Kn.prototype.reject=function(_t){return this.filter(Jp(On(_t)))},Kn.prototype.slice=function(_t,kt){_t=Un(_t);var zt=this;return zt.__filtered__&&(_t>0||kt<0)?new Kn(zt):(_t<0?zt=zt.takeRight(-_t):_t&&(zt=zt.drop(_t)),kt!==$&&(kt=Un(kt),zt=kt<0?zt.dropRight(-kt):zt.take(kt-_t)),zt)},Kn.prototype.takeRightWhile=function(_t){return this.reverse().takeWhile(_t).reverse()},Kn.prototype.toArray=function(){return this.take(At)},Do(Kn.prototype,function(_t,kt){var zt=/^(?:filter|find|map|reject)|While$/.test(kt),rr=/^(?:head|last)$/.test(kt),ur=vr[rr?"take"+(kt=="last"?"Right":""):kt],yr=rr||/^find/.test(kt);ur&&(vr.prototype[kt]=function(){var Cr=this.__wrapped__,Mr=rr?[1]:arguments,Br=Cr instanceof Kn,en=Mr[0],tn=Br||Dn(Cr),sn=function(qn){var Gn=ur.apply(vr,Il([qn],Mr));return rr&&An?Gn[0]:Gn};tn&&zt&&typeof en=="function"&&en.length!=1&&(Br=tn=!1);var An=this.__chain__,In=!!this.__actions__.length,jn=yr&&!An,zn=Br&&!In;if(!yr&&tn){Cr=zn?Cr:new Kn(this);var Bn=_t.apply(Cr,Mr);return Bn.__actions__.push({func:Gp,args:[sn],thisArg:$}),new go(Bn,An)}return jn&&zn?_t.apply(this,Mr):(Bn=this.thru(sn),jn?rr?Bn.value()[0]:Bn.value():Bn)})}),po(["pop","push","shift","sort","splice","unshift"],function(_t){var kt=xp[_t],zt=/^(?:push|sort|unshift)$/.test(_t)?"tap":"thru",rr=/^(?:pop|shift)$/.test(_t);vr.prototype[_t]=function(){var ur=arguments;if(rr&&!this.__chain__){var yr=this.value();return kt.apply(Dn(yr)?yr:[],ur)}return this[zt](function(Cr){return kt.apply(Dn(Cr)?Cr:[],ur)})}}),Do(Kn.prototype,function(_t,kt){var zt=vr[kt];if(zt){var rr=zt.name+"";cs.call(Eu,rr)||(Eu[rr]=[]),Eu[rr].push({name:kt,func:zt})}}),Eu[Up($,Pt).name]=[{name:"wrapper",func:$}],Kn.prototype.clone=by,Kn.prototype.reverse=yy,Kn.prototype.value=xy,vr.prototype.at=X2,vr.prototype.chain=J2,vr.prototype.commit=Q2,vr.prototype.next=eE,vr.prototype.plant=rE,vr.prototype.reverse=nE,vr.prototype.toJSON=vr.prototype.valueOf=vr.prototype.value=iE,vr.prototype.first=vr.prototype.head,Vu&&(vr.prototype[Vu]=tE),vr},bu=Xv();Nn?((Nn.exports=bu)._=bu,_n._=bu):cn._=bu}).call(commonjsGlobal)})(lodash,lodash.exports);var lodashExports=lodash.exports,isCheckBoxInput=_=>_.type==="checkbox",isDateObject=_=>_ instanceof Date,isNullOrUndefined=_=>_==null;const isObjectType=_=>typeof _=="object";var isObject$4=_=>!isNullOrUndefined(_)&&!Array.isArray(_)&&isObjectType(_)&&!isDateObject(_),getEventValue=_=>isObject$4(_)&&_.target?isCheckBoxInput(_.target)?_.target.checked:_.target.value:_,getNodeParentName=_=>_.substring(0,_.search(/\.\d+(\.|$)/))||_,isNameInFieldArray=(_,a)=>_.has(getNodeParentName(a)),isPlainObject$6=_=>{const a=_.constructor&&_.constructor.prototype;return isObject$4(a)&&a.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(_){let a;const $=Array.isArray(_);if(_ instanceof Date)a=new Date(_);else if(_ instanceof Set)a=new Set(_);else if(!(isWeb&&(_ instanceof Blob||_ instanceof FileList))&&($||isObject$4(_)))if(a=$?[]:{},!$&&!isPlainObject$6(_))a=_;else for(const j in _)_.hasOwnProperty(j)&&(a[j]=cloneObject(_[j]));else return _;return a}var compact=_=>Array.isArray(_)?_.filter(Boolean):[],isUndefined$2=_=>_===void 0,get$4=(_,a,$)=>{if(!a||!isObject$4(_))return $;const j=compact(a.split(/[,[\].]+?/)).reduce((et,tt)=>isNullOrUndefined(et)?et:et[tt],_);return isUndefined$2(j)||j===_?isUndefined$2(_[a])?$:_[a]:j},isBoolean$3=_=>typeof _=="boolean",isKey=_=>/^\w*$/.test(_),stringToPath$4=_=>compact(_.replace(/["|']|\]/g,"").split(/\.|\[/)),set$2=(_,a,$)=>{let j=-1;const et=isKey(a)?[a]:stringToPath$4(a),tt=et.length,rt=tt-1;for(;++jReact$2.useContext(HookFormContext),FormProvider=_=>{const{children:a,...$}=_;return React$2.createElement(HookFormContext.Provider,{value:$},a)};var getProxyFormState=(_,a,$,j=!0)=>{const et={defaultValues:a._defaultValues};for(const tt in _)Object.defineProperty(et,tt,{get:()=>{const rt=tt;return a._proxyFormState[rt]!==VALIDATION_MODE.all&&(a._proxyFormState[rt]=!j||VALIDATION_MODE.all),_[rt]}});return et},isEmptyObject=_=>isObject$4(_)&&!Object.keys(_).length,shouldRenderFormState=(_,a,$,j)=>{$(_);const{name:et,...tt}=_;return isEmptyObject(tt)||Object.keys(tt).length>=Object.keys(a).length||Object.keys(tt).find(rt=>a[rt]===VALIDATION_MODE.all)},convertToArrayPayload=_=>Array.isArray(_)?_:[_];function useSubscribe(_){const a=React$2.useRef(_);a.current=_,React$2.useEffect(()=>{const $=!_.disabled&&a.current.subject&&a.current.subject.subscribe({next:a.current.next});return()=>{$&&$.unsubscribe()}},[_.disabled])}var isString$3=_=>typeof _=="string",generateWatchOutput=(_,a,$,j,et)=>isString$3(_)?(j&&a.watch.add(_),get$4($,_,et)):Array.isArray(_)?_.map(tt=>(j&&a.watch.add(tt),get$4($,tt))):(j&&(a.watchAll=!0),$),appendErrors=(_,a,$,j,et)=>a?{...$[_],types:{...$[_]&&$[_].types?$[_].types:{},[j]:et||!0}}:{},generateId=()=>{const _=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const $=(Math.random()*16+_)%16|0;return(a=="x"?$:$&3|8).toString(16)})},getFocusFieldName=(_,a,$={})=>$.shouldFocus||isUndefined$2($.shouldFocus)?$.focusName||`${_}.${isUndefined$2($.focusIndex)?a:$.focusIndex}.`:"",getValidationModes=_=>({isOnSubmit:!_||_===VALIDATION_MODE.onSubmit,isOnBlur:_===VALIDATION_MODE.onBlur,isOnChange:_===VALIDATION_MODE.onChange,isOnAll:_===VALIDATION_MODE.all,isOnTouch:_===VALIDATION_MODE.onTouched}),isWatched=(_,a,$)=>!$&&(a.watchAll||a.watch.has(_)||[...a.watch].some(j=>_.startsWith(j)&&/^\.\w+/.test(_.slice(j.length))));const iterateFieldsByAction=(_,a,$,j)=>{for(const et of $||Object.keys(_)){const tt=get$4(_,et);if(tt){const{_f:rt,...nt}=tt;if(rt){if(rt.refs&&rt.refs[0]&&a(rt.refs[0],et)&&!j)break;if(rt.ref&&a(rt.ref,rt.name)&&!j)break;iterateFieldsByAction(nt,a)}else isObject$4(nt)&&iterateFieldsByAction(nt,a)}}};var updateFieldArrayRootError=(_,a,$)=>{const j=compact(get$4(_,$));return set$2(j,"root",a[$]),set$2(_,$,j),_},isFileInput=_=>_.type==="file",isFunction$4=_=>typeof _=="function",isHTMLElement=_=>{if(!isWeb)return!1;const a=_?_.ownerDocument:0;return _ instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},isMessage=_=>isString$3(_),isRadioInput=_=>_.type==="radio",isRegex=_=>_ instanceof RegExp;const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=_=>{if(Array.isArray(_)){if(_.length>1){const a=_.filter($=>$&&$.checked&&!$.disabled).map($=>$.value);return{value:a,isValid:!!a.length}}return _[0].checked&&!_[0].disabled?_[0].attributes&&!isUndefined$2(_[0].attributes.value)?isUndefined$2(_[0].value)||_[0].value===""?validResult:{value:_[0].value,isValid:!0}:validResult:defaultResult}return defaultResult};const defaultReturn={isValid:!1,value:null};var getRadioValue=_=>Array.isArray(_)?_.reduce((a,$)=>$&&$.checked&&!$.disabled?{isValid:!0,value:$.value}:a,defaultReturn):defaultReturn;function getValidateError(_,a,$="validate"){if(isMessage(_)||Array.isArray(_)&&_.every(isMessage)||isBoolean$3(_)&&!_)return{type:$,message:isMessage(_)?_:"",ref:a}}var getValueAndMessage=_=>isObject$4(_)&&!isRegex(_)?_:{value:_,message:""},validateField=async(_,a,$,j,et)=>{const{ref:tt,refs:rt,required:nt,maxLength:it,minLength:ot,min:st,max:at,pattern:ut,validate:ht,name:bt,valueAsNumber:Et,mount:Ct,disabled:Pt}=_._f,Tt=get$4(a,bt);if(!Ct||Pt)return{};const It=rt?rt[0]:tt,Lt=yt=>{j&&It.reportValidity&&(It.setCustomValidity(isBoolean$3(yt)?"":yt||""),It.reportValidity())},Nt={},Ut=isRadioInput(tt),jt=isCheckBoxInput(tt),Mt=Ut||jt,Dt=(Et||isFileInput(tt))&&isUndefined$2(tt.value)&&isUndefined$2(Tt)||isHTMLElement(tt)&&tt.value===""||Tt===""||Array.isArray(Tt)&&!Tt.length,Ft=appendErrors.bind(null,bt,$,Nt),Bt=(yt,mt,ct,dt=INPUT_VALIDATION_RULES.maxLength,vt=INPUT_VALIDATION_RULES.minLength)=>{const St=yt?mt:ct;Nt[bt]={type:yt?dt:vt,message:St,ref:tt,...Ft(yt?dt:vt,St)}};if(et?!Array.isArray(Tt)||!Tt.length:nt&&(!Mt&&(Dt||isNullOrUndefined(Tt))||isBoolean$3(Tt)&&!Tt||jt&&!getCheckboxValue(rt).isValid||Ut&&!getRadioValue(rt).isValid)){const{value:yt,message:mt}=isMessage(nt)?{value:!!nt,message:nt}:getValueAndMessage(nt);if(yt&&(Nt[bt]={type:INPUT_VALIDATION_RULES.required,message:mt,ref:It,...Ft(INPUT_VALIDATION_RULES.required,mt)},!$))return Lt(mt),Nt}if(!Dt&&(!isNullOrUndefined(st)||!isNullOrUndefined(at))){let yt,mt;const ct=getValueAndMessage(at),dt=getValueAndMessage(st);if(!isNullOrUndefined(Tt)&&!isNaN(Tt)){const vt=tt.valueAsNumber||Tt&&+Tt;isNullOrUndefined(ct.value)||(yt=vt>ct.value),isNullOrUndefined(dt.value)||(mt=vtnew Date(new Date().toDateString()+" "+xt),Rt=tt.type=="time",$t=tt.type=="week";isString$3(ct.value)&&Tt&&(yt=Rt?St(Tt)>St(ct.value):$t?Tt>ct.value:vt>new Date(ct.value)),isString$3(dt.value)&&Tt&&(mt=Rt?St(Tt)+yt.value,dt=!isNullOrUndefined(mt.value)&&Tt.length<+mt.value;if((ct||dt)&&(Bt(ct,yt.message,mt.message),!$))return Lt(Nt[bt].message),Nt}if(ut&&!Dt&&isString$3(Tt)){const{value:yt,message:mt}=getValueAndMessage(ut);if(isRegex(yt)&&!Tt.match(yt)&&(Nt[bt]={type:INPUT_VALIDATION_RULES.pattern,message:mt,ref:tt,...Ft(INPUT_VALIDATION_RULES.pattern,mt)},!$))return Lt(mt),Nt}if(ht){if(isFunction$4(ht)){const yt=await ht(Tt,a),mt=getValidateError(yt,It);if(mt&&(Nt[bt]={...mt,...Ft(INPUT_VALIDATION_RULES.validate,mt.message)},!$))return Lt(mt.message),Nt}else if(isObject$4(ht)){let yt={};for(const mt in ht){if(!isEmptyObject(yt)&&!$)break;const ct=getValidateError(await ht[mt](Tt,a),It,mt);ct&&(yt={...ct,...Ft(mt,ct.message)},Lt(ct.message),$&&(Nt[bt]=yt))}if(!isEmptyObject(yt)&&(Nt[bt]={ref:It,...yt},!$))return Nt}}return Lt(!0),Nt},appendAt=(_,a)=>[..._,...convertToArrayPayload(a)],fillEmptyArray=_=>Array.isArray(_)?_.map(()=>{}):void 0;function insert$1(_,a,$){return[..._.slice(0,a),...convertToArrayPayload($),..._.slice(a)]}var moveArrayAt=(_,a,$)=>Array.isArray(_)?(isUndefined$2(_[$])&&(_[$]=void 0),_.splice($,0,_.splice(a,1)[0]),_):[],prependAt=(_,a)=>[...convertToArrayPayload(a),...convertToArrayPayload(_)];function removeAtIndexes(_,a){let $=0;const j=[..._];for(const et of a)j.splice(et-$,1),$++;return compact(j).length?j:[]}var removeArrayAt=(_,a)=>isUndefined$2(a)?[]:removeAtIndexes(_,convertToArrayPayload(a).sort(($,j)=>$-j)),swapArrayAt=(_,a,$)=>{[_[a],_[$]]=[_[$],_[a]]};function baseGet(_,a){const $=a.slice(0,-1).length;let j=0;for(;j<$;)_=isUndefined$2(_)?j++:_[a[j++]];return _}function isEmptyArray(_){for(const a in _)if(_.hasOwnProperty(a)&&!isUndefined$2(_[a]))return!1;return!0}function unset(_,a){const $=Array.isArray(a)?a:isKey(a)?[a]:stringToPath$4(a),j=$.length===1?_:baseGet(_,$),et=$.length-1,tt=$[et];return j&&delete j[tt],et!==0&&(isObject$4(j)&&isEmptyObject(j)||Array.isArray(j)&&isEmptyArray(j))&&unset(_,$.slice(0,-1)),_}var updateAt=(_,a,$)=>(_[a]=$,_);function useFieldArray(_){const a=useFormContext(),{control:$=a.control,name:j,keyName:et="id",shouldUnregister:tt}=_,[rt,nt]=React$2.useState($._getFieldArray(j)),it=React$2.useRef($._getFieldArray(j).map(generateId)),ot=React$2.useRef(rt),st=React$2.useRef(j),at=React$2.useRef(!1);st.current=j,ot.current=rt,$._names.array.add(j),_.rules&&$.register(j,_.rules),useSubscribe({next:({values:Nt,name:Ut})=>{if(Ut===st.current||!Ut){const jt=get$4(Nt,st.current);Array.isArray(jt)&&(nt(jt),it.current=jt.map(generateId))}},subject:$._subjects.array});const ut=React$2.useCallback(Nt=>{at.current=!0,$._updateFieldArray(j,Nt)},[$,j]),ht=(Nt,Ut)=>{const jt=convertToArrayPayload(cloneObject(Nt)),Mt=appendAt($._getFieldArray(j),jt);$._names.focus=getFocusFieldName(j,Mt.length-1,Ut),it.current=appendAt(it.current,jt.map(generateId)),ut(Mt),nt(Mt),$._updateFieldArray(j,Mt,appendAt,{argA:fillEmptyArray(Nt)})},bt=(Nt,Ut)=>{const jt=convertToArrayPayload(cloneObject(Nt)),Mt=prependAt($._getFieldArray(j),jt);$._names.focus=getFocusFieldName(j,0,Ut),it.current=prependAt(it.current,jt.map(generateId)),ut(Mt),nt(Mt),$._updateFieldArray(j,Mt,prependAt,{argA:fillEmptyArray(Nt)})},Et=Nt=>{const Ut=removeArrayAt($._getFieldArray(j),Nt);it.current=removeArrayAt(it.current,Nt),ut(Ut),nt(Ut),$._updateFieldArray(j,Ut,removeArrayAt,{argA:Nt})},Ct=(Nt,Ut,jt)=>{const Mt=convertToArrayPayload(cloneObject(Ut)),Dt=insert$1($._getFieldArray(j),Nt,Mt);$._names.focus=getFocusFieldName(j,Nt,jt),it.current=insert$1(it.current,Nt,Mt.map(generateId)),ut(Dt),nt(Dt),$._updateFieldArray(j,Dt,insert$1,{argA:Nt,argB:fillEmptyArray(Ut)})},Pt=(Nt,Ut)=>{const jt=$._getFieldArray(j);swapArrayAt(jt,Nt,Ut),swapArrayAt(it.current,Nt,Ut),ut(jt),nt(jt),$._updateFieldArray(j,jt,swapArrayAt,{argA:Nt,argB:Ut},!1)},Tt=(Nt,Ut)=>{const jt=$._getFieldArray(j);moveArrayAt(jt,Nt,Ut),moveArrayAt(it.current,Nt,Ut),ut(jt),nt(jt),$._updateFieldArray(j,jt,moveArrayAt,{argA:Nt,argB:Ut},!1)},It=(Nt,Ut)=>{const jt=cloneObject(Ut),Mt=updateAt($._getFieldArray(j),Nt,jt);it.current=[...Mt].map((Dt,Ft)=>!Dt||Ft===Nt?generateId():it.current[Ft]),ut(Mt),nt([...Mt]),$._updateFieldArray(j,Mt,updateAt,{argA:Nt,argB:jt},!0,!1)},Lt=Nt=>{const Ut=convertToArrayPayload(cloneObject(Nt));it.current=Ut.map(generateId),ut([...Ut]),nt([...Ut]),$._updateFieldArray(j,[...Ut],jt=>jt,{},!0,!1)};return React$2.useEffect(()=>{if($._state.action=!1,isWatched(j,$._names)&&$._subjects.state.next({...$._formState}),at.current&&(!getValidationModes($._options.mode).isOnSubmit||$._formState.isSubmitted))if($._options.resolver)$._executeSchema([j]).then(Nt=>{const Ut=get$4(Nt.errors,j),jt=get$4($._formState.errors,j);(jt?!Ut&&jt.type||Ut&&(jt.type!==Ut.type||jt.message!==Ut.message):Ut&&Ut.type)&&(Ut?set$2($._formState.errors,j,Ut):unset($._formState.errors,j),$._subjects.state.next({errors:$._formState.errors}))});else{const Nt=get$4($._fields,j);Nt&&Nt._f&&!(getValidationModes($._options.reValidateMode).isOnSubmit&&getValidationModes($._options.mode).isOnSubmit)&&validateField(Nt,$._formValues,$._options.criteriaMode===VALIDATION_MODE.all,$._options.shouldUseNativeValidation,!0).then(Ut=>!isEmptyObject(Ut)&&$._subjects.state.next({errors:updateFieldArrayRootError($._formState.errors,Ut,j)}))}$._subjects.values.next({name:j,values:{...$._formValues}}),$._names.focus&&iterateFieldsByAction($._fields,(Nt,Ut)=>{if($._names.focus&&Ut.startsWith($._names.focus)&&Nt.focus)return Nt.focus(),1}),$._names.focus="",$._updateValid(),at.current=!1},[rt,j,$]),React$2.useEffect(()=>(!get$4($._formValues,j)&&$._updateFieldArray(j),()=>{($._options.shouldUnregister||tt)&&$.unregister(j)}),[j,$,et,tt]),{swap:React$2.useCallback(Pt,[ut,j,$]),move:React$2.useCallback(Tt,[ut,j,$]),prepend:React$2.useCallback(bt,[ut,j,$]),append:React$2.useCallback(ht,[ut,j,$]),remove:React$2.useCallback(Et,[ut,j,$]),insert:React$2.useCallback(Ct,[ut,j,$]),update:React$2.useCallback(It,[ut,j,$]),replace:React$2.useCallback(Lt,[ut,j,$]),fields:React$2.useMemo(()=>rt.map((Nt,Ut)=>({...Nt,[et]:it.current[Ut]||generateId()})),[rt,et])}}var createSubject=()=>{let _=[];return{get observers(){return _},next:et=>{for(const tt of _)tt.next&&tt.next(et)},subscribe:et=>(_.push(et),{unsubscribe:()=>{_=_.filter(tt=>tt!==et)}}),unsubscribe:()=>{_=[]}}},isPrimitive=_=>isNullOrUndefined(_)||!isObjectType(_);function deepEqual$1(_,a){if(isPrimitive(_)||isPrimitive(a))return _===a;if(isDateObject(_)&&isDateObject(a))return _.getTime()===a.getTime();const $=Object.keys(_),j=Object.keys(a);if($.length!==j.length)return!1;for(const et of $){const tt=_[et];if(!j.includes(et))return!1;if(et!=="ref"){const rt=a[et];if(isDateObject(tt)&&isDateObject(rt)||isObject$4(tt)&&isObject$4(rt)||Array.isArray(tt)&&Array.isArray(rt)?!deepEqual$1(tt,rt):tt!==rt)return!1}}return!0}var isMultipleSelect=_=>_.type==="select-multiple",isRadioOrCheckbox=_=>isRadioInput(_)||isCheckBoxInput(_),live=_=>isHTMLElement(_)&&_.isConnected,objectHasFunction=_=>{for(const a in _)if(isFunction$4(_[a]))return!0;return!1};function markFieldsDirty(_,a={}){const $=Array.isArray(_);if(isObject$4(_)||$)for(const j in _)Array.isArray(_[j])||isObject$4(_[j])&&!objectHasFunction(_[j])?(a[j]=Array.isArray(_[j])?[]:{},markFieldsDirty(_[j],a[j])):isNullOrUndefined(_[j])||(a[j]=!0);return a}function getDirtyFieldsFromDefaultValues(_,a,$){const j=Array.isArray(_);if(isObject$4(_)||j)for(const et in _)Array.isArray(_[et])||isObject$4(_[et])&&!objectHasFunction(_[et])?isUndefined$2(a)||isPrimitive($[et])?$[et]=Array.isArray(_[et])?markFieldsDirty(_[et],[]):{...markFieldsDirty(_[et])}:getDirtyFieldsFromDefaultValues(_[et],isNullOrUndefined(a)?{}:a[et],$[et]):$[et]=!deepEqual$1(_[et],a[et]);return $}var getDirtyFields=(_,a)=>getDirtyFieldsFromDefaultValues(_,a,markFieldsDirty(a)),getFieldValueAs=(_,{valueAsNumber:a,valueAsDate:$,setValueAs:j})=>isUndefined$2(_)?_:a?_===""?NaN:_&&+_:$&&isString$3(_)?new Date(_):j?j(_):_;function getFieldValue(_){const a=_.ref;if(!(_.refs?_.refs.every($=>$.disabled):a.disabled))return isFileInput(a)?a.files:isRadioInput(a)?getRadioValue(_.refs).value:isMultipleSelect(a)?[...a.selectedOptions].map(({value:$})=>$):isCheckBoxInput(a)?getCheckboxValue(_.refs).value:getFieldValueAs(isUndefined$2(a.value)?_.ref.value:a.value,_)}var getResolverOptions=(_,a,$,j)=>{const et={};for(const tt of _){const rt=get$4(a,tt);rt&&set$2(et,tt,rt._f)}return{criteriaMode:$,names:[..._],fields:et,shouldUseNativeValidation:j}},getRuleValue=_=>isUndefined$2(_)?_:isRegex(_)?_.source:isObject$4(_)?isRegex(_.value)?_.value.source:_.value:_,hasValidation=_=>_.mount&&(_.required||_.min||_.max||_.maxLength||_.minLength||_.pattern||_.validate);function schemaErrorLookup(_,a,$){const j=get$4(_,$);if(j||isKey($))return{error:j,name:$};const et=$.split(".");for(;et.length;){const tt=et.join("."),rt=get$4(a,tt),nt=get$4(_,tt);if(rt&&!Array.isArray(rt)&&$!==tt)return{name:$};if(nt&&nt.type)return{name:tt,error:nt};et.pop()}return{name:$}}var skipValidation=(_,a,$,j,et)=>et.isOnAll?!1:!$&&et.isOnTouch?!(a||_):($?j.isOnBlur:et.isOnBlur)?!_:($?j.isOnChange:et.isOnChange)?_:!0,unsetEmptyArray=(_,a)=>!compact(get$4(_,a)).length&&unset(_,a);const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(_={}){let a={...defaultOptions$1,..._},$={submitCount:0,isDirty:!1,isLoading:isFunction$4(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1},j={},et=isObject$4(a.defaultValues)||isObject$4(a.values)?cloneObject(a.defaultValues||a.values)||{}:{},tt=a.shouldUnregister?{}:cloneObject(et),rt={action:!1,mount:!1,watch:!1},nt={mount:new Set,unMount:new Set,array:new Set,watch:new Set},it,ot=0;const st={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},at={values:createSubject(),array:createSubject(),state:createSubject()},ut=getValidationModes(a.mode),ht=getValidationModes(a.reValidateMode),bt=a.criteriaMode===VALIDATION_MODE.all,Et=lr=>fr=>{clearTimeout(ot),ot=setTimeout(lr,fr)},Ct=async lr=>{if(st.isValid||lr){const fr=a.resolver?isEmptyObject((await Mt()).errors):await Ft(j,!0);fr!==$.isValid&&at.state.next({isValid:fr})}},Pt=(lr,fr)=>{(st.isValidating||st.validatingFields)&&((lr||Array.from(nt.mount)).forEach(Er=>{Er&&(fr?set$2($.validatingFields,Er,fr):unset($.validatingFields,Er))}),at.state.next({validatingFields:$.validatingFields,isValidating:!isEmptyObject($.validatingFields)}))},Tt=(lr,fr=[],Er,$r,Pr=!0,Rr=!0)=>{if($r&&Er){if(rt.action=!0,Rr&&Array.isArray(get$4(j,lr))){const Ar=Er(get$4(j,lr),$r.argA,$r.argB);Pr&&set$2(j,lr,Ar)}if(Rr&&Array.isArray(get$4($.errors,lr))){const Ar=Er(get$4($.errors,lr),$r.argA,$r.argB);Pr&&set$2($.errors,lr,Ar),unsetEmptyArray($.errors,lr)}if(st.touchedFields&&Rr&&Array.isArray(get$4($.touchedFields,lr))){const Ar=Er(get$4($.touchedFields,lr),$r.argA,$r.argB);Pr&&set$2($.touchedFields,lr,Ar)}st.dirtyFields&&($.dirtyFields=getDirtyFields(et,tt)),at.state.next({name:lr,isDirty:yt(lr,fr),dirtyFields:$.dirtyFields,errors:$.errors,isValid:$.isValid})}else set$2(tt,lr,fr)},It=(lr,fr)=>{set$2($.errors,lr,fr),at.state.next({errors:$.errors})},Lt=lr=>{$.errors=lr,at.state.next({errors:$.errors,isValid:!1})},Nt=(lr,fr,Er,$r)=>{const Pr=get$4(j,lr);if(Pr){const Rr=get$4(tt,lr,isUndefined$2(Er)?get$4(et,lr):Er);isUndefined$2(Rr)||$r&&$r.defaultChecked||fr?set$2(tt,lr,fr?Rr:getFieldValue(Pr._f)):dt(lr,Rr),rt.mount&&Ct()}},Ut=(lr,fr,Er,$r,Pr)=>{let Rr=!1,Ar=!1;const Or={name:lr},Lr=!!(get$4(j,lr)&&get$4(j,lr)._f.disabled);if(!Er||$r){st.isDirty&&(Ar=$.isDirty,$.isDirty=Or.isDirty=yt(),Rr=Ar!==Or.isDirty);const or=Lr||deepEqual$1(get$4(et,lr),fr);Ar=!!(!Lr&&get$4($.dirtyFields,lr)),or||Lr?unset($.dirtyFields,lr):set$2($.dirtyFields,lr,!0),Or.dirtyFields=$.dirtyFields,Rr=Rr||st.dirtyFields&&Ar!==!or}if(Er){const or=get$4($.touchedFields,lr);or||(set$2($.touchedFields,lr,Er),Or.touchedFields=$.touchedFields,Rr=Rr||st.touchedFields&&or!==Er)}return Rr&&Pr&&at.state.next(Or),Rr?Or:{}},jt=(lr,fr,Er,$r)=>{const Pr=get$4($.errors,lr),Rr=st.isValid&&isBoolean$3(fr)&&$.isValid!==fr;if(_.delayError&&Er?(it=Et(()=>It(lr,Er)),it(_.delayError)):(clearTimeout(ot),it=null,Er?set$2($.errors,lr,Er):unset($.errors,lr)),(Er?!deepEqual$1(Pr,Er):Pr)||!isEmptyObject($r)||Rr){const Ar={...$r,...Rr&&isBoolean$3(fr)?{isValid:fr}:{},errors:$.errors,name:lr};$={...$,...Ar},at.state.next(Ar)}},Mt=async lr=>{Pt(lr,!0);const fr=await a.resolver(tt,a.context,getResolverOptions(lr||nt.mount,j,a.criteriaMode,a.shouldUseNativeValidation));return Pt(lr),fr},Dt=async lr=>{const{errors:fr}=await Mt(lr);if(lr)for(const Er of lr){const $r=get$4(fr,Er);$r?set$2($.errors,Er,$r):unset($.errors,Er)}else $.errors=fr;return fr},Ft=async(lr,fr,Er={valid:!0})=>{for(const $r in lr){const Pr=lr[$r];if(Pr){const{_f:Rr,...Ar}=Pr;if(Rr){const Or=nt.array.has(Rr.name);Pt([$r],!0);const Lr=await validateField(Pr,tt,bt,a.shouldUseNativeValidation&&!fr,Or);if(Pt([$r]),Lr[Rr.name]&&(Er.valid=!1,fr))break;!fr&&(get$4(Lr,Rr.name)?Or?updateFieldArrayRootError($.errors,Lr,Rr.name):set$2($.errors,Rr.name,Lr[Rr.name]):unset($.errors,Rr.name))}Ar&&await Ft(Ar,fr,Er)}}return Er.valid},Bt=()=>{for(const lr of nt.unMount){const fr=get$4(j,lr);fr&&(fr._f.refs?fr._f.refs.every(Er=>!live(Er)):!live(fr._f.ref))&&ir(lr)}nt.unMount=new Set},yt=(lr,fr)=>(lr&&fr&&set$2(tt,lr,fr),!deepEqual$1(At(),et)),mt=(lr,fr,Er)=>generateWatchOutput(lr,nt,{...rt.mount?tt:isUndefined$2(fr)?et:isString$3(lr)?{[lr]:fr}:fr},Er,fr),ct=lr=>compact(get$4(rt.mount?tt:et,lr,_.shouldUnregister?get$4(et,lr,[]):[])),dt=(lr,fr,Er={})=>{const $r=get$4(j,lr);let Pr=fr;if($r){const Rr=$r._f;Rr&&(!Rr.disabled&&set$2(tt,lr,getFieldValueAs(fr,Rr)),Pr=isHTMLElement(Rr.ref)&&isNullOrUndefined(fr)?"":fr,isMultipleSelect(Rr.ref)?[...Rr.ref.options].forEach(Ar=>Ar.selected=Pr.includes(Ar.value)):Rr.refs?isCheckBoxInput(Rr.ref)?Rr.refs.length>1?Rr.refs.forEach(Ar=>(!Ar.defaultChecked||!Ar.disabled)&&(Ar.checked=Array.isArray(Pr)?!!Pr.find(Or=>Or===Ar.value):Pr===Ar.value)):Rr.refs[0]&&(Rr.refs[0].checked=!!Pr):Rr.refs.forEach(Ar=>Ar.checked=Ar.value===Pr):isFileInput(Rr.ref)?Rr.ref.value="":(Rr.ref.value=Pr,Rr.ref.type||at.values.next({name:lr,values:{...tt}})))}(Er.shouldDirty||Er.shouldTouch)&&Ut(lr,Pr,Er.shouldTouch,Er.shouldDirty,!0),Er.shouldValidate&&xt(lr)},vt=(lr,fr,Er)=>{for(const $r in fr){const Pr=fr[$r],Rr=`${lr}.${$r}`,Ar=get$4(j,Rr);(nt.array.has(lr)||!isPrimitive(Pr)||Ar&&!Ar._f)&&!isDateObject(Pr)?vt(Rr,Pr,Er):dt(Rr,Pr,Er)}},St=(lr,fr,Er={})=>{const $r=get$4(j,lr),Pr=nt.array.has(lr),Rr=cloneObject(fr);set$2(tt,lr,Rr),Pr?(at.array.next({name:lr,values:{...tt}}),(st.isDirty||st.dirtyFields)&&Er.shouldDirty&&at.state.next({name:lr,dirtyFields:getDirtyFields(et,tt),isDirty:yt(lr,Rr)})):$r&&!$r._f&&!isNullOrUndefined(Rr)?vt(lr,Rr,Er):dt(lr,Rr,Er),isWatched(lr,nt)&&at.state.next({...$}),at.values.next({name:rt.mount?lr:void 0,values:{...tt}})},Rt=async lr=>{rt.mount=!0;const fr=lr.target;let Er=fr.name,$r=!0;const Pr=get$4(j,Er),Rr=()=>fr.type?getFieldValue(Pr._f):getEventValue(lr),Ar=Or=>{$r=Number.isNaN(Or)||Or===get$4(tt,Er,Or)};if(Pr){let Or,Lr;const or=Rr(),Yt=lr.type===EVENTS.BLUR||lr.type===EVENTS.FOCUS_OUT,er=!hasValidation(Pr._f)&&!a.resolver&&!get$4($.errors,Er)&&!Pr._f.deps||skipValidation(Yt,get$4($.touchedFields,Er),$.isSubmitted,ht,ut),Zt=isWatched(Er,nt,Yt);set$2(tt,Er,or),Yt?(Pr._f.onBlur&&Pr._f.onBlur(lr),it&&it(0)):Pr._f.onChange&&Pr._f.onChange(lr);const Vt=Ut(Er,or,Yt,!1),Gt=!isEmptyObject(Vt)||Zt;if(!Yt&&at.values.next({name:Er,type:lr.type,values:{...tt}}),er)return st.isValid&&Ct(),Gt&&at.state.next({name:Er,...Zt?{}:Vt});if(!Yt&&Zt&&at.state.next({...$}),a.resolver){const{errors:ar}=await Mt([Er]);if(Ar(or),$r){const br=schemaErrorLookup($.errors,j,Er),wr=schemaErrorLookup(ar,j,br.name||Er);Or=wr.error,Er=wr.name,Lr=isEmptyObject(ar)}}else Pt([Er],!0),Or=(await validateField(Pr,tt,bt,a.shouldUseNativeValidation))[Er],Pt([Er]),Ar(or),$r&&(Or?Lr=!1:st.isValid&&(Lr=await Ft(j,!0)));$r&&(Pr._f.deps&&xt(Pr._f.deps),jt(Er,Lr,Or,Vt))}},$t=(lr,fr)=>{if(get$4($.errors,fr)&&lr.focus)return lr.focus(),1},xt=async(lr,fr={})=>{let Er,$r;const Pr=convertToArrayPayload(lr);if(a.resolver){const Rr=await Dt(isUndefined$2(lr)?lr:Pr);Er=isEmptyObject(Rr),$r=lr?!Pr.some(Ar=>get$4(Rr,Ar)):Er}else lr?($r=(await Promise.all(Pr.map(async Rr=>{const Ar=get$4(j,Rr);return await Ft(Ar&&Ar._f?{[Rr]:Ar}:Ar)}))).every(Boolean),!(!$r&&!$.isValid)&&Ct()):$r=Er=await Ft(j);return at.state.next({...!isString$3(lr)||st.isValid&&Er!==$.isValid?{}:{name:lr},...a.resolver||!lr?{isValid:Er}:{},errors:$.errors}),fr.shouldFocus&&!$r&&iterateFieldsByAction(j,$t,lr?Pr:nt.mount),$r},At=lr=>{const fr={...rt.mount?tt:et};return isUndefined$2(lr)?fr:isString$3(lr)?get$4(fr,lr):lr.map(Er=>get$4(fr,Er))},wt=(lr,fr)=>({invalid:!!get$4((fr||$).errors,lr),isDirty:!!get$4((fr||$).dirtyFields,lr),isTouched:!!get$4((fr||$).touchedFields,lr),isValidating:!!get$4((fr||$).validatingFields,lr),error:get$4((fr||$).errors,lr)}),Ot=lr=>{lr&&convertToArrayPayload(lr).forEach(fr=>unset($.errors,fr)),at.state.next({errors:lr?$.errors:{}})},tr=(lr,fr,Er)=>{const $r=(get$4(j,lr,{_f:{}})._f||{}).ref,Pr=get$4($.errors,lr)||{},{ref:Rr,message:Ar,type:Or,...Lr}=Pr;set$2($.errors,lr,{...Lr,...fr,ref:$r}),at.state.next({name:lr,errors:$.errors,isValid:!1}),Er&&Er.shouldFocus&&$r&&$r.focus&&$r.focus()},nr=(lr,fr)=>isFunction$4(lr)?at.values.subscribe({next:Er=>lr(mt(void 0,fr),Er)}):mt(lr,fr,!0),ir=(lr,fr={})=>{for(const Er of lr?convertToArrayPayload(lr):nt.mount)nt.mount.delete(Er),nt.array.delete(Er),fr.keepValue||(unset(j,Er),unset(tt,Er)),!fr.keepError&&unset($.errors,Er),!fr.keepDirty&&unset($.dirtyFields,Er),!fr.keepTouched&&unset($.touchedFields,Er),!fr.keepIsValidating&&unset($.validatingFields,Er),!a.shouldUnregister&&!fr.keepDefaultValue&&unset(et,Er);at.values.next({values:{...tt}}),at.state.next({...$,...fr.keepDirty?{isDirty:yt()}:{}}),!fr.keepIsValid&&Ct()},Wt=({disabled:lr,name:fr,field:Er,fields:$r,value:Pr})=>{if(isBoolean$3(lr)&&rt.mount||lr){const Rr=lr?void 0:isUndefined$2(Pr)?getFieldValue(Er?Er._f:get$4($r,fr)._f):Pr;set$2(tt,fr,Rr),Ut(fr,Rr,!1,!1,!0)}},Kt=(lr,fr={})=>{let Er=get$4(j,lr);const $r=isBoolean$3(fr.disabled);return set$2(j,lr,{...Er||{},_f:{...Er&&Er._f?Er._f:{ref:{name:lr}},name:lr,mount:!0,...fr}}),nt.mount.add(lr),Er?Wt({field:Er,disabled:fr.disabled,name:lr,value:fr.value}):Nt(lr,!0,fr.value),{...$r?{disabled:fr.disabled}:{},...a.progressive?{required:!!fr.required,min:getRuleValue(fr.min),max:getRuleValue(fr.max),minLength:getRuleValue(fr.minLength),maxLength:getRuleValue(fr.maxLength),pattern:getRuleValue(fr.pattern)}:{},name:lr,onChange:Rt,onBlur:Rt,ref:Pr=>{if(Pr){Kt(lr,fr),Er=get$4(j,lr);const Rr=isUndefined$2(Pr.value)&&Pr.querySelectorAll&&Pr.querySelectorAll("input,select,textarea")[0]||Pr,Ar=isRadioOrCheckbox(Rr),Or=Er._f.refs||[];if(Ar?Or.find(Lr=>Lr===Rr):Rr===Er._f.ref)return;set$2(j,lr,{_f:{...Er._f,...Ar?{refs:[...Or.filter(live),Rr,...Array.isArray(get$4(et,lr))?[{}]:[]],ref:{type:Rr.type,name:lr}}:{ref:Rr}}}),Nt(lr,!1,void 0,Rr)}else Er=get$4(j,lr,{}),Er._f&&(Er._f.mount=!1),(a.shouldUnregister||fr.shouldUnregister)&&!(isNameInFieldArray(nt.array,lr)&&rt.action)&&nt.unMount.add(lr)}}},Jt=()=>a.shouldFocusError&&iterateFieldsByAction(j,$t,nt.mount),Ht=lr=>{isBoolean$3(lr)&&(at.state.next({disabled:lr}),iterateFieldsByAction(j,(fr,Er)=>{const $r=get$4(j,Er);$r&&(fr.disabled=$r._f.disabled||lr,Array.isArray($r._f.refs)&&$r._f.refs.forEach(Pr=>{Pr.disabled=$r._f.disabled||lr}))},0,!1))},qt=(lr,fr)=>async Er=>{let $r;Er&&(Er.preventDefault&&Er.preventDefault(),Er.persist&&Er.persist());let Pr=cloneObject(tt);if(at.state.next({isSubmitting:!0}),a.resolver){const{errors:Rr,values:Ar}=await Mt();$.errors=Rr,Pr=Ar}else await Ft(j);if(unset($.errors,"root"),isEmptyObject($.errors)){at.state.next({errors:{}});try{await lr(Pr,Er)}catch(Rr){$r=Rr}}else fr&&await fr({...$.errors},Er),Jt(),setTimeout(Jt);if(at.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject($.errors)&&!$r,submitCount:$.submitCount+1,errors:$.errors}),$r)throw $r},Qt=(lr,fr={})=>{get$4(j,lr)&&(isUndefined$2(fr.defaultValue)?St(lr,cloneObject(get$4(et,lr))):(St(lr,fr.defaultValue),set$2(et,lr,cloneObject(fr.defaultValue))),fr.keepTouched||unset($.touchedFields,lr),fr.keepDirty||(unset($.dirtyFields,lr),$.isDirty=fr.defaultValue?yt(lr,cloneObject(get$4(et,lr))):yt()),fr.keepError||(unset($.errors,lr),st.isValid&&Ct()),at.state.next({...$}))},dr=(lr,fr={})=>{const Er=lr?cloneObject(lr):et,$r=cloneObject(Er),Pr=isEmptyObject(lr),Rr=Pr?et:$r;if(fr.keepDefaultValues||(et=Er),!fr.keepValues){if(fr.keepDirtyValues)for(const Ar of nt.mount)get$4($.dirtyFields,Ar)?set$2(Rr,Ar,get$4(tt,Ar)):St(Ar,get$4(Rr,Ar));else{if(isWeb&&isUndefined$2(lr))for(const Ar of nt.mount){const Or=get$4(j,Ar);if(Or&&Or._f){const Lr=Array.isArray(Or._f.refs)?Or._f.refs[0]:Or._f.ref;if(isHTMLElement(Lr)){const or=Lr.closest("form");if(or){or.reset();break}}}}j={}}tt=_.shouldUnregister?fr.keepDefaultValues?cloneObject(et):{}:cloneObject(Rr),at.array.next({values:{...Rr}}),at.values.next({values:{...Rr}})}nt={mount:fr.keepDirtyValues?nt.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},rt.mount=!st.isValid||!!fr.keepIsValid||!!fr.keepDirtyValues,rt.watch=!!_.shouldUnregister,at.state.next({submitCount:fr.keepSubmitCount?$.submitCount:0,isDirty:Pr?!1:fr.keepDirty?$.isDirty:!!(fr.keepDefaultValues&&!deepEqual$1(lr,et)),isSubmitted:fr.keepIsSubmitted?$.isSubmitted:!1,dirtyFields:Pr?[]:fr.keepDirtyValues?fr.keepDefaultValues&&tt?getDirtyFields(et,tt):$.dirtyFields:fr.keepDefaultValues&&lr?getDirtyFields(et,lr):{},touchedFields:fr.keepTouched?$.touchedFields:{},errors:fr.keepErrors?$.errors:{},isSubmitSuccessful:fr.keepIsSubmitSuccessful?$.isSubmitSuccessful:!1,isSubmitting:!1})},xr=(lr,fr)=>dr(isFunction$4(lr)?lr(tt):lr,fr);return{control:{register:Kt,unregister:ir,getFieldState:wt,handleSubmit:qt,setError:tr,_executeSchema:Mt,_getWatch:mt,_getDirty:yt,_updateValid:Ct,_removeUnmounted:Bt,_updateFieldArray:Tt,_updateDisabledField:Wt,_getFieldArray:ct,_reset:dr,_resetDefaultValues:()=>isFunction$4(a.defaultValues)&&a.defaultValues().then(lr=>{xr(lr,a.resetOptions),at.state.next({isLoading:!1})}),_updateFormState:lr=>{$={...$,...lr}},_disableForm:Ht,_subjects:at,_proxyFormState:st,_setErrors:Lt,get _fields(){return j},get _formValues(){return tt},get _state(){return rt},set _state(lr){rt=lr},get _defaultValues(){return et},get _names(){return nt},set _names(lr){nt=lr},get _formState(){return $},set _formState(lr){$=lr},get _options(){return a},set _options(lr){a={...a,...lr}}},trigger:xt,register:Kt,handleSubmit:qt,watch:nr,setValue:St,getValues:At,reset:xr,resetField:Qt,clearErrors:Ot,unregister:ir,setError:tr,setFocus:(lr,fr={})=>{const Er=get$4(j,lr),$r=Er&&Er._f;if($r){const Pr=$r.refs?$r.refs[0]:$r.ref;Pr.focus&&(Pr.focus(),fr.shouldSelect&&Pr.select())}},getFieldState:wt}}function useForm(_={}){const a=React$2.useRef(),$=React$2.useRef(),[j,et]=React$2.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$4(_.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:_.errors||{},disabled:_.disabled||!1,defaultValues:isFunction$4(_.defaultValues)?void 0:_.defaultValues});a.current||(a.current={...createFormControl(_),formState:j});const tt=a.current.control;return tt._options=_,useSubscribe({subject:tt._subjects.state,next:rt=>{shouldRenderFormState(rt,tt._proxyFormState,tt._updateFormState)&&et({...tt._formState})}}),React$2.useEffect(()=>tt._disableForm(_.disabled),[tt,_.disabled]),React$2.useEffect(()=>{if(tt._proxyFormState.isDirty){const rt=tt._getDirty();rt!==j.isDirty&&tt._subjects.state.next({isDirty:rt})}},[tt,j.isDirty]),React$2.useEffect(()=>{_.values&&!deepEqual$1(_.values,$.current)?(tt._reset(_.values,tt._options.resetOptions),$.current=_.values,et(rt=>({...rt}))):tt._resetDefaultValues()},[_.values,tt]),React$2.useEffect(()=>{_.errors&&tt._setErrors(_.errors)},[_.errors,tt]),React$2.useEffect(()=>{tt._state.mount||(tt._updateValid(),tt._state.mount=!0),tt._state.watch&&(tt._state.watch=!1,tt._subjects.state.next({...tt._formState})),tt._removeUnmounted()}),React$2.useEffect(()=>{_.shouldUnregister&&tt._subjects.values.next({values:tt._getWatch()})},[_.shouldUnregister,tt]),a.current.formState=getProxyFormState(j,tt),a.current}const colors={orange:"#FB4F57",orangeL:"#FC7884",blue:"#0D99FF",blueL:"#4FA2FF",green:"#00C39A",greenL:"#00E7B6",black:"#000000",white:"#FFFFFF",gray:{900:"#121212",800:"#181818",700:"#282828",600:"#2C2B2B",500:"#414141",450:"#707070",400:"#C2C2C2",300:"#D6D6D6",200:"#EBEBEB",100:"#F0F0F0",50:"#F5F5F5"}},AccountsIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",textAlign:"center",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M14 5.6C14 5.03995 14 4.75992 14.109 4.54601C14.2049 4.35785 14.3578 4.20487 14.546 4.10899C14.7599 4 15.0399 4 15.6 4H18.4C18.9601 4 19.2401 4 19.454 4.10899C19.6422 4.20487 19.7951 4.35785 19.891 4.54601C20 4.75992 20 5.03995 20 5.6V8.4C20 8.96005 20 9.24008 19.891 9.45399C19.7951 9.64215 19.6422 9.79513 19.454 9.89101C19.2401 10 18.9601 10 18.4 10H15.6C15.0399 10 14.7599 10 14.546 9.89101C14.3578 9.79513 14.2049 9.64215 14.109 9.45399C14 9.24008 14 8.96005 14 8.4V5.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M4 5.6C4 5.03995 4 4.75992 4.10899 4.54601C4.20487 4.35785 4.35785 4.20487 4.54601 4.10899C4.75992 4 5.03995 4 5.6 4H8.4C8.96005 4 9.24008 4 9.45399 4.10899C9.64215 4.20487 9.79513 4.35785 9.89101 4.54601C10 4.75992 10 5.03995 10 5.6V8.4C10 8.96005 10 9.24008 9.89101 9.45399C9.79513 9.64215 9.64215 9.79513 9.45399 9.89101C9.24008 10 8.96005 10 8.4 10H5.6C5.03995 10 4.75992 10 4.54601 9.89101C4.35785 9.79513 4.20487 9.64215 4.10899 9.45399C4 9.24008 4 8.96005 4 8.4V5.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M4 15.6C4 15.0399 4 14.7599 4.10899 14.546C4.20487 14.3578 4.35785 14.2049 4.54601 14.109C4.75992 14 5.03995 14 5.6 14H8.4C8.96005 14 9.24008 14 9.45399 14.109C9.64215 14.2049 9.79513 14.3578 9.89101 14.546C10 14.7599 10 15.0399 10 15.6V18.4C10 18.9601 10 19.2401 9.89101 19.454C9.79513 19.6422 9.64215 19.7951 9.45399 19.891C9.24008 20 8.96005 20 8.4 20H5.6C5.03995 20 4.75992 20 4.54601 19.891C4.35785 19.7951 4.20487 19.6422 4.10899 19.454C4 19.2401 4 18.9601 4 18.4V15.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M14 15.6C14 15.0399 14 14.7599 14.109 14.546C14.2049 14.3578 14.3578 14.2049 14.546 14.109C14.7599 14 15.0399 14 15.6 14H18.4C18.9601 14 19.2401 14 19.454 14.109C19.6422 14.2049 19.7951 14.3578 19.891 14.546C20 14.7599 20 15.0399 20 15.6V18.4C20 18.9601 20 19.2401 19.891 19.454C19.7951 19.6422 19.6422 19.7951 19.454 19.891C19.2401 20 18.9601 20 18.4 20H15.6C15.0399 20 14.7599 20 14.546 19.891C14.3578 19.7951 14.2049 19.6422 14.109 19.454C14 19.2401 14 18.9601 14 18.4V15.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})]}),AddAccountIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M8.25 13.5H4.65C3.80992 13.5 3.38988 13.5 3.06901 13.3365C2.78677 13.1927 2.5573 12.9632 2.41349 12.681C2.25 12.3601 2.25 11.9401 2.25 11.1V5.4C2.25 4.55992 2.25 4.13988 2.41349 3.81901C2.5573 3.53677 2.78677 3.3073 3.06901 3.16349C3.38988 3 3.80992 3 4.65 3H13.35C14.1901 3 14.6101 3 14.931 3.16349C15.2132 3.3073 15.4427 3.53677 15.5865 3.81901C15.75 4.13988 15.75 4.55992 15.75 5.4V8.25M2.25 6H15.75M13.5 15V10.5M15.75 12.7506L11.25 12.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),AddContactIcon=_=>jsxRuntimeExports.jsx(Icon,{fill:"none",viewBox:"0 0 13 17",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13 12.5L10.75 12.5M10.75 12.5L8.5 12.5M10.75 12.5V10.25M10.75 12.5V14.75M6.25 14.75H1C1 11.8505 3.35051 9.5 6.25 9.5C6.77123 9.5 7.27472 9.57596 7.75 9.71741M9.25 4.25C9.25 5.90685 7.90685 7.25 6.25 7.25C4.59315 7.25 3.25 5.90685 3.25 4.25C3.25 2.59315 4.59315 1.25 6.25 1.25C7.90685 1.25 9.25 2.59315 9.25 4.25Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),AddressBookIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13.5 15.5C13.2164 14.3589 11.981 13.5 10.5 13.5C9.019 13.5 7.78364 14.3589 7.5 15.5M21 5V7M21 11V13M21 17V19M6.2 21H14.8C15.9201 21 16.4802 21 16.908 20.782C17.2843 20.5903 17.5903 20.2843 17.782 19.908C18 19.4802 18 18.9201 18 17.8V6.2C18 5.0799 18 4.51984 17.782 4.09202C17.5903 3.71569 17.2843 3.40973 16.908 3.21799C16.4802 3 15.9201 3 14.8 3H6.2C5.0799 3 4.51984 3 4.09202 3.21799C3.71569 3.40973 3.40973 3.71569 3.21799 4.09202C3 4.51984 3 5.07989 3 6.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21ZM11.5 9.5C11.5 10.0523 11.0523 10.5 10.5 10.5C9.94772 10.5 9.5 10.0523 9.5 9.5C9.5 8.94772 9.94772 8.5 10.5 8.5C11.0523 8.5 11.5 8.94772 11.5 9.5Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),BakerIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],"data-testid":"baker-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.74946 5.25V8.25M7.49946 1.5V4.5M13.4995 12V15M2.24946 6.75H5.24946M5.99946 3H8.99946M11.9995 13.5H14.9995M10.4995 5.25L12.6208 7.37132M14.6369 2.80959L15.0612 3.23385C15.3582 3.53086 15.5067 3.67937 15.5624 3.85062C15.6113 4.00125 15.6113 4.16351 15.5624 4.31414C15.5067 4.48539 15.3582 4.6339 15.0612 4.93091L4.89356 15.0985C4.59655 15.3955 4.44804 15.5441 4.2768 15.5997C4.12617 15.6486 3.9639 15.6486 3.81327 15.5997C3.64203 15.5441 3.49352 15.3955 3.19651 15.0985L2.77224 14.6743C2.47523 14.3773 2.32672 14.2288 2.27108 14.0575C2.22214 13.9069 2.22214 13.7446 2.27108 13.594C2.32672 13.4227 2.47523 13.2742 2.77224 12.9772L12.9399 2.80959C13.2369 2.51258 13.3854 2.36407 13.5566 2.30843C13.7073 2.25948 13.8695 2.25948 14.0202 2.30843C14.1914 2.36407 14.3399 2.51258 14.6369 2.80959Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),BatchIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",strokeWidth:"1.2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M10 4V20M14 4V20M4 8C4 8.92997 4 9.39496 4.10222 9.77646C4.37962 10.8117 5.18827 11.6204 6.22354 11.8978C6.60504 12 7.07003 12 8 12H16C16.93 12 17.395 12 17.7765 11.8978C18.8117 11.6204 19.6204 10.8117 19.8978 9.77646C20 9.39496 20 8.92997 20 8M4 8C4 7.07003 4 6.60504 4.10222 6.22354C4.37962 5.18827 5.18827 4.37962 6.22354 4.10222C6.60504 4 7.07003 4 8 4H16C16.93 4 17.395 4 17.7765 4.10222C18.8117 4.37962 19.6204 5.18827 19.8978 6.22354C20 6.60504 20 7.07003 20 8M4 8V16C4 16.93 4 17.395 4.10222 17.7765C4.37962 18.8117 5.18827 19.6204 6.22354 19.8978C6.60504 20 7.07003 20 8 20H16C16.93 20 17.395 20 17.7765 19.8978C18.8117 19.6204 19.6204 18.8117 19.8978 17.7765C20 17.395 20 16.93 20 16V8M10 16H8C7.07003 16 6.60504 16 6.22354 15.8978C5.18827 15.6204 4.37962 14.8117 4.10222 13.7765C4 13.395 4 12.93 4 12M14 16H16C16.93 16 17.395 16 17.7765 15.8978C18.8117 15.6204 19.6204 14.8117 19.8978 13.7765C20 13.395 20 12.93 20 12M7 8H7.01M17 8H17.01",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round"})}),BurgerMenuIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],textAlign:"center",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4 6H20M4 12H20M4 18H20",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CheckmarkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M6 9.25L7.84615 11.25L12 6.75M15.75 9C15.75 12.7279 12.7279 15.75 9 15.75C5.27208 15.75 2.25 12.7279 2.25 9C2.25 5.27208 5.27208 2.25 9 2.25C12.7279 2.25 15.75 5.27208 15.75 9Z",stroke:"#00C39A",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronDownIcon$1=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4.5 6.75L9 11.25L13.5 6.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronRightIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M7 14L11.5 9.5L7 5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronUpIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4.5 11.25L9 6.75L13.5 11.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CoinIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 10V14M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ContactIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none","data-testid":"contact-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.75 15.75C3.75 12.8505 6.10051 10.5 9 10.5C11.8995 10.5 14.25 12.8505 14.25 15.75M12 5.25C12 6.90685 10.6569 8.25 9 8.25C7.34315 8.25 6 6.90685 6 5.25C6 3.59315 7.34315 2.25 9 2.25C10.6569 2.25 12 3.59315 12 5.25Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ContractIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M7.5 12.75L6 11.25L7.5 9.75M10.5 9.75L12 11.25L10.5 12.75M9.75 2.25H6.15C5.30992 2.25 4.88988 2.25 4.56901 2.41349C4.28677 2.5573 4.0573 2.78677 3.91349 3.06901C3.75 3.38988 3.75 3.80992 3.75 4.65V13.35C3.75 14.1901 3.75 14.6101 3.91349 14.931C4.0573 15.2132 4.28677 15.4427 4.56901 15.5865C4.88988 15.75 5.30992 15.75 6.15 15.75H11.85C12.6901 15.75 13.1101 15.75 13.431 15.5865C13.7132 15.4427 13.9427 15.2132 14.0865 14.931C14.25 14.6101 14.25 14.1901 14.25 13.35V6.75M9.75 2.25L14.25 6.75M9.75 2.25V6C9.75 6.41421 10.0858 6.75 10.5 6.75H14.25",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CrossedCircleIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13.773 13.773C14.9945 12.5515 15.75 10.864 15.75 9C15.75 5.27208 12.7279 2.25 9 2.25C7.13604 2.25 5.44854 3.00552 4.22703 4.22703M13.773 13.773C12.5515 14.9945 10.864 15.75 9 15.75C5.27208 15.75 2.25 12.7279 2.25 9C2.25 7.13604 3.00552 5.44854 4.22703 4.22703M13.773 13.773L4.22703 4.22703",stroke:"#FB4F57",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DiamondIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.125 9H20.875M12 3L8 9L12 20.6667L16 9L12 3ZM12.64 20.1467L20.64 9.48C20.7691 9.30787 20.8336 9.22181 20.8585 9.12728C20.8805 9.04385 20.8805 8.95615 20.8585 8.87272C20.8336 8.77819 20.7691 8.69213 20.64 8.52L16.74 3.32C16.652 3.20267 16.608 3.144 16.5522 3.10169C16.5028 3.06421 16.4469 3.03625 16.3873 3.01922C16.32 3 16.2467 3 16.1 3H7.9C7.75333 3 7.68 3 7.61269 3.01922C7.55308 3.03625 7.49715 3.06421 7.44776 3.10169C7.392 3.144 7.348 3.20267 7.26 3.32L3.36 8.52C3.2309 8.69213 3.16635 8.77819 3.14147 8.87271C3.11951 8.95615 3.11951 9.04385 3.14147 9.12728C3.16635 9.2218 3.2309 9.30787 3.36 9.48L11.36 20.1467C11.5771 20.4362 11.6857 20.5809 11.8188 20.6327C11.9353 20.678 12.0647 20.678 12.1812 20.6327C12.3143 20.5809 12.4229 20.4362 12.64 20.1467Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DocumentIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9 17H13M9 13H13M9 9H10M17 18V21M17 15H17.01M13 3H8.2C7.0799 3 6.51984 3 6.09202 3.21799C5.71569 3.40973 5.40973 3.71569 5.21799 4.09202C5 4.51984 5 5.0799 5 6.2V17.8C5 18.9201 5 19.4802 5.21799 19.908C5.40973 20.2843 5.71569 20.5903 6.09202 20.782C6.51984 21 7.0799 21 8.2 21H13M13 3L19 9M13 3V7.4C13 7.96005 13 8.24008 13.109 8.45399C13.2049 8.64215 13.3578 8.79513 13.546 8.89101C13.7599 9 14.0399 9 14.6 9H19M19 9V11.5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DoubleCheckmarkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4 14L9 19L20 8M6 8.88889L9.07692 12L16 5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DownloadIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"16px",height:"16px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M5 7.25L8 10.25M8 10.25L11 7.25M8 10.25V1.25M14.75 7.25V12.3494C14.75 13.1895 14.75 13.6095 14.5865 13.9304C14.4427 14.2126 14.2132 14.4421 13.931 14.5859C13.6101 14.7494 13.1901 14.7494 12.35 14.7494H3.65C2.80992 14.7494 2.38988 14.7494 2.06901 14.5859C1.78677 14.4421 1.5573 14.2126 1.41349 13.9304C1.25 13.6095 1.25 13.1895 1.25 12.3494V7.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),EditAccountIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M8.5 21H4C4 17.134 7.13401 14 11 14C11.1681 14 11.3348 14.0059 11.5 14.0176M15 7C15 9.20914 13.2091 11 11 11C8.79086 11 7 9.20914 7 7C7 4.79086 8.79086 3 11 3C13.2091 3 15 4.79086 15 7ZM12.5898 21L14.6148 20.595C14.7914 20.5597 14.8797 20.542 14.962 20.5097C15.0351 20.4811 15.1045 20.4439 15.1689 20.399C15.2414 20.3484 15.3051 20.2848 15.4324 20.1574L19.5898 16C20.1421 15.4477 20.1421 14.5523 19.5898 14C19.0376 13.4477 18.1421 13.4477 17.5898 14L13.4324 18.1574C13.3051 18.2848 13.2414 18.3484 13.1908 18.421C13.1459 18.4853 13.1088 18.5548 13.0801 18.6279C13.0478 18.7102 13.0302 18.7985 12.9948 18.975L12.5898 21Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),EmailIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"28px",height:"28px",fill:"black","data-testid":"email-icon",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:`M23.332 4.66602H4.66536C3.38203 4.66602 2.3437 5.71602 2.3437 6.99935L2.33203 20.9993C2.33203 +}`;var Un=pv(function(){return ns(yr,kn+"return "+sn).apply($,Cr)});if(Un.source=sn,X0(Un))throw Un;return Un}function p6(_t){return as(_t).toLowerCase()}function m6(_t){return as(_t).toUpperCase()}function g6(_t,It,Ut){if(_t=as(_t),_t&&(Ut||It===$))return wm(_t);if(!_t||!(It=$a(It)))return _t;var rr=$o(_t),ur=$o(It),yr=_m(rr,ur),Cr=Sm(rr,ur)+1;return Dl(rr,yr,Cr).join("")}function b6(_t,It,Ut){if(_t=as(_t),_t&&(Ut||It===$))return _t.slice(0,Rm(_t)+1);if(!_t||!(It=$a(It)))return _t;var rr=$o(_t),ur=Sm(rr,$o(It))+1;return Dl(rr,0,ur).join("")}function v6(_t,It,Ut){if(_t=as(_t),_t&&(Ut||It===$))return _t.replace(dn,"");if(!_t||!(It=$a(It)))return _t;var rr=$o(_t),ur=_m(rr,$o(It));return Dl(rr,ur).join("")}function y6(_t,It){var Ut=Ft,rr=Bt;if(ws(It)){var ur="separator"in It?It.separator:ur;Ut="length"in It?zn(It.length):Ut,rr="omission"in It?$a(It.omission):rr}_t=as(_t);var yr=_t.length;if(gu(_t)){var Cr=$o(_t);yr=Cr.length}if(Ut>=yr)return _t;var Mr=Ut-bu(rr);if(Mr<1)return rr;var Br=Cr?Dl(Cr,0,Mr).join(""):_t.slice(0,Mr);if(ur===$)return Br+rr;if(Cr&&(Mr+=Br.length-Mr),J0(ur)){if(_t.slice(Mr).search(ur)){var en,tn=Br;for(ur.global||(ur=p0(ur.source,as(yn.exec(ur))+"g")),ur.lastIndex=0;en=ur.exec(tn);)var sn=en.index;Br=Br.slice(0,sn===$?Mr:sn)}}else if(_t.indexOf($a(ur),Mr)!=Mr){var An=Br.lastIndexOf(ur);An>-1&&(Br=Br.slice(0,An))}return Br+rr}function x6(_t){return _t=as(_t),_t&&mn.test(_t)?_t.replace(Jr,Wv):_t}var E6=Su(function(_t,It,Ut){return _t+(Ut?" ":"")+It.toUpperCase()}),tm=p1("toUpperCase");function hv(_t,It,Ut){return _t=as(_t),It=Ut?$:It,It===$?Uv(_t)?Yv(_t):Mv(_t):_t.match(It)||[]}var pv=Hn(function(_t,It){try{return Os(_t,$,It)}catch(Ut){return X0(Ut)?Ut:new Ln(Ut)}}),w6=Go(function(_t,It){return co(It,function(Ut){Ut=Bo(Ut),Ko(_t,Ut,Z0(_t[Ut],_t))}),_t});function _6(_t){var It=_t==null?0:_t.length,Ut=On();return _t=It?xs(_t,function(rr){if(typeof rr[1]!="function")throw new lo(rt);return[Ut(rr[0]),rr[1]]}):[],Hn(function(rr){for(var ur=-1;++urRt)return[];var Ut=At,rr=zs(_t,At);It=On(It),_t-=At;for(var ur=d0(rr,It);++Ut<_t;)It(Ut);return ur}function q6(_t){return Dn(_t)?xs(_t,Bo):eo(_t)?[_t]:Js(j1(as(_t)))}function V6(_t){var It=++ey;return as(_t)+It}var K6=Up(function(_t,It){return _t+It},0),W6=N0("ceil"),G6=Up(function(_t,It){return _t/It},1),Z6=N0("floor");function Y6(_t){return _t&&_t.length?jp(_t,ga,w0):$}function X6(_t,It){return _t&&_t.length?jp(_t,On(It,2),w0):$}function J6(_t){return xm(_t,ga)}function Q6(_t,It){return xm(_t,On(It,2))}function eE(_t){return _t&&_t.length?jp(_t,ga,R0):$}function tE(_t,It){return _t&&_t.length?jp(_t,On(It,2),R0):$}var rE=Up(function(_t,It){return _t*It},1),nE=N0("round"),iE=Up(function(_t,It){return _t-It},0);function sE(_t){return _t&&_t.length?u0(_t,ga):0}function aE(_t,It){return _t&&_t.length?u0(_t,On(It,2)):0}return br.after=P3,br.ary=K1,br.assign=m4,br.assignIn=av,br.assignInWith=t0,br.assignWith=g4,br.at=b4,br.before=W1,br.bind=Z0,br.bindAll=w6,br.bindKey=G1,br.castArray=F3,br.chain=H1,br.chunk=W2,br.compact=G2,br.concat=Z2,br.cond=_6,br.conforms=S6,br.constant=rm,br.countBy=s3,br.create=v4,br.curry=Z1,br.curryRight=Y1,br.debounce=X1,br.defaults=y4,br.defaultsDeep=x4,br.defer=T3,br.delay=C3,br.difference=Y2,br.differenceBy=X2,br.differenceWith=J2,br.drop=Q2,br.dropRight=ex,br.dropRightWhile=tx,br.dropWhile=rx,br.fill=nx,br.filter=o3,br.flatMap=u3,br.flatMapDeep=d3,br.flatMapDepth=f3,br.flatten=D1,br.flattenDeep=ix,br.flattenDepth=sx,br.flip=I3,br.flow=R6,br.flowRight=A6,br.fromPairs=ax,br.functions=A4,br.functionsIn=P4,br.groupBy=h3,br.initial=lx,br.intersection=ux,br.intersectionBy=dx,br.intersectionWith=fx,br.invert=C4,br.invertBy=I4,br.invokeMap=m3,br.iteratee=nm,br.keyBy=g3,br.keys=Bs,br.keysIn=na,br.map=Zp,br.mapKeys=M4,br.mapValues=O4,br.matches=P6,br.matchesProperty=T6,br.memoize=Xp,br.merge=j4,br.mergeWith=ov,br.method=C6,br.methodOf=I6,br.mixin=im,br.negate=Jp,br.nthArg=M6,br.omit=B4,br.omitBy=N4,br.once=k3,br.orderBy=b3,br.over=O6,br.overArgs=M3,br.overEvery=j6,br.overSome=B6,br.partial=Y0,br.partialRight=J1,br.partition=v3,br.pick=L4,br.pickBy=cv,br.property=mv,br.propertyOf=N6,br.pull=bx,br.pullAll=z1,br.pullAllBy=vx,br.pullAllWith=yx,br.pullAt=xx,br.range=L6,br.rangeRight=D6,br.rearg=O3,br.reject=E3,br.remove=Ex,br.rest=j3,br.reverse=W0,br.sampleSize=_3,br.set=F4,br.setWith=z4,br.shuffle=S3,br.slice=wx,br.sortBy=A3,br.sortedUniq=Tx,br.sortedUniqBy=Cx,br.split=u6,br.spread=B3,br.tail=Ix,br.take=kx,br.takeRight=Mx,br.takeRightWhile=Ox,br.takeWhile=jx,br.tap=Yx,br.throttle=N3,br.thru=Gp,br.toArray=nv,br.toPairs=lv,br.toPairsIn=uv,br.toPath=q6,br.toPlainObject=sv,br.transform=U4,br.unary=L3,br.union=Bx,br.unionBy=Nx,br.unionWith=Lx,br.uniq=Dx,br.uniqBy=Fx,br.uniqWith=zx,br.unset=H4,br.unzip=G0,br.unzipWith=U1,br.update=q4,br.updateWith=V4,br.values=Au,br.valuesIn=K4,br.without=Ux,br.words=hv,br.wrap=D3,br.xor=Hx,br.xorBy=qx,br.xorWith=Vx,br.zip=Kx,br.zipObject=Wx,br.zipObjectDeep=Gx,br.zipWith=Zx,br.entries=lv,br.entriesIn=uv,br.extend=av,br.extendWith=t0,im(br,br),br.add=K6,br.attempt=pv,br.camelCase=Y4,br.capitalize=dv,br.ceil=W6,br.clamp=W4,br.clone=z3,br.cloneDeep=H3,br.cloneDeepWith=q3,br.cloneWith=U3,br.conformsTo=V3,br.deburr=fv,br.defaultTo=$6,br.divide=G6,br.endsWith=X4,br.eq=Ao,br.escape=J4,br.escapeRegExp=Q4,br.every=a3,br.find=c3,br.findIndex=N1,br.findKey=E4,br.findLast=l3,br.findLastIndex=L1,br.findLastKey=w4,br.floor=Z6,br.forEach=q1,br.forEachRight=V1,br.forIn=_4,br.forInRight=S4,br.forOwn=$4,br.forOwnRight=R4,br.get=Q0,br.gt=K3,br.gte=W3,br.has=T4,br.hasIn=em,br.head=F1,br.identity=ga,br.includes=p3,br.indexOf=ox,br.inRange=G4,br.invoke=k4,br.isArguments=au,br.isArray=Dn,br.isArrayBuffer=G3,br.isArrayLike=Qs,br.isArrayLikeObject=$s,br.isBoolean=Z3,br.isBuffer=Fl,br.isDate=Y3,br.isElement=X3,br.isEmpty=J3,br.isEqual=Q3,br.isEqualWith=e4,br.isError=X0,br.isFinite=t4,br.isFunction=Yo,br.isInteger=Q1,br.isLength=Qp,br.isMap=ev,br.isMatch=r4,br.isMatchWith=n4,br.isNaN=i4,br.isNative=s4,br.isNil=o4,br.isNull=a4,br.isNumber=tv,br.isObject=ws,br.isObjectLike=_s,br.isPlainObject=np,br.isRegExp=J0,br.isSafeInteger=c4,br.isSet=rv,br.isString=e0,br.isSymbol=eo,br.isTypedArray=Ru,br.isUndefined=l4,br.isWeakMap=u4,br.isWeakSet=d4,br.join=hx,br.kebabCase=e6,br.last=po,br.lastIndexOf=mx,br.lowerCase=t6,br.lowerFirst=r6,br.lt=f4,br.lte=h4,br.max=Y6,br.maxBy=X6,br.mean=J6,br.meanBy=Q6,br.min=eE,br.minBy=tE,br.stubArray=am,br.stubFalse=om,br.stubObject=F6,br.stubString=z6,br.stubTrue=U6,br.multiply=rE,br.nth=gx,br.noConflict=k6,br.noop=sm,br.now=Yp,br.pad=n6,br.padEnd=i6,br.padStart=s6,br.parseInt=a6,br.random=Z4,br.reduce=y3,br.reduceRight=x3,br.repeat=o6,br.replace=c6,br.result=D4,br.round=nE,br.runInContext=jr,br.sample=w3,br.size=$3,br.snakeCase=l6,br.some=R3,br.sortedIndex=_x,br.sortedIndexBy=Sx,br.sortedIndexOf=$x,br.sortedLastIndex=Rx,br.sortedLastIndexBy=Ax,br.sortedLastIndexOf=Px,br.startCase=d6,br.startsWith=f6,br.subtract=iE,br.sum=sE,br.sumBy=aE,br.template=h6,br.times=H6,br.toFinite=Xo,br.toInteger=zn,br.toLength=iv,br.toLower=p6,br.toNumber=mo,br.toSafeInteger=p4,br.toString=as,br.toUpper=m6,br.trim=g6,br.trimEnd=b6,br.trimStart=v6,br.truncate=y6,br.unescape=x6,br.uniqueId=V6,br.upperCase=E6,br.upperFirst=tm,br.each=q1,br.eachRight=V1,br.first=F1,im(br,function(){var _t={};return Oo(br,function(It,Ut){cs.call(br.prototype,Ut)||(_t[Ut]=It)}),_t}(),{chain:!1}),br.VERSION=j,co(["bind","bindKey","curry","curryRight","partial","partialRight"],function(_t){br[_t].placeholder=br}),co(["drop","take"],function(_t,It){Kn.prototype[_t]=function(Ut){Ut=Ut===$?1:Is(zn(Ut),0);var rr=this.__filtered__&&!It?new Kn(this):this.clone();return rr.__filtered__?rr.__takeCount__=zs(Ut,rr.__takeCount__):rr.__views__.push({size:zs(Ut,At),type:_t+(rr.__dir__<0?"Right":"")}),rr},Kn.prototype[_t+"Right"]=function(Ut){return this.reverse()[_t](Ut).reverse()}}),co(["filter","map","takeWhile"],function(_t,It){var Ut=It+1,rr=Ut==ct||Ut==vt;Kn.prototype[_t]=function(ur){var yr=this.clone();return yr.__iteratees__.push({iteratee:On(ur,3),type:Ut}),yr.__filtered__=yr.__filtered__||rr,yr}}),co(["head","last"],function(_t,It){var Ut="take"+(It?"Right":"");Kn.prototype[_t]=function(){return this[Ut](1).value()[0]}}),co(["initial","tail"],function(_t,It){var Ut="drop"+(It?"":"Right");Kn.prototype[_t]=function(){return this.__filtered__?new Kn(this):this[Ut](1)}}),Kn.prototype.compact=function(){return this.filter(ga)},Kn.prototype.find=function(_t){return this.filter(_t).head()},Kn.prototype.findLast=function(_t){return this.reverse().find(_t)},Kn.prototype.invokeMap=Hn(function(_t,It){return typeof _t=="function"?new Kn(this):this.map(function(Ut){return Xu(Ut,_t,It)})}),Kn.prototype.reject=function(_t){return this.filter(Jp(On(_t)))},Kn.prototype.slice=function(_t,It){_t=zn(_t);var Ut=this;return Ut.__filtered__&&(_t>0||It<0)?new Kn(Ut):(_t<0?Ut=Ut.takeRight(-_t):_t&&(Ut=Ut.drop(_t)),It!==$&&(It=zn(It),Ut=It<0?Ut.dropRight(-It):Ut.take(It-_t)),Ut)},Kn.prototype.takeRightWhile=function(_t){return this.reverse().takeWhile(_t).reverse()},Kn.prototype.toArray=function(){return this.take(At)},Oo(Kn.prototype,function(_t,It){var Ut=/^(?:filter|find|map|reject)|While$/.test(It),rr=/^(?:head|last)$/.test(It),ur=br[rr?"take"+(It=="last"?"Right":""):It],yr=rr||/^find/.test(It);ur&&(br.prototype[It]=function(){var Cr=this.__wrapped__,Mr=rr?[1]:arguments,Br=Cr instanceof Kn,en=Mr[0],tn=Br||Dn(Cr),sn=function(Vn){var Gn=ur.apply(br,Il([Vn],Mr));return rr&&An?Gn[0]:Gn};tn&&Ut&&typeof en=="function"&&en.length!=1&&(Br=tn=!1);var An=this.__chain__,kn=!!this.__actions__.length,jn=yr&&!An,Un=Br&&!kn;if(!yr&&tn){Cr=Un?Cr:new Kn(this);var Bn=_t.apply(Cr,Mr);return Bn.__actions__.push({func:Gp,args:[sn],thisArg:$}),new uo(Bn,An)}return jn&&Un?_t.apply(this,Mr):(Bn=this.thru(sn),jn?rr?Bn.value()[0]:Bn.value():Bn)})}),co(["pop","push","shift","sort","splice","unshift"],function(_t){var It=xp[_t],Ut=/^(?:push|sort|unshift)$/.test(_t)?"tap":"thru",rr=/^(?:pop|shift)$/.test(_t);br.prototype[_t]=function(){var ur=arguments;if(rr&&!this.__chain__){var yr=this.value();return It.apply(Dn(yr)?yr:[],ur)}return this[Ut](function(Cr){return It.apply(Dn(Cr)?Cr:[],ur)})}}),Oo(Kn.prototype,function(_t,It){var Ut=br[It];if(Ut){var rr=Ut.name+"";cs.call(Eu,rr)||(Eu[rr]=[]),Eu[rr].push({name:It,func:Ut})}}),Eu[zp($,Pt).name]=[{name:"wrapper",func:$}],Kn.prototype.clone=vy,Kn.prototype.reverse=yy,Kn.prototype.value=xy,br.prototype.at=Xx,br.prototype.chain=Jx,br.prototype.commit=Qx,br.prototype.next=e3,br.prototype.plant=r3,br.prototype.reverse=n3,br.prototype.toJSON=br.prototype.valueOf=br.prototype.value=i3,br.prototype.first=br.prototype.head,qu&&(br.prototype[qu]=t3),br},vu=Xv();Nn?((Nn.exports=vu)._=vu,_n._=vu):cn._=vu}).call(commonjsGlobal)})(lodash,lodash.exports);var lodashExports=lodash.exports,isCheckBoxInput=_=>_.type==="checkbox",isDateObject=_=>_ instanceof Date,isNullOrUndefined=_=>_==null;const isObjectType=_=>typeof _=="object";var isObject$4=_=>!isNullOrUndefined(_)&&!Array.isArray(_)&&isObjectType(_)&&!isDateObject(_),getEventValue=_=>isObject$4(_)&&_.target?isCheckBoxInput(_.target)?_.target.checked:_.target.value:_,getNodeParentName=_=>_.substring(0,_.search(/\.\d+(\.|$)/))||_,isNameInFieldArray=(_,a)=>_.has(getNodeParentName(a)),isPlainObject$6=_=>{const a=_.constructor&&_.constructor.prototype;return isObject$4(a)&&a.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(_){let a;const $=Array.isArray(_);if(_ instanceof Date)a=new Date(_);else if(_ instanceof Set)a=new Set(_);else if(!(isWeb&&(_ instanceof Blob||_ instanceof FileList))&&($||isObject$4(_)))if(a=$?[]:{},!$&&!isPlainObject$6(_))a=_;else for(const j in _)_.hasOwnProperty(j)&&(a[j]=cloneObject(_[j]));else return _;return a}var compact=_=>Array.isArray(_)?_.filter(Boolean):[],isUndefined$2=_=>_===void 0,get$4=(_,a,$)=>{if(!a||!isObject$4(_))return $;const j=compact(a.split(/[,[\].]+?/)).reduce((et,tt)=>isNullOrUndefined(et)?et:et[tt],_);return isUndefined$2(j)||j===_?isUndefined$2(_[a])?$:_[a]:j},isBoolean$3=_=>typeof _=="boolean",isKey=_=>/^\w*$/.test(_),stringToPath$4=_=>compact(_.replace(/["|']|\]/g,"").split(/\.|\[/)),set$2=(_,a,$)=>{let j=-1;const et=isKey(a)?[a]:stringToPath$4(a),tt=et.length,rt=tt-1;for(;++jReact$2.useContext(HookFormContext),FormProvider=_=>{const{children:a,...$}=_;return React$2.createElement(HookFormContext.Provider,{value:$},a)};var getProxyFormState=(_,a,$,j=!0)=>{const et={defaultValues:a._defaultValues};for(const tt in _)Object.defineProperty(et,tt,{get:()=>{const rt=tt;return a._proxyFormState[rt]!==VALIDATION_MODE.all&&(a._proxyFormState[rt]=!j||VALIDATION_MODE.all),_[rt]}});return et},isEmptyObject=_=>isObject$4(_)&&!Object.keys(_).length,shouldRenderFormState=(_,a,$,j)=>{$(_);const{name:et,...tt}=_;return isEmptyObject(tt)||Object.keys(tt).length>=Object.keys(a).length||Object.keys(tt).find(rt=>a[rt]===VALIDATION_MODE.all)},convertToArrayPayload=_=>Array.isArray(_)?_:[_];function useSubscribe(_){const a=React$2.useRef(_);a.current=_,React$2.useEffect(()=>{const $=!_.disabled&&a.current.subject&&a.current.subject.subscribe({next:a.current.next});return()=>{$&&$.unsubscribe()}},[_.disabled])}var isString$3=_=>typeof _=="string",generateWatchOutput=(_,a,$,j,et)=>isString$3(_)?(j&&a.watch.add(_),get$4($,_,et)):Array.isArray(_)?_.map(tt=>(j&&a.watch.add(tt),get$4($,tt))):(j&&(a.watchAll=!0),$),appendErrors=(_,a,$,j,et)=>a?{...$[_],types:{...$[_]&&$[_].types?$[_].types:{},[j]:et||!0}}:{},generateId=()=>{const _=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const $=(Math.random()*16+_)%16|0;return(a=="x"?$:$&3|8).toString(16)})},getFocusFieldName=(_,a,$={})=>$.shouldFocus||isUndefined$2($.shouldFocus)?$.focusName||`${_}.${isUndefined$2($.focusIndex)?a:$.focusIndex}.`:"",getValidationModes=_=>({isOnSubmit:!_||_===VALIDATION_MODE.onSubmit,isOnBlur:_===VALIDATION_MODE.onBlur,isOnChange:_===VALIDATION_MODE.onChange,isOnAll:_===VALIDATION_MODE.all,isOnTouch:_===VALIDATION_MODE.onTouched}),isWatched=(_,a,$)=>!$&&(a.watchAll||a.watch.has(_)||[...a.watch].some(j=>_.startsWith(j)&&/^\.\w+/.test(_.slice(j.length))));const iterateFieldsByAction=(_,a,$,j)=>{for(const et of $||Object.keys(_)){const tt=get$4(_,et);if(tt){const{_f:rt,...nt}=tt;if(rt){if(rt.refs&&rt.refs[0]&&a(rt.refs[0],et)&&!j)break;if(rt.ref&&a(rt.ref,rt.name)&&!j)break;iterateFieldsByAction(nt,a)}else isObject$4(nt)&&iterateFieldsByAction(nt,a)}}};var updateFieldArrayRootError=(_,a,$)=>{const j=compact(get$4(_,$));return set$2(j,"root",a[$]),set$2(_,$,j),_},isFileInput=_=>_.type==="file",isFunction$4=_=>typeof _=="function",isHTMLElement=_=>{if(!isWeb)return!1;const a=_?_.ownerDocument:0;return _ instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},isMessage=_=>isString$3(_),isRadioInput=_=>_.type==="radio",isRegex=_=>_ instanceof RegExp;const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=_=>{if(Array.isArray(_)){if(_.length>1){const a=_.filter($=>$&&$.checked&&!$.disabled).map($=>$.value);return{value:a,isValid:!!a.length}}return _[0].checked&&!_[0].disabled?_[0].attributes&&!isUndefined$2(_[0].attributes.value)?isUndefined$2(_[0].value)||_[0].value===""?validResult:{value:_[0].value,isValid:!0}:validResult:defaultResult}return defaultResult};const defaultReturn={isValid:!1,value:null};var getRadioValue=_=>Array.isArray(_)?_.reduce((a,$)=>$&&$.checked&&!$.disabled?{isValid:!0,value:$.value}:a,defaultReturn):defaultReturn;function getValidateError(_,a,$="validate"){if(isMessage(_)||Array.isArray(_)&&_.every(isMessage)||isBoolean$3(_)&&!_)return{type:$,message:isMessage(_)?_:"",ref:a}}var getValueAndMessage=_=>isObject$4(_)&&!isRegex(_)?_:{value:_,message:""},validateField=async(_,a,$,j,et)=>{const{ref:tt,refs:rt,required:nt,maxLength:it,minLength:at,min:st,max:ot,pattern:ut,validate:dt,name:mt,valueAsNumber:xt,mount:Ct,disabled:Pt}=_._f,Tt=get$4(a,mt);if(!Ct||Pt)return{};const kt=rt?rt[0]:tt,Lt=yt=>{j&&kt.reportValidity&&(kt.setCustomValidity(isBoolean$3(yt)?"":yt||""),kt.reportValidity())},Nt={},zt=isRadioInput(tt),jt=isCheckBoxInput(tt),Mt=zt||jt,Dt=(xt||isFileInput(tt))&&isUndefined$2(tt.value)&&isUndefined$2(Tt)||isHTMLElement(tt)&&tt.value===""||Tt===""||Array.isArray(Tt)&&!Tt.length,Ft=appendErrors.bind(null,mt,$,Nt),Bt=(yt,bt,ct,ht=INPUT_VALIDATION_RULES.maxLength,vt=INPUT_VALIDATION_RULES.minLength)=>{const St=yt?bt:ct;Nt[mt]={type:yt?ht:vt,message:St,ref:tt,...Ft(yt?ht:vt,St)}};if(et?!Array.isArray(Tt)||!Tt.length:nt&&(!Mt&&(Dt||isNullOrUndefined(Tt))||isBoolean$3(Tt)&&!Tt||jt&&!getCheckboxValue(rt).isValid||zt&&!getRadioValue(rt).isValid)){const{value:yt,message:bt}=isMessage(nt)?{value:!!nt,message:nt}:getValueAndMessage(nt);if(yt&&(Nt[mt]={type:INPUT_VALIDATION_RULES.required,message:bt,ref:kt,...Ft(INPUT_VALIDATION_RULES.required,bt)},!$))return Lt(bt),Nt}if(!Dt&&(!isNullOrUndefined(st)||!isNullOrUndefined(ot))){let yt,bt;const ct=getValueAndMessage(ot),ht=getValueAndMessage(st);if(!isNullOrUndefined(Tt)&&!isNaN(Tt)){const vt=tt.valueAsNumber||Tt&&+Tt;isNullOrUndefined(ct.value)||(yt=vt>ct.value),isNullOrUndefined(ht.value)||(bt=vtnew Date(new Date().toDateString()+" "+Et),Rt=tt.type=="time",$t=tt.type=="week";isString$3(ct.value)&&Tt&&(yt=Rt?St(Tt)>St(ct.value):$t?Tt>ct.value:vt>new Date(ct.value)),isString$3(ht.value)&&Tt&&(bt=Rt?St(Tt)+yt.value,ht=!isNullOrUndefined(bt.value)&&Tt.length<+bt.value;if((ct||ht)&&(Bt(ct,yt.message,bt.message),!$))return Lt(Nt[mt].message),Nt}if(ut&&!Dt&&isString$3(Tt)){const{value:yt,message:bt}=getValueAndMessage(ut);if(isRegex(yt)&&!Tt.match(yt)&&(Nt[mt]={type:INPUT_VALIDATION_RULES.pattern,message:bt,ref:tt,...Ft(INPUT_VALIDATION_RULES.pattern,bt)},!$))return Lt(bt),Nt}if(dt){if(isFunction$4(dt)){const yt=await dt(Tt,a),bt=getValidateError(yt,kt);if(bt&&(Nt[mt]={...bt,...Ft(INPUT_VALIDATION_RULES.validate,bt.message)},!$))return Lt(bt.message),Nt}else if(isObject$4(dt)){let yt={};for(const bt in dt){if(!isEmptyObject(yt)&&!$)break;const ct=getValidateError(await dt[bt](Tt,a),kt,bt);ct&&(yt={...ct,...Ft(bt,ct.message)},Lt(ct.message),$&&(Nt[mt]=yt))}if(!isEmptyObject(yt)&&(Nt[mt]={ref:kt,...yt},!$))return Nt}}return Lt(!0),Nt},appendAt=(_,a)=>[..._,...convertToArrayPayload(a)],fillEmptyArray=_=>Array.isArray(_)?_.map(()=>{}):void 0;function insert$1(_,a,$){return[..._.slice(0,a),...convertToArrayPayload($),..._.slice(a)]}var moveArrayAt=(_,a,$)=>Array.isArray(_)?(isUndefined$2(_[$])&&(_[$]=void 0),_.splice($,0,_.splice(a,1)[0]),_):[],prependAt=(_,a)=>[...convertToArrayPayload(a),...convertToArrayPayload(_)];function removeAtIndexes(_,a){let $=0;const j=[..._];for(const et of a)j.splice(et-$,1),$++;return compact(j).length?j:[]}var removeArrayAt=(_,a)=>isUndefined$2(a)?[]:removeAtIndexes(_,convertToArrayPayload(a).sort(($,j)=>$-j)),swapArrayAt=(_,a,$)=>{[_[a],_[$]]=[_[$],_[a]]};function baseGet(_,a){const $=a.slice(0,-1).length;let j=0;for(;j<$;)_=isUndefined$2(_)?j++:_[a[j++]];return _}function isEmptyArray(_){for(const a in _)if(_.hasOwnProperty(a)&&!isUndefined$2(_[a]))return!1;return!0}function unset(_,a){const $=Array.isArray(a)?a:isKey(a)?[a]:stringToPath$4(a),j=$.length===1?_:baseGet(_,$),et=$.length-1,tt=$[et];return j&&delete j[tt],et!==0&&(isObject$4(j)&&isEmptyObject(j)||Array.isArray(j)&&isEmptyArray(j))&&unset(_,$.slice(0,-1)),_}var updateAt=(_,a,$)=>(_[a]=$,_);function useFieldArray(_){const a=useFormContext(),{control:$=a.control,name:j,keyName:et="id",shouldUnregister:tt}=_,[rt,nt]=React$2.useState($._getFieldArray(j)),it=React$2.useRef($._getFieldArray(j).map(generateId)),at=React$2.useRef(rt),st=React$2.useRef(j),ot=React$2.useRef(!1);st.current=j,at.current=rt,$._names.array.add(j),_.rules&&$.register(j,_.rules),useSubscribe({next:({values:Nt,name:zt})=>{if(zt===st.current||!zt){const jt=get$4(Nt,st.current);Array.isArray(jt)&&(nt(jt),it.current=jt.map(generateId))}},subject:$._subjects.array});const ut=React$2.useCallback(Nt=>{ot.current=!0,$._updateFieldArray(j,Nt)},[$,j]),dt=(Nt,zt)=>{const jt=convertToArrayPayload(cloneObject(Nt)),Mt=appendAt($._getFieldArray(j),jt);$._names.focus=getFocusFieldName(j,Mt.length-1,zt),it.current=appendAt(it.current,jt.map(generateId)),ut(Mt),nt(Mt),$._updateFieldArray(j,Mt,appendAt,{argA:fillEmptyArray(Nt)})},mt=(Nt,zt)=>{const jt=convertToArrayPayload(cloneObject(Nt)),Mt=prependAt($._getFieldArray(j),jt);$._names.focus=getFocusFieldName(j,0,zt),it.current=prependAt(it.current,jt.map(generateId)),ut(Mt),nt(Mt),$._updateFieldArray(j,Mt,prependAt,{argA:fillEmptyArray(Nt)})},xt=Nt=>{const zt=removeArrayAt($._getFieldArray(j),Nt);it.current=removeArrayAt(it.current,Nt),ut(zt),nt(zt),$._updateFieldArray(j,zt,removeArrayAt,{argA:Nt})},Ct=(Nt,zt,jt)=>{const Mt=convertToArrayPayload(cloneObject(zt)),Dt=insert$1($._getFieldArray(j),Nt,Mt);$._names.focus=getFocusFieldName(j,Nt,jt),it.current=insert$1(it.current,Nt,Mt.map(generateId)),ut(Dt),nt(Dt),$._updateFieldArray(j,Dt,insert$1,{argA:Nt,argB:fillEmptyArray(zt)})},Pt=(Nt,zt)=>{const jt=$._getFieldArray(j);swapArrayAt(jt,Nt,zt),swapArrayAt(it.current,Nt,zt),ut(jt),nt(jt),$._updateFieldArray(j,jt,swapArrayAt,{argA:Nt,argB:zt},!1)},Tt=(Nt,zt)=>{const jt=$._getFieldArray(j);moveArrayAt(jt,Nt,zt),moveArrayAt(it.current,Nt,zt),ut(jt),nt(jt),$._updateFieldArray(j,jt,moveArrayAt,{argA:Nt,argB:zt},!1)},kt=(Nt,zt)=>{const jt=cloneObject(zt),Mt=updateAt($._getFieldArray(j),Nt,jt);it.current=[...Mt].map((Dt,Ft)=>!Dt||Ft===Nt?generateId():it.current[Ft]),ut(Mt),nt([...Mt]),$._updateFieldArray(j,Mt,updateAt,{argA:Nt,argB:jt},!0,!1)},Lt=Nt=>{const zt=convertToArrayPayload(cloneObject(Nt));it.current=zt.map(generateId),ut([...zt]),nt([...zt]),$._updateFieldArray(j,[...zt],jt=>jt,{},!0,!1)};return React$2.useEffect(()=>{if($._state.action=!1,isWatched(j,$._names)&&$._subjects.state.next({...$._formState}),ot.current&&(!getValidationModes($._options.mode).isOnSubmit||$._formState.isSubmitted))if($._options.resolver)$._executeSchema([j]).then(Nt=>{const zt=get$4(Nt.errors,j),jt=get$4($._formState.errors,j);(jt?!zt&&jt.type||zt&&(jt.type!==zt.type||jt.message!==zt.message):zt&&zt.type)&&(zt?set$2($._formState.errors,j,zt):unset($._formState.errors,j),$._subjects.state.next({errors:$._formState.errors}))});else{const Nt=get$4($._fields,j);Nt&&Nt._f&&!(getValidationModes($._options.reValidateMode).isOnSubmit&&getValidationModes($._options.mode).isOnSubmit)&&validateField(Nt,$._formValues,$._options.criteriaMode===VALIDATION_MODE.all,$._options.shouldUseNativeValidation,!0).then(zt=>!isEmptyObject(zt)&&$._subjects.state.next({errors:updateFieldArrayRootError($._formState.errors,zt,j)}))}$._subjects.values.next({name:j,values:{...$._formValues}}),$._names.focus&&iterateFieldsByAction($._fields,(Nt,zt)=>{if($._names.focus&&zt.startsWith($._names.focus)&&Nt.focus)return Nt.focus(),1}),$._names.focus="",$._updateValid(),ot.current=!1},[rt,j,$]),React$2.useEffect(()=>(!get$4($._formValues,j)&&$._updateFieldArray(j),()=>{($._options.shouldUnregister||tt)&&$.unregister(j)}),[j,$,et,tt]),{swap:React$2.useCallback(Pt,[ut,j,$]),move:React$2.useCallback(Tt,[ut,j,$]),prepend:React$2.useCallback(mt,[ut,j,$]),append:React$2.useCallback(dt,[ut,j,$]),remove:React$2.useCallback(xt,[ut,j,$]),insert:React$2.useCallback(Ct,[ut,j,$]),update:React$2.useCallback(kt,[ut,j,$]),replace:React$2.useCallback(Lt,[ut,j,$]),fields:React$2.useMemo(()=>rt.map((Nt,zt)=>({...Nt,[et]:it.current[zt]||generateId()})),[rt,et])}}var createSubject=()=>{let _=[];return{get observers(){return _},next:et=>{for(const tt of _)tt.next&&tt.next(et)},subscribe:et=>(_.push(et),{unsubscribe:()=>{_=_.filter(tt=>tt!==et)}}),unsubscribe:()=>{_=[]}}},isPrimitive=_=>isNullOrUndefined(_)||!isObjectType(_);function deepEqual$1(_,a){if(isPrimitive(_)||isPrimitive(a))return _===a;if(isDateObject(_)&&isDateObject(a))return _.getTime()===a.getTime();const $=Object.keys(_),j=Object.keys(a);if($.length!==j.length)return!1;for(const et of $){const tt=_[et];if(!j.includes(et))return!1;if(et!=="ref"){const rt=a[et];if(isDateObject(tt)&&isDateObject(rt)||isObject$4(tt)&&isObject$4(rt)||Array.isArray(tt)&&Array.isArray(rt)?!deepEqual$1(tt,rt):tt!==rt)return!1}}return!0}var isMultipleSelect=_=>_.type==="select-multiple",isRadioOrCheckbox=_=>isRadioInput(_)||isCheckBoxInput(_),live=_=>isHTMLElement(_)&&_.isConnected,objectHasFunction=_=>{for(const a in _)if(isFunction$4(_[a]))return!0;return!1};function markFieldsDirty(_,a={}){const $=Array.isArray(_);if(isObject$4(_)||$)for(const j in _)Array.isArray(_[j])||isObject$4(_[j])&&!objectHasFunction(_[j])?(a[j]=Array.isArray(_[j])?[]:{},markFieldsDirty(_[j],a[j])):isNullOrUndefined(_[j])||(a[j]=!0);return a}function getDirtyFieldsFromDefaultValues(_,a,$){const j=Array.isArray(_);if(isObject$4(_)||j)for(const et in _)Array.isArray(_[et])||isObject$4(_[et])&&!objectHasFunction(_[et])?isUndefined$2(a)||isPrimitive($[et])?$[et]=Array.isArray(_[et])?markFieldsDirty(_[et],[]):{...markFieldsDirty(_[et])}:getDirtyFieldsFromDefaultValues(_[et],isNullOrUndefined(a)?{}:a[et],$[et]):$[et]=!deepEqual$1(_[et],a[et]);return $}var getDirtyFields=(_,a)=>getDirtyFieldsFromDefaultValues(_,a,markFieldsDirty(a)),getFieldValueAs=(_,{valueAsNumber:a,valueAsDate:$,setValueAs:j})=>isUndefined$2(_)?_:a?_===""?NaN:_&&+_:$&&isString$3(_)?new Date(_):j?j(_):_;function getFieldValue(_){const a=_.ref;if(!(_.refs?_.refs.every($=>$.disabled):a.disabled))return isFileInput(a)?a.files:isRadioInput(a)?getRadioValue(_.refs).value:isMultipleSelect(a)?[...a.selectedOptions].map(({value:$})=>$):isCheckBoxInput(a)?getCheckboxValue(_.refs).value:getFieldValueAs(isUndefined$2(a.value)?_.ref.value:a.value,_)}var getResolverOptions=(_,a,$,j)=>{const et={};for(const tt of _){const rt=get$4(a,tt);rt&&set$2(et,tt,rt._f)}return{criteriaMode:$,names:[..._],fields:et,shouldUseNativeValidation:j}},getRuleValue=_=>isUndefined$2(_)?_:isRegex(_)?_.source:isObject$4(_)?isRegex(_.value)?_.value.source:_.value:_,hasValidation=_=>_.mount&&(_.required||_.min||_.max||_.maxLength||_.minLength||_.pattern||_.validate);function schemaErrorLookup(_,a,$){const j=get$4(_,$);if(j||isKey($))return{error:j,name:$};const et=$.split(".");for(;et.length;){const tt=et.join("."),rt=get$4(a,tt),nt=get$4(_,tt);if(rt&&!Array.isArray(rt)&&$!==tt)return{name:$};if(nt&&nt.type)return{name:tt,error:nt};et.pop()}return{name:$}}var skipValidation=(_,a,$,j,et)=>et.isOnAll?!1:!$&&et.isOnTouch?!(a||_):($?j.isOnBlur:et.isOnBlur)?!_:($?j.isOnChange:et.isOnChange)?_:!0,unsetEmptyArray=(_,a)=>!compact(get$4(_,a)).length&&unset(_,a);const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(_={}){let a={...defaultOptions$1,..._},$={submitCount:0,isDirty:!1,isLoading:isFunction$4(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1},j={},et=isObject$4(a.defaultValues)||isObject$4(a.values)?cloneObject(a.defaultValues||a.values)||{}:{},tt=a.shouldUnregister?{}:cloneObject(et),rt={action:!1,mount:!1,watch:!1},nt={mount:new Set,unMount:new Set,array:new Set,watch:new Set},it,at=0;const st={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},ot={values:createSubject(),array:createSubject(),state:createSubject()},ut=getValidationModes(a.mode),dt=getValidationModes(a.reValidateMode),mt=a.criteriaMode===VALIDATION_MODE.all,xt=lr=>fr=>{clearTimeout(at),at=setTimeout(lr,fr)},Ct=async lr=>{if(st.isValid||lr){const fr=a.resolver?isEmptyObject((await Mt()).errors):await Ft(j,!0);fr!==$.isValid&&ot.state.next({isValid:fr})}},Pt=(lr,fr)=>{(st.isValidating||st.validatingFields)&&((lr||Array.from(nt.mount)).forEach(Er=>{Er&&(fr?set$2($.validatingFields,Er,fr):unset($.validatingFields,Er))}),ot.state.next({validatingFields:$.validatingFields,isValidating:!isEmptyObject($.validatingFields)}))},Tt=(lr,fr=[],Er,$r,Pr=!0,Rr=!0)=>{if($r&&Er){if(rt.action=!0,Rr&&Array.isArray(get$4(j,lr))){const Ar=Er(get$4(j,lr),$r.argA,$r.argB);Pr&&set$2(j,lr,Ar)}if(Rr&&Array.isArray(get$4($.errors,lr))){const Ar=Er(get$4($.errors,lr),$r.argA,$r.argB);Pr&&set$2($.errors,lr,Ar),unsetEmptyArray($.errors,lr)}if(st.touchedFields&&Rr&&Array.isArray(get$4($.touchedFields,lr))){const Ar=Er(get$4($.touchedFields,lr),$r.argA,$r.argB);Pr&&set$2($.touchedFields,lr,Ar)}st.dirtyFields&&($.dirtyFields=getDirtyFields(et,tt)),ot.state.next({name:lr,isDirty:yt(lr,fr),dirtyFields:$.dirtyFields,errors:$.errors,isValid:$.isValid})}else set$2(tt,lr,fr)},kt=(lr,fr)=>{set$2($.errors,lr,fr),ot.state.next({errors:$.errors})},Lt=lr=>{$.errors=lr,ot.state.next({errors:$.errors,isValid:!1})},Nt=(lr,fr,Er,$r)=>{const Pr=get$4(j,lr);if(Pr){const Rr=get$4(tt,lr,isUndefined$2(Er)?get$4(et,lr):Er);isUndefined$2(Rr)||$r&&$r.defaultChecked||fr?set$2(tt,lr,fr?Rr:getFieldValue(Pr._f)):ht(lr,Rr),rt.mount&&Ct()}},zt=(lr,fr,Er,$r,Pr)=>{let Rr=!1,Ar=!1;const Or={name:lr},Lr=!!(get$4(j,lr)&&get$4(j,lr)._f.disabled);if(!Er||$r){st.isDirty&&(Ar=$.isDirty,$.isDirty=Or.isDirty=yt(),Rr=Ar!==Or.isDirty);const ar=Lr||deepEqual$1(get$4(et,lr),fr);Ar=!!(!Lr&&get$4($.dirtyFields,lr)),ar||Lr?unset($.dirtyFields,lr):set$2($.dirtyFields,lr,!0),Or.dirtyFields=$.dirtyFields,Rr=Rr||st.dirtyFields&&Ar!==!ar}if(Er){const ar=get$4($.touchedFields,lr);ar||(set$2($.touchedFields,lr,Er),Or.touchedFields=$.touchedFields,Rr=Rr||st.touchedFields&&ar!==Er)}return Rr&&Pr&&ot.state.next(Or),Rr?Or:{}},jt=(lr,fr,Er,$r)=>{const Pr=get$4($.errors,lr),Rr=st.isValid&&isBoolean$3(fr)&&$.isValid!==fr;if(_.delayError&&Er?(it=xt(()=>kt(lr,Er)),it(_.delayError)):(clearTimeout(at),it=null,Er?set$2($.errors,lr,Er):unset($.errors,lr)),(Er?!deepEqual$1(Pr,Er):Pr)||!isEmptyObject($r)||Rr){const Ar={...$r,...Rr&&isBoolean$3(fr)?{isValid:fr}:{},errors:$.errors,name:lr};$={...$,...Ar},ot.state.next(Ar)}},Mt=async lr=>{Pt(lr,!0);const fr=await a.resolver(tt,a.context,getResolverOptions(lr||nt.mount,j,a.criteriaMode,a.shouldUseNativeValidation));return Pt(lr),fr},Dt=async lr=>{const{errors:fr}=await Mt(lr);if(lr)for(const Er of lr){const $r=get$4(fr,Er);$r?set$2($.errors,Er,$r):unset($.errors,Er)}else $.errors=fr;return fr},Ft=async(lr,fr,Er={valid:!0})=>{for(const $r in lr){const Pr=lr[$r];if(Pr){const{_f:Rr,...Ar}=Pr;if(Rr){const Or=nt.array.has(Rr.name);Pt([$r],!0);const Lr=await validateField(Pr,tt,mt,a.shouldUseNativeValidation&&!fr,Or);if(Pt([$r]),Lr[Rr.name]&&(Er.valid=!1,fr))break;!fr&&(get$4(Lr,Rr.name)?Or?updateFieldArrayRootError($.errors,Lr,Rr.name):set$2($.errors,Rr.name,Lr[Rr.name]):unset($.errors,Rr.name))}Ar&&await Ft(Ar,fr,Er)}}return Er.valid},Bt=()=>{for(const lr of nt.unMount){const fr=get$4(j,lr);fr&&(fr._f.refs?fr._f.refs.every(Er=>!live(Er)):!live(fr._f.ref))&&ir(lr)}nt.unMount=new Set},yt=(lr,fr)=>(lr&&fr&&set$2(tt,lr,fr),!deepEqual$1(At(),et)),bt=(lr,fr,Er)=>generateWatchOutput(lr,nt,{...rt.mount?tt:isUndefined$2(fr)?et:isString$3(lr)?{[lr]:fr}:fr},Er,fr),ct=lr=>compact(get$4(rt.mount?tt:et,lr,_.shouldUnregister?get$4(et,lr,[]):[])),ht=(lr,fr,Er={})=>{const $r=get$4(j,lr);let Pr=fr;if($r){const Rr=$r._f;Rr&&(!Rr.disabled&&set$2(tt,lr,getFieldValueAs(fr,Rr)),Pr=isHTMLElement(Rr.ref)&&isNullOrUndefined(fr)?"":fr,isMultipleSelect(Rr.ref)?[...Rr.ref.options].forEach(Ar=>Ar.selected=Pr.includes(Ar.value)):Rr.refs?isCheckBoxInput(Rr.ref)?Rr.refs.length>1?Rr.refs.forEach(Ar=>(!Ar.defaultChecked||!Ar.disabled)&&(Ar.checked=Array.isArray(Pr)?!!Pr.find(Or=>Or===Ar.value):Pr===Ar.value)):Rr.refs[0]&&(Rr.refs[0].checked=!!Pr):Rr.refs.forEach(Ar=>Ar.checked=Ar.value===Pr):isFileInput(Rr.ref)?Rr.ref.value="":(Rr.ref.value=Pr,Rr.ref.type||ot.values.next({name:lr,values:{...tt}})))}(Er.shouldDirty||Er.shouldTouch)&&zt(lr,Pr,Er.shouldTouch,Er.shouldDirty,!0),Er.shouldValidate&&Et(lr)},vt=(lr,fr,Er)=>{for(const $r in fr){const Pr=fr[$r],Rr=`${lr}.${$r}`,Ar=get$4(j,Rr);(nt.array.has(lr)||!isPrimitive(Pr)||Ar&&!Ar._f)&&!isDateObject(Pr)?vt(Rr,Pr,Er):ht(Rr,Pr,Er)}},St=(lr,fr,Er={})=>{const $r=get$4(j,lr),Pr=nt.array.has(lr),Rr=cloneObject(fr);set$2(tt,lr,Rr),Pr?(ot.array.next({name:lr,values:{...tt}}),(st.isDirty||st.dirtyFields)&&Er.shouldDirty&&ot.state.next({name:lr,dirtyFields:getDirtyFields(et,tt),isDirty:yt(lr,Rr)})):$r&&!$r._f&&!isNullOrUndefined(Rr)?vt(lr,Rr,Er):ht(lr,Rr,Er),isWatched(lr,nt)&&ot.state.next({...$}),ot.values.next({name:rt.mount?lr:void 0,values:{...tt}})},Rt=async lr=>{rt.mount=!0;const fr=lr.target;let Er=fr.name,$r=!0;const Pr=get$4(j,Er),Rr=()=>fr.type?getFieldValue(Pr._f):getEventValue(lr),Ar=Or=>{$r=Number.isNaN(Or)||Or===get$4(tt,Er,Or)};if(Pr){let Or,Lr;const ar=Rr(),Yt=lr.type===EVENTS.BLUR||lr.type===EVENTS.FOCUS_OUT,er=!hasValidation(Pr._f)&&!a.resolver&&!get$4($.errors,Er)&&!Pr._f.deps||skipValidation(Yt,get$4($.touchedFields,Er),$.isSubmitted,dt,ut),Zt=isWatched(Er,nt,Yt);set$2(tt,Er,ar),Yt?(Pr._f.onBlur&&Pr._f.onBlur(lr),it&&it(0)):Pr._f.onChange&&Pr._f.onChange(lr);const qt=zt(Er,ar,Yt,!1),Gt=!isEmptyObject(qt)||Zt;if(!Yt&&ot.values.next({name:Er,type:lr.type,values:{...tt}}),er)return st.isValid&&Ct(),Gt&&ot.state.next({name:Er,...Zt?{}:qt});if(!Yt&&Zt&&ot.state.next({...$}),a.resolver){const{errors:or}=await Mt([Er]);if(Ar(ar),$r){const vr=schemaErrorLookup($.errors,j,Er),wr=schemaErrorLookup(or,j,vr.name||Er);Or=wr.error,Er=wr.name,Lr=isEmptyObject(or)}}else Pt([Er],!0),Or=(await validateField(Pr,tt,mt,a.shouldUseNativeValidation))[Er],Pt([Er]),Ar(ar),$r&&(Or?Lr=!1:st.isValid&&(Lr=await Ft(j,!0)));$r&&(Pr._f.deps&&Et(Pr._f.deps),jt(Er,Lr,Or,qt))}},$t=(lr,fr)=>{if(get$4($.errors,fr)&&lr.focus)return lr.focus(),1},Et=async(lr,fr={})=>{let Er,$r;const Pr=convertToArrayPayload(lr);if(a.resolver){const Rr=await Dt(isUndefined$2(lr)?lr:Pr);Er=isEmptyObject(Rr),$r=lr?!Pr.some(Ar=>get$4(Rr,Ar)):Er}else lr?($r=(await Promise.all(Pr.map(async Rr=>{const Ar=get$4(j,Rr);return await Ft(Ar&&Ar._f?{[Rr]:Ar}:Ar)}))).every(Boolean),!(!$r&&!$.isValid)&&Ct()):$r=Er=await Ft(j);return ot.state.next({...!isString$3(lr)||st.isValid&&Er!==$.isValid?{}:{name:lr},...a.resolver||!lr?{isValid:Er}:{},errors:$.errors}),fr.shouldFocus&&!$r&&iterateFieldsByAction(j,$t,lr?Pr:nt.mount),$r},At=lr=>{const fr={...rt.mount?tt:et};return isUndefined$2(lr)?fr:isString$3(lr)?get$4(fr,lr):lr.map(Er=>get$4(fr,Er))},wt=(lr,fr)=>({invalid:!!get$4((fr||$).errors,lr),isDirty:!!get$4((fr||$).dirtyFields,lr),isTouched:!!get$4((fr||$).touchedFields,lr),isValidating:!!get$4((fr||$).validatingFields,lr),error:get$4((fr||$).errors,lr)}),Ot=lr=>{lr&&convertToArrayPayload(lr).forEach(fr=>unset($.errors,fr)),ot.state.next({errors:lr?$.errors:{}})},tr=(lr,fr,Er)=>{const $r=(get$4(j,lr,{_f:{}})._f||{}).ref,Pr=get$4($.errors,lr)||{},{ref:Rr,message:Ar,type:Or,...Lr}=Pr;set$2($.errors,lr,{...Lr,...fr,ref:$r}),ot.state.next({name:lr,errors:$.errors,isValid:!1}),Er&&Er.shouldFocus&&$r&&$r.focus&&$r.focus()},nr=(lr,fr)=>isFunction$4(lr)?ot.values.subscribe({next:Er=>lr(bt(void 0,fr),Er)}):bt(lr,fr,!0),ir=(lr,fr={})=>{for(const Er of lr?convertToArrayPayload(lr):nt.mount)nt.mount.delete(Er),nt.array.delete(Er),fr.keepValue||(unset(j,Er),unset(tt,Er)),!fr.keepError&&unset($.errors,Er),!fr.keepDirty&&unset($.dirtyFields,Er),!fr.keepTouched&&unset($.touchedFields,Er),!fr.keepIsValidating&&unset($.validatingFields,Er),!a.shouldUnregister&&!fr.keepDefaultValue&&unset(et,Er);ot.values.next({values:{...tt}}),ot.state.next({...$,...fr.keepDirty?{isDirty:yt()}:{}}),!fr.keepIsValid&&Ct()},Wt=({disabled:lr,name:fr,field:Er,fields:$r,value:Pr})=>{if(isBoolean$3(lr)&&rt.mount||lr){const Rr=lr?void 0:isUndefined$2(Pr)?getFieldValue(Er?Er._f:get$4($r,fr)._f):Pr;set$2(tt,fr,Rr),zt(fr,Rr,!1,!1,!0)}},Kt=(lr,fr={})=>{let Er=get$4(j,lr);const $r=isBoolean$3(fr.disabled);return set$2(j,lr,{...Er||{},_f:{...Er&&Er._f?Er._f:{ref:{name:lr}},name:lr,mount:!0,...fr}}),nt.mount.add(lr),Er?Wt({field:Er,disabled:fr.disabled,name:lr,value:fr.value}):Nt(lr,!0,fr.value),{...$r?{disabled:fr.disabled}:{},...a.progressive?{required:!!fr.required,min:getRuleValue(fr.min),max:getRuleValue(fr.max),minLength:getRuleValue(fr.minLength),maxLength:getRuleValue(fr.maxLength),pattern:getRuleValue(fr.pattern)}:{},name:lr,onChange:Rt,onBlur:Rt,ref:Pr=>{if(Pr){Kt(lr,fr),Er=get$4(j,lr);const Rr=isUndefined$2(Pr.value)&&Pr.querySelectorAll&&Pr.querySelectorAll("input,select,textarea")[0]||Pr,Ar=isRadioOrCheckbox(Rr),Or=Er._f.refs||[];if(Ar?Or.find(Lr=>Lr===Rr):Rr===Er._f.ref)return;set$2(j,lr,{_f:{...Er._f,...Ar?{refs:[...Or.filter(live),Rr,...Array.isArray(get$4(et,lr))?[{}]:[]],ref:{type:Rr.type,name:lr}}:{ref:Rr}}}),Nt(lr,!1,void 0,Rr)}else Er=get$4(j,lr,{}),Er._f&&(Er._f.mount=!1),(a.shouldUnregister||fr.shouldUnregister)&&!(isNameInFieldArray(nt.array,lr)&&rt.action)&&nt.unMount.add(lr)}}},Jt=()=>a.shouldFocusError&&iterateFieldsByAction(j,$t,nt.mount),Ht=lr=>{isBoolean$3(lr)&&(ot.state.next({disabled:lr}),iterateFieldsByAction(j,(fr,Er)=>{const $r=get$4(j,Er);$r&&(fr.disabled=$r._f.disabled||lr,Array.isArray($r._f.refs)&&$r._f.refs.forEach(Pr=>{Pr.disabled=$r._f.disabled||lr}))},0,!1))},Vt=(lr,fr)=>async Er=>{let $r;Er&&(Er.preventDefault&&Er.preventDefault(),Er.persist&&Er.persist());let Pr=cloneObject(tt);if(ot.state.next({isSubmitting:!0}),a.resolver){const{errors:Rr,values:Ar}=await Mt();$.errors=Rr,Pr=Ar}else await Ft(j);if(unset($.errors,"root"),isEmptyObject($.errors)){ot.state.next({errors:{}});try{await lr(Pr,Er)}catch(Rr){$r=Rr}}else fr&&await fr({...$.errors},Er),Jt(),setTimeout(Jt);if(ot.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject($.errors)&&!$r,submitCount:$.submitCount+1,errors:$.errors}),$r)throw $r},Qt=(lr,fr={})=>{get$4(j,lr)&&(isUndefined$2(fr.defaultValue)?St(lr,cloneObject(get$4(et,lr))):(St(lr,fr.defaultValue),set$2(et,lr,cloneObject(fr.defaultValue))),fr.keepTouched||unset($.touchedFields,lr),fr.keepDirty||(unset($.dirtyFields,lr),$.isDirty=fr.defaultValue?yt(lr,cloneObject(get$4(et,lr))):yt()),fr.keepError||(unset($.errors,lr),st.isValid&&Ct()),ot.state.next({...$}))},dr=(lr,fr={})=>{const Er=lr?cloneObject(lr):et,$r=cloneObject(Er),Pr=isEmptyObject(lr),Rr=Pr?et:$r;if(fr.keepDefaultValues||(et=Er),!fr.keepValues){if(fr.keepDirtyValues)for(const Ar of nt.mount)get$4($.dirtyFields,Ar)?set$2(Rr,Ar,get$4(tt,Ar)):St(Ar,get$4(Rr,Ar));else{if(isWeb&&isUndefined$2(lr))for(const Ar of nt.mount){const Or=get$4(j,Ar);if(Or&&Or._f){const Lr=Array.isArray(Or._f.refs)?Or._f.refs[0]:Or._f.ref;if(isHTMLElement(Lr)){const ar=Lr.closest("form");if(ar){ar.reset();break}}}}j={}}tt=_.shouldUnregister?fr.keepDefaultValues?cloneObject(et):{}:cloneObject(Rr),ot.array.next({values:{...Rr}}),ot.values.next({values:{...Rr}})}nt={mount:fr.keepDirtyValues?nt.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},rt.mount=!st.isValid||!!fr.keepIsValid||!!fr.keepDirtyValues,rt.watch=!!_.shouldUnregister,ot.state.next({submitCount:fr.keepSubmitCount?$.submitCount:0,isDirty:Pr?!1:fr.keepDirty?$.isDirty:!!(fr.keepDefaultValues&&!deepEqual$1(lr,et)),isSubmitted:fr.keepIsSubmitted?$.isSubmitted:!1,dirtyFields:Pr?[]:fr.keepDirtyValues?fr.keepDefaultValues&&tt?getDirtyFields(et,tt):$.dirtyFields:fr.keepDefaultValues&&lr?getDirtyFields(et,lr):{},touchedFields:fr.keepTouched?$.touchedFields:{},errors:fr.keepErrors?$.errors:{},isSubmitSuccessful:fr.keepIsSubmitSuccessful?$.isSubmitSuccessful:!1,isSubmitting:!1})},xr=(lr,fr)=>dr(isFunction$4(lr)?lr(tt):lr,fr);return{control:{register:Kt,unregister:ir,getFieldState:wt,handleSubmit:Vt,setError:tr,_executeSchema:Mt,_getWatch:bt,_getDirty:yt,_updateValid:Ct,_removeUnmounted:Bt,_updateFieldArray:Tt,_updateDisabledField:Wt,_getFieldArray:ct,_reset:dr,_resetDefaultValues:()=>isFunction$4(a.defaultValues)&&a.defaultValues().then(lr=>{xr(lr,a.resetOptions),ot.state.next({isLoading:!1})}),_updateFormState:lr=>{$={...$,...lr}},_disableForm:Ht,_subjects:ot,_proxyFormState:st,_setErrors:Lt,get _fields(){return j},get _formValues(){return tt},get _state(){return rt},set _state(lr){rt=lr},get _defaultValues(){return et},get _names(){return nt},set _names(lr){nt=lr},get _formState(){return $},set _formState(lr){$=lr},get _options(){return a},set _options(lr){a={...a,...lr}}},trigger:Et,register:Kt,handleSubmit:Vt,watch:nr,setValue:St,getValues:At,reset:xr,resetField:Qt,clearErrors:Ot,unregister:ir,setError:tr,setFocus:(lr,fr={})=>{const Er=get$4(j,lr),$r=Er&&Er._f;if($r){const Pr=$r.refs?$r.refs[0]:$r.ref;Pr.focus&&(Pr.focus(),fr.shouldSelect&&Pr.select())}},getFieldState:wt}}function useForm(_={}){const a=React$2.useRef(),$=React$2.useRef(),[j,et]=React$2.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$4(_.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:_.errors||{},disabled:_.disabled||!1,defaultValues:isFunction$4(_.defaultValues)?void 0:_.defaultValues});a.current||(a.current={...createFormControl(_),formState:j});const tt=a.current.control;return tt._options=_,useSubscribe({subject:tt._subjects.state,next:rt=>{shouldRenderFormState(rt,tt._proxyFormState,tt._updateFormState)&&et({...tt._formState})}}),React$2.useEffect(()=>tt._disableForm(_.disabled),[tt,_.disabled]),React$2.useEffect(()=>{if(tt._proxyFormState.isDirty){const rt=tt._getDirty();rt!==j.isDirty&&tt._subjects.state.next({isDirty:rt})}},[tt,j.isDirty]),React$2.useEffect(()=>{_.values&&!deepEqual$1(_.values,$.current)?(tt._reset(_.values,tt._options.resetOptions),$.current=_.values,et(rt=>({...rt}))):tt._resetDefaultValues()},[_.values,tt]),React$2.useEffect(()=>{_.errors&&tt._setErrors(_.errors)},[_.errors,tt]),React$2.useEffect(()=>{tt._state.mount||(tt._updateValid(),tt._state.mount=!0),tt._state.watch&&(tt._state.watch=!1,tt._subjects.state.next({...tt._formState})),tt._removeUnmounted()}),React$2.useEffect(()=>{_.shouldUnregister&&tt._subjects.values.next({values:tt._getWatch()})},[_.shouldUnregister,tt]),a.current.formState=getProxyFormState(j,tt),a.current}const colors={orange:"#FB4F57",orangeL:"#FC7884",blue:"#0D99FF",blueL:"#4FA2FF",green:"#00C39A",greenL:"#00E7B6",black:"#000000",white:"#FFFFFF",gray:{900:"#121212",800:"#181818",700:"#282828",600:"#2C2B2B",500:"#414141",450:"#707070",400:"#C2C2C2",300:"#D6D6D6",200:"#EBEBEB",100:"#F0F0F0",50:"#F5F5F5"}},AccountsIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",textAlign:"center",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M14 5.6C14 5.03995 14 4.75992 14.109 4.54601C14.2049 4.35785 14.3578 4.20487 14.546 4.10899C14.7599 4 15.0399 4 15.6 4H18.4C18.9601 4 19.2401 4 19.454 4.10899C19.6422 4.20487 19.7951 4.35785 19.891 4.54601C20 4.75992 20 5.03995 20 5.6V8.4C20 8.96005 20 9.24008 19.891 9.45399C19.7951 9.64215 19.6422 9.79513 19.454 9.89101C19.2401 10 18.9601 10 18.4 10H15.6C15.0399 10 14.7599 10 14.546 9.89101C14.3578 9.79513 14.2049 9.64215 14.109 9.45399C14 9.24008 14 8.96005 14 8.4V5.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M4 5.6C4 5.03995 4 4.75992 4.10899 4.54601C4.20487 4.35785 4.35785 4.20487 4.54601 4.10899C4.75992 4 5.03995 4 5.6 4H8.4C8.96005 4 9.24008 4 9.45399 4.10899C9.64215 4.20487 9.79513 4.35785 9.89101 4.54601C10 4.75992 10 5.03995 10 5.6V8.4C10 8.96005 10 9.24008 9.89101 9.45399C9.79513 9.64215 9.64215 9.79513 9.45399 9.89101C9.24008 10 8.96005 10 8.4 10H5.6C5.03995 10 4.75992 10 4.54601 9.89101C4.35785 9.79513 4.20487 9.64215 4.10899 9.45399C4 9.24008 4 8.96005 4 8.4V5.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M4 15.6C4 15.0399 4 14.7599 4.10899 14.546C4.20487 14.3578 4.35785 14.2049 4.54601 14.109C4.75992 14 5.03995 14 5.6 14H8.4C8.96005 14 9.24008 14 9.45399 14.109C9.64215 14.2049 9.79513 14.3578 9.89101 14.546C10 14.7599 10 15.0399 10 15.6V18.4C10 18.9601 10 19.2401 9.89101 19.454C9.79513 19.6422 9.64215 19.7951 9.45399 19.891C9.24008 20 8.96005 20 8.4 20H5.6C5.03995 20 4.75992 20 4.54601 19.891C4.35785 19.7951 4.20487 19.6422 4.10899 19.454C4 19.2401 4 18.9601 4 18.4V15.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M14 15.6C14 15.0399 14 14.7599 14.109 14.546C14.2049 14.3578 14.3578 14.2049 14.546 14.109C14.7599 14 15.0399 14 15.6 14H18.4C18.9601 14 19.2401 14 19.454 14.109C19.6422 14.2049 19.7951 14.3578 19.891 14.546C20 14.7599 20 15.0399 20 15.6V18.4C20 18.9601 20 19.2401 19.891 19.454C19.7951 19.6422 19.6422 19.7951 19.454 19.891C19.2401 20 18.9601 20 18.4 20H15.6C15.0399 20 14.7599 20 14.546 19.891C14.3578 19.7951 14.2049 19.6422 14.109 19.454C14 19.2401 14 18.9601 14 18.4V15.6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})]}),AddAccountIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M8.25 13.5H4.65C3.80992 13.5 3.38988 13.5 3.06901 13.3365C2.78677 13.1927 2.5573 12.9632 2.41349 12.681C2.25 12.3601 2.25 11.9401 2.25 11.1V5.4C2.25 4.55992 2.25 4.13988 2.41349 3.81901C2.5573 3.53677 2.78677 3.3073 3.06901 3.16349C3.38988 3 3.80992 3 4.65 3H13.35C14.1901 3 14.6101 3 14.931 3.16349C15.2132 3.3073 15.4427 3.53677 15.5865 3.81901C15.75 4.13988 15.75 4.55992 15.75 5.4V8.25M2.25 6H15.75M13.5 15V10.5M15.75 12.7506L11.25 12.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),AddContactIcon=_=>jsxRuntimeExports.jsx(Icon,{fill:"none",viewBox:"0 0 13 17",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13 12.5L10.75 12.5M10.75 12.5L8.5 12.5M10.75 12.5V10.25M10.75 12.5V14.75M6.25 14.75H1C1 11.8505 3.35051 9.5 6.25 9.5C6.77123 9.5 7.27472 9.57596 7.75 9.71741M9.25 4.25C9.25 5.90685 7.90685 7.25 6.25 7.25C4.59315 7.25 3.25 5.90685 3.25 4.25C3.25 2.59315 4.59315 1.25 6.25 1.25C7.90685 1.25 9.25 2.59315 9.25 4.25Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),AddressBookIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13.5 15.5C13.2164 14.3589 11.981 13.5 10.5 13.5C9.019 13.5 7.78364 14.3589 7.5 15.5M21 5V7M21 11V13M21 17V19M6.2 21H14.8C15.9201 21 16.4802 21 16.908 20.782C17.2843 20.5903 17.5903 20.2843 17.782 19.908C18 19.4802 18 18.9201 18 17.8V6.2C18 5.0799 18 4.51984 17.782 4.09202C17.5903 3.71569 17.2843 3.40973 16.908 3.21799C16.4802 3 15.9201 3 14.8 3H6.2C5.0799 3 4.51984 3 4.09202 3.21799C3.71569 3.40973 3.40973 3.71569 3.21799 4.09202C3 4.51984 3 5.07989 3 6.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21ZM11.5 9.5C11.5 10.0523 11.0523 10.5 10.5 10.5C9.94772 10.5 9.5 10.0523 9.5 9.5C9.5 8.94772 9.94772 8.5 10.5 8.5C11.0523 8.5 11.5 8.94772 11.5 9.5Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),BakerIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],"data-testid":"baker-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.74946 5.25V8.25M7.49946 1.5V4.5M13.4995 12V15M2.24946 6.75H5.24946M5.99946 3H8.99946M11.9995 13.5H14.9995M10.4995 5.25L12.6208 7.37132M14.6369 2.80959L15.0612 3.23385C15.3582 3.53086 15.5067 3.67937 15.5624 3.85062C15.6113 4.00125 15.6113 4.16351 15.5624 4.31414C15.5067 4.48539 15.3582 4.6339 15.0612 4.93091L4.89356 15.0985C4.59655 15.3955 4.44804 15.5441 4.2768 15.5997C4.12617 15.6486 3.9639 15.6486 3.81327 15.5997C3.64203 15.5441 3.49352 15.3955 3.19651 15.0985L2.77224 14.6743C2.47523 14.3773 2.32672 14.2288 2.27108 14.0575C2.22214 13.9069 2.22214 13.7446 2.27108 13.594C2.32672 13.4227 2.47523 13.2742 2.77224 12.9772L12.9399 2.80959C13.2369 2.51258 13.3854 2.36407 13.5566 2.30843C13.7073 2.25948 13.8695 2.25948 14.0202 2.30843C14.1914 2.36407 14.3399 2.51258 14.6369 2.80959Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),BatchIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",strokeWidth:"1.2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M10 4V20M14 4V20M4 8C4 8.92997 4 9.39496 4.10222 9.77646C4.37962 10.8117 5.18827 11.6204 6.22354 11.8978C6.60504 12 7.07003 12 8 12H16C16.93 12 17.395 12 17.7765 11.8978C18.8117 11.6204 19.6204 10.8117 19.8978 9.77646C20 9.39496 20 8.92997 20 8M4 8C4 7.07003 4 6.60504 4.10222 6.22354C4.37962 5.18827 5.18827 4.37962 6.22354 4.10222C6.60504 4 7.07003 4 8 4H16C16.93 4 17.395 4 17.7765 4.10222C18.8117 4.37962 19.6204 5.18827 19.8978 6.22354C20 6.60504 20 7.07003 20 8M4 8V16C4 16.93 4 17.395 4.10222 17.7765C4.37962 18.8117 5.18827 19.6204 6.22354 19.8978C6.60504 20 7.07003 20 8 20H16C16.93 20 17.395 20 17.7765 19.8978C18.8117 19.6204 19.6204 18.8117 19.8978 17.7765C20 17.395 20 16.93 20 16V8M10 16H8C7.07003 16 6.60504 16 6.22354 15.8978C5.18827 15.6204 4.37962 14.8117 4.10222 13.7765C4 13.395 4 12.93 4 12M14 16H16C16.93 16 17.395 16 17.7765 15.8978C18.8117 15.6204 19.6204 14.8117 19.8978 13.7765C20 13.395 20 12.93 20 12M7 8H7.01M17 8H17.01",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round"})}),BurgerMenuIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],textAlign:"center",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4 6H20M4 12H20M4 18H20",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CheckmarkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M6 9.25L7.84615 11.25L12 6.75M15.75 9C15.75 12.7279 12.7279 15.75 9 15.75C5.27208 15.75 2.25 12.7279 2.25 9C2.25 5.27208 5.27208 2.25 9 2.25C12.7279 2.25 15.75 5.27208 15.75 9Z",stroke:"#00C39A",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronDownIcon$1=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4.5 6.75L9 11.25L13.5 6.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronRightIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M7 14L11.5 9.5L7 5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronUpIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4.5 11.25L9 6.75L13.5 11.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CoinIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 10V14M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ContactIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none","data-testid":"contact-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.75 15.75C3.75 12.8505 6.10051 10.5 9 10.5C11.8995 10.5 14.25 12.8505 14.25 15.75M12 5.25C12 6.90685 10.6569 8.25 9 8.25C7.34315 8.25 6 6.90685 6 5.25C6 3.59315 7.34315 2.25 9 2.25C10.6569 2.25 12 3.59315 12 5.25Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ContractIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M7.5 12.75L6 11.25L7.5 9.75M10.5 9.75L12 11.25L10.5 12.75M9.75 2.25H6.15C5.30992 2.25 4.88988 2.25 4.56901 2.41349C4.28677 2.5573 4.0573 2.78677 3.91349 3.06901C3.75 3.38988 3.75 3.80992 3.75 4.65V13.35C3.75 14.1901 3.75 14.6101 3.91349 14.931C4.0573 15.2132 4.28677 15.4427 4.56901 15.5865C4.88988 15.75 5.30992 15.75 6.15 15.75H11.85C12.6901 15.75 13.1101 15.75 13.431 15.5865C13.7132 15.4427 13.9427 15.2132 14.0865 14.931C14.25 14.6101 14.25 14.1901 14.25 13.35V6.75M9.75 2.25L14.25 6.75M9.75 2.25V6C9.75 6.41421 10.0858 6.75 10.5 6.75H14.25",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CrossedCircleIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13.773 13.773C14.9945 12.5515 15.75 10.864 15.75 9C15.75 5.27208 12.7279 2.25 9 2.25C7.13604 2.25 5.44854 3.00552 4.22703 4.22703M13.773 13.773C12.5515 14.9945 10.864 15.75 9 15.75C5.27208 15.75 2.25 12.7279 2.25 9C2.25 7.13604 3.00552 5.44854 4.22703 4.22703M13.773 13.773L4.22703 4.22703",stroke:"#FB4F57",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DiamondIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.125 9H20.875M12 3L8 9L12 20.6667L16 9L12 3ZM12.64 20.1467L20.64 9.48C20.7691 9.30787 20.8336 9.22181 20.8585 9.12728C20.8805 9.04385 20.8805 8.95615 20.8585 8.87272C20.8336 8.77819 20.7691 8.69213 20.64 8.52L16.74 3.32C16.652 3.20267 16.608 3.144 16.5522 3.10169C16.5028 3.06421 16.4469 3.03625 16.3873 3.01922C16.32 3 16.2467 3 16.1 3H7.9C7.75333 3 7.68 3 7.61269 3.01922C7.55308 3.03625 7.49715 3.06421 7.44776 3.10169C7.392 3.144 7.348 3.20267 7.26 3.32L3.36 8.52C3.2309 8.69213 3.16635 8.77819 3.14147 8.87271C3.11951 8.95615 3.11951 9.04385 3.14147 9.12728C3.16635 9.2218 3.2309 9.30787 3.36 9.48L11.36 20.1467C11.5771 20.4362 11.6857 20.5809 11.8188 20.6327C11.9353 20.678 12.0647 20.678 12.1812 20.6327C12.3143 20.5809 12.4229 20.4362 12.64 20.1467Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DocumentIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9 17H13M9 13H13M9 9H10M17 18V21M17 15H17.01M13 3H8.2C7.0799 3 6.51984 3 6.09202 3.21799C5.71569 3.40973 5.40973 3.71569 5.21799 4.09202C5 4.51984 5 5.0799 5 6.2V17.8C5 18.9201 5 19.4802 5.21799 19.908C5.40973 20.2843 5.71569 20.5903 6.09202 20.782C6.51984 21 7.0799 21 8.2 21H13M13 3L19 9M13 3V7.4C13 7.96005 13 8.24008 13.109 8.45399C13.2049 8.64215 13.3578 8.79513 13.546 8.89101C13.7599 9 14.0399 9 14.6 9H19M19 9V11.5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DoubleCheckmarkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4 14L9 19L20 8M6 8.88889L9.07692 12L16 5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DownloadIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"16px",height:"16px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M5 7.25L8 10.25M8 10.25L11 7.25M8 10.25V1.25M14.75 7.25V12.3494C14.75 13.1895 14.75 13.6095 14.5865 13.9304C14.4427 14.2126 14.2132 14.4421 13.931 14.5859C13.6101 14.7494 13.1901 14.7494 12.35 14.7494H3.65C2.80992 14.7494 2.38988 14.7494 2.06901 14.5859C1.78677 14.4421 1.5573 14.2126 1.41349 13.9304C1.25 13.6095 1.25 13.1895 1.25 12.3494V7.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),EditAccountIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M8.5 21H4C4 17.134 7.13401 14 11 14C11.1681 14 11.3348 14.0059 11.5 14.0176M15 7C15 9.20914 13.2091 11 11 11C8.79086 11 7 9.20914 7 7C7 4.79086 8.79086 3 11 3C13.2091 3 15 4.79086 15 7ZM12.5898 21L14.6148 20.595C14.7914 20.5597 14.8797 20.542 14.962 20.5097C15.0351 20.4811 15.1045 20.4439 15.1689 20.399C15.2414 20.3484 15.3051 20.2848 15.4324 20.1574L19.5898 16C20.1421 15.4477 20.1421 14.5523 19.5898 14C19.0376 13.4477 18.1421 13.4477 17.5898 14L13.4324 18.1574C13.3051 18.2848 13.2414 18.3484 13.1908 18.421C13.1459 18.4853 13.1088 18.5548 13.0801 18.6279C13.0478 18.7102 13.0302 18.7985 12.9948 18.975L12.5898 21Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),EmailIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"28px",height:"28px",fill:"black","data-testid":"email-icon",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:`M23.332 4.66602H4.66536C3.38203 4.66602 2.3437 5.71602 2.3437 6.99935L2.33203 20.9993C2.33203 22.2827 3.38203 23.3327 4.66536 23.3327H23.332C24.6154 23.3327 25.6654 22.2827 25.6654 20.9993V6.99935C25.6654 5.71602 24.6154 4.66602 23.332 4.66602ZM23.332 9.33268L13.9987 - 15.166L4.66536 9.33268V6.99935L13.9987 12.8327L23.332 6.99935V9.33268Z`})}),ExclamationIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"12px",height:"12px",fill:"none",stroke:colors.orange,viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M6 3.66667V6.58333M6 8.33333H6.00583M11.25 6C11.25 8.89949 8.89949 11.25 6 11.25C3.1005 11.25 0.75 8.89949 0.75 6C0.75 3.1005 3.1005 0.75 6 0.75C8.89949 0.75 11.25 3.1005 11.25 6Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ExitArrowIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15 3V15M3 9H12M12 9L9 6M12 9L9 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ExternalLinkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15 3L9 9M15 3V6.375M15 3H11.625M14.25 9.375V12.6C14.25 13.4401 14.25 13.8601 14.0865 14.181C13.9427 14.4632 13.7132 14.6927 13.431 14.8365C13.1101 15 12.6901 15 11.85 15H5.4C4.55992 15 4.13988 15 3.81901 14.8365C3.53677 14.6927 3.3073 14.4632 3.16349 14.181C3 13.8601 3 13.4401 3 12.6V6.15C3 5.30992 3 4.88988 3.16349 4.56901C3.3073 4.28677 3.53677 4.0573 3.81901 3.91349C4.13988 3.75 4.55992 3.75 5.4 3.75H8.625",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),EyeIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"16px",height:"12px",fill:"none",viewBox:"0 0 16 12",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M10.2501 6C10.2501 7.24264 9.2427 8.25 8.00006 8.25C6.75742 8.25 5.75006 7.24264 5.75006 6C5.75006 4.75736 6.75742 3.75 8.00006 3.75C9.2427 3.75 10.2501 4.75736 10.2501 6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M8.00039 0.75C4.64217 0.75 1.79946 2.95716 0.84375 5.99997C1.79944 9.04282 4.64217 11.25 8.00041 11.25C11.3586 11.25 14.2013 9.04284 15.157 6.00003C14.2014 2.95719 11.3586 0.75 8.00039 0.75Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})]}),EyeSlashIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M2.25024 2.25L15.7502 15.75M7.38345 7.43523C6.99147 7.84016 6.75024 8.39191 6.75024 9C6.75024 10.2426 7.7576 11.25 9.00024 11.25C9.6171 11.25 10.176 11.0018 10.5824 10.5997M4.87524 4.98536C3.45076 5.92525 2.36577 7.33796 1.84375 8.99997C2.79944 12.0428 5.64217 14.25 9.00041 14.25C10.4921 14.25 11.882 13.8145 13.0501 13.0638M8.25024 3.78705C8.49697 3.76254 8.74722 3.75 9.00039 3.75C12.3586 3.75 15.2014 5.95719 16.157 9.00003C15.9465 9.67048 15.6443 10.3004 15.2651 10.875",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FA12Icon=_=>jsxRuntimeExports.jsx(Icon,{width:"30px",height:"15px",fill:colors.gray[450],viewBox:"1 1 30 15",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.2429 13V4.27273H7.02131V5.79403H3.08807V7.87358H6.63778V9.39489H3.08807V13H1.2429ZM8.67685 13H6.69957L9.71236 4.27273H12.0902L15.0987 13H13.1214L10.9354 6.26705H10.8672L8.67685 13ZM8.55327 9.5696H13.2237V11.0099H8.55327V9.5696ZM19.4847 4.27273V13H17.6396V6.02415H17.5884L15.5898 7.27699V5.64062L17.7504 4.27273H19.4847ZM22.1683 13.1108C21.8871 13.1108 21.6456 13.0114 21.4439 12.8125C21.245 12.6108 21.1456 12.3693 21.1456 12.0881C21.1456 11.8097 21.245 11.571 21.4439 11.3722C21.6456 11.1733 21.8871 11.0739 22.1683 11.0739C22.4411 11.0739 22.6797 11.1733 22.8842 11.3722C23.0888 11.571 23.1911 11.8097 23.1911 12.0881C23.1911 12.2756 23.1428 12.4474 23.0462 12.6037C22.9524 12.7571 22.8288 12.8807 22.6754 12.9744C22.522 13.0653 22.353 13.1108 22.1683 13.1108ZM24.6644 13V11.6705L27.771 8.79403C28.0352 8.53835 28.2567 8.30824 28.4357 8.10369C28.6175 7.89915 28.7553 7.69886 28.8491 7.50284C28.9428 7.30398 28.9897 7.08949 28.9897 6.85938C28.9897 6.60369 28.9315 6.38352 28.815 6.19886C28.6985 6.01136 28.5394 5.8679 28.3377 5.76847C28.136 5.66619 27.9073 5.61506 27.6516 5.61506C27.3846 5.61506 27.1516 5.66903 26.9528 5.77699C26.7539 5.88494 26.6005 6.03977 26.4925 6.24148C26.3846 6.44318 26.3306 6.68324 26.3306 6.96165H24.5792C24.5792 6.39062 24.7085 5.89489 24.967 5.47443C25.2255 5.05398 25.5877 4.72869 26.0536 4.49858C26.5195 4.26847 27.0565 4.15341 27.6644 4.15341C28.2894 4.15341 28.8335 4.2642 29.2965 4.4858C29.7624 4.70455 30.1246 5.00852 30.3832 5.39773C30.6417 5.78693 30.771 6.23295 30.771 6.7358C30.771 7.06534 30.7056 7.39062 30.5749 7.71165C30.4471 8.03267 30.2184 8.3892 29.8888 8.78125C29.5593 9.17045 29.0948 9.63778 28.4954 10.1832L27.2212 11.4318V11.4915H30.886V13H24.6644Z"})}),FA2Icon=_=>jsxRuntimeExports.jsx(Icon,{width:"23px",height:"18px",fill:colors.gray[450],viewBox:"0 0 23 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.0261 13V4.27273H6.80451V5.79403H2.87127V7.87358H6.42099V9.39489H2.87127V13H1.0261ZM8.46005 13H6.48278L9.49556 4.27273H11.8734L14.8819 13H12.9047L10.7186 6.26705H10.6504L8.46005 13ZM8.33647 9.5696H13.0069V11.0099H8.33647V9.5696ZM15.8812 13V11.6705L18.9877 8.79403C19.252 8.53835 19.4735 8.30824 19.6525 8.10369C19.8343 7.89915 19.9721 7.69886 20.0659 7.50284C20.1596 7.30398 20.2065 7.08949 20.2065 6.85938C20.2065 6.60369 20.1483 6.38352 20.0318 6.19886C19.9153 6.01136 19.7562 5.8679 19.5545 5.76847C19.3528 5.66619 19.1241 5.61506 18.8684 5.61506C18.6014 5.61506 18.3684 5.66903 18.1696 5.77699C17.9707 5.88494 17.8173 6.03977 17.7093 6.24148C17.6014 6.44318 17.5474 6.68324 17.5474 6.96165H15.796C15.796 6.39062 15.9252 5.89489 16.1838 5.47443C16.4423 5.05398 16.8045 4.72869 17.2704 4.49858C17.7363 4.26847 18.2733 4.15341 18.8812 4.15341C19.5062 4.15341 20.0502 4.2642 20.5133 4.4858C20.9792 4.70455 21.3414 5.00852 21.6 5.39773C21.8585 5.78693 21.9877 6.23295 21.9877 6.7358C21.9877 7.06534 21.9224 7.39062 21.7917 7.71165C21.6639 8.03267 21.4352 8.3892 21.1056 8.78125C20.7761 9.17045 20.3116 9.63778 19.7122 10.1832L18.438 11.4318V11.4915H22.1028V13H15.8812Z"})}),FacebookIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"28px",height:"28px",fill:"none","data-testid":"facebook-icon",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M28 14.0856C28 6.30633 21.732 0 14 0C6.26801 0 0 6.30633 0 14.0856C0 21.1161 5.1196 26.9434 11.8125 28V18.1572H8.25781V14.0856H11.8125V10.9824C11.8125 7.45215 13.9026 5.50218 17.1005 5.50218C18.6322 5.50218 20.2344 5.77729 20.2344 5.77729V9.24367H18.469C16.7299 9.24367 16.1875 10.3294 16.1875 11.4434V14.0856H20.0703L19.4496 18.1572H16.1875V28C22.8804 26.9434 28 21.1161 28 14.0856Z",fill:"#1977F2",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M19.4496 18.0469L20.0703 14H16.1875V11.3738C16.1875 10.2667 16.7299 9.1875 18.469 9.1875H20.2344V5.74219C20.2344 5.74219 18.6322 5.46875 17.1005 5.46875C13.9026 5.46875 11.8125 7.40687 11.8125 10.9156V14H8.25781V18.0469H11.8125V27.8299C13.262 28.0567 14.738 28.0567 16.1875 27.8299V18.0469H19.4496Z",fill:"white",clipRule:"evenodd",fillRule:"evenodd"})]}),FetchingIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"19px",height:"19px",fill:"none",stroke:colors.gray[400],viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15.7842 10.2916C15.8165 10.0323 15.8332 9.76807 15.8332 9.49996C15.8332 6.00216 12.9976 3.16663 9.49984 3.16663C7.52021 3.16663 5.75273 4.07488 4.59135 5.49742M3.2155 8.70829C3.18316 8.96764 3.1665 9.23185 3.1665 9.49996C3.1665 12.9978 6.00203 15.8333 9.49984 15.8333C11.3914 15.8333 13.0893 15.004 14.2498 13.6892M11.8748 13.4583H14.2498V13.6892M4.59135 3.16663V5.49742M4.59135 5.49742V5.54157L6.96635 5.54163M14.2498 15.8333V13.6892",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FileArrowDownIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9 8.25V12.75M9 12.75L7.5 11.25M9 12.75L10.5 11.25M9.75 2.25H6.15C5.30992 2.25 4.88988 2.25 4.56901 2.41349C4.28677 2.5573 4.0573 2.78677 3.91349 3.06901C3.75 3.38988 3.75 3.80992 3.75 4.65V13.35C3.75 14.1901 3.75 14.6101 3.91349 14.931C4.0573 15.2132 4.28677 15.4427 4.56901 15.5865C4.88988 15.75 5.30992 15.75 6.15 15.75H11.85C12.6901 15.75 13.1101 15.75 13.431 15.5865C13.7132 15.4427 13.9427 15.2132 14.0865 14.931C14.25 14.6101 14.25 14.1901 14.25 13.35V6.75M9.75 2.25L14.25 6.75M9.75 2.25V5.55C9.75 5.97004 9.75 6.18006 9.83175 6.34049C9.90365 6.48161 10.0184 6.59635 10.1595 6.66825C10.3199 6.75 10.53 6.75 10.95 6.75H14.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FileCopyIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M11.25 2.25V4.8C11.25 5.22004 11.25 5.43006 11.3317 5.59049C11.4037 5.73161 11.5184 5.84635 11.6595 5.91825C11.8199 6 12.03 6 12.45 6H15M7.5 6H4.5C3.67157 6 3 6.67157 3 7.5V14.25C3 15.0784 3.67157 15.75 4.5 15.75H9C9.82843 15.75 10.5 15.0784 10.5 14.25V12M12 2.25H9.9C9.05992 2.25 8.63988 2.25 8.31901 2.41349C8.03677 2.5573 7.8073 2.78677 7.66349 3.06901C7.5 3.38988 7.5 3.80992 7.5 4.65V9.6C7.5 10.4401 7.5 10.8601 7.66349 11.181C7.8073 11.4632 8.03677 11.6927 8.31901 11.8365C8.63988 12 9.05992 12 9.9 12H12.6C13.4401 12 13.8601 12 14.181 11.8365C14.4632 11.6927 14.6927 11.4632 14.8365 11.181C15 10.8601 15 10.4401 15 9.6V5.25L12 2.25Z",strokeLinejoin:"round",strokeWidth:"1.2"})}),FlipForwardEnergy=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:"black",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M2.95314 5.997C4.05824 3.77605 6.35091 2.25 9 2.25C12.4718 2.25 15.3314 4.87105 15.708 8.24231M2.2912 9.74998C2.66427 13.125 5.52558 15.75 9 15.75C11.6496 15.75 13.9427 14.2234 15.0475 12.0017M2.25 3V6.375H5.625M15.75 15.375V12H12.375M8.625 6.75L7.5 9H10.5L9.375 11.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FolderInfoIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[400],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 10H12.01M12 13V16M12.0627 6.06274L11.9373 5.93726C11.5914 5.59135 11.4184 5.4184 11.2166 5.29472C11.0376 5.18506 10.8425 5.10425 10.6385 5.05526C10.4083 5 10.1637 5 9.67452 5H6.2C5.0799 5 4.51984 5 4.09202 5.21799C3.71569 5.40973 3.40973 5.71569 3.21799 6.09202C3 6.51984 3 7.07989 3 8.2V15.8C3 16.9201 3 17.4802 3.21799 17.908C3.40973 18.2843 3.71569 18.5903 4.09202 18.782C4.51984 19 5.07989 19 6.2 19H17.8C18.9201 19 19.4802 19 19.908 18.782C20.2843 18.5903 20.5903 18.2843 20.782 17.908C21 17.4802 21 16.9201 21 15.8V10.2C21 9.0799 21 8.51984 20.782 8.09202C20.5903 7.71569 20.2843 7.40973 19.908 7.21799C19.4802 7 18.9201 7 17.8 7H14.3255C13.8363 7 13.5917 7 13.3615 6.94474C13.1575 6.89575 12.9624 6.81494 12.7834 6.70528C12.5816 6.5816 12.4086 6.40865 12.0627 6.06274Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),GearIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M12.9046 3.06005C12.6988 3 12.4659 3 12 3C11.5341 3 11.3012 3 11.0954 3.06005C10.7942 3.14794 10.5281 3.32808 10.3346 3.57511C10.2024 3.74388 10.1159 3.96016 9.94291 4.39272C9.69419 5.01452 9.00393 5.33471 8.36857 5.123L7.79779 4.93281C7.3929 4.79785 7.19045 4.73036 6.99196 4.7188C6.70039 4.70181 6.4102 4.77032 6.15701 4.9159C5.98465 5.01501 5.83376 5.16591 5.53197 5.4677C5.21122 5.78845 5.05084 5.94882 4.94896 6.13189C4.79927 6.40084 4.73595 6.70934 4.76759 7.01551C4.78912 7.2239 4.87335 7.43449 5.04182 7.85566C5.30565 8.51523 5.05184 9.26878 4.44272 9.63433L4.16521 9.80087C3.74031 10.0558 3.52786 10.1833 3.37354 10.3588C3.23698 10.5141 3.13401 10.696 3.07109 10.893C3 11.1156 3 11.3658 3 11.8663C3 12.4589 3 12.7551 3.09462 13.0088C3.17823 13.2329 3.31422 13.4337 3.49124 13.5946C3.69158 13.7766 3.96395 13.8856 4.50866 14.1035C5.06534 14.3261 5.35196 14.9441 5.16236 15.5129L4.94721 16.1584C4.79819 16.6054 4.72367 16.829 4.7169 17.0486C4.70875 17.3127 4.77049 17.5742 4.89587 17.8067C5.00015 18.0002 5.16678 18.1668 5.5 18.5C5.83323 18.8332 5.99985 18.9998 6.19325 19.1041C6.4258 19.2295 6.68733 19.2913 6.9514 19.2831C7.17102 19.2763 7.39456 19.2018 7.84164 19.0528L8.36862 18.8771C9.00393 18.6654 9.6942 18.9855 9.94291 19.6073C10.1159 20.0398 10.2024 20.2561 10.3346 20.4249C10.5281 20.6719 10.7942 20.8521 11.0954 20.94C11.3012 21 11.5341 21 12 21C12.4659 21 12.6988 21 12.9046 20.94C13.2058 20.8521 13.4719 20.6719 13.6654 20.4249C13.7976 20.2561 13.8841 20.0398 14.0571 19.6073C14.3058 18.9855 14.9961 18.6654 15.6313 18.8773L16.1579 19.0529C16.605 19.2019 16.8286 19.2764 17.0482 19.2832C17.3123 19.2913 17.5738 19.2296 17.8063 19.1042C17.9997 18.9999 18.1664 18.8333 18.4996 18.5001C18.8328 18.1669 18.9994 18.0002 19.1037 17.8068C19.2291 17.5743 19.2908 17.3127 19.2827 17.0487C19.2759 16.8291 19.2014 16.6055 19.0524 16.1584L18.8374 15.5134C18.6477 14.9444 18.9344 14.3262 19.4913 14.1035C20.036 13.8856 20.3084 13.7766 20.5088 13.5946C20.6858 13.4337 20.8218 13.2329 20.9054 13.0088C21 12.7551 21 12.4589 21 11.8663C21 11.3658 21 11.1156 20.9289 10.893C20.866 10.696 20.763 10.5141 20.6265 10.3588C20.4721 10.1833 20.2597 10.0558 19.8348 9.80087L19.5569 9.63416C18.9478 9.26867 18.6939 8.51514 18.9578 7.85558C19.1262 7.43443 19.2105 7.22383 19.232 7.01543C19.2636 6.70926 19.2003 6.40077 19.0506 6.13181C18.9487 5.94875 18.7884 5.78837 18.4676 5.46762C18.1658 5.16584 18.0149 5.01494 17.8426 4.91583C17.5894 4.77024 17.2992 4.70174 17.0076 4.71872C16.8091 4.73029 16.6067 4.79777 16.2018 4.93273L15.6314 5.12287C14.9961 5.33464 14.3058 5.0145 14.0571 4.39272C13.8841 3.96016 13.7976 3.74388 13.6654 3.57511C13.4719 3.32808 13.2058 3.14794 12.9046 3.06005Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})]}),GoogleIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none","data-testid":"google-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M23.5198 12.2729C23.5198 11.422 23.4435 10.6038 23.3016 9.81836H12V14.4601H18.4581C18.1799 15.9601 17.3345 17.231 16.0636 18.0819V21.0927H19.9417C22.2107 19.0037 23.5198 15.9274 23.5198 12.2729Z",fill:"#4285F4",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M12.0008 24.0011C15.2408 24.0011 17.9571 22.9266 19.9425 21.0939L16.0644 18.083C14.9899 18.803 13.6153 19.2284 12.0008 19.2284C8.8754 19.2284 6.22999 17.1176 5.28637 14.2812H1.27734V17.3903C3.25186 21.312 7.30997 24.0011 12.0008 24.0011Z",fill:"#34A853",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M5.28537 14.2803C5.04537 13.5603 4.90901 12.7912 4.90901 12.0003C4.90901 11.2094 5.04537 10.4404 5.28537 9.72037V6.61133H1.27634C0.463629 8.2313 0 10.064 0 12.0003C0 13.9367 0.463629 15.7694 1.27634 17.3893L5.28537 14.2803Z",fill:"#FBBC05",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M12.0008 4.77265C13.7626 4.77265 15.3444 5.3781 16.588 6.56717L20.0298 3.1254C17.9516 1.18907 15.2353 0 12.0008 0C7.30997 0 3.25186 2.68905 1.27734 6.6108L5.28637 9.71984C6.22999 6.88353 8.8754 4.77265 12.0008 4.77265Z",fill:"#EA4335",clipRule:"evenodd",fillRule:"evenodd"})]}),HelpIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M18.3795 5.65166L14.1055 9.86303M9.89445 14.137L5.63994 18.3679M5.63408 5.63799L9.89445 9.86303M14.1056 14.137L18.364 18.364M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),HourglassIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15 2.25H3M15 15.75H3M3.75 2.25C3.75 4.13267 4.65921 5.89944 6.1912 6.99371L11.8088 11.0063C13.3408 12.1006 14.25 13.8673 14.25 15.75M14.25 2.25C14.25 4.13267 13.3408 5.89944 11.8088 6.99371L6.1912 11.0063C4.65921 12.1006 3.75 13.8673 3.75 15.75",stroke:"#FB4F57",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),OutgoingArrow=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],"data-testid":"outgoing-arrow-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M5.25 12.75L12.75 5.25M12.75 5.25H6M12.75 5.25V12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),IncomingArrow=_=>jsxRuntimeExports.jsx(OutgoingArrow,{css:{rotate:"180deg"},..._}),KeyIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],"data-testid":"key-icon",strokeWidth:"1.2",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9.24092 8.01389L3 14.25L4.5 15.75M5.25 12L6.75 13.5M15 5.625C15 7.48896 13.489 9 11.625 9C9.76104 9 8.25 7.48896 8.25 5.625C8.25 3.76104 9.76104 2.25 11.625 2.25C13.489 2.25 15 3.76104 15 5.625Z",strokeLinecap:"round",strokeLinejoin:"round"})}),LedgerIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:colors.gray[400],"data-testid":"ledger-icon",strokeWidth:"0",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M11.666 7.29183H12.3952V8.75016H9.47852V4.37516H10.9368L8.74935 1.4585L6.56185 4.37516H8.02018V10.2085H5.10352V8.54818C5.5381 8.29516 5.83268 7.82995 5.83268 7.29183C5.83268 6.90506 5.67904 6.53412 5.40555 6.26063C5.13206 5.98714 4.76112 5.8335 4.37435 5.8335C3.98757 5.8335 3.61664 5.98714 3.34315 6.26063C3.06966 6.53412 2.91602 6.90506 2.91602 7.29183C2.91602 7.82995 3.2106 8.29516 3.64518 8.54818V10.2085C3.64518 11.0128 4.29924 11.6668 5.10352 11.6668H8.02018V13.3271C7.79896 13.454 7.61508 13.6369 7.48707 13.8575C7.35906 14.0781 7.29143 14.3285 7.29102 14.5835C7.29102 14.9703 7.44466 15.3412 7.71815 15.6147C7.99164 15.8882 8.36257 16.0418 8.74935 16.0418C9.13612 16.0418 9.50706 15.8882 9.78055 15.6147C10.054 15.3412 10.2077 14.9703 10.2077 14.5835C10.2077 14.0454 9.9131 13.5802 9.47852 13.3271V10.2085H12.3952C13.1995 10.2085 13.8535 9.55443 13.8535 8.75016V7.29183H14.5827V4.37516H11.666V7.29183Z"})}),LinkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9.16586 17.6508C8.9261 17.8747 8.74055 18.0245 8.55093 18.134C7.62273 18.6699 6.47914 18.6699 5.55093 18.134C5.20889 17.9365 4.88009 17.6077 4.22251 16.9501C3.56492 16.2925 3.23612 15.9637 3.03864 15.6217C2.50274 14.6935 2.50274 13.5499 3.03864 12.6217C3.23612 12.2797 3.56492 11.9509 4.2225 11.2933L7.05093 8.46484C7.70852 7.80725 8.03732 7.47846 8.37936 7.28098C9.30756 6.74508 10.4512 6.74508 11.3794 7.28098C11.7214 7.47846 12.0502 7.80725 12.7078 8.46484C13.3654 9.12243 13.6942 9.45123 13.8916 9.79327C14.4275 10.7215 14.4275 11.8651 13.8916 12.7933C13.7822 12.9829 13.6323 13.1684 13.4085 13.4082M10.5929 10.5926C10.369 10.8323 10.2192 11.0179 10.1097 11.2075C9.57381 12.1357 9.57381 13.2793 10.1097 14.2075C10.3072 14.5495 10.636 14.8783 11.2936 15.5359C11.9512 16.1935 12.28 16.5223 12.622 16.7198C13.5502 17.2557 14.6938 17.2557 15.622 16.7198C15.964 16.5223 16.2928 16.1935 16.9504 15.5359L19.7789 12.7075C20.4364 12.0499 20.7652 11.7211 20.9627 11.3791C21.4986 10.4509 21.4986 9.30726 20.9627 8.37906C20.7652 8.03701 20.4364 7.70822 19.7789 7.05063C19.1213 6.39304 18.7925 6.06425 18.4504 5.86677C17.5222 5.33087 16.3786 5.33087 15.4504 5.86677C15.2608 5.97625 15.0753 6.12608 14.8355 6.34992",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),LockIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 14.5V16.5M7 10.0288C7.47142 10 8.05259 10 8.8 10H15.2C15.9474 10 16.5286 10 17 10.0288M7 10.0288C6.41168 10.0647 5.99429 10.1455 5.63803 10.327C5.07354 10.6146 4.6146 11.0735 4.32698 11.638C4 12.2798 4 13.1198 4 14.8V16.2C4 17.8802 4 18.7202 4.32698 19.362C4.6146 19.9265 5.07354 20.3854 5.63803 20.673C6.27976 21 7.11984 21 8.8 21H15.2C16.8802 21 17.7202 21 18.362 20.673C18.9265 20.3854 19.3854 19.9265 19.673 19.362C20 18.7202 20 17.8802 20 16.2V14.8C20 13.1198 20 12.2798 19.673 11.638C19.3854 11.0735 18.9265 10.6146 18.362 10.327C18.0057 10.1455 17.5883 10.0647 17 10.0288M7 10.0288V8C7 5.23858 9.23858 3 12 3C14.7614 3 17 5.23858 17 8V10.0288",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),MaintenanceIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:"black",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12.182 5.81859C13.9393 7.57595 13.9393 10.4252 12.182 12.1825M5.81802 12.1825C4.06066 10.4252 4.06066 7.57592 5.81802 5.81856M3.6967 14.3039C0.767767 11.3749 0.767767 6.6262 3.6967 3.69727M14.3033 3.6973C17.2322 6.62623 17.2322 11.375 14.3033 14.3039M10.5 9.00057C10.5 9.82899 9.82843 10.5006 9 10.5006C8.17157 10.5006 7.5 9.82899 7.5 9.00057C7.5 8.17214 8.17157 7.50057 9 7.50057C9.82843 7.50057 10.5 8.17214 10.5 9.00057Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),MakiIcon=({fishColor:_,...a})=>jsxRuntimeExports.jsxs(Icon,{width:"38px",height:"38px",fill:"none",viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",...a,children:[jsxRuntimeExports.jsx("path",{d:"M34.9985 26.2751C34.6599 26.8629 34.2436 27.4106 33.7512 27.9032C32.2815 29.3727 30.3277 30.1819 28.2496 30.1819H24.8477V34.9996H26.8032H28.2497C30.0524 34.9996 31.7472 34.2976 33.022 33.0229C34.2967 31.7481 34.9986 30.0533 34.9985 28.2507V26.2751Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M34.9989 20.9441C34.6603 21.5318 34.2439 22.0796 33.7514 22.572C32.2819 24.0416 30.328 24.8509 28.2499 24.8509H18.9983C17.8104 24.8511 16.8477 25.814 16.8477 27.0019C16.8477 28.1898 17.8104 29.1528 18.9983 29.153H28.25C30.0526 29.153 31.7474 28.4511 33.0222 27.1763C34.2965 25.902 34.9986 24.2076 34.9989 22.4054V20.9441ZM18.9988 27.8361C18.5381 27.8361 18.1645 27.4626 18.1645 27.0018C18.1645 26.5412 18.5381 26.1675 18.9988 26.1675C19.4596 26.1675 19.8331 26.5412 19.8331 27.0018C19.8331 27.4626 19.4596 27.8361 18.9988 27.8361Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M35 9.74895C35 6.02751 31.9724 3 28.2509 3H9.74908C6.02761 3 3 6.02751 3 9.74895V28.2511C3 31.9725 6.02761 35 9.74899 35H23.8176V30.1824H18.9995C17.2418 30.1824 15.8171 28.7576 15.8171 27.0001C15.8171 25.2426 17.2418 23.8179 18.9995 23.8179H23.8176V18.9998H9.74899C6.5911 18.9998 4.03113 16.4402 4.03113 13.2824V9.74905C4.03113 6.59127 6.5911 4.03131 9.74899 4.03131H28.2508C31.4087 4.03131 33.9686 6.59127 33.9686 9.74905V13.2824C33.9686 16.4403 31.4089 19.0001 28.251 19.0001L24.8491 18.9998V23.8179H28.2511C30.0539 23.8179 31.7487 23.1159 33.0233 21.8411C34.2977 20.5668 34.9997 18.8725 35 17.0703V9.74895Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M28.251 4.03174C31.4088 4.03174 33.9687 6.59167 33.9687 9.74952V13.2828C33.9687 16.4406 31.4089 19.0005 28.2511 19.0005L9.74908 19.0003C6.59124 19.0003 4.03125 16.4406 4.03125 13.2829V9.74954C4.03125 6.59167 6.5912 4.03174 9.74908 4.03174H28.251Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M28.2511 6.73267C29.611 6.73267 30.7641 7.6364 31.1394 8.87525C31.1926 9.05118 31.0527 9.22558 30.869 9.21814C28.2867 9.11348 25.877 8.32896 23.8154 7.038C23.6751 6.95014 23.739 6.73267 23.9045 6.73267H28.2511Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M21.9973 7.02488C24.4283 8.9081 27.4326 10.0842 30.7 10.2428C31.0172 10.2581 31.2679 10.5166 31.2679 10.8342V12.8702C31.2674 12.9124 31.2661 13.0446 31.2638 13.1857C31.2603 13.4148 31.069 13.5949 30.8401 13.5876C25.3913 13.4117 20.5215 10.9067 17.1937 7.03888C17.0905 6.91878 17.175 6.73267 17.3334 6.73267H21.1443C21.4533 6.73267 21.753 6.83569 21.9973 7.02488Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M15.9653 7.17305C19.4649 11.5395 24.7681 14.4013 30.735 14.6156C30.8376 14.6193 30.9004 14.7309 30.8481 14.8191C30.3219 15.7056 29.3544 16.3012 28.2505 16.3012H23.1255C22.9317 16.3012 22.7392 16.2646 22.5603 16.1899C18.0848 14.3242 14.3146 11.0926 11.7745 7.01866C11.6968 6.89417 11.7878 6.73267 11.9345 6.73267H15.0503C15.4065 6.73267 15.7426 6.89513 15.9653 7.17305Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M9.75058 6.73267H10.1145C10.294 6.73267 10.4589 6.82889 10.5496 6.98379C12.776 10.7844 16.0081 13.9276 19.8791 16.0439C20.0039 16.1122 19.9556 16.3012 19.8134 16.3012H15.1194C14.5651 16.3012 14.0261 16.1087 13.6043 15.7491C11.1433 13.6507 9.05479 11.1267 7.45371 8.29236C7.34983 8.10846 7.3762 7.87733 7.51835 7.72112C8.07107 7.11383 8.86658 6.73267 9.75058 6.73267Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M12.3071 15.9829C12.4313 16.0951 12.3514 16.3013 12.184 16.3013H9.71437C8.06547 16.2829 6.73047 14.9363 6.73047 13.2836V9.7504L6.73065 9.54576C6.73077 9.42446 6.89048 9.37962 6.95305 9.48354C8.41152 11.9061 10.2194 14.096 12.3071 15.9829Z",fill:_})]}),NoticeIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 8H12.01M12 11V16M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),OutlineExclamationCircleIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"16px",height:"16px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M8 5V8.75M8 11H8.0075M14.75 8C14.75 11.7279 11.7279 14.75 8 14.75C4.27208 14.75 1.25 11.7279 1.25 8C1.25 4.27208 4.27208 1.25 8 1.25C11.7279 1.25 14.75 4.27208 14.75 8Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),PenIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M11.3348 4.66483L13.2208 6.55082M3 15L3.03164 14.7785C3.1436 13.9948 3.19958 13.6029 3.32692 13.2371C3.43992 12.9124 3.59428 12.6037 3.78619 12.3185C4.00247 11.9971 4.28237 11.7172 4.84218 11.1574L12.609 3.3906C13.1298 2.8698 13.9742 2.8698 14.495 3.3906C15.0158 3.9114 15.0158 4.75578 14.495 5.27658L6.58565 13.1859C6.07779 13.6938 5.82386 13.9477 5.53462 14.1497C5.27789 14.3289 5.001 14.4774 4.70965 14.5921C4.3814 14.7213 4.02937 14.7923 3.32535 14.9344L3 15Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),PlusIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[300],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4 12H20M12 4V20",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),RedditIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none","data-testid":"reddit-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M12 0C5.37281 0 0 5.37281 0 12C0 15.3141 1.34344 18.3141 3.51469 20.4853L1.22906 22.7709C0.775312 23.2247 1.09688 24 1.73813 24H12C18.6272 24 24 18.6272 24 12C24 5.37281 18.6272 0 12 0Z",fill:"#FF4500"}),jsxRuntimeExports.jsx("path",{d:"M14.4414 5.65922C14.6495 6.54141 15.4417 7.19859 16.3877 7.19859C17.492 7.19859 18.3873 6.30328 18.3873 5.19891C18.3873 4.09453 17.492 3.19922 16.3877 3.19922C15.422 3.19922 14.6167 3.88359 14.4292 4.79391C12.812 4.96734 11.5492 6.33891 11.5492 8.00109C11.5492 8.00484 11.5492 8.00766 11.5492 8.01141C9.79047 8.08547 8.18453 8.58609 6.90953 9.37641C6.43609 9.00984 5.84172 8.79141 5.19672 8.79141C3.64891 8.79141 2.39453 10.0458 2.39453 11.5936C2.39453 12.7167 3.05453 13.6842 4.00797 14.1314C4.10078 17.3845 7.64547 20.0011 12.0058 20.0011C16.3661 20.0011 19.9155 17.3817 20.0036 14.1258C20.9495 13.6758 21.6039 12.7111 21.6039 11.5945C21.6039 10.0467 20.3495 8.79234 18.8017 8.79234C18.1595 8.79234 17.568 9.00891 17.0955 9.37266C15.8092 8.57672 14.1855 8.07609 12.4089 8.00953C12.4089 8.00672 12.4089 8.00484 12.4089 8.00203C12.4089 6.81141 13.2939 5.82328 14.4414 5.66109V5.65922ZM6.79703 13.372C6.84391 12.3558 7.51891 11.5758 8.30359 11.5758C9.08828 11.5758 9.68828 12.3998 9.64141 13.4161C9.59453 14.4323 9.00859 14.8017 8.22297 14.8017C7.43734 14.8017 6.75016 14.3883 6.79703 13.372ZM15.7089 11.5758C16.4945 11.5758 17.1695 12.3558 17.2155 13.372C17.2623 14.3883 16.5742 14.8017 15.7895 14.8017C15.0048 14.8017 14.418 14.4333 14.3711 13.4161C14.3242 12.3998 14.9233 11.5758 15.7089 11.5758ZM14.7752 15.7233C14.9223 15.7383 15.0161 15.8911 14.9589 16.028C14.4761 17.182 13.3361 17.993 12.0058 17.993C10.6755 17.993 9.53641 17.182 9.05266 16.028C8.99547 15.8911 9.08922 15.7383 9.23641 15.7233C10.0989 15.6361 11.0317 15.5883 12.0058 15.5883C12.9798 15.5883 13.9117 15.6361 14.7752 15.7233Z",fill:"white"})]}),RefreshClockIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18",height:"18",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3 9C3 12.3137 5.68629 15 9 15C12.3137 15 15 12.3137 15 9C15 5.68629 12.3137 3 9 3C7.20796 3 5.59942 3.78563 4.5 5.03126C4.43696 5.10268 4.3756 5.17562 4.31597 5.25M9 6V9L10.875 10.875M4.31543 3.00293V5.25293H6.56543",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ReloadIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"22px",height:"22px",strokeWidth:"0",viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M16.1791 5.82018C15.5007 5.13713 14.6938 4.59511 13.8049 4.22539C12.916 3.85568 11.9627 3.66556 10.9999 3.66602C6.94828 3.66602 3.67578 6.94768 3.67578 10.9993C3.67578 15.051 6.94828 18.3327 10.9999 18.3327C14.4191 18.3327 17.2699 15.9952 18.0858 12.8327H16.1791C15.8015 13.9047 15.1005 14.8332 14.1728 15.4899C13.2452 16.1467 12.1366 16.4994 10.9999 16.4993C7.96578 16.4993 5.49995 14.0335 5.49995 10.9993C5.49995 7.96518 7.96578 5.49935 10.9999 5.49935C12.5216 5.49935 13.8783 6.13185 14.8683 7.13102L11.9166 10.0827H18.3333V3.66602L16.1791 5.82018Z"})}),RotateIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],"data-testid":"rotate-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12.5 18.5C17.1944 18.5 21 14.6944 21 10C21 5.30558 17.1944 1.5 12.5 1.5C7.80558 1.5 4 5.30558 4 10C4 11.5433 4.41128 12.9905 5.13022 14.238M1.5 13L5.13022 14.238M6.82531 10.3832L5.47107 14.3542L5.13022 14.238",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SlashIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M16 3L8 21",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SlidersIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"32px",height:"32px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M16 7.33333C16 9.17428 14.5076 10.6667 12.6667 10.6667C10.8257 10.6667 9.33333 9.17428 9.33333 7.33333M16 7.33333C16 5.49238 14.5076 4 12.6667 4C10.8257 4 9.33333 5.49238 9.33333 7.33333M16 7.33333H28M9.33333 7.33333H4M25.3333 16C25.3333 17.8409 23.8409 19.3333 22 19.3333C20.1591 19.3333 18.6667 17.8409 18.6667 16M25.3333 16C25.3333 14.1591 23.8409 12.6667 22 12.6667C20.1591 12.6667 18.6667 14.1591 18.6667 16M25.3333 16H28M18.6667 16H4M13.3333 24.6667C13.3333 26.5076 11.8409 28 10 28C8.15905 28 6.66667 26.5076 6.66667 24.6667M13.3333 24.6667C13.3333 22.8257 11.8409 21.3333 10 21.3333C8.15905 21.3333 6.66667 22.8257 6.66667 24.6667M13.3333 24.6667H28M6.66667 24.6667H4",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),TezIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"30px",height:"30px",fill:"none","data-testid":"tez-icon",viewBox:"0 0 30 30",..._,children:[jsxRuntimeExports.jsx("rect",{width:"30",height:"30",fill:"white",rx:"4"}),jsxRuntimeExports.jsx("rect",{width:"30",height:"30",fill:"url(#pattern0)",rx:"4"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsx("pattern",{width:"1",height:"1",id:"pattern0",patternContentUnits:"objectBoundingBox",children:jsxRuntimeExports.jsx("use",{transform:"translate(0.1753 0.101557) scale(0.00532296)",xlinkHref:"#image0_2912_38337"})}),jsxRuntimeExports.jsx("image",{width:"122",height:"150",id:"image0_2912_38337",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAACWCAYAAAAR35wdAAAMP2lDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEBooUsJvQkiNYCUEFrovdkISYBQYgwEFXtZVHDtogI2dFVEwQqIBUUUC4ti74sFFWVdLNiVNymg677yvfm+ufPff87858y5M/feAUDtBEckykPVAcgXForjQgLoKalpdNJTQAS6gAyUgTOHWyBixsREAFiG2r+Xd9cBIm2vOEi1/tn/X4sGj1/ABQCJgTiDV8DNh/ggAHgVVyQuBIAo5c2nFIqkGFagJYYBQrxIirPkuEqKM+R4r8wmIY4FcRsASiocjjgLANVLkKcXcbOghmo/xE5CnkAIgBodYt/8/Ek8iNMhtoE2Ioil+oyMH3Sy/qaZMazJ4WQNY/lcZEUpUFAgyuNM+z/T8b9Lfp5kyIcVrCrZ4tA46Zxh3m7mTgqXYhWI+4QZUdEQa0L8QcCT2UOMUrIloYlye9SQW8CCOQM6EDvxOIHhEBtCHCzMi4pQ8BmZgmA2xHCFoFMFhewEiPUgXsQvCIpX2GwWT4pT+EIbMsUspoI/yxHL/Ep93ZfkJjIV+q+z+WyFPqZanJ2QDDEFYosiQVIUxKoQOxbkxocrbMYUZ7OihmzEkjhp/BYQx/GFIQFyfawoUxwcp7AvzS8Ymi+2OVvAjlLg/YXZCaHy/GBtXI4sfjgX7BJfyEwc0uEXpEQMzYXHDwySzx17xhcmxit0PogKA+LkY3GKKC9GYY+b8fNCpLwZxK4FRfGKsXhSIVyQcn08U1QYkyCPEy/O4YTFyOPBl4MIwAKBgA4ksGaASSAHCDr7GvvgnbwnGHCAGGQBPnBQMEMjkmU9QniNB8XgT4j4oGB4XICslw+KIP91mJVfHUCmrLdINiIXPIE4H4SDPHgvkY0SDntLAo8hI/iHdw6sXBhvHqzS/n/PD7HfGSZkIhSMZMgjXW3IkhhEDCSGEoOJtrgB7ot74xHw6g+rM87APYfm8d2e8ITQRXhIuEboJtyaKJgn/inKSNAN9YMVucj4MRe4FdR0wwNwH6gOlXEd3AA44K7QDxP3g57dIMtSxC3NCv0n7b/N4IenobAjO5FRsi7Zn2zz80hVO1W3YRVprn/MjzzWjOF8s4Z7fvbP+iH7PNiG/2yJLcIOYO3YSewcdhRrBHSsBWvCOrBjUjy8uh7LVteQtzhZPLlQR/APf0NPVprJAqdap16nL/K+Qv5U6TsasCaJpokFWdmFdCb8IvDpbCHXcSTd2cnZBQDp90X++noTK/tuIDod37n5fwDg0zI4OHjkOxfWAsA+D7j9D3/nbBjw06EMwNnDXIm4SM7h0gsBviXU4E7TB8bAHNjA+TgDd+AN/EEQCAPRIAGkggkw+my4zsVgCpgB5oISUAaWgzWgAmwCW8FOsAfsB43gKDgJzoAL4BK4Bu7A1dMDXoB+8A58RhCEhFARGqKPmCCWiD3ijDAQXyQIiUDikFQkHclChIgEmYHMR8qQlUgFsgWpQfYhh5GTyDmkC7mFPEB6kdfIJxRDVVAt1Ai1QkehDJSJhqMJ6Hg0C52MFqML0KXoOrQa3Y02oCfRC+g1tBt9gQ5gAFPGdDBTzAFjYCwsGkvDMjExNgsrxcqxaqwOa4bP+QrWjfVhH3EiTsPpuANcwaF4Is7FJ+Oz8CV4Bb4Tb8Db8Cv4A7wf/0agEgwJ9gQvApuQQsgiTCGUEMoJ2wmHCKfhXuohvCMSiTpEa6IH3IupxBzidOIS4gZiPfEEsYv4iDhAIpH0SfYkH1I0iUMqJJWQ1pN2k1pIl0k9pA9KykomSs5KwUppSkKleUrlSruUjitdVnqq9JmsTrYke5GjyTzyNPIy8jZyM/kiuYf8maJBsab4UBIoOZS5lHWUOsppyl3KG2VlZTNlT+VYZYHyHOV1ynuVzyo/UP6ooqlip8JSGaciUVmqskPlhMotlTdUKtWK6k9NoxZSl1JrqKeo96kfVGmqjqpsVZ7qbNVK1QbVy6ov1chqlmpMtQlqxWrlagfULqr1qZPVrdRZ6hz1WeqV6ofVb6gPaNA0RmtEa+RrLNHYpXFO45kmSdNKM0iTp7lAc6vmKc1HNIxmTmPRuLT5tG2007QeLaKWtRZbK0erTGuPVqdWv7amtqt2kvZU7UrtY9rdOpiOlQ5bJ09nmc5+nes6n3SNdJm6fN3FunW6l3Xf643Q89fj65Xq1etd0/ukT9cP0s/VX6HfqH/PADewM4g1mGKw0eC0Qd8IrRHeI7gjSkfsH3HbEDW0M4wznG641bDDcMDI2CjESGS03uiUUZ+xjrG/cY7xauPjxr0mNBNfE4HJapMWk+d0bTqTnkdfR2+j95samoaaSky3mHaafjazNks0m2dWb3bPnGLOMM80X23eat5vYWIRaTHDotbitiXZkmGZbbnWst3yvZW1VbLVQqtGq2fWetZs62LrWuu7NlQbP5vJNtU2V22JtgzbXNsNtpfsUDs3u2y7SruL9qi9u73AfoN910jCSM+RwpHVI284qDgwHYocah0eOOo4RjjOc2x0fDnKYlTaqBWj2kd9c3JzynPa5nRntObosNHzRjePfu1s58x1rnS+6kJ1CXaZ7dLk8srV3pXvutH1phvNLdJtoVur21d3D3exe517r4eFR7pHlccNhhYjhrGEcdaT4BngOdvzqOdHL3evQq/9Xn95O3jneu/yfjbGegx/zLYxj3zMfDg+W3y6fem+6b6bfbv9TP04ftV+D/3N/Xn+2/2fMm2ZOczdzJcBTgHigEMB71lerJmsE4FYYEhgaWBnkGZQYlBF0P1gs+Cs4Nrg/hC3kOkhJ0IJoeGhK0JvsI3YXHYNuz/MI2xmWFu4Snh8eEX4wwi7CHFEcyQaGRa5KvJulGWUMKoxGkSzo1dF34uxjpkccySWGBsTWxn7JG503Iy49nha/MT4XfHvEgISliXcSbRJlCS2JqkljUuqSXqfHJi8Mrk7ZVTKzJQLqQapgtSmNFJaUtr2tIGxQWPXjO0Z5zauZNz18dbjp44/N8FgQt6EYxPVJnImHkgnpCen70r/wonmVHMGMtgZVRn9XBZ3LfcFz5+3mtfL9+Gv5D/N9MlcmfksyydrVVZvtl92eXafgCWoELzKCc3ZlPM+Nzp3R+5gXnJefb5Sfnr+YaGmMFfYNsl40tRJXSJ7UYmoe7LX5DWT+8Xh4u0FSMH4gqZCLfgj3yGxkfwieVDkW1RZ9GFK0pQDUzWmCqd2TLObtnja0+Lg4t+m49O501tnmM6YO+PBTObMLbOQWRmzWmebz14wu2dOyJydcylzc+f+Ps9p3sp5b+cnz29eYLRgzoJHv4T8UluiWiIuubHQe+GmRfgiwaLOxS6L1y/+VsorPV/mVFZe9mUJd8n5X0f/uu7XwaWZSzuXuS/buJy4XLj8+gq/FTtXaqwsXvloVeSqhtX01aWr366ZuOZcuWv5prWUtZK13esi1jWtt1i/fP2XiuyKa5UBlfVVhlWLq95v4G24vNF/Y90mo01lmz5tFmy+uSVkS0O1VXX5VuLWoq1PtiVta/+N8VvNdoPtZdu/7hDu6N4Zt7OtxqOmZpfhrmW1aK2ktnf3uN2X9gTuaapzqNtSr1Nfthfslex9vi993/X94ftbDzAO1B20PFh1iHaotAFpmNbQ35jd2N2U2tR1OOxwa7N386Ejjkd2HDU9WnlM+9iy45TjC44PthS3DJwQneg7mXXyUevE1junUk5dbYtt6zwdfvrsmeAzp9qZ7S1nfc4ePed17vB5xvnGC+4XGjrcOg797vb7oU73zoaLHhebLnleau4a03X8st/lk1cCr5y5yr564VrUta7riddv3hh3o/sm7+azW3m3Xt0uuv35zpy7hLul99Tvld83vF/9h+0f9d3u3cceBD7oeBj/8M4j7qMXjwsef+lZ8IT6pPypydOaZ87PjvYG9156PvZ5zwvRi899JX9q/Fn10ublwb/8/+roT+nveSV+Nfh6yRv9Nzveur5tHYgZuP8u/93n96Uf9D/s/Mj42P4p+dPTz1O+kL6s+2r7tflb+Le7g/mDgyKOmCP7FcBgRTMzAXi9AwBqKgA0eD6jjJWf/2QFkZ9ZZQj8Jyw/I8qKOwB18P89tg/+3dwAYO82ePyC+mrjAIihApDgCVAXl+E6dFaTnSulhQjPAZujvmbkZ4B/U+Rnzh/i/rkFUlVX8HP7L34RfGukfYUwAAAAOGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAACoAIABAAAAAEAAAB6oAMABAAAAAEAAACWAAAAAGjynq0AABD3SURBVHgB7V0JcFXVGf7Pey8QEnCp2ta97rYuHRW0VqkLilapSm1MAgVCwLQ4WrRDq6gVHWt1Ojpt1cEOkhBAshgqFRe6WIvLWHEsMxW07tS1xVYQRba8906/88gN9yU3efcs797zknOHcO899/z/+f//O//Zz3lE7nIWcBZwFnAWcBZwFnAWcBaIzQIstpRDJlzVwHcv66RvZBmdzBiNIk5HtzaxI0OSu2hdFkjZZIm6Ol6+JUknJQigchrFBbgZOowjwJcjP7VJ5lKRJTagq6p4sqySjssmaBQ89WQOYLcRHZskwj9cQNYHbqnY01o5IwO6aho/PJVF0StA3VkEn4j7MA9MgO2uIlqgaEDX1PHRLEnnoU4dCflPxd9uhCJYXDlMFYFF5uA7ubj/ZSxQNKBZgm6FIGeYLn9RdytmERmzDLy4XT428BRzGuVbwAGdb48B+1Y0oNHXPbO1kbHUDhpOWZqEivV1E1Z0dbSaFSOt72qn8Vsg5k1qou6kQobZ1NbI9tDhMRhpi+bRQcaEh89Bm/mPQd9cWHEtECnQQhW0xu8urkqOe5AFIgd66w5aFSRI2DDXvQprqfx4kQO9bBH7GPXs5nwxwr+5xlh4W/ljRg50V+I7/ELIPDuPlrHWrrhxAb1LAvcUiQUc0JGYOf5EHNDxYxCJBA7oSMwcfyIO6PgxiEQCB3QkZo4/EQd0/BhEIoEDOhIzx5+IAzp+DCKRwAEdiZnjT8QBHT8GkUgQeuHBRfV8RCXROizN2ysSyfpLhNNT/X0eiN/EZA42M8xobWavqugXehVoRRYAJy0AWWjJsLp0kF05j0xSLdSeo6J66KI7k3LLbFUMbJIG07tlqvxCA62agKOzwwKhgU6m3Q6J2CHjtFVVhtBAu6Jb1cSG6Dg9uamSfqnKLTTQqgk4OgMWAMifVNIFK+5h21W5OaBVLRcVHadndUEWoobuXnWmaWMyQWIBvvaFLbI/ApM9VRlhL7UROVTTl6JjNARdo9lSNF5kjBdsTul5sscq1z3zXqK610zjbyLhw1TTa20UG3CxTNDyq6GBl32aoeXQ9XxpUeHJ6c9obEcHU26A+dN0RbffGgafxYkOtoAs1HJAGwTXYyVATo6gh2zwZE8mB7RnCUP3bpAZXSTN0nBx7U/fAe23hubzzTfzRM6TLQNZqOWA1gTXIxcgv/outaNHYZUne/I5oD1LaN056wL5e9Jsilhc+2UJ3Y/2E7lnvwU4q62nxZjbkwYZ4wGrMga7UH6pej47j+5pEan3bpAnSpEhsgAZR1+OMdVPLpS+A7qQhfr53uXJyiAvXsw+74e90U+u6FY0J0b3GkFaEiALFZ1HKwAtQMZgSL0sqVdcR+nJnowOaM8SIe+lCLJQzQEdEmARDSDPLTVP9tRzQHuWKHDvAnlGgWi9PsdZXPuFcY0xvzX6eK6t57/Cp5IFWajlPLoPcL3gHMiMrvbew95t8WRPXge0Z4mAuwbIq8VgSByt6wA1ckGu6O7DMgD5dgxrqnjy6uR2OmvxkugGQ/pQIS/YeXSeOXa+1NTzmwHydQGf+g1CcZ0DeckSZt0PvDiP7gEdWtfXogslvb/JZpCFis6jfUB3gXyHLyjUo+0gCyUc0F1QVk/jM+HJAxJkB7QPZOT4X3e9hr6Vgid7ygz6OhoNrx/Ckwc0yALsQV1050BmdJ+X68PeS8mTPZ0GLdCqIGPz8BrRT7axC+WBGnQflEV37VQ+Ff1kaU8WILNtdMaSFvv6yUHg+sMGnUcLkHHwi1gdInd1gdzSwjbKEdoRu0Q9Wm2DHfrJ9TC7WB0ifzG6oVRBFsoOGo/Gb25NAcDynrwrSyxHRlkNPpfsCiqdpxL1aDkDY4LiUlA0y1H1jo2McgJCl4Hfx7g3wU3uap3P1veOaV/IYPHoC42aXhyqx+gn+CnGf4mpzPGT+BeN8i8Cs0EBNBpfxSm5GJWLqczyIbQe3bV54sfQi4CREZaDAmg03ZQPYgtrZWyuuxy56Q0AvsBGDx8UQOMMjKFhAdONB8Drysvojep6/mNdXibpSxRoFMYyF6NhMtG14zLaLcHoLtTfL02Yzk/S5meAQYkCLdePRuzIPDoPE0bHYVz8RXTL5k6cyHfL+xbxS4kCLWcl+P8QOQqzsVH8zMgMpdcw511llnN4boMCaIxRL4RnPYa/D8ObxmxM1N1fhrEfhHevqJnKDzTLvTA3ubquML9QMaCs5jljMJviNX4y32tYkkbCy8Xgx4XoHp2uyEqdjNPHyHQXti1gq9SZyFEqG0wumfzY+kCLoVu5ejpfgl1vtQ18b56mixEyHqCfA4NEUp8DaPGLuzVtTWzZLmmK9xQL0GiNvg6jHqGqVmujukf3l2bu5yQ4jqhI5E66P7e/uMa+ZenG1gXsNmP8+mAUF9AvAejj+pCpYHCxgPYnLAY9hg7BRndOs5Ct9vN/M/0M774fnt1gmq+fXyxAY/ToeRjvFL8gMs9RAO2XByXQVXi/EZmzaGPaAPvRz1NU/cg8tsWftqnnuFrdWjM+OJ0v0gGQ1iZ2D07ZPQRGvx6AGDmEtSeAyPjjhqfpie808Iqe30y8xwI0lHpfR/hERXGL0iDZhKehJLk9lcKpxJwWBcXRDmN0amWG/lBXx8u1efVgEAvQPEuv9ZBD6jWRUq/fpRIKiPzAPPZvePgU6HAaAH8lIIpWEOrS0duS9KgWkwDiWICGR68OkCV0EIrPE0NHLlJE9IGfA+DHQJZbTScBsMegXbDUJN9YgEZ9pwU0DDDGpBF0eKG1fBN+Ye4EzJCt0+HTi5bRpRgyvbJXuGJALK1uISvWXj2G2wWKchOMe2RLM3tDld40HRYdfCHF6WG0zI2OtGWzdFL7AqbrGPEtDkSR16Fj7GxS/kwRnfQK0XY0sg0oykcj3gOF4sp8ZwlaKgZyZGiC4sZSdAtB0Fn8XZBAYcNQFF1TW8ePDhs/qnhomU9CWvNNpQc9D6lk+u2A2IBe3sQ+Q712r45BeFJht4UvQawC+brv1dgjwL4cJdZvjTEkmllVx5VHEoUcsQEtEkfr++firnoht5+JCZInZNdooUV7Kf7eQvrVqmkXokMjbQbiaFVP/jSSmpk6VqDFmmg0Nq7wKyT7DLDHYI3WK7n9VP0Qf7+B74tMMQvDr2vQYFqKv0NBm+2HRPsTPPsyePZz2ozAALKehlZ4jSov0Md/5fqM6E5oS8JJVAdroNSbuL8DfllYaAgmNEfhfk5P/gDhF/C8G3qGm3wXrfGk2LdlYmIEfNDgO15Fvlg92hMY/erJMPo/vHflO6MRMOg3Aepk3H+GvzkAfXYQyCINfEd+KO4lWuPIaKKBpn9hxg8l19kqjKwAWowjb++ksTB7pP1iZC6tMfewBsd885PQ7a6w8fuLh5Uxs/r73tc3K4AWwi1bzD5Kp1G8cr1x8L4UDQrHb20aH1MOSkeEocidheLjzb6+hw1HKfRtlR0h1gAtFO1YxN5NdZJYB22stdqPAeuWzGeReHS3DNjN0f2s8ZAkkt7RaRXQQndxfqZoraJeHYuida2GPQJJ4VXPiOFTpLEwMEIRA9vms5Uosf6mmwTq/HGyPNBWsftCi/x01EtToVw1wK/UkPb3oF0IgMU9tqt6Kr84kSBtGdJJ2qNjHtsUVhHrgfYUEZPx25P4eV6emzQYCc88GPXVV7zvve6cPkGcp5E52rF4fnnHXLa5V5yYAnRXwQqxMR9ehanS0FOZqZh0lU62uRnHxFDOE/K8QSzXTe+gfZMp7Fnuungnvde+kL3lvdt2R+l0HzLgnVpyJXJz8gMP6L6M0jqP/Q/fxF/JXChGl6G00QIaPL4qo7B1jTEZ4Us1bksTextAr9ORH/RHydA7oGWsZTAuPPJFHXbOo3WsFyEtPFJrgaQQtWoyPyisyM6jw1rKdDxOH+iyxMheaPxCR9QVytH3sAAj7R8gZanwmwkc0D3sH9Uriu5O3bSGpin0gIkDWtfaivSYo9Y6hQHDw1u7xhZCSVAyAyaeNlghsh9P0EHZDH2KQ6U+kBkG9HjYcMfSlgq0nNUvJlfHlwTQGO++DEVdFYY8xcL9PTGyRBgvJsrkfhj0XbyvzGL5MNY/RzbtqI5QN+WXup8UHpBJ1smQWQ107XR+PBYDLcNwoVjfFXgh/CB8n4zjnibD21djE9w4sT8qMLJdgbp7rqX2fVlbR+dmrbL0vAA5LD7w+BMzGXoB/cv9w9LEFQ8Z9HCdtFFHr5GhtxLo3EAAo+UATmUf9AHw6kUyRoglLqNjdNJFrfWsDL2VQAOoNiixp4wieXEZnS3q9bwwi14mTucHQBz1OhqnGnU0MamRNeuArp7Ov4vi+lRdXNBeu1aXR7HosZb9FC3ejJ6UpbcOaJalKbJKBMUX9fWECVy9VAhiaigMmXCsDivQPyJLbx/QBvc+Z4dhjbed13gdsZLbsD1X8rKqe5U7hEZvXVie+lhuE3p2J4+wiC+5BfiM9lFNAt78kMpvblnl0cnhtLeqAQLp1FrtgayMBWou+UW3rFlFFqs8OsGpHDnW2AWjrDPGzACjqql8HzQ0lTfKoe/8AfaKSdfPQnSrPDoxhIyu1MSY+KsG8DHGAvPH12gxY3STKj0yvV0XzjYx4tTg8hxy/2m2aDehnh+K9enKK1Ohz1roo7wZ3iqPFqBAIa21VB6wmB260Xu24Y7cO1dHDtD/VIfeOqBRxDyto1COltPsB5vYX7X5GGKAUbqrUDefp8Hu8fYmtkKD3q46WiiC4u1xHYVAext2Lt6hycMYeXUdF5vw71ZlCE/eku7UP4HJOo9ua2R/QfH9XwXDvIzRsJHYW2VNkY2jKI5NJOUHN/J053S12GWaF6bwYh3QQgcAdq+CLk+0zGd/V6ArCgkaleejGhI7J/dVTQAZfikaYPer0vvprAQ6jWOpUGRt8gsa4nlmTR0fHSJe0aMAZNENWgGghysnxukpgGzsV3WsBFqc+4Fdk1fLGoklqR0NH+2ZL9l0vfiiC4WdksKLb/HClO5YVJDYThcp0fZBhExn74WlQQ+jGFdReM7mJN1ZrNPse1pMrGjBHPo1KIWugLwqiyW6WaK4fi+TpZM7mtl/ugMNPFgN9KRJvDJdRi+g1fo1aV05fQ7Dt2HN2cK2ZvaMNH0Igsum8W/hmIkrEdVMEQtPTmdprGmQhSpWAy0EFMt7IeRKSHqEeFe6doIuNsU/Bfq1qK/WtjSyd1R44cSCcViBejGqFvHzSd17slV4+WngyY2ZcrSwi7Rh33qghTHEZECS0Z9RLJo+u/N9sF8PI4ti8kMAtx4AYjnWzgvG2R2lwgG4749vByJULAEye3H6CKN4kzAg8iezjPO5lQTQQmTxI544ouI3ALsuX4XSfUMGezTDaEqu8VlkNUoGaM8OWOt9LrxuId6V+6cer7juKCVexwjg7Pb57KGoZCg5oIVhRCOts4xmQvjrUKSOiMpYuukA4Ocx534fTjxYpMtLlr4kgfaU7Pp5g+vhHT+AIuqDEx7D4tzXA+AW/DW1N7K1xUmiMNeSBtpTT6w1Sw3H6cCM6vF3lhce1x2gbsF+sHbxMwkYltWdpDGixoAA2m+JCdP4wdhwNxaAnwBjn4678mS9n2+hZzSsVsGYTwPclbaA65d5wAHtV048i58ArNyB80UTdCReD0Wr/QiAcggUPwqZoN/6HfG2gmYD/jaCbgM8dSMyj3jfANqP8P4yqo230aj6J8KsvgY80IWsf0kd36M8QRXo5lSk8Ic+bQV60jtM/ARRobTdd2cBZwFnAWcBZwFnAWeB/wO9yrSXP8OnPQAAAABJRU5ErkJggg=="})]})]}),ThreeDotsIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[300],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13.5 9H13.5075M9 9H9.0075M4.5 9H4.5075M9.75 9C9.75 9.41421 9.41421 9.75 9 9.75C8.58579 9.75 8.25 9.41421 8.25 9C8.25 8.58579 8.58579 8.25 9 8.25C9.41421 8.25 9.75 8.58579 9.75 9ZM14.25 9C14.25 9.41421 13.9142 9.75 13.5 9.75C13.0858 9.75 12.75 9.41421 12.75 9C12.75 8.58579 13.0858 8.25 13.5 8.25C13.9142 8.25 14.25 8.58579 14.25 9ZM5.25 9C5.25 9.41421 4.91421 9.75 4.5 9.75C4.08579 9.75 3.75 9.41421 3.75 9C3.75 8.58579 4.08579 8.25 4.5 8.25C4.91421 8.25 5.25 8.58579 5.25 9Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),TokenIcon=({contract:_,...a})=>{const $=`https://services.tzkt.io/v1/avatars/${_}`;return jsxRuntimeExports.jsx(Image$1,{fallbackSrc:"./static/media/coin-front.svg",src:$,...a})},TrashIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3 4.5H15M12 4.5L11.797 3.89105C11.6003 3.30094 11.502 3.00588 11.3195 2.78774C11.1584 2.5951 10.9516 2.44599 10.7179 2.35408C10.4532 2.25 10.1422 2.25 9.52018 2.25H8.47982C7.85779 2.25 7.54677 2.25 7.28213 2.35408C7.04844 2.44599 6.84156 2.5951 6.68047 2.78774C6.49804 3.00588 6.39969 3.30094 6.20298 3.89105L6 4.5M13.5 4.5V12.15C13.5 13.4101 13.5 14.0402 13.2548 14.5215C13.039 14.9448 12.6948 15.289 12.2715 15.5048C11.7902 15.75 11.1601 15.75 9.9 15.75H8.1C6.83988 15.75 6.20982 15.75 5.72852 15.5048C5.30516 15.289 4.96095 14.9448 4.74524 14.5215C4.5 14.0402 4.5 13.4101 4.5 12.15V4.5M10.5 7.5V12.75M7.5 7.5V12.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),TwitterIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"20px",height:"18px",fill:"black","data-testid":"twitter-icon",viewBox:"0 0 20 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M0.0467972 0L7.472 9.92803L0 18H1.68178L8.22366 10.9327L13.5091 18H19.2319L11.3887 7.51364L18.3437 0H16.6619L10.6374 6.50863L5.76957 0H0.0467972ZM2.51993 1.23866H5.14894L16.7584 16.7613H14.1294L2.51993 1.23866Z"})}),UnknownContactIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none","data-testid":"unknown-contact-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.16602 15.5625C3.16602 12.7435 5.45123 10.4583 8.27018 10.4583C8.51775 10.4583 8.7612 10.476 8.99935 10.51M13.3722 13.375C14.1014 12.6458 14.8305 12.3575 14.8305 11.5521C14.8305 10.7467 14.1776 10.0938 13.3722 10.0938C12.6927 10.0938 12.1217 10.5585 11.9598 11.1875M13.3722 15.5625H13.3795M11.1868 5.35417C11.1868 6.965 9.88101 8.27083 8.27018 8.27083C6.65935 8.27083 5.35352 6.965 5.35352 5.35417C5.35352 3.74334 6.65935 2.4375 8.27018 2.4375C9.88101 2.4375 11.1868 3.74334 11.1868 5.35417Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),USBIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M20.5 11L18.7396 7.60473C18.253 6.65855 18.0097 6.18545 17.6514 5.84012C17.3346 5.5347 16.9544 5.30272 16.5379 5.16065C16.067 5 15.535 5 14.471 5H9.52901C8.46503 5 7.93304 5 7.46209 5.16065C7.04558 5.30272 6.66542 5.5347 6.34859 5.84012C5.99034 6.18545 5.74703 6.65855 5.26042 7.60473L3.5 11M20.5 11C20.6981 11.3853 20.7658 11.5446 20.8357 11.747C20.8977 11.9267 20.9426 12.1119 20.9696 12.3002C21 12.5121 21 12.7287 21 13.162V14.2C21 15.8802 21 16.7202 20.673 17.362C20.3854 17.9265 19.9265 18.3854 19.362 18.673C18.7202 19 17.8802 19 16.2 19H7.8C6.11984 19 5.27976 19 4.63803 18.673C4.07354 18.3854 3.6146 17.9265 3.32698 17.362C3 16.7202 3 15.8802 3 14.2V13.162C3 12.7287 3 12.5121 3.03041 12.3002C3.05741 12.1119 3.10225 11.9267 3.16432 11.747C3.23421 11.5446 3.30186 11.3853 3.5 11M20.5 11H3.5M15 15H17",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),VerifiedIcon=()=>jsxRuntimeExports.jsxs(Flex,{position:"relative",alignItems:"center",justifyContent:"center","data-testid":"verified-icon",children:[jsxRuntimeExports.jsx(StarIcon,{}),jsxRuntimeExports.jsx(Flex,{position:"absolute",alignItems:"center",justifyContent:"center",children:jsxRuntimeExports.jsx(CheckIcon$1,{})})]}),StarIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"14px",height:"14px",fill:colors.gray[450],viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M6.51019 0.479749C6.78233 0.213196 7.21767 0.213195 7.48981 0.479749L8.86158 1.82333C8.99061 1.94972 9.16351 2.02134 9.34412 2.02321L11.2642 2.04314C11.6451 2.04709 11.9529 2.35492 11.9569 2.73584L11.9768 4.65588C11.9787 4.83649 12.0503 5.00939 12.1767 5.13842L13.5203 6.51019C13.7868 6.78233 13.7868 7.21767 13.5203 7.48981L12.1767 8.86158C12.0503 8.99061 11.9787 9.16351 11.9768 9.34412L11.9569 11.2642C11.9529 11.6451 11.6451 11.9529 11.2642 11.9569L9.34412 11.9768C9.16351 11.9787 8.99061 12.0503 8.86158 12.1767L7.48981 13.5203C7.21767 13.7868 6.78233 13.7868 6.51019 13.5203L5.13842 12.1767C5.00939 12.0503 4.83649 11.9787 4.65588 11.9768L2.73584 11.9569C2.35492 11.9529 2.04709 11.6451 2.04314 11.2642L2.02321 9.34412C2.02134 9.16351 1.94972 8.99061 1.82333 8.86158L0.479749 7.48981C0.213196 7.21767 0.213195 6.78233 0.479749 6.51019L1.82333 5.13842C1.94972 5.00939 2.02134 4.83649 2.02321 4.65588L2.04314 2.73584C2.04709 2.35492 2.35492 2.04709 2.73584 2.04314L4.65588 2.02321C4.83649 2.02134 5.00939 1.94972 5.13842 1.82333L6.51019 0.479749Z",strokeLinecap:"square",strokeLinejoin:"round"})}),CheckIcon$1=_=>jsxRuntimeExports.jsx(Icon,{width:"7px",height:"5px",fill:"none",stroke:"white",viewBox:"0 0 7 5",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.66699 2.19314L3.0281 3.55425L5.75033 0.832031",strokeLinecap:"square",strokeLinejoin:"round"})}),WalletPlusIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M10 16V14.0003M10 14.0003V12M10 14.0003L12 14.0005M10 14.0003L8 14M21 12V11.2C21 10.0799 21 9.51984 20.782 9.09202C20.5903 8.7157 20.2843 8.40973 19.908 8.21799C19.4802 8 18.9201 8 17.8 8H3M21 12V16M21 12H19C17.8954 12 17 12.8954 17 14C17 15.1046 17.8954 16 19 16H21M21 16V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8V8M18 8V7.2C18 6.0799 18 5.51984 17.782 5.09202C17.5903 4.71569 17.2843 4.40973 16.908 4.21799C16.4802 4 15.9201 4 14.8 4H6.2C5.07989 4 4.51984 4 4.09202 4.21799C3.71569 4.40973 3.40973 4.71569 3.21799 5.09202C3 5.51984 3 6.0799 3 7.2V8",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),WarningIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"36px",height:"32px",fill:"none",stroke:colors.orangeL,viewBox:"0 0 36 32",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M18.0004 24.3332H18.0171M18.0004 12.6665V19.3332M8.68719 30.9999H27.3136C30.2831 30.9999 31.7678 30.9999 32.6386 30.3754C33.3985 29.8305 33.8946 28.9915 34.0058 28.0631C34.1333 26.9991 33.4178 25.6982 31.9868 23.0963L22.6736 6.16318C21.1499 3.39292 20.3881 2.00779 19.3814 1.54954C18.5041 1.15015 17.4968 1.15015 16.6194 1.54954C15.6127 2.00779 14.8509 3.39292 13.3273 6.16317L4.01404 23.0963C2.58301 25.6982 1.8675 26.9991 1.99498 28.0631C2.10622 28.9915 2.6023 29.8305 3.36219 30.3754C4.23304 30.9999 5.71776 30.9999 8.68719 30.9999Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),XMark=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4.5 4.5L13.5 13.5M13.5 4.5L4.5 13.5","data-testid":"xmark-icon-path",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})});function keys(_){return Object.keys(_)}var ExposedPromiseStatus;(function(_){_.PENDING="pending",_.RESOLVED="resolved",_.REJECTED="rejected"})(ExposedPromiseStatus||(ExposedPromiseStatus={}));const notInitialized$1=()=>{throw new Error("ExposedPromise not initialized yet.")};class ExposedPromise{constructor(){Yr(this,"_promise");Yr(this,"_resolve",notInitialized$1);Yr(this,"_reject",notInitialized$1);Yr(this,"_status",ExposedPromiseStatus.PENDING);Yr(this,"_promiseResult");Yr(this,"_promiseError");this._promise=new Promise((a,$)=>{this._resolve=j=>{this.isSettled()||(this._promiseResult=j,a(j),this._status=ExposedPromiseStatus.RESOLVED)},this._reject=j=>{this.isSettled()||(this._promiseError=j,$(j),this._status=ExposedPromiseStatus.REJECTED)}})}get promise(){return this._promise}get resolve(){return this._resolve}get reject(){return this._reject}get status(){return this._status}get promiseResult(){return this._promiseResult}get promiseError(){return this._promiseError}static resolve(a){const $=new ExposedPromise;return $.resolve(a),$}static reject(a){const $=new ExposedPromise;return $.reject(a),$}isPending(){return this.status===ExposedPromiseStatus.PENDING}isResolved(){return this.status===ExposedPromiseStatus.RESOLVED}isRejected(){return this.status===ExposedPromiseStatus.REJECTED}isSettled(){return this.isResolved()||this.isRejected()}}var buffer$2={},base64Js$1={};base64Js$1.byteLength=byteLength$2;base64Js$1.toByteArray=toByteArray$1;base64Js$1.fromByteArray=fromByteArray$1;var lookup$3=[],revLookup$1=[],Arr$1=typeof Uint8Array<"u"?Uint8Array:Array,code$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$2=0,len$1=code$1.length;i$20)throw new Error("Invalid string. Length must be a multiple of 4");var $=_.indexOf("=");$===-1&&($=a);var j=$===a?0:4-$%4;return[$,j]}function byteLength$2(_){var a=getLens$1(_),$=a[0],j=a[1];return($+j)*3/4-j}function _byteLength$1(_,a,$){return(a+$)*3/4-$}function toByteArray$1(_){var a,$=getLens$1(_),j=$[0],et=$[1],tt=new Arr$1(_byteLength$1(_,j,et)),rt=0,nt=et>0?j-4:j,it;for(it=0;it>16&255,tt[rt++]=a>>8&255,tt[rt++]=a&255;return et===2&&(a=revLookup$1[_.charCodeAt(it)]<<2|revLookup$1[_.charCodeAt(it+1)]>>4,tt[rt++]=a&255),et===1&&(a=revLookup$1[_.charCodeAt(it)]<<10|revLookup$1[_.charCodeAt(it+1)]<<4|revLookup$1[_.charCodeAt(it+2)]>>2,tt[rt++]=a>>8&255,tt[rt++]=a&255),tt}function tripletToBase64$1(_){return lookup$3[_>>18&63]+lookup$3[_>>12&63]+lookup$3[_>>6&63]+lookup$3[_&63]}function encodeChunk$1(_,a,$){for(var j,et=[],tt=a;tt<$;tt+=3)j=(_[tt]<<16&16711680)+(_[tt+1]<<8&65280)+(_[tt+2]&255),et.push(tripletToBase64$1(j));return et.join("")}function fromByteArray$1(_){for(var a,$=_.length,j=$%3,et=[],tt=16383,rt=0,nt=$-j;rtnt?nt:rt+tt));return j===1?(a=_[$-1],et.push(lookup$3[a>>2]+lookup$3[a<<4&63]+"==")):j===2&&(a=(_[$-2]<<8)+_[$-1],et.push(lookup$3[a>>10]+lookup$3[a>>4&63]+lookup$3[a<<2&63]+"=")),et.join("")}var ieee754$1={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754$1.read=function(_,a,$,j,et){var tt,rt,nt=et*8-j-1,it=(1<>1,st=-7,at=$?et-1:0,ut=$?-1:1,ht=_[a+at];for(at+=ut,tt=ht&(1<<-st)-1,ht>>=-st,st+=nt;st>0;tt=tt*256+_[a+at],at+=ut,st-=8);for(rt=tt&(1<<-st)-1,tt>>=-st,st+=j;st>0;rt=rt*256+_[a+at],at+=ut,st-=8);if(tt===0)tt=1-ot;else{if(tt===it)return rt?NaN:(ht?-1:1)*(1/0);rt=rt+Math.pow(2,j),tt=tt-ot}return(ht?-1:1)*rt*Math.pow(2,tt-j)};ieee754$1.write=function(_,a,$,j,et,tt){var rt,nt,it,ot=tt*8-et-1,st=(1<>1,ut=et===23?Math.pow(2,-24)-Math.pow(2,-77):0,ht=j?0:tt-1,bt=j?1:-1,Et=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(nt=isNaN(a)?1:0,rt=st):(rt=Math.floor(Math.log(a)/Math.LN2),a*(it=Math.pow(2,-rt))<1&&(rt--,it*=2),rt+at>=1?a+=ut/it:a+=ut*Math.pow(2,1-at),a*it>=2&&(rt++,it/=2),rt+at>=st?(nt=0,rt=st):rt+at>=1?(nt=(a*it-1)*Math.pow(2,et),rt=rt+at):(nt=a*Math.pow(2,at-1)*Math.pow(2,et),rt=0));et>=8;_[$+ht]=nt&255,ht+=bt,nt/=256,et-=8);for(rt=rt<0;_[$+ht]=rt&255,ht+=bt,rt/=256,ot-=8);_[$+ht-bt]|=Et*128};/*! + 15.166L4.66536 9.33268V6.99935L13.9987 12.8327L23.332 6.99935V9.33268Z`})}),ExclamationIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"12px",height:"12px",fill:"none",stroke:colors.orange,viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M6 3.66667V6.58333M6 8.33333H6.00583M11.25 6C11.25 8.89949 8.89949 11.25 6 11.25C3.1005 11.25 0.75 8.89949 0.75 6C0.75 3.1005 3.1005 0.75 6 0.75C8.89949 0.75 11.25 3.1005 11.25 6Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ExitArrowIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15 3V15M3 9H12M12 9L9 6M12 9L9 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ExternalLinkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15 3L9 9M15 3V6.375M15 3H11.625M14.25 9.375V12.6C14.25 13.4401 14.25 13.8601 14.0865 14.181C13.9427 14.4632 13.7132 14.6927 13.431 14.8365C13.1101 15 12.6901 15 11.85 15H5.4C4.55992 15 4.13988 15 3.81901 14.8365C3.53677 14.6927 3.3073 14.4632 3.16349 14.181C3 13.8601 3 13.4401 3 12.6V6.15C3 5.30992 3 4.88988 3.16349 4.56901C3.3073 4.28677 3.53677 4.0573 3.81901 3.91349C4.13988 3.75 4.55992 3.75 5.4 3.75H8.625",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),EyeIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"16px",height:"12px",fill:"none",viewBox:"0 0 16 12",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M10.2501 6C10.2501 7.24264 9.2427 8.25 8.00006 8.25C6.75742 8.25 5.75006 7.24264 5.75006 6C5.75006 4.75736 6.75742 3.75 8.00006 3.75C9.2427 3.75 10.2501 4.75736 10.2501 6Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M8.00039 0.75C4.64217 0.75 1.79946 2.95716 0.84375 5.99997C1.79944 9.04282 4.64217 11.25 8.00041 11.25C11.3586 11.25 14.2013 9.04284 15.157 6.00003C14.2014 2.95719 11.3586 0.75 8.00039 0.75Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})]}),EyeSlashIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M2.25024 2.25L15.7502 15.75M7.38345 7.43523C6.99147 7.84016 6.75024 8.39191 6.75024 9C6.75024 10.2426 7.7576 11.25 9.00024 11.25C9.6171 11.25 10.176 11.0018 10.5824 10.5997M4.87524 4.98536C3.45076 5.92525 2.36577 7.33796 1.84375 8.99997C2.79944 12.0428 5.64217 14.25 9.00041 14.25C10.4921 14.25 11.882 13.8145 13.0501 13.0638M8.25024 3.78705C8.49697 3.76254 8.74722 3.75 9.00039 3.75C12.3586 3.75 15.2014 5.95719 16.157 9.00003C15.9465 9.67048 15.6443 10.3004 15.2651 10.875",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FA12Icon=_=>jsxRuntimeExports.jsx(Icon,{width:"30px",height:"15px",fill:colors.gray[450],viewBox:"1 1 30 15",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.2429 13V4.27273H7.02131V5.79403H3.08807V7.87358H6.63778V9.39489H3.08807V13H1.2429ZM8.67685 13H6.69957L9.71236 4.27273H12.0902L15.0987 13H13.1214L10.9354 6.26705H10.8672L8.67685 13ZM8.55327 9.5696H13.2237V11.0099H8.55327V9.5696ZM19.4847 4.27273V13H17.6396V6.02415H17.5884L15.5898 7.27699V5.64062L17.7504 4.27273H19.4847ZM22.1683 13.1108C21.8871 13.1108 21.6456 13.0114 21.4439 12.8125C21.245 12.6108 21.1456 12.3693 21.1456 12.0881C21.1456 11.8097 21.245 11.571 21.4439 11.3722C21.6456 11.1733 21.8871 11.0739 22.1683 11.0739C22.4411 11.0739 22.6797 11.1733 22.8842 11.3722C23.0888 11.571 23.1911 11.8097 23.1911 12.0881C23.1911 12.2756 23.1428 12.4474 23.0462 12.6037C22.9524 12.7571 22.8288 12.8807 22.6754 12.9744C22.522 13.0653 22.353 13.1108 22.1683 13.1108ZM24.6644 13V11.6705L27.771 8.79403C28.0352 8.53835 28.2567 8.30824 28.4357 8.10369C28.6175 7.89915 28.7553 7.69886 28.8491 7.50284C28.9428 7.30398 28.9897 7.08949 28.9897 6.85938C28.9897 6.60369 28.9315 6.38352 28.815 6.19886C28.6985 6.01136 28.5394 5.8679 28.3377 5.76847C28.136 5.66619 27.9073 5.61506 27.6516 5.61506C27.3846 5.61506 27.1516 5.66903 26.9528 5.77699C26.7539 5.88494 26.6005 6.03977 26.4925 6.24148C26.3846 6.44318 26.3306 6.68324 26.3306 6.96165H24.5792C24.5792 6.39062 24.7085 5.89489 24.967 5.47443C25.2255 5.05398 25.5877 4.72869 26.0536 4.49858C26.5195 4.26847 27.0565 4.15341 27.6644 4.15341C28.2894 4.15341 28.8335 4.2642 29.2965 4.4858C29.7624 4.70455 30.1246 5.00852 30.3832 5.39773C30.6417 5.78693 30.771 6.23295 30.771 6.7358C30.771 7.06534 30.7056 7.39062 30.5749 7.71165C30.4471 8.03267 30.2184 8.3892 29.8888 8.78125C29.5593 9.17045 29.0948 9.63778 28.4954 10.1832L27.2212 11.4318V11.4915H30.886V13H24.6644Z"})}),FA2Icon=_=>jsxRuntimeExports.jsx(Icon,{width:"23px",height:"18px",fill:colors.gray[450],viewBox:"0 0 23 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.0261 13V4.27273H6.80451V5.79403H2.87127V7.87358H6.42099V9.39489H2.87127V13H1.0261ZM8.46005 13H6.48278L9.49556 4.27273H11.8734L14.8819 13H12.9047L10.7186 6.26705H10.6504L8.46005 13ZM8.33647 9.5696H13.0069V11.0099H8.33647V9.5696ZM15.8812 13V11.6705L18.9877 8.79403C19.252 8.53835 19.4735 8.30824 19.6525 8.10369C19.8343 7.89915 19.9721 7.69886 20.0659 7.50284C20.1596 7.30398 20.2065 7.08949 20.2065 6.85938C20.2065 6.60369 20.1483 6.38352 20.0318 6.19886C19.9153 6.01136 19.7562 5.8679 19.5545 5.76847C19.3528 5.66619 19.1241 5.61506 18.8684 5.61506C18.6014 5.61506 18.3684 5.66903 18.1696 5.77699C17.9707 5.88494 17.8173 6.03977 17.7093 6.24148C17.6014 6.44318 17.5474 6.68324 17.5474 6.96165H15.796C15.796 6.39062 15.9252 5.89489 16.1838 5.47443C16.4423 5.05398 16.8045 4.72869 17.2704 4.49858C17.7363 4.26847 18.2733 4.15341 18.8812 4.15341C19.5062 4.15341 20.0502 4.2642 20.5133 4.4858C20.9792 4.70455 21.3414 5.00852 21.6 5.39773C21.8585 5.78693 21.9877 6.23295 21.9877 6.7358C21.9877 7.06534 21.9224 7.39062 21.7917 7.71165C21.6639 8.03267 21.4352 8.3892 21.1056 8.78125C20.7761 9.17045 20.3116 9.63778 19.7122 10.1832L18.438 11.4318V11.4915H22.1028V13H15.8812Z"})}),FacebookIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"28px",height:"28px",fill:"none","data-testid":"facebook-icon",viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M28 14.0856C28 6.30633 21.732 0 14 0C6.26801 0 0 6.30633 0 14.0856C0 21.1161 5.1196 26.9434 11.8125 28V18.1572H8.25781V14.0856H11.8125V10.9824C11.8125 7.45215 13.9026 5.50218 17.1005 5.50218C18.6322 5.50218 20.2344 5.77729 20.2344 5.77729V9.24367H18.469C16.7299 9.24367 16.1875 10.3294 16.1875 11.4434V14.0856H20.0703L19.4496 18.1572H16.1875V28C22.8804 26.9434 28 21.1161 28 14.0856Z",fill:"#1977F2",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M19.4496 18.0469L20.0703 14H16.1875V11.3738C16.1875 10.2667 16.7299 9.1875 18.469 9.1875H20.2344V5.74219C20.2344 5.74219 18.6322 5.46875 17.1005 5.46875C13.9026 5.46875 11.8125 7.40687 11.8125 10.9156V14H8.25781V18.0469H11.8125V27.8299C13.262 28.0567 14.738 28.0567 16.1875 27.8299V18.0469H19.4496Z",fill:"white",clipRule:"evenodd",fillRule:"evenodd"})]}),FetchingIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"19px",height:"19px",fill:"none",stroke:colors.gray[400],viewBox:"0 0 19 19",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15.7842 10.2916C15.8165 10.0323 15.8332 9.76807 15.8332 9.49996C15.8332 6.00216 12.9976 3.16663 9.49984 3.16663C7.52021 3.16663 5.75273 4.07488 4.59135 5.49742M3.2155 8.70829C3.18316 8.96764 3.1665 9.23185 3.1665 9.49996C3.1665 12.9978 6.00203 15.8333 9.49984 15.8333C11.3914 15.8333 13.0893 15.004 14.2498 13.6892M11.8748 13.4583H14.2498V13.6892M4.59135 3.16663V5.49742M4.59135 5.49742V5.54157L6.96635 5.54163M14.2498 15.8333V13.6892",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FileArrowDownIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9 8.25V12.75M9 12.75L7.5 11.25M9 12.75L10.5 11.25M9.75 2.25H6.15C5.30992 2.25 4.88988 2.25 4.56901 2.41349C4.28677 2.5573 4.0573 2.78677 3.91349 3.06901C3.75 3.38988 3.75 3.80992 3.75 4.65V13.35C3.75 14.1901 3.75 14.6101 3.91349 14.931C4.0573 15.2132 4.28677 15.4427 4.56901 15.5865C4.88988 15.75 5.30992 15.75 6.15 15.75H11.85C12.6901 15.75 13.1101 15.75 13.431 15.5865C13.7132 15.4427 13.9427 15.2132 14.0865 14.931C14.25 14.6101 14.25 14.1901 14.25 13.35V6.75M9.75 2.25L14.25 6.75M9.75 2.25V5.55C9.75 5.97004 9.75 6.18006 9.83175 6.34049C9.90365 6.48161 10.0184 6.59635 10.1595 6.66825C10.3199 6.75 10.53 6.75 10.95 6.75H14.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FileCopyIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M11.25 2.25V4.8C11.25 5.22004 11.25 5.43006 11.3317 5.59049C11.4037 5.73161 11.5184 5.84635 11.6595 5.91825C11.8199 6 12.03 6 12.45 6H15M7.5 6H4.5C3.67157 6 3 6.67157 3 7.5V14.25C3 15.0784 3.67157 15.75 4.5 15.75H9C9.82843 15.75 10.5 15.0784 10.5 14.25V12M12 2.25H9.9C9.05992 2.25 8.63988 2.25 8.31901 2.41349C8.03677 2.5573 7.8073 2.78677 7.66349 3.06901C7.5 3.38988 7.5 3.80992 7.5 4.65V9.6C7.5 10.4401 7.5 10.8601 7.66349 11.181C7.8073 11.4632 8.03677 11.6927 8.31901 11.8365C8.63988 12 9.05992 12 9.9 12H12.6C13.4401 12 13.8601 12 14.181 11.8365C14.4632 11.6927 14.6927 11.4632 14.8365 11.181C15 10.8601 15 10.4401 15 9.6V5.25L12 2.25Z",strokeLinejoin:"round",strokeWidth:"1.2"})}),FlipForwardEnergy=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:"black",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M2.95314 5.997C4.05824 3.77605 6.35091 2.25 9 2.25C12.4718 2.25 15.3314 4.87105 15.708 8.24231M2.2912 9.74998C2.66427 13.125 5.52558 15.75 9 15.75C11.6496 15.75 13.9427 14.2234 15.0475 12.0017M2.25 3V6.375H5.625M15.75 15.375V12H12.375M8.625 6.75L7.5 9H10.5L9.375 11.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),FolderInfoIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[400],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 10H12.01M12 13V16M12.0627 6.06274L11.9373 5.93726C11.5914 5.59135 11.4184 5.4184 11.2166 5.29472C11.0376 5.18506 10.8425 5.10425 10.6385 5.05526C10.4083 5 10.1637 5 9.67452 5H6.2C5.0799 5 4.51984 5 4.09202 5.21799C3.71569 5.40973 3.40973 5.71569 3.21799 6.09202C3 6.51984 3 7.07989 3 8.2V15.8C3 16.9201 3 17.4802 3.21799 17.908C3.40973 18.2843 3.71569 18.5903 4.09202 18.782C4.51984 19 5.07989 19 6.2 19H17.8C18.9201 19 19.4802 19 19.908 18.782C20.2843 18.5903 20.5903 18.2843 20.782 17.908C21 17.4802 21 16.9201 21 15.8V10.2C21 9.0799 21 8.51984 20.782 8.09202C20.5903 7.71569 20.2843 7.40973 19.908 7.21799C19.4802 7 18.9201 7 17.8 7H14.3255C13.8363 7 13.5917 7 13.3615 6.94474C13.1575 6.89575 12.9624 6.81494 12.7834 6.70528C12.5816 6.5816 12.4086 6.40865 12.0627 6.06274Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),GearIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"}),jsxRuntimeExports.jsx("path",{d:"M12.9046 3.06005C12.6988 3 12.4659 3 12 3C11.5341 3 11.3012 3 11.0954 3.06005C10.7942 3.14794 10.5281 3.32808 10.3346 3.57511C10.2024 3.74388 10.1159 3.96016 9.94291 4.39272C9.69419 5.01452 9.00393 5.33471 8.36857 5.123L7.79779 4.93281C7.3929 4.79785 7.19045 4.73036 6.99196 4.7188C6.70039 4.70181 6.4102 4.77032 6.15701 4.9159C5.98465 5.01501 5.83376 5.16591 5.53197 5.4677C5.21122 5.78845 5.05084 5.94882 4.94896 6.13189C4.79927 6.40084 4.73595 6.70934 4.76759 7.01551C4.78912 7.2239 4.87335 7.43449 5.04182 7.85566C5.30565 8.51523 5.05184 9.26878 4.44272 9.63433L4.16521 9.80087C3.74031 10.0558 3.52786 10.1833 3.37354 10.3588C3.23698 10.5141 3.13401 10.696 3.07109 10.893C3 11.1156 3 11.3658 3 11.8663C3 12.4589 3 12.7551 3.09462 13.0088C3.17823 13.2329 3.31422 13.4337 3.49124 13.5946C3.69158 13.7766 3.96395 13.8856 4.50866 14.1035C5.06534 14.3261 5.35196 14.9441 5.16236 15.5129L4.94721 16.1584C4.79819 16.6054 4.72367 16.829 4.7169 17.0486C4.70875 17.3127 4.77049 17.5742 4.89587 17.8067C5.00015 18.0002 5.16678 18.1668 5.5 18.5C5.83323 18.8332 5.99985 18.9998 6.19325 19.1041C6.4258 19.2295 6.68733 19.2913 6.9514 19.2831C7.17102 19.2763 7.39456 19.2018 7.84164 19.0528L8.36862 18.8771C9.00393 18.6654 9.6942 18.9855 9.94291 19.6073C10.1159 20.0398 10.2024 20.2561 10.3346 20.4249C10.5281 20.6719 10.7942 20.8521 11.0954 20.94C11.3012 21 11.5341 21 12 21C12.4659 21 12.6988 21 12.9046 20.94C13.2058 20.8521 13.4719 20.6719 13.6654 20.4249C13.7976 20.2561 13.8841 20.0398 14.0571 19.6073C14.3058 18.9855 14.9961 18.6654 15.6313 18.8773L16.1579 19.0529C16.605 19.2019 16.8286 19.2764 17.0482 19.2832C17.3123 19.2913 17.5738 19.2296 17.8063 19.1042C17.9997 18.9999 18.1664 18.8333 18.4996 18.5001C18.8328 18.1669 18.9994 18.0002 19.1037 17.8068C19.2291 17.5743 19.2908 17.3127 19.2827 17.0487C19.2759 16.8291 19.2014 16.6055 19.0524 16.1584L18.8374 15.5134C18.6477 14.9444 18.9344 14.3262 19.4913 14.1035C20.036 13.8856 20.3084 13.7766 20.5088 13.5946C20.6858 13.4337 20.8218 13.2329 20.9054 13.0088C21 12.7551 21 12.4589 21 11.8663C21 11.3658 21 11.1156 20.9289 10.893C20.866 10.696 20.763 10.5141 20.6265 10.3588C20.4721 10.1833 20.2597 10.0558 19.8348 9.80087L19.5569 9.63416C18.9478 9.26867 18.6939 8.51514 18.9578 7.85558C19.1262 7.43443 19.2105 7.22383 19.232 7.01543C19.2636 6.70926 19.2003 6.40077 19.0506 6.13181C18.9487 5.94875 18.7884 5.78837 18.4676 5.46762C18.1658 5.16584 18.0149 5.01494 17.8426 4.91583C17.5894 4.77024 17.2992 4.70174 17.0076 4.71872C16.8091 4.73029 16.6067 4.79777 16.2018 4.93273L15.6314 5.12287C14.9961 5.33464 14.3058 5.0145 14.0571 4.39272C13.8841 3.96016 13.7976 3.74388 13.6654 3.57511C13.4719 3.32808 13.2058 3.14794 12.9046 3.06005Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})]}),GoogleIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none","data-testid":"google-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M23.5198 12.2729C23.5198 11.422 23.4435 10.6038 23.3016 9.81836H12V14.4601H18.4581C18.1799 15.9601 17.3345 17.231 16.0636 18.0819V21.0927H19.9417C22.2107 19.0037 23.5198 15.9274 23.5198 12.2729Z",fill:"#4285F4",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M12.0008 24.0011C15.2408 24.0011 17.9571 22.9266 19.9425 21.0939L16.0644 18.083C14.9899 18.803 13.6153 19.2284 12.0008 19.2284C8.8754 19.2284 6.22999 17.1176 5.28637 14.2812H1.27734V17.3903C3.25186 21.312 7.30997 24.0011 12.0008 24.0011Z",fill:"#34A853",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M5.28537 14.2803C5.04537 13.5603 4.90901 12.7912 4.90901 12.0003C4.90901 11.2094 5.04537 10.4404 5.28537 9.72037V6.61133H1.27634C0.463629 8.2313 0 10.064 0 12.0003C0 13.9367 0.463629 15.7694 1.27634 17.3893L5.28537 14.2803Z",fill:"#FBBC05",clipRule:"evenodd",fillRule:"evenodd"}),jsxRuntimeExports.jsx("path",{d:"M12.0008 4.77265C13.7626 4.77265 15.3444 5.3781 16.588 6.56717L20.0298 3.1254C17.9516 1.18907 15.2353 0 12.0008 0C7.30997 0 3.25186 2.68905 1.27734 6.6108L5.28637 9.71984C6.22999 6.88353 8.8754 4.77265 12.0008 4.77265Z",fill:"#EA4335",clipRule:"evenodd",fillRule:"evenodd"})]}),HelpIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M18.3795 5.65166L14.1055 9.86303M9.89445 14.137L5.63994 18.3679M5.63408 5.63799L9.89445 9.86303M14.1056 14.137L18.364 18.364M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12ZM15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z",stroke:colors.gray[450],strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),HourglassIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M15 2.25H3M15 15.75H3M3.75 2.25C3.75 4.13267 4.65921 5.89944 6.1912 6.99371L11.8088 11.0063C13.3408 12.1006 14.25 13.8673 14.25 15.75M14.25 2.25C14.25 4.13267 13.3408 5.89944 11.8088 6.99371L6.1912 11.0063C4.65921 12.1006 3.75 13.8673 3.75 15.75",stroke:"#FB4F57",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),OutgoingArrow=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],"data-testid":"outgoing-arrow-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M5.25 12.75L12.75 5.25M12.75 5.25H6M12.75 5.25V12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),IncomingArrow=_=>jsxRuntimeExports.jsx(OutgoingArrow,{css:{rotate:"180deg"},..._}),KeyIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],"data-testid":"key-icon",strokeWidth:"1.2",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9.24092 8.01389L3 14.25L4.5 15.75M5.25 12L6.75 13.5M15 5.625C15 7.48896 13.489 9 11.625 9C9.76104 9 8.25 7.48896 8.25 5.625C8.25 3.76104 9.76104 2.25 11.625 2.25C13.489 2.25 15 3.76104 15 5.625Z",strokeLinecap:"round",strokeLinejoin:"round"})}),LedgerIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:colors.gray[400],"data-testid":"ledger-icon",strokeWidth:"0",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M11.666 7.29183H12.3952V8.75016H9.47852V4.37516H10.9368L8.74935 1.4585L6.56185 4.37516H8.02018V10.2085H5.10352V8.54818C5.5381 8.29516 5.83268 7.82995 5.83268 7.29183C5.83268 6.90506 5.67904 6.53412 5.40555 6.26063C5.13206 5.98714 4.76112 5.8335 4.37435 5.8335C3.98757 5.8335 3.61664 5.98714 3.34315 6.26063C3.06966 6.53412 2.91602 6.90506 2.91602 7.29183C2.91602 7.82995 3.2106 8.29516 3.64518 8.54818V10.2085C3.64518 11.0128 4.29924 11.6668 5.10352 11.6668H8.02018V13.3271C7.79896 13.454 7.61508 13.6369 7.48707 13.8575C7.35906 14.0781 7.29143 14.3285 7.29102 14.5835C7.29102 14.9703 7.44466 15.3412 7.71815 15.6147C7.99164 15.8882 8.36257 16.0418 8.74935 16.0418C9.13612 16.0418 9.50706 15.8882 9.78055 15.6147C10.054 15.3412 10.2077 14.9703 10.2077 14.5835C10.2077 14.0454 9.9131 13.5802 9.47852 13.3271V10.2085H12.3952C13.1995 10.2085 13.8535 9.55443 13.8535 8.75016V7.29183H14.5827V4.37516H11.666V7.29183Z"})}),LinkIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M9.16586 17.6508C8.9261 17.8747 8.74055 18.0245 8.55093 18.134C7.62273 18.6699 6.47914 18.6699 5.55093 18.134C5.20889 17.9365 4.88009 17.6077 4.22251 16.9501C3.56492 16.2925 3.23612 15.9637 3.03864 15.6217C2.50274 14.6935 2.50274 13.5499 3.03864 12.6217C3.23612 12.2797 3.56492 11.9509 4.2225 11.2933L7.05093 8.46484C7.70852 7.80725 8.03732 7.47846 8.37936 7.28098C9.30756 6.74508 10.4512 6.74508 11.3794 7.28098C11.7214 7.47846 12.0502 7.80725 12.7078 8.46484C13.3654 9.12243 13.6942 9.45123 13.8916 9.79327C14.4275 10.7215 14.4275 11.8651 13.8916 12.7933C13.7822 12.9829 13.6323 13.1684 13.4085 13.4082M10.5929 10.5926C10.369 10.8323 10.2192 11.0179 10.1097 11.2075C9.57381 12.1357 9.57381 13.2793 10.1097 14.2075C10.3072 14.5495 10.636 14.8783 11.2936 15.5359C11.9512 16.1935 12.28 16.5223 12.622 16.7198C13.5502 17.2557 14.6938 17.2557 15.622 16.7198C15.964 16.5223 16.2928 16.1935 16.9504 15.5359L19.7789 12.7075C20.4364 12.0499 20.7652 11.7211 20.9627 11.3791C21.4986 10.4509 21.4986 9.30726 20.9627 8.37906C20.7652 8.03701 20.4364 7.70822 19.7789 7.05063C19.1213 6.39304 18.7925 6.06425 18.4504 5.86677C17.5222 5.33087 16.3786 5.33087 15.4504 5.86677C15.2608 5.97625 15.0753 6.12608 14.8355 6.34992",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),LockIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 14.5V16.5M7 10.0288C7.47142 10 8.05259 10 8.8 10H15.2C15.9474 10 16.5286 10 17 10.0288M7 10.0288C6.41168 10.0647 5.99429 10.1455 5.63803 10.327C5.07354 10.6146 4.6146 11.0735 4.32698 11.638C4 12.2798 4 13.1198 4 14.8V16.2C4 17.8802 4 18.7202 4.32698 19.362C4.6146 19.9265 5.07354 20.3854 5.63803 20.673C6.27976 21 7.11984 21 8.8 21H15.2C16.8802 21 17.7202 21 18.362 20.673C18.9265 20.3854 19.3854 19.9265 19.673 19.362C20 18.7202 20 17.8802 20 16.2V14.8C20 13.1198 20 12.2798 19.673 11.638C19.3854 11.0735 18.9265 10.6146 18.362 10.327C18.0057 10.1455 17.5883 10.0647 17 10.0288M7 10.0288V8C7 5.23858 9.23858 3 12 3C14.7614 3 17 5.23858 17 8V10.0288",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),MaintenanceIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:"black",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12.182 5.81859C13.9393 7.57595 13.9393 10.4252 12.182 12.1825M5.81802 12.1825C4.06066 10.4252 4.06066 7.57592 5.81802 5.81856M3.6967 14.3039C0.767767 11.3749 0.767767 6.6262 3.6967 3.69727M14.3033 3.6973C17.2322 6.62623 17.2322 11.375 14.3033 14.3039M10.5 9.00057C10.5 9.82899 9.82843 10.5006 9 10.5006C8.17157 10.5006 7.5 9.82899 7.5 9.00057C7.5 8.17214 8.17157 7.50057 9 7.50057C9.82843 7.50057 10.5 8.17214 10.5 9.00057Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),MakiIcon=({fishColor:_,...a})=>jsxRuntimeExports.jsxs(Icon,{width:"38px",height:"38px",fill:"none",viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",...a,children:[jsxRuntimeExports.jsx("path",{d:"M34.9985 26.2751C34.6599 26.8629 34.2436 27.4106 33.7512 27.9032C32.2815 29.3727 30.3277 30.1819 28.2496 30.1819H24.8477V34.9996H26.8032H28.2497C30.0524 34.9996 31.7472 34.2976 33.022 33.0229C34.2967 31.7481 34.9986 30.0533 34.9985 28.2507V26.2751Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M34.9989 20.9441C34.6603 21.5318 34.2439 22.0796 33.7514 22.572C32.2819 24.0416 30.328 24.8509 28.2499 24.8509H18.9983C17.8104 24.8511 16.8477 25.814 16.8477 27.0019C16.8477 28.1898 17.8104 29.1528 18.9983 29.153H28.25C30.0526 29.153 31.7474 28.4511 33.0222 27.1763C34.2965 25.902 34.9986 24.2076 34.9989 22.4054V20.9441ZM18.9988 27.8361C18.5381 27.8361 18.1645 27.4626 18.1645 27.0018C18.1645 26.5412 18.5381 26.1675 18.9988 26.1675C19.4596 26.1675 19.8331 26.5412 19.8331 27.0018C19.8331 27.4626 19.4596 27.8361 18.9988 27.8361Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M35 9.74895C35 6.02751 31.9724 3 28.2509 3H9.74908C6.02761 3 3 6.02751 3 9.74895V28.2511C3 31.9725 6.02761 35 9.74899 35H23.8176V30.1824H18.9995C17.2418 30.1824 15.8171 28.7576 15.8171 27.0001C15.8171 25.2426 17.2418 23.8179 18.9995 23.8179H23.8176V18.9998H9.74899C6.5911 18.9998 4.03113 16.4402 4.03113 13.2824V9.74905C4.03113 6.59127 6.5911 4.03131 9.74899 4.03131H28.2508C31.4087 4.03131 33.9686 6.59127 33.9686 9.74905V13.2824C33.9686 16.4403 31.4089 19.0001 28.251 19.0001L24.8491 18.9998V23.8179H28.2511C30.0539 23.8179 31.7487 23.1159 33.0233 21.8411C34.2977 20.5668 34.9997 18.8725 35 17.0703V9.74895Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M28.251 4.03174C31.4088 4.03174 33.9687 6.59167 33.9687 9.74952V13.2828C33.9687 16.4406 31.4089 19.0005 28.2511 19.0005L9.74908 19.0003C6.59124 19.0003 4.03125 16.4406 4.03125 13.2829V9.74954C4.03125 6.59167 6.5912 4.03174 9.74908 4.03174H28.251Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M28.2511 6.73267C29.611 6.73267 30.7641 7.6364 31.1394 8.87525C31.1926 9.05118 31.0527 9.22558 30.869 9.21814C28.2867 9.11348 25.877 8.32896 23.8154 7.038C23.6751 6.95014 23.739 6.73267 23.9045 6.73267H28.2511Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M21.9973 7.02488C24.4283 8.9081 27.4326 10.0842 30.7 10.2428C31.0172 10.2581 31.2679 10.5166 31.2679 10.8342V12.8702C31.2674 12.9124 31.2661 13.0446 31.2638 13.1857C31.2603 13.4148 31.069 13.5949 30.8401 13.5876C25.3913 13.4117 20.5215 10.9067 17.1937 7.03888C17.0905 6.91878 17.175 6.73267 17.3334 6.73267H21.1443C21.4533 6.73267 21.753 6.83569 21.9973 7.02488Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M15.9653 7.17305C19.4649 11.5395 24.7681 14.4013 30.735 14.6156C30.8376 14.6193 30.9004 14.7309 30.8481 14.8191C30.3219 15.7056 29.3544 16.3012 28.2505 16.3012H23.1255C22.9317 16.3012 22.7392 16.2646 22.5603 16.1899C18.0848 14.3242 14.3146 11.0926 11.7745 7.01866C11.6968 6.89417 11.7878 6.73267 11.9345 6.73267H15.0503C15.4065 6.73267 15.7426 6.89513 15.9653 7.17305Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M9.75058 6.73267H10.1145C10.294 6.73267 10.4589 6.82889 10.5496 6.98379C12.776 10.7844 16.0081 13.9276 19.8791 16.0439C20.0039 16.1122 19.9556 16.3012 19.8134 16.3012H15.1194C14.5651 16.3012 14.0261 16.1087 13.6043 15.7491C11.1433 13.6507 9.05479 11.1267 7.45371 8.29236C7.34983 8.10846 7.3762 7.87733 7.51835 7.72112C8.07107 7.11383 8.86658 6.73267 9.75058 6.73267Z",fill:_}),jsxRuntimeExports.jsx("path",{d:"M12.3071 15.9829C12.4313 16.0951 12.3514 16.3013 12.184 16.3013H9.71437C8.06547 16.2829 6.73047 14.9363 6.73047 13.2836V9.7504L6.73065 9.54576C6.73077 9.42446 6.89048 9.37962 6.95305 9.48354C8.41152 11.9061 10.2194 14.096 12.3071 15.9829Z",fill:_})]}),NoticeIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12 8H12.01M12 11V16M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),OutlineExclamationCircleIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"16px",height:"16px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M8 5V8.75M8 11H8.0075M14.75 8C14.75 11.7279 11.7279 14.75 8 14.75C4.27208 14.75 1.25 11.7279 1.25 8C1.25 4.27208 4.27208 1.25 8 1.25C11.7279 1.25 14.75 4.27208 14.75 8Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),PenIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M11.3348 4.66483L13.2208 6.55082M3 15L3.03164 14.7785C3.1436 13.9948 3.19958 13.6029 3.32692 13.2371C3.43992 12.9124 3.59428 12.6037 3.78619 12.3185C4.00247 11.9971 4.28237 11.7172 4.84218 11.1574L12.609 3.3906C13.1298 2.8698 13.9742 2.8698 14.495 3.3906C15.0158 3.9114 15.0158 4.75578 14.495 5.27658L6.58565 13.1859C6.07779 13.6938 5.82386 13.9477 5.53462 14.1497C5.27789 14.3289 5.001 14.4774 4.70965 14.5921C4.3814 14.7213 4.02937 14.7923 3.32535 14.9344L3 15Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),PlusIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[300],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4 12H20M12 4V20",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),RedditIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none","data-testid":"reddit-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:[jsxRuntimeExports.jsx("path",{d:"M12 0C5.37281 0 0 5.37281 0 12C0 15.3141 1.34344 18.3141 3.51469 20.4853L1.22906 22.7709C0.775312 23.2247 1.09688 24 1.73813 24H12C18.6272 24 24 18.6272 24 12C24 5.37281 18.6272 0 12 0Z",fill:"#FF4500"}),jsxRuntimeExports.jsx("path",{d:"M14.4414 5.65922C14.6495 6.54141 15.4417 7.19859 16.3877 7.19859C17.492 7.19859 18.3873 6.30328 18.3873 5.19891C18.3873 4.09453 17.492 3.19922 16.3877 3.19922C15.422 3.19922 14.6167 3.88359 14.4292 4.79391C12.812 4.96734 11.5492 6.33891 11.5492 8.00109C11.5492 8.00484 11.5492 8.00766 11.5492 8.01141C9.79047 8.08547 8.18453 8.58609 6.90953 9.37641C6.43609 9.00984 5.84172 8.79141 5.19672 8.79141C3.64891 8.79141 2.39453 10.0458 2.39453 11.5936C2.39453 12.7167 3.05453 13.6842 4.00797 14.1314C4.10078 17.3845 7.64547 20.0011 12.0058 20.0011C16.3661 20.0011 19.9155 17.3817 20.0036 14.1258C20.9495 13.6758 21.6039 12.7111 21.6039 11.5945C21.6039 10.0467 20.3495 8.79234 18.8017 8.79234C18.1595 8.79234 17.568 9.00891 17.0955 9.37266C15.8092 8.57672 14.1855 8.07609 12.4089 8.00953C12.4089 8.00672 12.4089 8.00484 12.4089 8.00203C12.4089 6.81141 13.2939 5.82328 14.4414 5.66109V5.65922ZM6.79703 13.372C6.84391 12.3558 7.51891 11.5758 8.30359 11.5758C9.08828 11.5758 9.68828 12.3998 9.64141 13.4161C9.59453 14.4323 9.00859 14.8017 8.22297 14.8017C7.43734 14.8017 6.75016 14.3883 6.79703 13.372ZM15.7089 11.5758C16.4945 11.5758 17.1695 12.3558 17.2155 13.372C17.2623 14.3883 16.5742 14.8017 15.7895 14.8017C15.0048 14.8017 14.418 14.4333 14.3711 13.4161C14.3242 12.3998 14.9233 11.5758 15.7089 11.5758ZM14.7752 15.7233C14.9223 15.7383 15.0161 15.8911 14.9589 16.028C14.4761 17.182 13.3361 17.993 12.0058 17.993C10.6755 17.993 9.53641 17.182 9.05266 16.028C8.99547 15.8911 9.08922 15.7383 9.23641 15.7233C10.0989 15.6361 11.0317 15.5883 12.0058 15.5883C12.9798 15.5883 13.9117 15.6361 14.7752 15.7233Z",fill:"white"})]}),RefreshClockIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18",height:"18",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3 9C3 12.3137 5.68629 15 9 15C12.3137 15 15 12.3137 15 9C15 5.68629 12.3137 3 9 3C7.20796 3 5.59942 3.78563 4.5 5.03126C4.43696 5.10268 4.3756 5.17562 4.31597 5.25M9 6V9L10.875 10.875M4.31543 3.00293V5.25293H6.56543",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ReloadIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"22px",height:"22px",strokeWidth:"0",viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M16.1791 5.82018C15.5007 5.13713 14.6938 4.59511 13.8049 4.22539C12.916 3.85568 11.9627 3.66556 10.9999 3.66602C6.94828 3.66602 3.67578 6.94768 3.67578 10.9993C3.67578 15.051 6.94828 18.3327 10.9999 18.3327C14.4191 18.3327 17.2699 15.9952 18.0858 12.8327H16.1791C15.8015 13.9047 15.1005 14.8332 14.1728 15.4899C13.2452 16.1467 12.1366 16.4994 10.9999 16.4993C7.96578 16.4993 5.49995 14.0335 5.49995 10.9993C5.49995 7.96518 7.96578 5.49935 10.9999 5.49935C12.5216 5.49935 13.8783 6.13185 14.8683 7.13102L11.9166 10.0827H18.3333V3.66602L16.1791 5.82018Z"})}),RotateIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],"data-testid":"rotate-icon",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M12.5 18.5C17.1944 18.5 21 14.6944 21 10C21 5.30558 17.1944 1.5 12.5 1.5C7.80558 1.5 4 5.30558 4 10C4 11.5433 4.41128 12.9905 5.13022 14.238M1.5 13L5.13022 14.238M6.82531 10.3832L5.47107 14.3542L5.13022 14.238",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SlashIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M16 3L8 21",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SlidersIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"32px",height:"32px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M16 7.33333C16 9.17428 14.5076 10.6667 12.6667 10.6667C10.8257 10.6667 9.33333 9.17428 9.33333 7.33333M16 7.33333C16 5.49238 14.5076 4 12.6667 4C10.8257 4 9.33333 5.49238 9.33333 7.33333M16 7.33333H28M9.33333 7.33333H4M25.3333 16C25.3333 17.8409 23.8409 19.3333 22 19.3333C20.1591 19.3333 18.6667 17.8409 18.6667 16M25.3333 16C25.3333 14.1591 23.8409 12.6667 22 12.6667C20.1591 12.6667 18.6667 14.1591 18.6667 16M25.3333 16H28M18.6667 16H4M13.3333 24.6667C13.3333 26.5076 11.8409 28 10 28C8.15905 28 6.66667 26.5076 6.66667 24.6667M13.3333 24.6667C13.3333 22.8257 11.8409 21.3333 10 21.3333C8.15905 21.3333 6.66667 22.8257 6.66667 24.6667M13.3333 24.6667H28M6.66667 24.6667H4",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),TezIcon=_=>jsxRuntimeExports.jsxs(Icon,{width:"30px",height:"30px",fill:"none","data-testid":"tez-icon",viewBox:"0 0 30 30",..._,children:[jsxRuntimeExports.jsx("rect",{width:"30",height:"30",fill:"white",rx:"4"}),jsxRuntimeExports.jsx("rect",{width:"30",height:"30",fill:"url(#pattern0)",rx:"4"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsx("pattern",{width:"1",height:"1",id:"pattern0",patternContentUnits:"objectBoundingBox",children:jsxRuntimeExports.jsx("use",{transform:"translate(0.1753 0.101557) scale(0.00532296)",xlinkHref:"#image0_2912_38337"})}),jsxRuntimeExports.jsx("image",{width:"122",height:"150",id:"image0_2912_38337",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAACWCAYAAAAR35wdAAAMP2lDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEBooUsJvQkiNYCUEFrovdkISYBQYgwEFXtZVHDtogI2dFVEwQqIBUUUC4ti74sFFWVdLNiVNymg677yvfm+ufPff87858y5M/feAUDtBEckykPVAcgXForjQgLoKalpdNJTQAS6gAyUgTOHWyBixsREAFiG2r+Xd9cBIm2vOEi1/tn/X4sGj1/ABQCJgTiDV8DNh/ggAHgVVyQuBIAo5c2nFIqkGFagJYYBQrxIirPkuEqKM+R4r8wmIY4FcRsASiocjjgLANVLkKcXcbOghmo/xE5CnkAIgBodYt/8/Ek8iNMhtoE2Ioil+oyMH3Sy/qaZMazJ4WQNY/lcZEUpUFAgyuNM+z/T8b9Lfp5kyIcVrCrZ4tA46Zxh3m7mTgqXYhWI+4QZUdEQa0L8QcCT2UOMUrIloYlye9SQW8CCOQM6EDvxOIHhEBtCHCzMi4pQ8BmZgmA2xHCFoFMFhewEiPUgXsQvCIpX2GwWT4pT+EIbMsUspoI/yxHL/Ep93ZfkJjIV+q+z+WyFPqZanJ2QDDEFYosiQVIUxKoQOxbkxocrbMYUZ7OihmzEkjhp/BYQx/GFIQFyfawoUxwcp7AvzS8Ymi+2OVvAjlLg/YXZCaHy/GBtXI4sfjgX7BJfyEwc0uEXpEQMzYXHDwySzx17xhcmxit0PogKA+LkY3GKKC9GYY+b8fNCpLwZxK4FRfGKsXhSIVyQcn08U1QYkyCPEy/O4YTFyOPBl4MIwAKBgA4ksGaASSAHCDr7GvvgnbwnGHCAGGQBPnBQMEMjkmU9QniNB8XgT4j4oGB4XICslw+KIP91mJVfHUCmrLdINiIXPIE4H4SDPHgvkY0SDntLAo8hI/iHdw6sXBhvHqzS/n/PD7HfGSZkIhSMZMgjXW3IkhhEDCSGEoOJtrgB7ot74xHw6g+rM87APYfm8d2e8ITQRXhIuEboJtyaKJgn/inKSNAN9YMVucj4MRe4FdR0wwNwH6gOlXEd3AA44K7QDxP3g57dIMtSxC3NCv0n7b/N4IenobAjO5FRsi7Zn2zz80hVO1W3YRVprn/MjzzWjOF8s4Z7fvbP+iH7PNiG/2yJLcIOYO3YSewcdhRrBHSsBWvCOrBjUjy8uh7LVteQtzhZPLlQR/APf0NPVprJAqdap16nL/K+Qv5U6TsasCaJpokFWdmFdCb8IvDpbCHXcSTd2cnZBQDp90X++noTK/tuIDod37n5fwDg0zI4OHjkOxfWAsA+D7j9D3/nbBjw06EMwNnDXIm4SM7h0gsBviXU4E7TB8bAHNjA+TgDd+AN/EEQCAPRIAGkggkw+my4zsVgCpgB5oISUAaWgzWgAmwCW8FOsAfsB43gKDgJzoAL4BK4Bu7A1dMDXoB+8A58RhCEhFARGqKPmCCWiD3ijDAQXyQIiUDikFQkHclChIgEmYHMR8qQlUgFsgWpQfYhh5GTyDmkC7mFPEB6kdfIJxRDVVAt1Ai1QkehDJSJhqMJ6Hg0C52MFqML0KXoOrQa3Y02oCfRC+g1tBt9gQ5gAFPGdDBTzAFjYCwsGkvDMjExNgsrxcqxaqwOa4bP+QrWjfVhH3EiTsPpuANcwaF4Is7FJ+Oz8CV4Bb4Tb8Db8Cv4A7wf/0agEgwJ9gQvApuQQsgiTCGUEMoJ2wmHCKfhXuohvCMSiTpEa6IH3IupxBzidOIS4gZiPfEEsYv4iDhAIpH0SfYkH1I0iUMqJJWQ1pN2k1pIl0k9pA9KykomSs5KwUppSkKleUrlSruUjitdVnqq9JmsTrYke5GjyTzyNPIy8jZyM/kiuYf8maJBsab4UBIoOZS5lHWUOsppyl3KG2VlZTNlT+VYZYHyHOV1ynuVzyo/UP6ooqlip8JSGaciUVmqskPlhMotlTdUKtWK6k9NoxZSl1JrqKeo96kfVGmqjqpsVZ7qbNVK1QbVy6ov1chqlmpMtQlqxWrlagfULqr1qZPVrdRZ6hz1WeqV6ofVb6gPaNA0RmtEa+RrLNHYpXFO45kmSdNKM0iTp7lAc6vmKc1HNIxmTmPRuLT5tG2007QeLaKWtRZbK0erTGuPVqdWv7amtqt2kvZU7UrtY9rdOpiOlQ5bJ09nmc5+nes6n3SNdJm6fN3FunW6l3Xf643Q89fj65Xq1etd0/ukT9cP0s/VX6HfqH/PADewM4g1mGKw0eC0Qd8IrRHeI7gjSkfsH3HbEDW0M4wznG641bDDcMDI2CjESGS03uiUUZ+xjrG/cY7xauPjxr0mNBNfE4HJapMWk+d0bTqTnkdfR2+j95samoaaSky3mHaafjazNks0m2dWb3bPnGLOMM80X23eat5vYWIRaTHDotbitiXZkmGZbbnWst3yvZW1VbLVQqtGq2fWetZs62LrWuu7NlQbP5vJNtU2V22JtgzbXNsNtpfsUDs3u2y7SruL9qi9u73AfoN910jCSM+RwpHVI284qDgwHYocah0eOOo4RjjOc2x0fDnKYlTaqBWj2kd9c3JzynPa5nRntObosNHzRjePfu1s58x1rnS+6kJ1CXaZ7dLk8srV3pXvutH1phvNLdJtoVur21d3D3exe517r4eFR7pHlccNhhYjhrGEcdaT4BngOdvzqOdHL3evQq/9Xn95O3jneu/yfjbGegx/zLYxj3zMfDg+W3y6fem+6b6bfbv9TP04ftV+D/3N/Xn+2/2fMm2ZOczdzJcBTgHigEMB71lerJmsE4FYYEhgaWBnkGZQYlBF0P1gs+Cs4Nrg/hC3kOkhJ0IJoeGhK0JvsI3YXHYNuz/MI2xmWFu4Snh8eEX4wwi7CHFEcyQaGRa5KvJulGWUMKoxGkSzo1dF34uxjpkccySWGBsTWxn7JG503Iy49nha/MT4XfHvEgISliXcSbRJlCS2JqkljUuqSXqfHJi8Mrk7ZVTKzJQLqQapgtSmNFJaUtr2tIGxQWPXjO0Z5zauZNz18dbjp44/N8FgQt6EYxPVJnImHkgnpCen70r/wonmVHMGMtgZVRn9XBZ3LfcFz5+3mtfL9+Gv5D/N9MlcmfksyydrVVZvtl92eXafgCWoELzKCc3ZlPM+Nzp3R+5gXnJefb5Sfnr+YaGmMFfYNsl40tRJXSJ7UYmoe7LX5DWT+8Xh4u0FSMH4gqZCLfgj3yGxkfwieVDkW1RZ9GFK0pQDUzWmCqd2TLObtnja0+Lg4t+m49O501tnmM6YO+PBTObMLbOQWRmzWmebz14wu2dOyJydcylzc+f+Ps9p3sp5b+cnz29eYLRgzoJHv4T8UluiWiIuubHQe+GmRfgiwaLOxS6L1y/+VsorPV/mVFZe9mUJd8n5X0f/uu7XwaWZSzuXuS/buJy4XLj8+gq/FTtXaqwsXvloVeSqhtX01aWr366ZuOZcuWv5prWUtZK13esi1jWtt1i/fP2XiuyKa5UBlfVVhlWLq95v4G24vNF/Y90mo01lmz5tFmy+uSVkS0O1VXX5VuLWoq1PtiVta/+N8VvNdoPtZdu/7hDu6N4Zt7OtxqOmZpfhrmW1aK2ktnf3uN2X9gTuaapzqNtSr1Nfthfslex9vi993/X94ftbDzAO1B20PFh1iHaotAFpmNbQ35jd2N2U2tR1OOxwa7N386Ejjkd2HDU9WnlM+9iy45TjC44PthS3DJwQneg7mXXyUevE1junUk5dbYtt6zwdfvrsmeAzp9qZ7S1nfc4ePed17vB5xvnGC+4XGjrcOg797vb7oU73zoaLHhebLnleau4a03X8st/lk1cCr5y5yr564VrUta7riddv3hh3o/sm7+azW3m3Xt0uuv35zpy7hLul99Tvld83vF/9h+0f9d3u3cceBD7oeBj/8M4j7qMXjwsef+lZ8IT6pPypydOaZ87PjvYG9156PvZ5zwvRi899JX9q/Fn10ublwb/8/+roT+nveSV+Nfh6yRv9Nzveur5tHYgZuP8u/93n96Uf9D/s/Mj42P4p+dPTz1O+kL6s+2r7tflb+Le7g/mDgyKOmCP7FcBgRTMzAXi9AwBqKgA0eD6jjJWf/2QFkZ9ZZQj8Jyw/I8qKOwB18P89tg/+3dwAYO82ePyC+mrjAIihApDgCVAXl+E6dFaTnSulhQjPAZujvmbkZ4B/U+Rnzh/i/rkFUlVX8HP7L34RfGukfYUwAAAAOGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAACoAIABAAAAAEAAAB6oAMABAAAAAEAAACWAAAAAGjynq0AABD3SURBVHgB7V0JcFXVGf7Pey8QEnCp2ta97rYuHRW0VqkLilapSm1MAgVCwLQ4WrRDq6gVHWt1Ojpt1cEOkhBAshgqFRe6WIvLWHEsMxW07tS1xVYQRba8906/88gN9yU3efcs797zknOHcO899/z/+f//O//Zz3lE7nIWcBZwFnAWcBZwFnAWcBaIzQIstpRDJlzVwHcv66RvZBmdzBiNIk5HtzaxI0OSu2hdFkjZZIm6Ol6+JUknJQigchrFBbgZOowjwJcjP7VJ5lKRJTagq6p4sqySjssmaBQ89WQOYLcRHZskwj9cQNYHbqnY01o5IwO6aho/PJVF0StA3VkEn4j7MA9MgO2uIlqgaEDX1PHRLEnnoU4dCflPxd9uhCJYXDlMFYFF5uA7ubj/ZSxQNKBZgm6FIGeYLn9RdytmERmzDLy4XT428BRzGuVbwAGdb48B+1Y0oNHXPbO1kbHUDhpOWZqEivV1E1Z0dbSaFSOt72qn8Vsg5k1qou6kQobZ1NbI9tDhMRhpi+bRQcaEh89Bm/mPQd9cWHEtECnQQhW0xu8urkqOe5AFIgd66w5aFSRI2DDXvQprqfx4kQO9bBH7GPXs5nwxwr+5xlh4W/ljRg50V+I7/ELIPDuPlrHWrrhxAb1LAvcUiQUc0JGYOf5EHNDxYxCJBA7oSMwcfyIO6PgxiEQCB3QkZo4/EQd0/BhEIoEDOhIzx5+IAzp+DCKRwAEdiZnjT8QBHT8GkUgQeuHBRfV8RCXROizN2ysSyfpLhNNT/X0eiN/EZA42M8xobWavqugXehVoRRYAJy0AWWjJsLp0kF05j0xSLdSeo6J66KI7k3LLbFUMbJIG07tlqvxCA62agKOzwwKhgU6m3Q6J2CHjtFVVhtBAu6Jb1cSG6Dg9uamSfqnKLTTQqgk4OgMWAMifVNIFK+5h21W5OaBVLRcVHadndUEWoobuXnWmaWMyQWIBvvaFLbI/ApM9VRlhL7UROVTTl6JjNARdo9lSNF5kjBdsTul5sscq1z3zXqK610zjbyLhw1TTa20UG3CxTNDyq6GBl32aoeXQ9XxpUeHJ6c9obEcHU26A+dN0RbffGgafxYkOtoAs1HJAGwTXYyVATo6gh2zwZE8mB7RnCUP3bpAZXSTN0nBx7U/fAe23hubzzTfzRM6TLQNZqOWA1gTXIxcgv/outaNHYZUne/I5oD1LaN056wL5e9Jsilhc+2UJ3Y/2E7lnvwU4q62nxZjbkwYZ4wGrMga7UH6pej47j+5pEan3bpAnSpEhsgAZR1+OMdVPLpS+A7qQhfr53uXJyiAvXsw+74e90U+u6FY0J0b3GkFaEiALFZ1HKwAtQMZgSL0sqVdcR+nJnowOaM8SIe+lCLJQzQEdEmARDSDPLTVP9tRzQHuWKHDvAnlGgWi9PsdZXPuFcY0xvzX6eK6t57/Cp5IFWajlPLoPcL3gHMiMrvbew95t8WRPXge0Z4mAuwbIq8VgSByt6wA1ckGu6O7DMgD5dgxrqnjy6uR2OmvxkugGQ/pQIS/YeXSeOXa+1NTzmwHydQGf+g1CcZ0DeckSZt0PvDiP7gEdWtfXogslvb/JZpCFis6jfUB3gXyHLyjUo+0gCyUc0F1QVk/jM+HJAxJkB7QPZOT4X3e9hr6Vgid7ygz6OhoNrx/Ckwc0yALsQV1050BmdJ+X68PeS8mTPZ0GLdCqIGPz8BrRT7axC+WBGnQflEV37VQ+Ff1kaU8WILNtdMaSFvv6yUHg+sMGnUcLkHHwi1gdInd1gdzSwjbKEdoRu0Q9Wm2DHfrJ9TC7WB0ifzG6oVRBFsoOGo/Gb25NAcDynrwrSyxHRlkNPpfsCiqdpxL1aDkDY4LiUlA0y1H1jo2McgJCl4Hfx7g3wU3uap3P1veOaV/IYPHoC42aXhyqx+gn+CnGf4mpzPGT+BeN8i8Cs0EBNBpfxSm5GJWLqczyIbQe3bV54sfQi4CREZaDAmg03ZQPYgtrZWyuuxy56Q0AvsBGDx8UQOMMjKFhAdONB8Drysvojep6/mNdXibpSxRoFMYyF6NhMtG14zLaLcHoLtTfL02Yzk/S5meAQYkCLdePRuzIPDoPE0bHYVz8RXTL5k6cyHfL+xbxS4kCLWcl+P8QOQqzsVH8zMgMpdcw511llnN4boMCaIxRL4RnPYa/D8ObxmxM1N1fhrEfhHevqJnKDzTLvTA3ubquML9QMaCs5jljMJviNX4y32tYkkbCy8Xgx4XoHp2uyEqdjNPHyHQXti1gq9SZyFEqG0wumfzY+kCLoVu5ejpfgl1vtQ18b56mixEyHqCfA4NEUp8DaPGLuzVtTWzZLmmK9xQL0GiNvg6jHqGqVmujukf3l2bu5yQ4jqhI5E66P7e/uMa+ZenG1gXsNmP8+mAUF9AvAejj+pCpYHCxgPYnLAY9hg7BRndOs5Ct9vN/M/0M774fnt1gmq+fXyxAY/ToeRjvFL8gMs9RAO2XByXQVXi/EZmzaGPaAPvRz1NU/cg8tsWftqnnuFrdWjM+OJ0v0gGQ1iZ2D07ZPQRGvx6AGDmEtSeAyPjjhqfpie808Iqe30y8xwI0lHpfR/hERXGL0iDZhKehJLk9lcKpxJwWBcXRDmN0amWG/lBXx8u1efVgEAvQPEuv9ZBD6jWRUq/fpRIKiPzAPPZvePgU6HAaAH8lIIpWEOrS0duS9KgWkwDiWICGR68OkCV0EIrPE0NHLlJE9IGfA+DHQJZbTScBsMegXbDUJN9YgEZ9pwU0DDDGpBF0eKG1fBN+Ye4EzJCt0+HTi5bRpRgyvbJXuGJALK1uISvWXj2G2wWKchOMe2RLM3tDld40HRYdfCHF6WG0zI2OtGWzdFL7AqbrGPEtDkSR16Fj7GxS/kwRnfQK0XY0sg0oykcj3gOF4sp8ZwlaKgZyZGiC4sZSdAtB0Fn8XZBAYcNQFF1TW8ePDhs/qnhomU9CWvNNpQc9D6lk+u2A2IBe3sQ+Q712r45BeFJht4UvQawC+brv1dgjwL4cJdZvjTEkmllVx5VHEoUcsQEtEkfr++firnoht5+JCZInZNdooUV7Kf7eQvrVqmkXokMjbQbiaFVP/jSSmpk6VqDFmmg0Nq7wKyT7DLDHYI3WK7n9VP0Qf7+B74tMMQvDr2vQYFqKv0NBm+2HRPsTPPsyePZz2ozAALKehlZ4jSov0Md/5fqM6E5oS8JJVAdroNSbuL8DfllYaAgmNEfhfk5P/gDhF/C8G3qGm3wXrfGk2LdlYmIEfNDgO15Fvlg92hMY/erJMPo/vHflO6MRMOg3Aepk3H+GvzkAfXYQyCINfEd+KO4lWuPIaKKBpn9hxg8l19kqjKwAWowjb++ksTB7pP1iZC6tMfewBsd885PQ7a6w8fuLh5Uxs/r73tc3K4AWwi1bzD5Kp1G8cr1x8L4UDQrHb20aH1MOSkeEocidheLjzb6+hw1HKfRtlR0h1gAtFO1YxN5NdZJYB22stdqPAeuWzGeReHS3DNjN0f2s8ZAkkt7RaRXQQndxfqZoraJeHYuida2GPQJJ4VXPiOFTpLEwMEIRA9vms5Uosf6mmwTq/HGyPNBWsftCi/x01EtToVw1wK/UkPb3oF0IgMU9tqt6Kr84kSBtGdJJ2qNjHtsUVhHrgfYUEZPx25P4eV6emzQYCc88GPXVV7zvve6cPkGcp5E52rF4fnnHXLa5V5yYAnRXwQqxMR9ehanS0FOZqZh0lU62uRnHxFDOE/K8QSzXTe+gfZMp7Fnuungnvde+kL3lvdt2R+l0HzLgnVpyJXJz8gMP6L6M0jqP/Q/fxF/JXChGl6G00QIaPL4qo7B1jTEZ4Us1bksTextAr9ORH/RHydA7oGWsZTAuPPJFHXbOo3WsFyEtPFJrgaQQtWoyPyisyM6jw1rKdDxOH+iyxMheaPxCR9QVytH3sAAj7R8gZanwmwkc0D3sH9Uriu5O3bSGpin0gIkDWtfaivSYo9Y6hQHDw1u7xhZCSVAyAyaeNlghsh9P0EHZDH2KQ6U+kBkG9HjYcMfSlgq0nNUvJlfHlwTQGO++DEVdFYY8xcL9PTGyRBgvJsrkfhj0XbyvzGL5MNY/RzbtqI5QN+WXup8UHpBJ1smQWQ107XR+PBYDLcNwoVjfFXgh/CB8n4zjnibD21djE9w4sT8qMLJdgbp7rqX2fVlbR+dmrbL0vAA5LD7w+BMzGXoB/cv9w9LEFQ8Z9HCdtFFHr5GhtxLo3EAAo+UATmUf9AHw6kUyRoglLqNjdNJFrfWsDL2VQAOoNiixp4wieXEZnS3q9bwwi14mTucHQBz1OhqnGnU0MamRNeuArp7Ov4vi+lRdXNBeu1aXR7HosZb9FC3ejJ6UpbcOaJalKbJKBMUX9fWECVy9VAhiaigMmXCsDivQPyJLbx/QBvc+Z4dhjbed13gdsZLbsD1X8rKqe5U7hEZvXVie+lhuE3p2J4+wiC+5BfiM9lFNAt78kMpvblnl0cnhtLeqAQLp1FrtgayMBWou+UW3rFlFFqs8OsGpHDnW2AWjrDPGzACjqql8HzQ0lTfKoe/8AfaKSdfPQnSrPDoxhIyu1MSY+KsG8DHGAvPH12gxY3STKj0yvV0XzjYx4tTg8hxy/2m2aDehnh+K9enKK1Ohz1roo7wZ3iqPFqBAIa21VB6wmB260Xu24Y7cO1dHDtD/VIfeOqBRxDyto1COltPsB5vYX7X5GGKAUbqrUDefp8Hu8fYmtkKD3q46WiiC4u1xHYVAext2Lt6hycMYeXUdF5vw71ZlCE/eku7UP4HJOo9ua2R/QfH9XwXDvIzRsJHYW2VNkY2jKI5NJOUHN/J053S12GWaF6bwYh3QQgcAdq+CLk+0zGd/V6ArCgkaleejGhI7J/dVTQAZfikaYPer0vvprAQ6jWOpUGRt8gsa4nlmTR0fHSJe0aMAZNENWgGghysnxukpgGzsV3WsBFqc+4Fdk1fLGoklqR0NH+2ZL9l0vfiiC4WdksKLb/HClO5YVJDYThcp0fZBhExn74WlQQ+jGFdReM7mJN1ZrNPse1pMrGjBHPo1KIWugLwqiyW6WaK4fi+TpZM7mtl/ugMNPFgN9KRJvDJdRi+g1fo1aV05fQ7Dt2HN2cK2ZvaMNH0Igsum8W/hmIkrEdVMEQtPTmdprGmQhSpWAy0EFMt7IeRKSHqEeFe6doIuNsU/Bfq1qK/WtjSyd1R44cSCcViBejGqFvHzSd17slV4+WngyY2ZcrSwi7Rh33qghTHEZECS0Z9RLJo+u/N9sF8PI4ti8kMAtx4AYjnWzgvG2R2lwgG4749vByJULAEye3H6CKN4kzAg8iezjPO5lQTQQmTxI544ouI3ALsuX4XSfUMGezTDaEqu8VlkNUoGaM8OWOt9LrxuId6V+6cer7juKCVexwjg7Pb57KGoZCg5oIVhRCOts4xmQvjrUKSOiMpYuukA4Ocx534fTjxYpMtLlr4kgfaU7Pp5g+vhHT+AIuqDEx7D4tzXA+AW/DW1N7K1xUmiMNeSBtpTT6w1Sw3H6cCM6vF3lhce1x2gbsF+sHbxMwkYltWdpDGixoAA2m+JCdP4wdhwNxaAnwBjn4678mS9n2+hZzSsVsGYTwPclbaA65d5wAHtV048i58ArNyB80UTdCReD0Wr/QiAcggUPwqZoN/6HfG2gmYD/jaCbgM8dSMyj3jfANqP8P4yqo230aj6J8KsvgY80IWsf0kd36M8QRXo5lSk8Ic+bQV60jtM/ARRobTdd2cBZwFnAWcBZwFnAWeB/wO9yrSXP8OnPQAAAABJRU5ErkJggg=="})]})]}),ThreeDotsIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[300],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M13.5 9H13.5075M9 9H9.0075M4.5 9H4.5075M9.75 9C9.75 9.41421 9.41421 9.75 9 9.75C8.58579 9.75 8.25 9.41421 8.25 9C8.25 8.58579 8.58579 8.25 9 8.25C9.41421 8.25 9.75 8.58579 9.75 9ZM14.25 9C14.25 9.41421 13.9142 9.75 13.5 9.75C13.0858 9.75 12.75 9.41421 12.75 9C12.75 8.58579 13.0858 8.25 13.5 8.25C13.9142 8.25 14.25 8.58579 14.25 9ZM5.25 9C5.25 9.41421 4.91421 9.75 4.5 9.75C4.08579 9.75 3.75 9.41421 3.75 9C3.75 8.58579 4.08579 8.25 4.5 8.25C4.91421 8.25 5.25 8.58579 5.25 9Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),TokenIcon=({contract:_,...a})=>{const $=`https://services.tzkt.io/v1/avatars/${_}`;return jsxRuntimeExports.jsx(Image$1,{fallbackSrc:"./static/media/coin-front.svg",src:$,...a})},TrashIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3 4.5H15M12 4.5L11.797 3.89105C11.6003 3.30094 11.502 3.00588 11.3195 2.78774C11.1584 2.5951 10.9516 2.44599 10.7179 2.35408C10.4532 2.25 10.1422 2.25 9.52018 2.25H8.47982C7.85779 2.25 7.54677 2.25 7.28213 2.35408C7.04844 2.44599 6.84156 2.5951 6.68047 2.78774C6.49804 3.00588 6.39969 3.30094 6.20298 3.89105L6 4.5M13.5 4.5V12.15C13.5 13.4101 13.5 14.0402 13.2548 14.5215C13.039 14.9448 12.6948 15.289 12.2715 15.5048C11.7902 15.75 11.1601 15.75 9.9 15.75H8.1C6.83988 15.75 6.20982 15.75 5.72852 15.5048C5.30516 15.289 4.96095 14.9448 4.74524 14.5215C4.5 14.0402 4.5 13.4101 4.5 12.15V4.5M10.5 7.5V12.75M7.5 7.5V12.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),TwitterIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"20px",height:"18px",fill:"black","data-testid":"twitter-icon",viewBox:"0 0 20 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M0.0467972 0L7.472 9.92803L0 18H1.68178L8.22366 10.9327L13.5091 18H19.2319L11.3887 7.51364L18.3437 0H16.6619L10.6374 6.50863L5.76957 0H0.0467972ZM2.51993 1.23866H5.14894L16.7584 16.7613H14.1294L2.51993 1.23866Z"})}),UnknownContactIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none","data-testid":"unknown-contact-icon",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M3.16602 15.5625C3.16602 12.7435 5.45123 10.4583 8.27018 10.4583C8.51775 10.4583 8.7612 10.476 8.99935 10.51M13.3722 13.375C14.1014 12.6458 14.8305 12.3575 14.8305 11.5521C14.8305 10.7467 14.1776 10.0938 13.3722 10.0938C12.6927 10.0938 12.1217 10.5585 11.9598 11.1875M13.3722 15.5625H13.3795M11.1868 5.35417C11.1868 6.965 9.88101 8.27083 8.27018 8.27083C6.65935 8.27083 5.35352 6.965 5.35352 5.35417C5.35352 3.74334 6.65935 2.4375 8.27018 2.4375C9.88101 2.4375 11.1868 3.74334 11.1868 5.35417Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),USBIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M20.5 11L18.7396 7.60473C18.253 6.65855 18.0097 6.18545 17.6514 5.84012C17.3346 5.5347 16.9544 5.30272 16.5379 5.16065C16.067 5 15.535 5 14.471 5H9.52901C8.46503 5 7.93304 5 7.46209 5.16065C7.04558 5.30272 6.66542 5.5347 6.34859 5.84012C5.99034 6.18545 5.74703 6.65855 5.26042 7.60473L3.5 11M20.5 11C20.6981 11.3853 20.7658 11.5446 20.8357 11.747C20.8977 11.9267 20.9426 12.1119 20.9696 12.3002C21 12.5121 21 12.7287 21 13.162V14.2C21 15.8802 21 16.7202 20.673 17.362C20.3854 17.9265 19.9265 18.3854 19.362 18.673C18.7202 19 17.8802 19 16.2 19H7.8C6.11984 19 5.27976 19 4.63803 18.673C4.07354 18.3854 3.6146 17.9265 3.32698 17.362C3 16.7202 3 15.8802 3 14.2V13.162C3 12.7287 3 12.5121 3.03041 12.3002C3.05741 12.1119 3.10225 11.9267 3.16432 11.747C3.23421 11.5446 3.30186 11.3853 3.5 11M20.5 11H3.5M15 15H17",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),VerifiedIcon=()=>jsxRuntimeExports.jsxs(Flex,{position:"relative",alignItems:"center",justifyContent:"center","data-testid":"verified-icon",children:[jsxRuntimeExports.jsx(StarIcon,{}),jsxRuntimeExports.jsx(Flex,{position:"absolute",alignItems:"center",justifyContent:"center",children:jsxRuntimeExports.jsx(CheckIcon$1,{})})]}),StarIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"14px",height:"14px",fill:colors.gray[450],viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M6.51019 0.479749C6.78233 0.213196 7.21767 0.213195 7.48981 0.479749L8.86158 1.82333C8.99061 1.94972 9.16351 2.02134 9.34412 2.02321L11.2642 2.04314C11.6451 2.04709 11.9529 2.35492 11.9569 2.73584L11.9768 4.65588C11.9787 4.83649 12.0503 5.00939 12.1767 5.13842L13.5203 6.51019C13.7868 6.78233 13.7868 7.21767 13.5203 7.48981L12.1767 8.86158C12.0503 8.99061 11.9787 9.16351 11.9768 9.34412L11.9569 11.2642C11.9529 11.6451 11.6451 11.9529 11.2642 11.9569L9.34412 11.9768C9.16351 11.9787 8.99061 12.0503 8.86158 12.1767L7.48981 13.5203C7.21767 13.7868 6.78233 13.7868 6.51019 13.5203L5.13842 12.1767C5.00939 12.0503 4.83649 11.9787 4.65588 11.9768L2.73584 11.9569C2.35492 11.9529 2.04709 11.6451 2.04314 11.2642L2.02321 9.34412C2.02134 9.16351 1.94972 8.99061 1.82333 8.86158L0.479749 7.48981C0.213196 7.21767 0.213195 6.78233 0.479749 6.51019L1.82333 5.13842C1.94972 5.00939 2.02134 4.83649 2.02321 4.65588L2.04314 2.73584C2.04709 2.35492 2.35492 2.04709 2.73584 2.04314L4.65588 2.02321C4.83649 2.02134 5.00939 1.94972 5.13842 1.82333L6.51019 0.479749Z",strokeLinecap:"square",strokeLinejoin:"round"})}),CheckIcon$1=_=>jsxRuntimeExports.jsx(Icon,{width:"7px",height:"5px",fill:"none",stroke:"white",viewBox:"0 0 7 5",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M1.66699 2.19314L3.0281 3.55425L5.75033 0.832031",strokeLinecap:"square",strokeLinejoin:"round"})}),WalletPlusIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",stroke:colors.gray[450],viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M10 16V14.0003M10 14.0003V12M10 14.0003L12 14.0005M10 14.0003L8 14M21 12V11.2C21 10.0799 21 9.51984 20.782 9.09202C20.5903 8.7157 20.2843 8.40973 19.908 8.21799C19.4802 8 18.9201 8 17.8 8H3M21 12V16M21 12H19C17.8954 12 17 12.8954 17 14C17 15.1046 17.8954 16 19 16H21M21 16V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8V8M18 8V7.2C18 6.0799 18 5.51984 17.782 5.09202C17.5903 4.71569 17.2843 4.40973 16.908 4.21799C16.4802 4 15.9201 4 14.8 4H6.2C5.07989 4 4.51984 4 4.09202 4.21799C3.71569 4.40973 3.40973 4.71569 3.21799 5.09202C3 5.51984 3 6.0799 3 7.2V8",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),WarningIcon=_=>jsxRuntimeExports.jsx(Icon,{width:"36px",height:"32px",fill:"none",stroke:colors.orangeL,viewBox:"0 0 36 32",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M18.0004 24.3332H18.0171M18.0004 12.6665V19.3332M8.68719 30.9999H27.3136C30.2831 30.9999 31.7678 30.9999 32.6386 30.3754C33.3985 29.8305 33.8946 28.9915 34.0058 28.0631C34.1333 26.9991 33.4178 25.6982 31.9868 23.0963L22.6736 6.16318C21.1499 3.39292 20.3881 2.00779 19.3814 1.54954C18.5041 1.15015 17.4968 1.15015 16.6194 1.54954C15.6127 2.00779 14.8509 3.39292 13.3273 6.16317L4.01404 23.0963C2.58301 25.6982 1.8675 26.9991 1.99498 28.0631C2.10622 28.9915 2.6023 29.8305 3.36219 30.3754C4.23304 30.9999 5.71776 30.9999 8.68719 30.9999Z",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}),XMark=_=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",..._,children:jsxRuntimeExports.jsx("path",{d:"M4.5 4.5L13.5 13.5M13.5 4.5L4.5 13.5","data-testid":"xmark-icon-path",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})});function keys(_){return Object.keys(_)}var ExposedPromiseStatus;(function(_){_.PENDING="pending",_.RESOLVED="resolved",_.REJECTED="rejected"})(ExposedPromiseStatus||(ExposedPromiseStatus={}));const notInitialized$1=()=>{throw new Error("ExposedPromise not initialized yet.")};class ExposedPromise{constructor(){Yr(this,"_promise");Yr(this,"_resolve",notInitialized$1);Yr(this,"_reject",notInitialized$1);Yr(this,"_status",ExposedPromiseStatus.PENDING);Yr(this,"_promiseResult");Yr(this,"_promiseError");this._promise=new Promise((a,$)=>{this._resolve=j=>{this.isSettled()||(this._promiseResult=j,a(j),this._status=ExposedPromiseStatus.RESOLVED)},this._reject=j=>{this.isSettled()||(this._promiseError=j,$(j),this._status=ExposedPromiseStatus.REJECTED)}})}get promise(){return this._promise}get resolve(){return this._resolve}get reject(){return this._reject}get status(){return this._status}get promiseResult(){return this._promiseResult}get promiseError(){return this._promiseError}static resolve(a){const $=new ExposedPromise;return $.resolve(a),$}static reject(a){const $=new ExposedPromise;return $.reject(a),$}isPending(){return this.status===ExposedPromiseStatus.PENDING}isResolved(){return this.status===ExposedPromiseStatus.RESOLVED}isRejected(){return this.status===ExposedPromiseStatus.REJECTED}isSettled(){return this.isResolved()||this.isRejected()}}var buffer$2={},base64Js$1={};base64Js$1.byteLength=byteLength$2;base64Js$1.toByteArray=toByteArray$1;base64Js$1.fromByteArray=fromByteArray$1;var lookup$3=[],revLookup$1=[],Arr$1=typeof Uint8Array<"u"?Uint8Array:Array,code$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$2=0,len$1=code$1.length;i$20)throw new Error("Invalid string. Length must be a multiple of 4");var $=_.indexOf("=");$===-1&&($=a);var j=$===a?0:4-$%4;return[$,j]}function byteLength$2(_){var a=getLens$1(_),$=a[0],j=a[1];return($+j)*3/4-j}function _byteLength$1(_,a,$){return(a+$)*3/4-$}function toByteArray$1(_){var a,$=getLens$1(_),j=$[0],et=$[1],tt=new Arr$1(_byteLength$1(_,j,et)),rt=0,nt=et>0?j-4:j,it;for(it=0;it>16&255,tt[rt++]=a>>8&255,tt[rt++]=a&255;return et===2&&(a=revLookup$1[_.charCodeAt(it)]<<2|revLookup$1[_.charCodeAt(it+1)]>>4,tt[rt++]=a&255),et===1&&(a=revLookup$1[_.charCodeAt(it)]<<10|revLookup$1[_.charCodeAt(it+1)]<<4|revLookup$1[_.charCodeAt(it+2)]>>2,tt[rt++]=a>>8&255,tt[rt++]=a&255),tt}function tripletToBase64$1(_){return lookup$3[_>>18&63]+lookup$3[_>>12&63]+lookup$3[_>>6&63]+lookup$3[_&63]}function encodeChunk$1(_,a,$){for(var j,et=[],tt=a;tt<$;tt+=3)j=(_[tt]<<16&16711680)+(_[tt+1]<<8&65280)+(_[tt+2]&255),et.push(tripletToBase64$1(j));return et.join("")}function fromByteArray$1(_){for(var a,$=_.length,j=$%3,et=[],tt=16383,rt=0,nt=$-j;rtnt?nt:rt+tt));return j===1?(a=_[$-1],et.push(lookup$3[a>>2]+lookup$3[a<<4&63]+"==")):j===2&&(a=(_[$-2]<<8)+_[$-1],et.push(lookup$3[a>>10]+lookup$3[a>>4&63]+lookup$3[a<<2&63]+"=")),et.join("")}var ieee754$1={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754$1.read=function(_,a,$,j,et){var tt,rt,nt=et*8-j-1,it=(1<>1,st=-7,ot=$?et-1:0,ut=$?-1:1,dt=_[a+ot];for(ot+=ut,tt=dt&(1<<-st)-1,dt>>=-st,st+=nt;st>0;tt=tt*256+_[a+ot],ot+=ut,st-=8);for(rt=tt&(1<<-st)-1,tt>>=-st,st+=j;st>0;rt=rt*256+_[a+ot],ot+=ut,st-=8);if(tt===0)tt=1-at;else{if(tt===it)return rt?NaN:(dt?-1:1)*(1/0);rt=rt+Math.pow(2,j),tt=tt-at}return(dt?-1:1)*rt*Math.pow(2,tt-j)};ieee754$1.write=function(_,a,$,j,et,tt){var rt,nt,it,at=tt*8-et-1,st=(1<>1,ut=et===23?Math.pow(2,-24)-Math.pow(2,-77):0,dt=j?0:tt-1,mt=j?1:-1,xt=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(nt=isNaN(a)?1:0,rt=st):(rt=Math.floor(Math.log(a)/Math.LN2),a*(it=Math.pow(2,-rt))<1&&(rt--,it*=2),rt+ot>=1?a+=ut/it:a+=ut*Math.pow(2,1-ot),a*it>=2&&(rt++,it/=2),rt+ot>=st?(nt=0,rt=st):rt+ot>=1?(nt=(a*it-1)*Math.pow(2,et),rt=rt+ot):(nt=a*Math.pow(2,ot-1)*Math.pow(2,et),rt=0));et>=8;_[$+dt]=nt&255,dt+=mt,nt/=256,et-=8);for(rt=rt<0;_[$+dt]=rt&255,dt+=mt,rt/=256,at-=8);_[$+dt-mt]|=xt*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(_){const a=base64Js$1,$=ieee754$1,j=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_.Buffer=st,_.SlowBuffer=Nt,_.INSPECT_MAX_BYTES=50;const et=2147483647;_.kMaxLength=et;const{Uint8Array:tt,ArrayBuffer:rt,SharedArrayBuffer:nt}=globalThis;st.TYPED_ARRAY_SUPPORT=it(),!st.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function it(){try{const Zt=new tt(1),Vt={foo:function(){return 42}};return Object.setPrototypeOf(Vt,tt.prototype),Object.setPrototypeOf(Zt,Vt),Zt.foo()===42}catch{return!1}}Object.defineProperty(st.prototype,"parent",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.buffer}}),Object.defineProperty(st.prototype,"offset",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.byteOffset}});function ot(Zt){if(Zt>et)throw new RangeError('The value "'+Zt+'" is invalid for option "size"');const Vt=new tt(Zt);return Object.setPrototypeOf(Vt,st.prototype),Vt}function st(Zt,Vt,Gt){if(typeof Zt=="number"){if(typeof Vt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bt(Zt)}return at(Zt,Vt,Gt)}st.poolSize=8192;function at(Zt,Vt,Gt){if(typeof Zt=="string")return Et(Zt,Vt);if(rt.isView(Zt))return Pt(Zt);if(Zt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Zt);if(Or(Zt,rt)||Zt&&Or(Zt.buffer,rt)||typeof nt<"u"&&(Or(Zt,nt)||Zt&&Or(Zt.buffer,nt)))return Tt(Zt,Vt,Gt);if(typeof Zt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const ar=Zt.valueOf&&Zt.valueOf();if(ar!=null&&ar!==Zt)return st.from(ar,Vt,Gt);const br=It(Zt);if(br)return br;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Zt[Symbol.toPrimitive]=="function")return st.from(Zt[Symbol.toPrimitive]("string"),Vt,Gt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Zt)}st.from=function(Zt,Vt,Gt){return at(Zt,Vt,Gt)},Object.setPrototypeOf(st.prototype,tt.prototype),Object.setPrototypeOf(st,tt);function ut(Zt){if(typeof Zt!="number")throw new TypeError('"size" argument must be of type number');if(Zt<0)throw new RangeError('The value "'+Zt+'" is invalid for option "size"')}function ht(Zt,Vt,Gt){return ut(Zt),Zt<=0?ot(Zt):Vt!==void 0?typeof Gt=="string"?ot(Zt).fill(Vt,Gt):ot(Zt).fill(Vt):ot(Zt)}st.alloc=function(Zt,Vt,Gt){return ht(Zt,Vt,Gt)};function bt(Zt){return ut(Zt),ot(Zt<0?0:Lt(Zt)|0)}st.allocUnsafe=function(Zt){return bt(Zt)},st.allocUnsafeSlow=function(Zt){return bt(Zt)};function Et(Zt,Vt){if((typeof Vt!="string"||Vt==="")&&(Vt="utf8"),!st.isEncoding(Vt))throw new TypeError("Unknown encoding: "+Vt);const Gt=Ut(Zt,Vt)|0;let ar=ot(Gt);const br=ar.write(Zt,Vt);return br!==Gt&&(ar=ar.slice(0,br)),ar}function Ct(Zt){const Vt=Zt.length<0?0:Lt(Zt.length)|0,Gt=ot(Vt);for(let ar=0;ar=et)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et.toString(16)+" bytes");return Zt|0}function Nt(Zt){return+Zt!=Zt&&(Zt=0),st.alloc(+Zt)}st.isBuffer=function(Vt){return Vt!=null&&Vt._isBuffer===!0&&Vt!==st.prototype},st.compare=function(Vt,Gt){if(Or(Vt,tt)&&(Vt=st.from(Vt,Vt.offset,Vt.byteLength)),Or(Gt,tt)&&(Gt=st.from(Gt,Gt.offset,Gt.byteLength)),!st.isBuffer(Vt)||!st.isBuffer(Gt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Vt===Gt)return 0;let ar=Vt.length,br=Gt.length;for(let wr=0,Sr=Math.min(ar,br);wrbr.length?(st.isBuffer(Sr)||(Sr=st.from(Sr)),Sr.copy(br,wr)):tt.prototype.set.call(br,Sr,wr);else if(st.isBuffer(Sr))Sr.copy(br,wr);else throw new TypeError('"list" argument must be an Array of Buffers');wr+=Sr.length}return br};function Ut(Zt,Vt){if(st.isBuffer(Zt))return Zt.length;if(rt.isView(Zt)||Or(Zt,rt))return Zt.byteLength;if(typeof Zt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Zt);const Gt=Zt.length,ar=arguments.length>2&&arguments[2]===!0;if(!ar&&Gt===0)return 0;let br=!1;for(;;)switch(Vt){case"ascii":case"latin1":case"binary":return Gt;case"utf8":case"utf-8":return Er(Zt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Gt*2;case"hex":return Gt>>>1;case"base64":return Rr(Zt).length;default:if(br)return ar?-1:Er(Zt).length;Vt=(""+Vt).toLowerCase(),br=!0}}st.byteLength=Ut;function jt(Zt,Vt,Gt){let ar=!1;if((Vt===void 0||Vt<0)&&(Vt=0),Vt>this.length||((Gt===void 0||Gt>this.length)&&(Gt=this.length),Gt<=0)||(Gt>>>=0,Vt>>>=0,Gt<=Vt))return"";for(Zt||(Zt="utf8");;)switch(Zt){case"hex":return wt(this,Vt,Gt);case"utf8":case"utf-8":return St(this,Vt,Gt);case"ascii":return xt(this,Vt,Gt);case"latin1":case"binary":return At(this,Vt,Gt);case"base64":return vt(this,Vt,Gt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,Vt,Gt);default:if(ar)throw new TypeError("Unknown encoding: "+Zt);Zt=(Zt+"").toLowerCase(),ar=!0}}st.prototype._isBuffer=!0;function Mt(Zt,Vt,Gt){const ar=Zt[Vt];Zt[Vt]=Zt[Gt],Zt[Gt]=ar}st.prototype.swap16=function(){const Vt=this.length;if(Vt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Gt=0;GtGt&&(Vt+=" ... "),""},j&&(st.prototype[j]=st.prototype.inspect),st.prototype.compare=function(Vt,Gt,ar,br,wr){if(Or(Vt,tt)&&(Vt=st.from(Vt,Vt.offset,Vt.byteLength)),!st.isBuffer(Vt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Vt);if(Gt===void 0&&(Gt=0),ar===void 0&&(ar=Vt?Vt.length:0),br===void 0&&(br=0),wr===void 0&&(wr=this.length),Gt<0||ar>Vt.length||br<0||wr>this.length)throw new RangeError("out of range index");if(br>=wr&&Gt>=ar)return 0;if(br>=wr)return-1;if(Gt>=ar)return 1;if(Gt>>>=0,ar>>>=0,br>>>=0,wr>>>=0,this===Vt)return 0;let Sr=wr-br,Wr=ar-Gt;const Hr=Math.min(Sr,Wr),Fr=this.slice(br,wr),pn=Vt.slice(Gt,ar);for(let Jr=0;Jr2147483647?Gt=2147483647:Gt<-2147483648&&(Gt=-2147483648),Gt=+Gt,Lr(Gt)&&(Gt=br?0:Zt.length-1),Gt<0&&(Gt=Zt.length+Gt),Gt>=Zt.length){if(br)return-1;Gt=Zt.length-1}else if(Gt<0)if(br)Gt=0;else return-1;if(typeof Vt=="string"&&(Vt=st.from(Vt,ar)),st.isBuffer(Vt))return Vt.length===0?-1:Ft(Zt,Vt,Gt,ar,br);if(typeof Vt=="number")return Vt=Vt&255,typeof tt.prototype.indexOf=="function"?br?tt.prototype.indexOf.call(Zt,Vt,Gt):tt.prototype.lastIndexOf.call(Zt,Vt,Gt):Ft(Zt,[Vt],Gt,ar,br);throw new TypeError("val must be string, number or Buffer")}function Ft(Zt,Vt,Gt,ar,br){let wr=1,Sr=Zt.length,Wr=Vt.length;if(ar!==void 0&&(ar=String(ar).toLowerCase(),ar==="ucs2"||ar==="ucs-2"||ar==="utf16le"||ar==="utf-16le")){if(Zt.length<2||Vt.length<2)return-1;wr=2,Sr/=2,Wr/=2,Gt/=2}function Hr(pn,Jr){return wr===1?pn[Jr]:pn.readUInt16BE(Jr*wr)}let Fr;if(br){let pn=-1;for(Fr=Gt;FrSr&&(Gt=Sr-Wr),Fr=Gt;Fr>=0;Fr--){let pn=!0;for(let Jr=0;Jrbr&&(ar=br)):ar=br;const wr=Vt.length;ar>wr/2&&(ar=wr/2);let Sr;for(Sr=0;Sr>>0,isFinite(ar)?(ar=ar>>>0,br===void 0&&(br="utf8")):(br=ar,ar=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const wr=this.length-Gt;if((ar===void 0||ar>wr)&&(ar=wr),Vt.length>0&&(ar<0||Gt<0)||Gt>this.length)throw new RangeError("Attempt to write outside buffer bounds");br||(br="utf8");let Sr=!1;for(;;)switch(br){case"hex":return Bt(this,Vt,Gt,ar);case"utf8":case"utf-8":return yt(this,Vt,Gt,ar);case"ascii":case"latin1":case"binary":return mt(this,Vt,Gt,ar);case"base64":return ct(this,Vt,Gt,ar);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,Vt,Gt,ar);default:if(Sr)throw new TypeError("Unknown encoding: "+br);br=(""+br).toLowerCase(),Sr=!0}},st.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vt(Zt,Vt,Gt){return Vt===0&&Gt===Zt.length?a.fromByteArray(Zt):a.fromByteArray(Zt.slice(Vt,Gt))}function St(Zt,Vt,Gt){Gt=Math.min(Zt.length,Gt);const ar=[];let br=Vt;for(;br239?4:wr>223?3:wr>191?2:1;if(br+Wr<=Gt){let Hr,Fr,pn,Jr;switch(Wr){case 1:wr<128&&(Sr=wr);break;case 2:Hr=Zt[br+1],(Hr&192)===128&&(Jr=(wr&31)<<6|Hr&63,Jr>127&&(Sr=Jr));break;case 3:Hr=Zt[br+1],Fr=Zt[br+2],(Hr&192)===128&&(Fr&192)===128&&(Jr=(wr&15)<<12|(Hr&63)<<6|Fr&63,Jr>2047&&(Jr<55296||Jr>57343)&&(Sr=Jr));break;case 4:Hr=Zt[br+1],Fr=Zt[br+2],pn=Zt[br+3],(Hr&192)===128&&(Fr&192)===128&&(pn&192)===128&&(Jr=(wr&15)<<18|(Hr&63)<<12|(Fr&63)<<6|pn&63,Jr>65535&&Jr<1114112&&(Sr=Jr))}}Sr===null?(Sr=65533,Wr=1):Sr>65535&&(Sr-=65536,ar.push(Sr>>>10&1023|55296),Sr=56320|Sr&1023),ar.push(Sr),br+=Wr}return $t(ar)}const Rt=4096;function $t(Zt){const Vt=Zt.length;if(Vt<=Rt)return String.fromCharCode.apply(String,Zt);let Gt="",ar=0;for(;arar)&&(Gt=ar);let br="";for(let wr=Vt;wrar&&(Vt=ar),Gt<0?(Gt+=ar,Gt<0&&(Gt=0)):Gt>ar&&(Gt=ar),GtGt)throw new RangeError("Trying to access beyond buffer length")}st.prototype.readUintLE=st.prototype.readUIntLE=function(Vt,Gt,ar){Vt=Vt>>>0,Gt=Gt>>>0,ar||tr(Vt,Gt,this.length);let br=this[Vt],wr=1,Sr=0;for(;++Sr>>0,Gt=Gt>>>0,ar||tr(Vt,Gt,this.length);let br=this[Vt+--Gt],wr=1;for(;Gt>0&&(wr*=256);)br+=this[Vt+--Gt]*wr;return br},st.prototype.readUint8=st.prototype.readUInt8=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,1,this.length),this[Vt]},st.prototype.readUint16LE=st.prototype.readUInt16LE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,2,this.length),this[Vt]|this[Vt+1]<<8},st.prototype.readUint16BE=st.prototype.readUInt16BE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,2,this.length),this[Vt]<<8|this[Vt+1]},st.prototype.readUint32LE=st.prototype.readUInt32LE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,4,this.length),(this[Vt]|this[Vt+1]<<8|this[Vt+2]<<16)+this[Vt+3]*16777216},st.prototype.readUint32BE=st.prototype.readUInt32BE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,4,this.length),this[Vt]*16777216+(this[Vt+1]<<16|this[Vt+2]<<8|this[Vt+3])},st.prototype.readBigUInt64LE=Yt(function(Vt){Vt=Vt>>>0,kr(Vt,"offset");const Gt=this[Vt],ar=this[Vt+7];(Gt===void 0||ar===void 0)&&Ir(Vt,this.length-8);const br=Gt+this[++Vt]*2**8+this[++Vt]*2**16+this[++Vt]*2**24,wr=this[++Vt]+this[++Vt]*2**8+this[++Vt]*2**16+ar*2**24;return BigInt(br)+(BigInt(wr)<>>0,kr(Vt,"offset");const Gt=this[Vt],ar=this[Vt+7];(Gt===void 0||ar===void 0)&&Ir(Vt,this.length-8);const br=Gt*2**24+this[++Vt]*2**16+this[++Vt]*2**8+this[++Vt],wr=this[++Vt]*2**24+this[++Vt]*2**16+this[++Vt]*2**8+ar;return(BigInt(br)<>>0,Gt=Gt>>>0,ar||tr(Vt,Gt,this.length);let br=this[Vt],wr=1,Sr=0;for(;++Sr=wr&&(br-=Math.pow(2,8*Gt)),br},st.prototype.readIntBE=function(Vt,Gt,ar){Vt=Vt>>>0,Gt=Gt>>>0,ar||tr(Vt,Gt,this.length);let br=Gt,wr=1,Sr=this[Vt+--br];for(;br>0&&(wr*=256);)Sr+=this[Vt+--br]*wr;return wr*=128,Sr>=wr&&(Sr-=Math.pow(2,8*Gt)),Sr},st.prototype.readInt8=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,1,this.length),this[Vt]&128?(255-this[Vt]+1)*-1:this[Vt]},st.prototype.readInt16LE=function(Vt,Gt){Vt=Vt>>>0,Gt||tr(Vt,2,this.length);const ar=this[Vt]|this[Vt+1]<<8;return ar&32768?ar|4294901760:ar},st.prototype.readInt16BE=function(Vt,Gt){Vt=Vt>>>0,Gt||tr(Vt,2,this.length);const ar=this[Vt+1]|this[Vt]<<8;return ar&32768?ar|4294901760:ar},st.prototype.readInt32LE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,4,this.length),this[Vt]|this[Vt+1]<<8|this[Vt+2]<<16|this[Vt+3]<<24},st.prototype.readInt32BE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,4,this.length),this[Vt]<<24|this[Vt+1]<<16|this[Vt+2]<<8|this[Vt+3]},st.prototype.readBigInt64LE=Yt(function(Vt){Vt=Vt>>>0,kr(Vt,"offset");const Gt=this[Vt],ar=this[Vt+7];(Gt===void 0||ar===void 0)&&Ir(Vt,this.length-8);const br=this[Vt+4]+this[Vt+5]*2**8+this[Vt+6]*2**16+(ar<<24);return(BigInt(br)<>>0,kr(Vt,"offset");const Gt=this[Vt],ar=this[Vt+7];(Gt===void 0||ar===void 0)&&Ir(Vt,this.length-8);const br=(Gt<<24)+this[++Vt]*2**16+this[++Vt]*2**8+this[++Vt];return(BigInt(br)<>>0,Gt||tr(Vt,4,this.length),$.read(this,Vt,!0,23,4)},st.prototype.readFloatBE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,4,this.length),$.read(this,Vt,!1,23,4)},st.prototype.readDoubleLE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,8,this.length),$.read(this,Vt,!0,52,8)},st.prototype.readDoubleBE=function(Vt,Gt){return Vt=Vt>>>0,Gt||tr(Vt,8,this.length),$.read(this,Vt,!1,52,8)};function nr(Zt,Vt,Gt,ar,br,wr){if(!st.isBuffer(Zt))throw new TypeError('"buffer" argument must be a Buffer instance');if(Vt>br||VtZt.length)throw new RangeError("Index out of range")}st.prototype.writeUintLE=st.prototype.writeUIntLE=function(Vt,Gt,ar,br){if(Vt=+Vt,Gt=Gt>>>0,ar=ar>>>0,!br){const Wr=Math.pow(2,8*ar)-1;nr(this,Vt,Gt,ar,Wr,0)}let wr=1,Sr=0;for(this[Gt]=Vt&255;++Sr>>0,ar=ar>>>0,!br){const Wr=Math.pow(2,8*ar)-1;nr(this,Vt,Gt,ar,Wr,0)}let wr=ar-1,Sr=1;for(this[Gt+wr]=Vt&255;--wr>=0&&(Sr*=256);)this[Gt+wr]=Vt/Sr&255;return Gt+ar},st.prototype.writeUint8=st.prototype.writeUInt8=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,1,255,0),this[Gt]=Vt&255,Gt+1},st.prototype.writeUint16LE=st.prototype.writeUInt16LE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,2,65535,0),this[Gt]=Vt&255,this[Gt+1]=Vt>>>8,Gt+2},st.prototype.writeUint16BE=st.prototype.writeUInt16BE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,2,65535,0),this[Gt]=Vt>>>8,this[Gt+1]=Vt&255,Gt+2},st.prototype.writeUint32LE=st.prototype.writeUInt32LE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,4,4294967295,0),this[Gt+3]=Vt>>>24,this[Gt+2]=Vt>>>16,this[Gt+1]=Vt>>>8,this[Gt]=Vt&255,Gt+4},st.prototype.writeUint32BE=st.prototype.writeUInt32BE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,4,4294967295,0),this[Gt]=Vt>>>24,this[Gt+1]=Vt>>>16,this[Gt+2]=Vt>>>8,this[Gt+3]=Vt&255,Gt+4};function ir(Zt,Vt,Gt,ar,br){pr(Vt,ar,br,Zt,Gt,7);let wr=Number(Vt&BigInt(4294967295));Zt[Gt++]=wr,wr=wr>>8,Zt[Gt++]=wr,wr=wr>>8,Zt[Gt++]=wr,wr=wr>>8,Zt[Gt++]=wr;let Sr=Number(Vt>>BigInt(32)&BigInt(4294967295));return Zt[Gt++]=Sr,Sr=Sr>>8,Zt[Gt++]=Sr,Sr=Sr>>8,Zt[Gt++]=Sr,Sr=Sr>>8,Zt[Gt++]=Sr,Gt}function Wt(Zt,Vt,Gt,ar,br){pr(Vt,ar,br,Zt,Gt,7);let wr=Number(Vt&BigInt(4294967295));Zt[Gt+7]=wr,wr=wr>>8,Zt[Gt+6]=wr,wr=wr>>8,Zt[Gt+5]=wr,wr=wr>>8,Zt[Gt+4]=wr;let Sr=Number(Vt>>BigInt(32)&BigInt(4294967295));return Zt[Gt+3]=Sr,Sr=Sr>>8,Zt[Gt+2]=Sr,Sr=Sr>>8,Zt[Gt+1]=Sr,Sr=Sr>>8,Zt[Gt]=Sr,Gt+8}st.prototype.writeBigUInt64LE=Yt(function(Vt,Gt=0){return ir(this,Vt,Gt,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeBigUInt64BE=Yt(function(Vt,Gt=0){return Wt(this,Vt,Gt,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeIntLE=function(Vt,Gt,ar,br){if(Vt=+Vt,Gt=Gt>>>0,!br){const Hr=Math.pow(2,8*ar-1);nr(this,Vt,Gt,ar,Hr-1,-Hr)}let wr=0,Sr=1,Wr=0;for(this[Gt]=Vt&255;++wr>0)-Wr&255;return Gt+ar},st.prototype.writeIntBE=function(Vt,Gt,ar,br){if(Vt=+Vt,Gt=Gt>>>0,!br){const Hr=Math.pow(2,8*ar-1);nr(this,Vt,Gt,ar,Hr-1,-Hr)}let wr=ar-1,Sr=1,Wr=0;for(this[Gt+wr]=Vt&255;--wr>=0&&(Sr*=256);)Vt<0&&Wr===0&&this[Gt+wr+1]!==0&&(Wr=1),this[Gt+wr]=(Vt/Sr>>0)-Wr&255;return Gt+ar},st.prototype.writeInt8=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,1,127,-128),Vt<0&&(Vt=255+Vt+1),this[Gt]=Vt&255,Gt+1},st.prototype.writeInt16LE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,2,32767,-32768),this[Gt]=Vt&255,this[Gt+1]=Vt>>>8,Gt+2},st.prototype.writeInt16BE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,2,32767,-32768),this[Gt]=Vt>>>8,this[Gt+1]=Vt&255,Gt+2},st.prototype.writeInt32LE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,4,2147483647,-2147483648),this[Gt]=Vt&255,this[Gt+1]=Vt>>>8,this[Gt+2]=Vt>>>16,this[Gt+3]=Vt>>>24,Gt+4},st.prototype.writeInt32BE=function(Vt,Gt,ar){return Vt=+Vt,Gt=Gt>>>0,ar||nr(this,Vt,Gt,4,2147483647,-2147483648),Vt<0&&(Vt=4294967295+Vt+1),this[Gt]=Vt>>>24,this[Gt+1]=Vt>>>16,this[Gt+2]=Vt>>>8,this[Gt+3]=Vt&255,Gt+4},st.prototype.writeBigInt64LE=Yt(function(Vt,Gt=0){return ir(this,Vt,Gt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),st.prototype.writeBigInt64BE=Yt(function(Vt,Gt=0){return Wt(this,Vt,Gt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Kt(Zt,Vt,Gt,ar,br,wr){if(Gt+ar>Zt.length)throw new RangeError("Index out of range");if(Gt<0)throw new RangeError("Index out of range")}function Jt(Zt,Vt,Gt,ar,br){return Vt=+Vt,Gt=Gt>>>0,br||Kt(Zt,Vt,Gt,4),$.write(Zt,Vt,Gt,ar,23,4),Gt+4}st.prototype.writeFloatLE=function(Vt,Gt,ar){return Jt(this,Vt,Gt,!0,ar)},st.prototype.writeFloatBE=function(Vt,Gt,ar){return Jt(this,Vt,Gt,!1,ar)};function Ht(Zt,Vt,Gt,ar,br){return Vt=+Vt,Gt=Gt>>>0,br||Kt(Zt,Vt,Gt,8),$.write(Zt,Vt,Gt,ar,52,8),Gt+8}st.prototype.writeDoubleLE=function(Vt,Gt,ar){return Ht(this,Vt,Gt,!0,ar)},st.prototype.writeDoubleBE=function(Vt,Gt,ar){return Ht(this,Vt,Gt,!1,ar)},st.prototype.copy=function(Vt,Gt,ar,br){if(!st.isBuffer(Vt))throw new TypeError("argument should be a Buffer");if(ar||(ar=0),!br&&br!==0&&(br=this.length),Gt>=Vt.length&&(Gt=Vt.length),Gt||(Gt=0),br>0&&br=this.length)throw new RangeError("Index out of range");if(br<0)throw new RangeError("sourceEnd out of bounds");br>this.length&&(br=this.length),Vt.length-Gt>>0,ar=ar===void 0?this.length:ar>>>0,Vt||(Vt=0);let wr;if(typeof Vt=="number")for(wr=Gt;wr2**32?br=dr(String(Gt)):typeof Gt=="bigint"&&(br=String(Gt),(Gt>BigInt(2)**BigInt(32)||Gt<-(BigInt(2)**BigInt(32)))&&(br=dr(br)),br+="n"),ar+=` It must be ${Vt}. Received ${br}`,ar},RangeError);function dr(Zt){let Vt="",Gt=Zt.length;const ar=Zt[0]==="-"?1:0;for(;Gt>=ar+4;Gt-=3)Vt=`_${Zt.slice(Gt-3,Gt)}${Vt}`;return`${Zt.slice(0,Gt)}${Vt}`}function xr(Zt,Vt,Gt){kr(Vt,"offset"),(Zt[Vt]===void 0||Zt[Vt+Gt]===void 0)&&Ir(Vt,Zt.length-(Gt+1))}function pr(Zt,Vt,Gt,ar,br,wr){if(Zt>Gt||Zt= 0${Sr} and < 2${Sr} ** ${(wr+1)*8}${Sr}`:Wr=`>= -(2${Sr} ** ${(wr+1)*8-1}${Sr}) and < 2 ** ${(wr+1)*8-1}${Sr}`,new qt.ERR_OUT_OF_RANGE("value",Wr,Zt)}xr(ar,br,wr)}function kr(Zt,Vt){if(typeof Zt!="number")throw new qt.ERR_INVALID_ARG_TYPE(Vt,"number",Zt)}function Ir(Zt,Vt,Gt){throw Math.floor(Zt)!==Zt?(kr(Zt,Gt),new qt.ERR_OUT_OF_RANGE("offset","an integer",Zt)):Vt<0?new qt.ERR_BUFFER_OUT_OF_BOUNDS:new qt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Vt}`,Zt)}const lr=/[^+/0-9A-Za-z-_]/g;function fr(Zt){if(Zt=Zt.split("=")[0],Zt=Zt.trim().replace(lr,""),Zt.length<2)return"";for(;Zt.length%4!==0;)Zt=Zt+"=";return Zt}function Er(Zt,Vt){Vt=Vt||1/0;let Gt;const ar=Zt.length;let br=null;const wr=[];for(let Sr=0;Sr55295&&Gt<57344){if(!br){if(Gt>56319){(Vt-=3)>-1&&wr.push(239,191,189);continue}else if(Sr+1===ar){(Vt-=3)>-1&&wr.push(239,191,189);continue}br=Gt;continue}if(Gt<56320){(Vt-=3)>-1&&wr.push(239,191,189),br=Gt;continue}Gt=(br-55296<<10|Gt-56320)+65536}else br&&(Vt-=3)>-1&&wr.push(239,191,189);if(br=null,Gt<128){if((Vt-=1)<0)break;wr.push(Gt)}else if(Gt<2048){if((Vt-=2)<0)break;wr.push(Gt>>6|192,Gt&63|128)}else if(Gt<65536){if((Vt-=3)<0)break;wr.push(Gt>>12|224,Gt>>6&63|128,Gt&63|128)}else if(Gt<1114112){if((Vt-=4)<0)break;wr.push(Gt>>18|240,Gt>>12&63|128,Gt>>6&63|128,Gt&63|128)}else throw new Error("Invalid code point")}return wr}function $r(Zt){const Vt=[];for(let Gt=0;Gt>8,br=Gt%256,wr.push(br),wr.push(ar);return wr}function Rr(Zt){return a.toByteArray(fr(Zt))}function Ar(Zt,Vt,Gt,ar){let br;for(br=0;br=Vt.length||br>=Zt.length);++br)Vt[br+Gt]=Zt[br];return br}function Or(Zt,Vt){return Zt instanceof Vt||Zt!=null&&Zt.constructor!=null&&Zt.constructor.name!=null&&Zt.constructor.name===Vt.name}function Lr(Zt){return Zt!==Zt}const or=function(){const Zt="0123456789abcdef",Vt=new Array(256);for(let Gt=0;Gt<16;++Gt){const ar=Gt*16;for(let br=0;br<16;++br)Vt[ar+br]=Zt[Gt]+Zt[br]}return Vt}();function Yt(Zt){return typeof BigInt>"u"?er:Zt}function er(){throw new Error("BigInt not supported")}})(buffer$2);const Buffer$g=buffer$2.Buffer;var inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(a,$){$&&(a.super_=$,a.prototype=Object.create($.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(a,$){if($){a.super_=$;var j=function(){};j.prototype=$.prototype,a.prototype=new j,a.prototype.constructor=a}};var inherits_browserExports=inherits_browser.exports,safeBuffer$2={exports:{}},buffer$1={},base64Js={};base64Js.byteLength=byteLength$1;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup$2=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$1=0,len=code.length;i$10)throw new Error("Invalid string. Length must be a multiple of 4");var $=_.indexOf("=");$===-1&&($=a);var j=$===a?0:4-$%4;return[$,j]}function byteLength$1(_){var a=getLens(_),$=a[0],j=a[1];return($+j)*3/4-j}function _byteLength(_,a,$){return(a+$)*3/4-$}function toByteArray(_){var a,$=getLens(_),j=$[0],et=$[1],tt=new Arr(_byteLength(_,j,et)),rt=0,nt=et>0?j-4:j,it;for(it=0;it>16&255,tt[rt++]=a>>8&255,tt[rt++]=a&255;return et===2&&(a=revLookup[_.charCodeAt(it)]<<2|revLookup[_.charCodeAt(it+1)]>>4,tt[rt++]=a&255),et===1&&(a=revLookup[_.charCodeAt(it)]<<10|revLookup[_.charCodeAt(it+1)]<<4|revLookup[_.charCodeAt(it+2)]>>2,tt[rt++]=a>>8&255,tt[rt++]=a&255),tt}function tripletToBase64(_){return lookup$2[_>>18&63]+lookup$2[_>>12&63]+lookup$2[_>>6&63]+lookup$2[_&63]}function encodeChunk(_,a,$){for(var j,et=[],tt=a;tt<$;tt+=3)j=(_[tt]<<16&16711680)+(_[tt+1]<<8&65280)+(_[tt+2]&255),et.push(tripletToBase64(j));return et.join("")}function fromByteArray(_){for(var a,$=_.length,j=$%3,et=[],tt=16383,rt=0,nt=$-j;rtnt?nt:rt+tt));return j===1?(a=_[$-1],et.push(lookup$2[a>>2]+lookup$2[a<<4&63]+"==")):j===2&&(a=(_[$-2]<<8)+_[$-1],et.push(lookup$2[a>>10]+lookup$2[a>>4&63]+lookup$2[a<<2&63]+"=")),et.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(_,a,$,j,et){var tt,rt,nt=et*8-j-1,it=(1<>1,st=-7,at=$?et-1:0,ut=$?-1:1,ht=_[a+at];for(at+=ut,tt=ht&(1<<-st)-1,ht>>=-st,st+=nt;st>0;tt=tt*256+_[a+at],at+=ut,st-=8);for(rt=tt&(1<<-st)-1,tt>>=-st,st+=j;st>0;rt=rt*256+_[a+at],at+=ut,st-=8);if(tt===0)tt=1-ot;else{if(tt===it)return rt?NaN:(ht?-1:1)*(1/0);rt=rt+Math.pow(2,j),tt=tt-ot}return(ht?-1:1)*rt*Math.pow(2,tt-j)};ieee754.write=function(_,a,$,j,et,tt){var rt,nt,it,ot=tt*8-et-1,st=(1<>1,ut=et===23?Math.pow(2,-24)-Math.pow(2,-77):0,ht=j?0:tt-1,bt=j?1:-1,Et=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(nt=isNaN(a)?1:0,rt=st):(rt=Math.floor(Math.log(a)/Math.LN2),a*(it=Math.pow(2,-rt))<1&&(rt--,it*=2),rt+at>=1?a+=ut/it:a+=ut*Math.pow(2,1-at),a*it>=2&&(rt++,it/=2),rt+at>=st?(nt=0,rt=st):rt+at>=1?(nt=(a*it-1)*Math.pow(2,et),rt=rt+at):(nt=a*Math.pow(2,at-1)*Math.pow(2,et),rt=0));et>=8;_[$+ht]=nt&255,ht+=bt,nt/=256,et-=8);for(rt=rt<0;_[$+ht]=rt&255,ht+=bt,rt/=256,ot-=8);_[$+ht-bt]|=Et*128};/*! + */(function(_){const a=base64Js$1,$=ieee754$1,j=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_.Buffer=st,_.SlowBuffer=Nt,_.INSPECT_MAX_BYTES=50;const et=2147483647;_.kMaxLength=et;const{Uint8Array:tt,ArrayBuffer:rt,SharedArrayBuffer:nt}=globalThis;st.TYPED_ARRAY_SUPPORT=it(),!st.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function it(){try{const Zt=new tt(1),qt={foo:function(){return 42}};return Object.setPrototypeOf(qt,tt.prototype),Object.setPrototypeOf(Zt,qt),Zt.foo()===42}catch{return!1}}Object.defineProperty(st.prototype,"parent",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.buffer}}),Object.defineProperty(st.prototype,"offset",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.byteOffset}});function at(Zt){if(Zt>et)throw new RangeError('The value "'+Zt+'" is invalid for option "size"');const qt=new tt(Zt);return Object.setPrototypeOf(qt,st.prototype),qt}function st(Zt,qt,Gt){if(typeof Zt=="number"){if(typeof qt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return mt(Zt)}return ot(Zt,qt,Gt)}st.poolSize=8192;function ot(Zt,qt,Gt){if(typeof Zt=="string")return xt(Zt,qt);if(rt.isView(Zt))return Pt(Zt);if(Zt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Zt);if(Or(Zt,rt)||Zt&&Or(Zt.buffer,rt)||typeof nt<"u"&&(Or(Zt,nt)||Zt&&Or(Zt.buffer,nt)))return Tt(Zt,qt,Gt);if(typeof Zt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const or=Zt.valueOf&&Zt.valueOf();if(or!=null&&or!==Zt)return st.from(or,qt,Gt);const vr=kt(Zt);if(vr)return vr;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Zt[Symbol.toPrimitive]=="function")return st.from(Zt[Symbol.toPrimitive]("string"),qt,Gt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Zt)}st.from=function(Zt,qt,Gt){return ot(Zt,qt,Gt)},Object.setPrototypeOf(st.prototype,tt.prototype),Object.setPrototypeOf(st,tt);function ut(Zt){if(typeof Zt!="number")throw new TypeError('"size" argument must be of type number');if(Zt<0)throw new RangeError('The value "'+Zt+'" is invalid for option "size"')}function dt(Zt,qt,Gt){return ut(Zt),Zt<=0?at(Zt):qt!==void 0?typeof Gt=="string"?at(Zt).fill(qt,Gt):at(Zt).fill(qt):at(Zt)}st.alloc=function(Zt,qt,Gt){return dt(Zt,qt,Gt)};function mt(Zt){return ut(Zt),at(Zt<0?0:Lt(Zt)|0)}st.allocUnsafe=function(Zt){return mt(Zt)},st.allocUnsafeSlow=function(Zt){return mt(Zt)};function xt(Zt,qt){if((typeof qt!="string"||qt==="")&&(qt="utf8"),!st.isEncoding(qt))throw new TypeError("Unknown encoding: "+qt);const Gt=zt(Zt,qt)|0;let or=at(Gt);const vr=or.write(Zt,qt);return vr!==Gt&&(or=or.slice(0,vr)),or}function Ct(Zt){const qt=Zt.length<0?0:Lt(Zt.length)|0,Gt=at(qt);for(let or=0;or=et)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et.toString(16)+" bytes");return Zt|0}function Nt(Zt){return+Zt!=Zt&&(Zt=0),st.alloc(+Zt)}st.isBuffer=function(qt){return qt!=null&&qt._isBuffer===!0&&qt!==st.prototype},st.compare=function(qt,Gt){if(Or(qt,tt)&&(qt=st.from(qt,qt.offset,qt.byteLength)),Or(Gt,tt)&&(Gt=st.from(Gt,Gt.offset,Gt.byteLength)),!st.isBuffer(qt)||!st.isBuffer(Gt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(qt===Gt)return 0;let or=qt.length,vr=Gt.length;for(let wr=0,Sr=Math.min(or,vr);wrvr.length?(st.isBuffer(Sr)||(Sr=st.from(Sr)),Sr.copy(vr,wr)):tt.prototype.set.call(vr,Sr,wr);else if(st.isBuffer(Sr))Sr.copy(vr,wr);else throw new TypeError('"list" argument must be an Array of Buffers');wr+=Sr.length}return vr};function zt(Zt,qt){if(st.isBuffer(Zt))return Zt.length;if(rt.isView(Zt)||Or(Zt,rt))return Zt.byteLength;if(typeof Zt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Zt);const Gt=Zt.length,or=arguments.length>2&&arguments[2]===!0;if(!or&&Gt===0)return 0;let vr=!1;for(;;)switch(qt){case"ascii":case"latin1":case"binary":return Gt;case"utf8":case"utf-8":return Er(Zt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Gt*2;case"hex":return Gt>>>1;case"base64":return Rr(Zt).length;default:if(vr)return or?-1:Er(Zt).length;qt=(""+qt).toLowerCase(),vr=!0}}st.byteLength=zt;function jt(Zt,qt,Gt){let or=!1;if((qt===void 0||qt<0)&&(qt=0),qt>this.length||((Gt===void 0||Gt>this.length)&&(Gt=this.length),Gt<=0)||(Gt>>>=0,qt>>>=0,Gt<=qt))return"";for(Zt||(Zt="utf8");;)switch(Zt){case"hex":return wt(this,qt,Gt);case"utf8":case"utf-8":return St(this,qt,Gt);case"ascii":return Et(this,qt,Gt);case"latin1":case"binary":return At(this,qt,Gt);case"base64":return vt(this,qt,Gt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,qt,Gt);default:if(or)throw new TypeError("Unknown encoding: "+Zt);Zt=(Zt+"").toLowerCase(),or=!0}}st.prototype._isBuffer=!0;function Mt(Zt,qt,Gt){const or=Zt[qt];Zt[qt]=Zt[Gt],Zt[Gt]=or}st.prototype.swap16=function(){const qt=this.length;if(qt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Gt=0;GtGt&&(qt+=" ... "),""},j&&(st.prototype[j]=st.prototype.inspect),st.prototype.compare=function(qt,Gt,or,vr,wr){if(Or(qt,tt)&&(qt=st.from(qt,qt.offset,qt.byteLength)),!st.isBuffer(qt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof qt);if(Gt===void 0&&(Gt=0),or===void 0&&(or=qt?qt.length:0),vr===void 0&&(vr=0),wr===void 0&&(wr=this.length),Gt<0||or>qt.length||vr<0||wr>this.length)throw new RangeError("out of range index");if(vr>=wr&&Gt>=or)return 0;if(vr>=wr)return-1;if(Gt>=or)return 1;if(Gt>>>=0,or>>>=0,vr>>>=0,wr>>>=0,this===qt)return 0;let Sr=wr-vr,Wr=or-Gt;const Hr=Math.min(Sr,Wr),Fr=this.slice(vr,wr),pn=qt.slice(Gt,or);for(let Jr=0;Jr2147483647?Gt=2147483647:Gt<-2147483648&&(Gt=-2147483648),Gt=+Gt,Lr(Gt)&&(Gt=vr?0:Zt.length-1),Gt<0&&(Gt=Zt.length+Gt),Gt>=Zt.length){if(vr)return-1;Gt=Zt.length-1}else if(Gt<0)if(vr)Gt=0;else return-1;if(typeof qt=="string"&&(qt=st.from(qt,or)),st.isBuffer(qt))return qt.length===0?-1:Ft(Zt,qt,Gt,or,vr);if(typeof qt=="number")return qt=qt&255,typeof tt.prototype.indexOf=="function"?vr?tt.prototype.indexOf.call(Zt,qt,Gt):tt.prototype.lastIndexOf.call(Zt,qt,Gt):Ft(Zt,[qt],Gt,or,vr);throw new TypeError("val must be string, number or Buffer")}function Ft(Zt,qt,Gt,or,vr){let wr=1,Sr=Zt.length,Wr=qt.length;if(or!==void 0&&(or=String(or).toLowerCase(),or==="ucs2"||or==="ucs-2"||or==="utf16le"||or==="utf-16le")){if(Zt.length<2||qt.length<2)return-1;wr=2,Sr/=2,Wr/=2,Gt/=2}function Hr(pn,Jr){return wr===1?pn[Jr]:pn.readUInt16BE(Jr*wr)}let Fr;if(vr){let pn=-1;for(Fr=Gt;FrSr&&(Gt=Sr-Wr),Fr=Gt;Fr>=0;Fr--){let pn=!0;for(let Jr=0;Jrvr&&(or=vr)):or=vr;const wr=qt.length;or>wr/2&&(or=wr/2);let Sr;for(Sr=0;Sr>>0,isFinite(or)?(or=or>>>0,vr===void 0&&(vr="utf8")):(vr=or,or=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const wr=this.length-Gt;if((or===void 0||or>wr)&&(or=wr),qt.length>0&&(or<0||Gt<0)||Gt>this.length)throw new RangeError("Attempt to write outside buffer bounds");vr||(vr="utf8");let Sr=!1;for(;;)switch(vr){case"hex":return Bt(this,qt,Gt,or);case"utf8":case"utf-8":return yt(this,qt,Gt,or);case"ascii":case"latin1":case"binary":return bt(this,qt,Gt,or);case"base64":return ct(this,qt,Gt,or);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ht(this,qt,Gt,or);default:if(Sr)throw new TypeError("Unknown encoding: "+vr);vr=(""+vr).toLowerCase(),Sr=!0}},st.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vt(Zt,qt,Gt){return qt===0&&Gt===Zt.length?a.fromByteArray(Zt):a.fromByteArray(Zt.slice(qt,Gt))}function St(Zt,qt,Gt){Gt=Math.min(Zt.length,Gt);const or=[];let vr=qt;for(;vr239?4:wr>223?3:wr>191?2:1;if(vr+Wr<=Gt){let Hr,Fr,pn,Jr;switch(Wr){case 1:wr<128&&(Sr=wr);break;case 2:Hr=Zt[vr+1],(Hr&192)===128&&(Jr=(wr&31)<<6|Hr&63,Jr>127&&(Sr=Jr));break;case 3:Hr=Zt[vr+1],Fr=Zt[vr+2],(Hr&192)===128&&(Fr&192)===128&&(Jr=(wr&15)<<12|(Hr&63)<<6|Fr&63,Jr>2047&&(Jr<55296||Jr>57343)&&(Sr=Jr));break;case 4:Hr=Zt[vr+1],Fr=Zt[vr+2],pn=Zt[vr+3],(Hr&192)===128&&(Fr&192)===128&&(pn&192)===128&&(Jr=(wr&15)<<18|(Hr&63)<<12|(Fr&63)<<6|pn&63,Jr>65535&&Jr<1114112&&(Sr=Jr))}}Sr===null?(Sr=65533,Wr=1):Sr>65535&&(Sr-=65536,or.push(Sr>>>10&1023|55296),Sr=56320|Sr&1023),or.push(Sr),vr+=Wr}return $t(or)}const Rt=4096;function $t(Zt){const qt=Zt.length;if(qt<=Rt)return String.fromCharCode.apply(String,Zt);let Gt="",or=0;for(;oror)&&(Gt=or);let vr="";for(let wr=qt;wror&&(qt=or),Gt<0?(Gt+=or,Gt<0&&(Gt=0)):Gt>or&&(Gt=or),GtGt)throw new RangeError("Trying to access beyond buffer length")}st.prototype.readUintLE=st.prototype.readUIntLE=function(qt,Gt,or){qt=qt>>>0,Gt=Gt>>>0,or||tr(qt,Gt,this.length);let vr=this[qt],wr=1,Sr=0;for(;++Sr>>0,Gt=Gt>>>0,or||tr(qt,Gt,this.length);let vr=this[qt+--Gt],wr=1;for(;Gt>0&&(wr*=256);)vr+=this[qt+--Gt]*wr;return vr},st.prototype.readUint8=st.prototype.readUInt8=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,1,this.length),this[qt]},st.prototype.readUint16LE=st.prototype.readUInt16LE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,2,this.length),this[qt]|this[qt+1]<<8},st.prototype.readUint16BE=st.prototype.readUInt16BE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,2,this.length),this[qt]<<8|this[qt+1]},st.prototype.readUint32LE=st.prototype.readUInt32LE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,4,this.length),(this[qt]|this[qt+1]<<8|this[qt+2]<<16)+this[qt+3]*16777216},st.prototype.readUint32BE=st.prototype.readUInt32BE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,4,this.length),this[qt]*16777216+(this[qt+1]<<16|this[qt+2]<<8|this[qt+3])},st.prototype.readBigUInt64LE=Yt(function(qt){qt=qt>>>0,Ir(qt,"offset");const Gt=this[qt],or=this[qt+7];(Gt===void 0||or===void 0)&&kr(qt,this.length-8);const vr=Gt+this[++qt]*2**8+this[++qt]*2**16+this[++qt]*2**24,wr=this[++qt]+this[++qt]*2**8+this[++qt]*2**16+or*2**24;return BigInt(vr)+(BigInt(wr)<>>0,Ir(qt,"offset");const Gt=this[qt],or=this[qt+7];(Gt===void 0||or===void 0)&&kr(qt,this.length-8);const vr=Gt*2**24+this[++qt]*2**16+this[++qt]*2**8+this[++qt],wr=this[++qt]*2**24+this[++qt]*2**16+this[++qt]*2**8+or;return(BigInt(vr)<>>0,Gt=Gt>>>0,or||tr(qt,Gt,this.length);let vr=this[qt],wr=1,Sr=0;for(;++Sr=wr&&(vr-=Math.pow(2,8*Gt)),vr},st.prototype.readIntBE=function(qt,Gt,or){qt=qt>>>0,Gt=Gt>>>0,or||tr(qt,Gt,this.length);let vr=Gt,wr=1,Sr=this[qt+--vr];for(;vr>0&&(wr*=256);)Sr+=this[qt+--vr]*wr;return wr*=128,Sr>=wr&&(Sr-=Math.pow(2,8*Gt)),Sr},st.prototype.readInt8=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,1,this.length),this[qt]&128?(255-this[qt]+1)*-1:this[qt]},st.prototype.readInt16LE=function(qt,Gt){qt=qt>>>0,Gt||tr(qt,2,this.length);const or=this[qt]|this[qt+1]<<8;return or&32768?or|4294901760:or},st.prototype.readInt16BE=function(qt,Gt){qt=qt>>>0,Gt||tr(qt,2,this.length);const or=this[qt+1]|this[qt]<<8;return or&32768?or|4294901760:or},st.prototype.readInt32LE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,4,this.length),this[qt]|this[qt+1]<<8|this[qt+2]<<16|this[qt+3]<<24},st.prototype.readInt32BE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,4,this.length),this[qt]<<24|this[qt+1]<<16|this[qt+2]<<8|this[qt+3]},st.prototype.readBigInt64LE=Yt(function(qt){qt=qt>>>0,Ir(qt,"offset");const Gt=this[qt],or=this[qt+7];(Gt===void 0||or===void 0)&&kr(qt,this.length-8);const vr=this[qt+4]+this[qt+5]*2**8+this[qt+6]*2**16+(or<<24);return(BigInt(vr)<>>0,Ir(qt,"offset");const Gt=this[qt],or=this[qt+7];(Gt===void 0||or===void 0)&&kr(qt,this.length-8);const vr=(Gt<<24)+this[++qt]*2**16+this[++qt]*2**8+this[++qt];return(BigInt(vr)<>>0,Gt||tr(qt,4,this.length),$.read(this,qt,!0,23,4)},st.prototype.readFloatBE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,4,this.length),$.read(this,qt,!1,23,4)},st.prototype.readDoubleLE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,8,this.length),$.read(this,qt,!0,52,8)},st.prototype.readDoubleBE=function(qt,Gt){return qt=qt>>>0,Gt||tr(qt,8,this.length),$.read(this,qt,!1,52,8)};function nr(Zt,qt,Gt,or,vr,wr){if(!st.isBuffer(Zt))throw new TypeError('"buffer" argument must be a Buffer instance');if(qt>vr||qtZt.length)throw new RangeError("Index out of range")}st.prototype.writeUintLE=st.prototype.writeUIntLE=function(qt,Gt,or,vr){if(qt=+qt,Gt=Gt>>>0,or=or>>>0,!vr){const Wr=Math.pow(2,8*or)-1;nr(this,qt,Gt,or,Wr,0)}let wr=1,Sr=0;for(this[Gt]=qt&255;++Sr>>0,or=or>>>0,!vr){const Wr=Math.pow(2,8*or)-1;nr(this,qt,Gt,or,Wr,0)}let wr=or-1,Sr=1;for(this[Gt+wr]=qt&255;--wr>=0&&(Sr*=256);)this[Gt+wr]=qt/Sr&255;return Gt+or},st.prototype.writeUint8=st.prototype.writeUInt8=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,1,255,0),this[Gt]=qt&255,Gt+1},st.prototype.writeUint16LE=st.prototype.writeUInt16LE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,2,65535,0),this[Gt]=qt&255,this[Gt+1]=qt>>>8,Gt+2},st.prototype.writeUint16BE=st.prototype.writeUInt16BE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,2,65535,0),this[Gt]=qt>>>8,this[Gt+1]=qt&255,Gt+2},st.prototype.writeUint32LE=st.prototype.writeUInt32LE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,4,4294967295,0),this[Gt+3]=qt>>>24,this[Gt+2]=qt>>>16,this[Gt+1]=qt>>>8,this[Gt]=qt&255,Gt+4},st.prototype.writeUint32BE=st.prototype.writeUInt32BE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,4,4294967295,0),this[Gt]=qt>>>24,this[Gt+1]=qt>>>16,this[Gt+2]=qt>>>8,this[Gt+3]=qt&255,Gt+4};function ir(Zt,qt,Gt,or,vr){pr(qt,or,vr,Zt,Gt,7);let wr=Number(qt&BigInt(4294967295));Zt[Gt++]=wr,wr=wr>>8,Zt[Gt++]=wr,wr=wr>>8,Zt[Gt++]=wr,wr=wr>>8,Zt[Gt++]=wr;let Sr=Number(qt>>BigInt(32)&BigInt(4294967295));return Zt[Gt++]=Sr,Sr=Sr>>8,Zt[Gt++]=Sr,Sr=Sr>>8,Zt[Gt++]=Sr,Sr=Sr>>8,Zt[Gt++]=Sr,Gt}function Wt(Zt,qt,Gt,or,vr){pr(qt,or,vr,Zt,Gt,7);let wr=Number(qt&BigInt(4294967295));Zt[Gt+7]=wr,wr=wr>>8,Zt[Gt+6]=wr,wr=wr>>8,Zt[Gt+5]=wr,wr=wr>>8,Zt[Gt+4]=wr;let Sr=Number(qt>>BigInt(32)&BigInt(4294967295));return Zt[Gt+3]=Sr,Sr=Sr>>8,Zt[Gt+2]=Sr,Sr=Sr>>8,Zt[Gt+1]=Sr,Sr=Sr>>8,Zt[Gt]=Sr,Gt+8}st.prototype.writeBigUInt64LE=Yt(function(qt,Gt=0){return ir(this,qt,Gt,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeBigUInt64BE=Yt(function(qt,Gt=0){return Wt(this,qt,Gt,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeIntLE=function(qt,Gt,or,vr){if(qt=+qt,Gt=Gt>>>0,!vr){const Hr=Math.pow(2,8*or-1);nr(this,qt,Gt,or,Hr-1,-Hr)}let wr=0,Sr=1,Wr=0;for(this[Gt]=qt&255;++wr>0)-Wr&255;return Gt+or},st.prototype.writeIntBE=function(qt,Gt,or,vr){if(qt=+qt,Gt=Gt>>>0,!vr){const Hr=Math.pow(2,8*or-1);nr(this,qt,Gt,or,Hr-1,-Hr)}let wr=or-1,Sr=1,Wr=0;for(this[Gt+wr]=qt&255;--wr>=0&&(Sr*=256);)qt<0&&Wr===0&&this[Gt+wr+1]!==0&&(Wr=1),this[Gt+wr]=(qt/Sr>>0)-Wr&255;return Gt+or},st.prototype.writeInt8=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,1,127,-128),qt<0&&(qt=255+qt+1),this[Gt]=qt&255,Gt+1},st.prototype.writeInt16LE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,2,32767,-32768),this[Gt]=qt&255,this[Gt+1]=qt>>>8,Gt+2},st.prototype.writeInt16BE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,2,32767,-32768),this[Gt]=qt>>>8,this[Gt+1]=qt&255,Gt+2},st.prototype.writeInt32LE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,4,2147483647,-2147483648),this[Gt]=qt&255,this[Gt+1]=qt>>>8,this[Gt+2]=qt>>>16,this[Gt+3]=qt>>>24,Gt+4},st.prototype.writeInt32BE=function(qt,Gt,or){return qt=+qt,Gt=Gt>>>0,or||nr(this,qt,Gt,4,2147483647,-2147483648),qt<0&&(qt=4294967295+qt+1),this[Gt]=qt>>>24,this[Gt+1]=qt>>>16,this[Gt+2]=qt>>>8,this[Gt+3]=qt&255,Gt+4},st.prototype.writeBigInt64LE=Yt(function(qt,Gt=0){return ir(this,qt,Gt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),st.prototype.writeBigInt64BE=Yt(function(qt,Gt=0){return Wt(this,qt,Gt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Kt(Zt,qt,Gt,or,vr,wr){if(Gt+or>Zt.length)throw new RangeError("Index out of range");if(Gt<0)throw new RangeError("Index out of range")}function Jt(Zt,qt,Gt,or,vr){return qt=+qt,Gt=Gt>>>0,vr||Kt(Zt,qt,Gt,4),$.write(Zt,qt,Gt,or,23,4),Gt+4}st.prototype.writeFloatLE=function(qt,Gt,or){return Jt(this,qt,Gt,!0,or)},st.prototype.writeFloatBE=function(qt,Gt,or){return Jt(this,qt,Gt,!1,or)};function Ht(Zt,qt,Gt,or,vr){return qt=+qt,Gt=Gt>>>0,vr||Kt(Zt,qt,Gt,8),$.write(Zt,qt,Gt,or,52,8),Gt+8}st.prototype.writeDoubleLE=function(qt,Gt,or){return Ht(this,qt,Gt,!0,or)},st.prototype.writeDoubleBE=function(qt,Gt,or){return Ht(this,qt,Gt,!1,or)},st.prototype.copy=function(qt,Gt,or,vr){if(!st.isBuffer(qt))throw new TypeError("argument should be a Buffer");if(or||(or=0),!vr&&vr!==0&&(vr=this.length),Gt>=qt.length&&(Gt=qt.length),Gt||(Gt=0),vr>0&&vr=this.length)throw new RangeError("Index out of range");if(vr<0)throw new RangeError("sourceEnd out of bounds");vr>this.length&&(vr=this.length),qt.length-Gt>>0,or=or===void 0?this.length:or>>>0,qt||(qt=0);let wr;if(typeof qt=="number")for(wr=Gt;wr2**32?vr=dr(String(Gt)):typeof Gt=="bigint"&&(vr=String(Gt),(Gt>BigInt(2)**BigInt(32)||Gt<-(BigInt(2)**BigInt(32)))&&(vr=dr(vr)),vr+="n"),or+=` It must be ${qt}. Received ${vr}`,or},RangeError);function dr(Zt){let qt="",Gt=Zt.length;const or=Zt[0]==="-"?1:0;for(;Gt>=or+4;Gt-=3)qt=`_${Zt.slice(Gt-3,Gt)}${qt}`;return`${Zt.slice(0,Gt)}${qt}`}function xr(Zt,qt,Gt){Ir(qt,"offset"),(Zt[qt]===void 0||Zt[qt+Gt]===void 0)&&kr(qt,Zt.length-(Gt+1))}function pr(Zt,qt,Gt,or,vr,wr){if(Zt>Gt||Zt= 0${Sr} and < 2${Sr} ** ${(wr+1)*8}${Sr}`:Wr=`>= -(2${Sr} ** ${(wr+1)*8-1}${Sr}) and < 2 ** ${(wr+1)*8-1}${Sr}`,new Vt.ERR_OUT_OF_RANGE("value",Wr,Zt)}xr(or,vr,wr)}function Ir(Zt,qt){if(typeof Zt!="number")throw new Vt.ERR_INVALID_ARG_TYPE(qt,"number",Zt)}function kr(Zt,qt,Gt){throw Math.floor(Zt)!==Zt?(Ir(Zt,Gt),new Vt.ERR_OUT_OF_RANGE("offset","an integer",Zt)):qt<0?new Vt.ERR_BUFFER_OUT_OF_BOUNDS:new Vt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${qt}`,Zt)}const lr=/[^+/0-9A-Za-z-_]/g;function fr(Zt){if(Zt=Zt.split("=")[0],Zt=Zt.trim().replace(lr,""),Zt.length<2)return"";for(;Zt.length%4!==0;)Zt=Zt+"=";return Zt}function Er(Zt,qt){qt=qt||1/0;let Gt;const or=Zt.length;let vr=null;const wr=[];for(let Sr=0;Sr55295&&Gt<57344){if(!vr){if(Gt>56319){(qt-=3)>-1&&wr.push(239,191,189);continue}else if(Sr+1===or){(qt-=3)>-1&&wr.push(239,191,189);continue}vr=Gt;continue}if(Gt<56320){(qt-=3)>-1&&wr.push(239,191,189),vr=Gt;continue}Gt=(vr-55296<<10|Gt-56320)+65536}else vr&&(qt-=3)>-1&&wr.push(239,191,189);if(vr=null,Gt<128){if((qt-=1)<0)break;wr.push(Gt)}else if(Gt<2048){if((qt-=2)<0)break;wr.push(Gt>>6|192,Gt&63|128)}else if(Gt<65536){if((qt-=3)<0)break;wr.push(Gt>>12|224,Gt>>6&63|128,Gt&63|128)}else if(Gt<1114112){if((qt-=4)<0)break;wr.push(Gt>>18|240,Gt>>12&63|128,Gt>>6&63|128,Gt&63|128)}else throw new Error("Invalid code point")}return wr}function $r(Zt){const qt=[];for(let Gt=0;Gt>8,vr=Gt%256,wr.push(vr),wr.push(or);return wr}function Rr(Zt){return a.toByteArray(fr(Zt))}function Ar(Zt,qt,Gt,or){let vr;for(vr=0;vr=qt.length||vr>=Zt.length);++vr)qt[vr+Gt]=Zt[vr];return vr}function Or(Zt,qt){return Zt instanceof qt||Zt!=null&&Zt.constructor!=null&&Zt.constructor.name!=null&&Zt.constructor.name===qt.name}function Lr(Zt){return Zt!==Zt}const ar=function(){const Zt="0123456789abcdef",qt=new Array(256);for(let Gt=0;Gt<16;++Gt){const or=Gt*16;for(let vr=0;vr<16;++vr)qt[or+vr]=Zt[Gt]+Zt[vr]}return qt}();function Yt(Zt){return typeof BigInt>"u"?er:Zt}function er(){throw new Error("BigInt not supported")}})(buffer$2);const Buffer$g=buffer$2.Buffer;var inherits_browser={exports:{}};typeof Object.create=="function"?inherits_browser.exports=function(a,$){$&&(a.super_=$,a.prototype=Object.create($.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(a,$){if($){a.super_=$;var j=function(){};j.prototype=$.prototype,a.prototype=new j,a.prototype.constructor=a}};var inherits_browserExports=inherits_browser.exports,safeBuffer$2={exports:{}},buffer$1={},base64Js={};base64Js.byteLength=byteLength$1;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup$2=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$1=0,len=code.length;i$10)throw new Error("Invalid string. Length must be a multiple of 4");var $=_.indexOf("=");$===-1&&($=a);var j=$===a?0:4-$%4;return[$,j]}function byteLength$1(_){var a=getLens(_),$=a[0],j=a[1];return($+j)*3/4-j}function _byteLength(_,a,$){return(a+$)*3/4-$}function toByteArray(_){var a,$=getLens(_),j=$[0],et=$[1],tt=new Arr(_byteLength(_,j,et)),rt=0,nt=et>0?j-4:j,it;for(it=0;it>16&255,tt[rt++]=a>>8&255,tt[rt++]=a&255;return et===2&&(a=revLookup[_.charCodeAt(it)]<<2|revLookup[_.charCodeAt(it+1)]>>4,tt[rt++]=a&255),et===1&&(a=revLookup[_.charCodeAt(it)]<<10|revLookup[_.charCodeAt(it+1)]<<4|revLookup[_.charCodeAt(it+2)]>>2,tt[rt++]=a>>8&255,tt[rt++]=a&255),tt}function tripletToBase64(_){return lookup$2[_>>18&63]+lookup$2[_>>12&63]+lookup$2[_>>6&63]+lookup$2[_&63]}function encodeChunk(_,a,$){for(var j,et=[],tt=a;tt<$;tt+=3)j=(_[tt]<<16&16711680)+(_[tt+1]<<8&65280)+(_[tt+2]&255),et.push(tripletToBase64(j));return et.join("")}function fromByteArray(_){for(var a,$=_.length,j=$%3,et=[],tt=16383,rt=0,nt=$-j;rtnt?nt:rt+tt));return j===1?(a=_[$-1],et.push(lookup$2[a>>2]+lookup$2[a<<4&63]+"==")):j===2&&(a=(_[$-2]<<8)+_[$-1],et.push(lookup$2[a>>10]+lookup$2[a>>4&63]+lookup$2[a<<2&63]+"=")),et.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(_,a,$,j,et){var tt,rt,nt=et*8-j-1,it=(1<>1,st=-7,ot=$?et-1:0,ut=$?-1:1,dt=_[a+ot];for(ot+=ut,tt=dt&(1<<-st)-1,dt>>=-st,st+=nt;st>0;tt=tt*256+_[a+ot],ot+=ut,st-=8);for(rt=tt&(1<<-st)-1,tt>>=-st,st+=j;st>0;rt=rt*256+_[a+ot],ot+=ut,st-=8);if(tt===0)tt=1-at;else{if(tt===it)return rt?NaN:(dt?-1:1)*(1/0);rt=rt+Math.pow(2,j),tt=tt-at}return(dt?-1:1)*rt*Math.pow(2,tt-j)};ieee754.write=function(_,a,$,j,et,tt){var rt,nt,it,at=tt*8-et-1,st=(1<>1,ut=et===23?Math.pow(2,-24)-Math.pow(2,-77):0,dt=j?0:tt-1,mt=j?1:-1,xt=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(nt=isNaN(a)?1:0,rt=st):(rt=Math.floor(Math.log(a)/Math.LN2),a*(it=Math.pow(2,-rt))<1&&(rt--,it*=2),rt+ot>=1?a+=ut/it:a+=ut*Math.pow(2,1-ot),a*it>=2&&(rt++,it/=2),rt+ot>=st?(nt=0,rt=st):rt+ot>=1?(nt=(a*it-1)*Math.pow(2,et),rt=rt+ot):(nt=a*Math.pow(2,ot-1)*Math.pow(2,et),rt=0));et>=8;_[$+dt]=nt&255,dt+=mt,nt/=256,et-=8);for(rt=rt<0;_[$+dt]=rt&255,dt+=mt,rt/=256,at-=8);_[$+dt-mt]|=xt*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(_){const a=base64Js,$=ieee754,j=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_.Buffer=nt,_.SlowBuffer=Tt,_.INSPECT_MAX_BYTES=50;const et=2147483647;_.kMaxLength=et,nt.TYPED_ARRAY_SUPPORT=tt(),!nt.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tt(){try{const or=new Uint8Array(1),Yt={foo:function(){return 42}};return Object.setPrototypeOf(Yt,Uint8Array.prototype),Object.setPrototypeOf(or,Yt),or.foo()===42}catch{return!1}}Object.defineProperty(nt.prototype,"parent",{enumerable:!0,get:function(){if(nt.isBuffer(this))return this.buffer}}),Object.defineProperty(nt.prototype,"offset",{enumerable:!0,get:function(){if(nt.isBuffer(this))return this.byteOffset}});function rt(or){if(or>et)throw new RangeError('The value "'+or+'" is invalid for option "size"');const Yt=new Uint8Array(or);return Object.setPrototypeOf(Yt,nt.prototype),Yt}function nt(or,Yt,er){if(typeof or=="number"){if(typeof Yt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return at(or)}return it(or,Yt,er)}nt.poolSize=8192;function it(or,Yt,er){if(typeof or=="string")return ut(or,Yt);if(ArrayBuffer.isView(or))return bt(or);if(or==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof or);if(Pr(or,ArrayBuffer)||or&&Pr(or.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pr(or,SharedArrayBuffer)||or&&Pr(or.buffer,SharedArrayBuffer)))return Et(or,Yt,er);if(typeof or=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Zt=or.valueOf&&or.valueOf();if(Zt!=null&&Zt!==or)return nt.from(Zt,Yt,er);const Vt=Ct(or);if(Vt)return Vt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof or[Symbol.toPrimitive]=="function")return nt.from(or[Symbol.toPrimitive]("string"),Yt,er);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof or)}nt.from=function(or,Yt,er){return it(or,Yt,er)},Object.setPrototypeOf(nt.prototype,Uint8Array.prototype),Object.setPrototypeOf(nt,Uint8Array);function ot(or){if(typeof or!="number")throw new TypeError('"size" argument must be of type number');if(or<0)throw new RangeError('The value "'+or+'" is invalid for option "size"')}function st(or,Yt,er){return ot(or),or<=0?rt(or):Yt!==void 0?typeof er=="string"?rt(or).fill(Yt,er):rt(or).fill(Yt):rt(or)}nt.alloc=function(or,Yt,er){return st(or,Yt,er)};function at(or){return ot(or),rt(or<0?0:Pt(or)|0)}nt.allocUnsafe=function(or){return at(or)},nt.allocUnsafeSlow=function(or){return at(or)};function ut(or,Yt){if((typeof Yt!="string"||Yt==="")&&(Yt="utf8"),!nt.isEncoding(Yt))throw new TypeError("Unknown encoding: "+Yt);const er=It(or,Yt)|0;let Zt=rt(er);const Vt=Zt.write(or,Yt);return Vt!==er&&(Zt=Zt.slice(0,Vt)),Zt}function ht(or){const Yt=or.length<0?0:Pt(or.length)|0,er=rt(Yt);for(let Zt=0;Zt=et)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et.toString(16)+" bytes");return or|0}function Tt(or){return+or!=or&&(or=0),nt.alloc(+or)}nt.isBuffer=function(Yt){return Yt!=null&&Yt._isBuffer===!0&&Yt!==nt.prototype},nt.compare=function(Yt,er){if(Pr(Yt,Uint8Array)&&(Yt=nt.from(Yt,Yt.offset,Yt.byteLength)),Pr(er,Uint8Array)&&(er=nt.from(er,er.offset,er.byteLength)),!nt.isBuffer(Yt)||!nt.isBuffer(er))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Yt===er)return 0;let Zt=Yt.length,Vt=er.length;for(let Gt=0,ar=Math.min(Zt,Vt);GtVt.length?(nt.isBuffer(ar)||(ar=nt.from(ar)),ar.copy(Vt,Gt)):Uint8Array.prototype.set.call(Vt,ar,Gt);else if(nt.isBuffer(ar))ar.copy(Vt,Gt);else throw new TypeError('"list" argument must be an Array of Buffers');Gt+=ar.length}return Vt};function It(or,Yt){if(nt.isBuffer(or))return or.length;if(ArrayBuffer.isView(or)||Pr(or,ArrayBuffer))return or.byteLength;if(typeof or!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof or);const er=or.length,Zt=arguments.length>2&&arguments[2]===!0;if(!Zt&&er===0)return 0;let Vt=!1;for(;;)switch(Yt){case"ascii":case"latin1":case"binary":return er;case"utf8":case"utf-8":return Ir(or).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return er*2;case"hex":return er>>>1;case"base64":return Er(or).length;default:if(Vt)return Zt?-1:Ir(or).length;Yt=(""+Yt).toLowerCase(),Vt=!0}}nt.byteLength=It;function Lt(or,Yt,er){let Zt=!1;if((Yt===void 0||Yt<0)&&(Yt=0),Yt>this.length||((er===void 0||er>this.length)&&(er=this.length),er<=0)||(er>>>=0,Yt>>>=0,er<=Yt))return"";for(or||(or="utf8");;)switch(or){case"hex":return $t(this,Yt,er);case"utf8":case"utf-8":return ct(this,Yt,er);case"ascii":return St(this,Yt,er);case"latin1":case"binary":return Rt(this,Yt,er);case"base64":return mt(this,Yt,er);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt(this,Yt,er);default:if(Zt)throw new TypeError("Unknown encoding: "+or);or=(or+"").toLowerCase(),Zt=!0}}nt.prototype._isBuffer=!0;function Nt(or,Yt,er){const Zt=or[Yt];or[Yt]=or[er],or[er]=Zt}nt.prototype.swap16=function(){const Yt=this.length;if(Yt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let er=0;erer&&(Yt+=" ... "),""},j&&(nt.prototype[j]=nt.prototype.inspect),nt.prototype.compare=function(Yt,er,Zt,Vt,Gt){if(Pr(Yt,Uint8Array)&&(Yt=nt.from(Yt,Yt.offset,Yt.byteLength)),!nt.isBuffer(Yt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Yt);if(er===void 0&&(er=0),Zt===void 0&&(Zt=Yt?Yt.length:0),Vt===void 0&&(Vt=0),Gt===void 0&&(Gt=this.length),er<0||Zt>Yt.length||Vt<0||Gt>this.length)throw new RangeError("out of range index");if(Vt>=Gt&&er>=Zt)return 0;if(Vt>=Gt)return-1;if(er>=Zt)return 1;if(er>>>=0,Zt>>>=0,Vt>>>=0,Gt>>>=0,this===Yt)return 0;let ar=Gt-Vt,br=Zt-er;const wr=Math.min(ar,br),Sr=this.slice(Vt,Gt),Wr=Yt.slice(er,Zt);for(let Hr=0;Hr2147483647?er=2147483647:er<-2147483648&&(er=-2147483648),er=+er,Rr(er)&&(er=Vt?0:or.length-1),er<0&&(er=or.length+er),er>=or.length){if(Vt)return-1;er=or.length-1}else if(er<0)if(Vt)er=0;else return-1;if(typeof Yt=="string"&&(Yt=nt.from(Yt,Zt)),nt.isBuffer(Yt))return Yt.length===0?-1:jt(or,Yt,er,Zt,Vt);if(typeof Yt=="number")return Yt=Yt&255,typeof Uint8Array.prototype.indexOf=="function"?Vt?Uint8Array.prototype.indexOf.call(or,Yt,er):Uint8Array.prototype.lastIndexOf.call(or,Yt,er):jt(or,[Yt],er,Zt,Vt);throw new TypeError("val must be string, number or Buffer")}function jt(or,Yt,er,Zt,Vt){let Gt=1,ar=or.length,br=Yt.length;if(Zt!==void 0&&(Zt=String(Zt).toLowerCase(),Zt==="ucs2"||Zt==="ucs-2"||Zt==="utf16le"||Zt==="utf-16le")){if(or.length<2||Yt.length<2)return-1;Gt=2,ar/=2,br/=2,er/=2}function wr(Wr,Hr){return Gt===1?Wr[Hr]:Wr.readUInt16BE(Hr*Gt)}let Sr;if(Vt){let Wr=-1;for(Sr=er;Srar&&(er=ar-br),Sr=er;Sr>=0;Sr--){let Wr=!0;for(let Hr=0;HrVt&&(Zt=Vt)):Zt=Vt;const Gt=Yt.length;Zt>Gt/2&&(Zt=Gt/2);let ar;for(ar=0;ar>>0,isFinite(Zt)?(Zt=Zt>>>0,Vt===void 0&&(Vt="utf8")):(Vt=Zt,Zt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Gt=this.length-er;if((Zt===void 0||Zt>Gt)&&(Zt=Gt),Yt.length>0&&(Zt<0||er<0)||er>this.length)throw new RangeError("Attempt to write outside buffer bounds");Vt||(Vt="utf8");let ar=!1;for(;;)switch(Vt){case"hex":return Mt(this,Yt,er,Zt);case"utf8":case"utf-8":return Dt(this,Yt,er,Zt);case"ascii":case"latin1":case"binary":return Ft(this,Yt,er,Zt);case"base64":return Bt(this,Yt,er,Zt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yt(this,Yt,er,Zt);default:if(ar)throw new TypeError("Unknown encoding: "+Vt);Vt=(""+Vt).toLowerCase(),ar=!0}},nt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mt(or,Yt,er){return Yt===0&&er===or.length?a.fromByteArray(or):a.fromByteArray(or.slice(Yt,er))}function ct(or,Yt,er){er=Math.min(or.length,er);const Zt=[];let Vt=Yt;for(;Vt239?4:Gt>223?3:Gt>191?2:1;if(Vt+br<=er){let wr,Sr,Wr,Hr;switch(br){case 1:Gt<128&&(ar=Gt);break;case 2:wr=or[Vt+1],(wr&192)===128&&(Hr=(Gt&31)<<6|wr&63,Hr>127&&(ar=Hr));break;case 3:wr=or[Vt+1],Sr=or[Vt+2],(wr&192)===128&&(Sr&192)===128&&(Hr=(Gt&15)<<12|(wr&63)<<6|Sr&63,Hr>2047&&(Hr<55296||Hr>57343)&&(ar=Hr));break;case 4:wr=or[Vt+1],Sr=or[Vt+2],Wr=or[Vt+3],(wr&192)===128&&(Sr&192)===128&&(Wr&192)===128&&(Hr=(Gt&15)<<18|(wr&63)<<12|(Sr&63)<<6|Wr&63,Hr>65535&&Hr<1114112&&(ar=Hr))}}ar===null?(ar=65533,br=1):ar>65535&&(ar-=65536,Zt.push(ar>>>10&1023|55296),ar=56320|ar&1023),Zt.push(ar),Vt+=br}return vt(Zt)}const dt=4096;function vt(or){const Yt=or.length;if(Yt<=dt)return String.fromCharCode.apply(String,or);let er="",Zt=0;for(;ZtZt)&&(er=Zt);let Vt="";for(let Gt=Yt;GtZt&&(Yt=Zt),er<0?(er+=Zt,er<0&&(er=0)):er>Zt&&(er=Zt),erer)throw new RangeError("Trying to access beyond buffer length")}nt.prototype.readUintLE=nt.prototype.readUIntLE=function(Yt,er,Zt){Yt=Yt>>>0,er=er>>>0,Zt||At(Yt,er,this.length);let Vt=this[Yt],Gt=1,ar=0;for(;++ar>>0,er=er>>>0,Zt||At(Yt,er,this.length);let Vt=this[Yt+--er],Gt=1;for(;er>0&&(Gt*=256);)Vt+=this[Yt+--er]*Gt;return Vt},nt.prototype.readUint8=nt.prototype.readUInt8=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,1,this.length),this[Yt]},nt.prototype.readUint16LE=nt.prototype.readUInt16LE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,2,this.length),this[Yt]|this[Yt+1]<<8},nt.prototype.readUint16BE=nt.prototype.readUInt16BE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,2,this.length),this[Yt]<<8|this[Yt+1]},nt.prototype.readUint32LE=nt.prototype.readUInt32LE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),(this[Yt]|this[Yt+1]<<8|this[Yt+2]<<16)+this[Yt+3]*16777216},nt.prototype.readUint32BE=nt.prototype.readUInt32BE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),this[Yt]*16777216+(this[Yt+1]<<16|this[Yt+2]<<8|this[Yt+3])},nt.prototype.readBigUInt64LE=Or(function(Yt){Yt=Yt>>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const Vt=er+this[++Yt]*2**8+this[++Yt]*2**16+this[++Yt]*2**24,Gt=this[++Yt]+this[++Yt]*2**8+this[++Yt]*2**16+Zt*2**24;return BigInt(Vt)+(BigInt(Gt)<>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const Vt=er*2**24+this[++Yt]*2**16+this[++Yt]*2**8+this[++Yt],Gt=this[++Yt]*2**24+this[++Yt]*2**16+this[++Yt]*2**8+Zt;return(BigInt(Vt)<>>0,er=er>>>0,Zt||At(Yt,er,this.length);let Vt=this[Yt],Gt=1,ar=0;for(;++ar=Gt&&(Vt-=Math.pow(2,8*er)),Vt},nt.prototype.readIntBE=function(Yt,er,Zt){Yt=Yt>>>0,er=er>>>0,Zt||At(Yt,er,this.length);let Vt=er,Gt=1,ar=this[Yt+--Vt];for(;Vt>0&&(Gt*=256);)ar+=this[Yt+--Vt]*Gt;return Gt*=128,ar>=Gt&&(ar-=Math.pow(2,8*er)),ar},nt.prototype.readInt8=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,1,this.length),this[Yt]&128?(255-this[Yt]+1)*-1:this[Yt]},nt.prototype.readInt16LE=function(Yt,er){Yt=Yt>>>0,er||At(Yt,2,this.length);const Zt=this[Yt]|this[Yt+1]<<8;return Zt&32768?Zt|4294901760:Zt},nt.prototype.readInt16BE=function(Yt,er){Yt=Yt>>>0,er||At(Yt,2,this.length);const Zt=this[Yt+1]|this[Yt]<<8;return Zt&32768?Zt|4294901760:Zt},nt.prototype.readInt32LE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),this[Yt]|this[Yt+1]<<8|this[Yt+2]<<16|this[Yt+3]<<24},nt.prototype.readInt32BE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),this[Yt]<<24|this[Yt+1]<<16|this[Yt+2]<<8|this[Yt+3]},nt.prototype.readBigInt64LE=Or(function(Yt){Yt=Yt>>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const Vt=this[Yt+4]+this[Yt+5]*2**8+this[Yt+6]*2**16+(Zt<<24);return(BigInt(Vt)<>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const Vt=(er<<24)+this[++Yt]*2**16+this[++Yt]*2**8+this[++Yt];return(BigInt(Vt)<>>0,er||At(Yt,4,this.length),$.read(this,Yt,!0,23,4)},nt.prototype.readFloatBE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),$.read(this,Yt,!1,23,4)},nt.prototype.readDoubleLE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,8,this.length),$.read(this,Yt,!0,52,8)},nt.prototype.readDoubleBE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,8,this.length),$.read(this,Yt,!1,52,8)};function wt(or,Yt,er,Zt,Vt,Gt){if(!nt.isBuffer(or))throw new TypeError('"buffer" argument must be a Buffer instance');if(Yt>Vt||Ytor.length)throw new RangeError("Index out of range")}nt.prototype.writeUintLE=nt.prototype.writeUIntLE=function(Yt,er,Zt,Vt){if(Yt=+Yt,er=er>>>0,Zt=Zt>>>0,!Vt){const br=Math.pow(2,8*Zt)-1;wt(this,Yt,er,Zt,br,0)}let Gt=1,ar=0;for(this[er]=Yt&255;++ar>>0,Zt=Zt>>>0,!Vt){const br=Math.pow(2,8*Zt)-1;wt(this,Yt,er,Zt,br,0)}let Gt=Zt-1,ar=1;for(this[er+Gt]=Yt&255;--Gt>=0&&(ar*=256);)this[er+Gt]=Yt/ar&255;return er+Zt},nt.prototype.writeUint8=nt.prototype.writeUInt8=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,1,255,0),this[er]=Yt&255,er+1},nt.prototype.writeUint16LE=nt.prototype.writeUInt16LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,65535,0),this[er]=Yt&255,this[er+1]=Yt>>>8,er+2},nt.prototype.writeUint16BE=nt.prototype.writeUInt16BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,65535,0),this[er]=Yt>>>8,this[er+1]=Yt&255,er+2},nt.prototype.writeUint32LE=nt.prototype.writeUInt32LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,4294967295,0),this[er+3]=Yt>>>24,this[er+2]=Yt>>>16,this[er+1]=Yt>>>8,this[er]=Yt&255,er+4},nt.prototype.writeUint32BE=nt.prototype.writeUInt32BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,4294967295,0),this[er]=Yt>>>24,this[er+1]=Yt>>>16,this[er+2]=Yt>>>8,this[er+3]=Yt&255,er+4};function Ot(or,Yt,er,Zt,Vt){Qt(Yt,Zt,Vt,or,er,7);let Gt=Number(Yt&BigInt(4294967295));or[er++]=Gt,Gt=Gt>>8,or[er++]=Gt,Gt=Gt>>8,or[er++]=Gt,Gt=Gt>>8,or[er++]=Gt;let ar=Number(Yt>>BigInt(32)&BigInt(4294967295));return or[er++]=ar,ar=ar>>8,or[er++]=ar,ar=ar>>8,or[er++]=ar,ar=ar>>8,or[er++]=ar,er}function tr(or,Yt,er,Zt,Vt){Qt(Yt,Zt,Vt,or,er,7);let Gt=Number(Yt&BigInt(4294967295));or[er+7]=Gt,Gt=Gt>>8,or[er+6]=Gt,Gt=Gt>>8,or[er+5]=Gt,Gt=Gt>>8,or[er+4]=Gt;let ar=Number(Yt>>BigInt(32)&BigInt(4294967295));return or[er+3]=ar,ar=ar>>8,or[er+2]=ar,ar=ar>>8,or[er+1]=ar,ar=ar>>8,or[er]=ar,er+8}nt.prototype.writeBigUInt64LE=Or(function(Yt,er=0){return Ot(this,Yt,er,BigInt(0),BigInt("0xffffffffffffffff"))}),nt.prototype.writeBigUInt64BE=Or(function(Yt,er=0){return tr(this,Yt,er,BigInt(0),BigInt("0xffffffffffffffff"))}),nt.prototype.writeIntLE=function(Yt,er,Zt,Vt){if(Yt=+Yt,er=er>>>0,!Vt){const wr=Math.pow(2,8*Zt-1);wt(this,Yt,er,Zt,wr-1,-wr)}let Gt=0,ar=1,br=0;for(this[er]=Yt&255;++Gt>0)-br&255;return er+Zt},nt.prototype.writeIntBE=function(Yt,er,Zt,Vt){if(Yt=+Yt,er=er>>>0,!Vt){const wr=Math.pow(2,8*Zt-1);wt(this,Yt,er,Zt,wr-1,-wr)}let Gt=Zt-1,ar=1,br=0;for(this[er+Gt]=Yt&255;--Gt>=0&&(ar*=256);)Yt<0&&br===0&&this[er+Gt+1]!==0&&(br=1),this[er+Gt]=(Yt/ar>>0)-br&255;return er+Zt},nt.prototype.writeInt8=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,1,127,-128),Yt<0&&(Yt=255+Yt+1),this[er]=Yt&255,er+1},nt.prototype.writeInt16LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,32767,-32768),this[er]=Yt&255,this[er+1]=Yt>>>8,er+2},nt.prototype.writeInt16BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,32767,-32768),this[er]=Yt>>>8,this[er+1]=Yt&255,er+2},nt.prototype.writeInt32LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,2147483647,-2147483648),this[er]=Yt&255,this[er+1]=Yt>>>8,this[er+2]=Yt>>>16,this[er+3]=Yt>>>24,er+4},nt.prototype.writeInt32BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,2147483647,-2147483648),Yt<0&&(Yt=4294967295+Yt+1),this[er]=Yt>>>24,this[er+1]=Yt>>>16,this[er+2]=Yt>>>8,this[er+3]=Yt&255,er+4},nt.prototype.writeBigInt64LE=Or(function(Yt,er=0){return Ot(this,Yt,er,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),nt.prototype.writeBigInt64BE=Or(function(Yt,er=0){return tr(this,Yt,er,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nr(or,Yt,er,Zt,Vt,Gt){if(er+Zt>or.length)throw new RangeError("Index out of range");if(er<0)throw new RangeError("Index out of range")}function ir(or,Yt,er,Zt,Vt){return Yt=+Yt,er=er>>>0,Vt||nr(or,Yt,er,4),$.write(or,Yt,er,Zt,23,4),er+4}nt.prototype.writeFloatLE=function(Yt,er,Zt){return ir(this,Yt,er,!0,Zt)},nt.prototype.writeFloatBE=function(Yt,er,Zt){return ir(this,Yt,er,!1,Zt)};function Wt(or,Yt,er,Zt,Vt){return Yt=+Yt,er=er>>>0,Vt||nr(or,Yt,er,8),$.write(or,Yt,er,Zt,52,8),er+8}nt.prototype.writeDoubleLE=function(Yt,er,Zt){return Wt(this,Yt,er,!0,Zt)},nt.prototype.writeDoubleBE=function(Yt,er,Zt){return Wt(this,Yt,er,!1,Zt)},nt.prototype.copy=function(Yt,er,Zt,Vt){if(!nt.isBuffer(Yt))throw new TypeError("argument should be a Buffer");if(Zt||(Zt=0),!Vt&&Vt!==0&&(Vt=this.length),er>=Yt.length&&(er=Yt.length),er||(er=0),Vt>0&&Vt=this.length)throw new RangeError("Index out of range");if(Vt<0)throw new RangeError("sourceEnd out of bounds");Vt>this.length&&(Vt=this.length),Yt.length-er>>0,Zt=Zt===void 0?this.length:Zt>>>0,Yt||(Yt=0);let Gt;if(typeof Yt=="number")for(Gt=er;Gt2**32?Vt=Ht(String(er)):typeof er=="bigint"&&(Vt=String(er),(er>BigInt(2)**BigInt(32)||er<-(BigInt(2)**BigInt(32)))&&(Vt=Ht(Vt)),Vt+="n"),Zt+=` It must be ${Yt}. Received ${Vt}`,Zt},RangeError);function Ht(or){let Yt="",er=or.length;const Zt=or[0]==="-"?1:0;for(;er>=Zt+4;er-=3)Yt=`_${or.slice(er-3,er)}${Yt}`;return`${or.slice(0,er)}${Yt}`}function qt(or,Yt,er){dr(Yt,"offset"),(or[Yt]===void 0||or[Yt+er]===void 0)&&xr(Yt,or.length-(er+1))}function Qt(or,Yt,er,Zt,Vt,Gt){if(or>er||or= 0${ar} and < 2${ar} ** ${(Gt+1)*8}${ar}`:br=`>= -(2${ar} ** ${(Gt+1)*8-1}${ar}) and < 2 ** ${(Gt+1)*8-1}${ar}`,new Kt.ERR_OUT_OF_RANGE("value",br,or)}qt(Zt,Vt,Gt)}function dr(or,Yt){if(typeof or!="number")throw new Kt.ERR_INVALID_ARG_TYPE(Yt,"number",or)}function xr(or,Yt,er){throw Math.floor(or)!==or?(dr(or,er),new Kt.ERR_OUT_OF_RANGE("offset","an integer",or)):Yt<0?new Kt.ERR_BUFFER_OUT_OF_BOUNDS:new Kt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Yt}`,or)}const pr=/[^+/0-9A-Za-z-_]/g;function kr(or){if(or=or.split("=")[0],or=or.trim().replace(pr,""),or.length<2)return"";for(;or.length%4!==0;)or=or+"=";return or}function Ir(or,Yt){Yt=Yt||1/0;let er;const Zt=or.length;let Vt=null;const Gt=[];for(let ar=0;ar55295&&er<57344){if(!Vt){if(er>56319){(Yt-=3)>-1&&Gt.push(239,191,189);continue}else if(ar+1===Zt){(Yt-=3)>-1&&Gt.push(239,191,189);continue}Vt=er;continue}if(er<56320){(Yt-=3)>-1&&Gt.push(239,191,189),Vt=er;continue}er=(Vt-55296<<10|er-56320)+65536}else Vt&&(Yt-=3)>-1&&Gt.push(239,191,189);if(Vt=null,er<128){if((Yt-=1)<0)break;Gt.push(er)}else if(er<2048){if((Yt-=2)<0)break;Gt.push(er>>6|192,er&63|128)}else if(er<65536){if((Yt-=3)<0)break;Gt.push(er>>12|224,er>>6&63|128,er&63|128)}else if(er<1114112){if((Yt-=4)<0)break;Gt.push(er>>18|240,er>>12&63|128,er>>6&63|128,er&63|128)}else throw new Error("Invalid code point")}return Gt}function lr(or){const Yt=[];for(let er=0;er>8,Vt=er%256,Gt.push(Vt),Gt.push(Zt);return Gt}function Er(or){return a.toByteArray(kr(or))}function $r(or,Yt,er,Zt){let Vt;for(Vt=0;Vt=Yt.length||Vt>=or.length);++Vt)Yt[Vt+er]=or[Vt];return Vt}function Pr(or,Yt){return or instanceof Yt||or!=null&&or.constructor!=null&&or.constructor.name!=null&&or.constructor.name===Yt.name}function Rr(or){return or!==or}const Ar=function(){const or="0123456789abcdef",Yt=new Array(256);for(let er=0;er<16;++er){const Zt=er*16;for(let Vt=0;Vt<16;++Vt)Yt[Zt+Vt]=or[er]+or[Vt]}return Yt}();function Or(or){return typeof BigInt>"u"?Lr:or}function Lr(){throw new Error("BigInt not supported")}})(buffer$1);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(_,a){var $=buffer$1,j=$.Buffer;function et(rt,nt){for(var it in rt)nt[it]=rt[it]}j.from&&j.alloc&&j.allocUnsafe&&j.allocUnsafeSlow?_.exports=$:(et($,a),a.Buffer=tt);function tt(rt,nt,it){return j(rt,nt,it)}tt.prototype=Object.create(j.prototype),et(j,tt),tt.from=function(rt,nt,it){if(typeof rt=="number")throw new TypeError("Argument must not be a number");return j(rt,nt,it)},tt.alloc=function(rt,nt,it){if(typeof rt!="number")throw new TypeError("Argument must be a number");var ot=j(rt);return nt!==void 0?typeof it=="string"?ot.fill(nt,it):ot.fill(nt):ot.fill(0),ot},tt.allocUnsafe=function(rt){if(typeof rt!="number")throw new TypeError("Argument must be a number");return j(rt)},tt.allocUnsafeSlow=function(rt){if(typeof rt!="number")throw new TypeError("Argument must be a number");return $.SlowBuffer(rt)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports=safeBuffer$2.exports,readableBrowser$1={exports:{}};function getDefaultExportFromCjs(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var browser$d={exports:{}},process$1=browser$d.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(_){if(cachedSetTimeout===setTimeout)return setTimeout(_,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(_,0);try{return cachedSetTimeout(_,0)}catch{try{return cachedSetTimeout.call(null,_,0)}catch{return cachedSetTimeout.call(this,_,0)}}}function runClearTimeout(_){if(cachedClearTimeout===clearTimeout)return clearTimeout(_);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(_);try{return cachedClearTimeout(_)}catch{try{return cachedClearTimeout.call(null,_)}catch{return cachedClearTimeout.call(this,_)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var _=runTimeout(cleanUpNextTick);draining=!0;for(var a=queue.length;a;){for(currentQueue=queue,queue=[];++queueIndex1)for(var $=1;$0&&(rt=$[0]),rt instanceof Error)throw rt;var nt=new Error("Unhandled error."+(rt?" ("+rt.message+")":""));throw nt.context=rt,nt}var it=tt[a];if(it===void 0)return!1;if(typeof it=="function")ReflectApply(it,this,$);else for(var ot=it.length,st=arrayClone(it,ot),j=0;j0&&rt.length>et&&!rt.warned){rt.warned=!0;var nt=new Error("Possible EventEmitter memory leak detected. "+rt.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");nt.name="MaxListenersExceededWarning",nt.emitter=_,nt.type=a,nt.count=rt.length,ProcessEmitWarning(nt)}return _}EventEmitter$1.prototype.addListener=function(a,$){return _addListener(this,a,$,!1)};EventEmitter$1.prototype.on=EventEmitter$1.prototype.addListener;EventEmitter$1.prototype.prependListener=function(a,$){return _addListener(this,a,$,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(_,a,$){var j={fired:!1,wrapFn:void 0,target:_,type:a,listener:$},et=onceWrapper.bind(j);return et.listener=$,j.wrapFn=et,et}EventEmitter$1.prototype.once=function(a,$){return checkListener($),this.on(a,_onceWrap(this,a,$)),this};EventEmitter$1.prototype.prependOnceListener=function(a,$){return checkListener($),this.prependListener(a,_onceWrap(this,a,$)),this};EventEmitter$1.prototype.removeListener=function(a,$){var j,et,tt,rt,nt;if(checkListener($),et=this._events,et===void 0)return this;if(j=et[a],j===void 0)return this;if(j===$||j.listener===$)--this._eventsCount===0?this._events=Object.create(null):(delete et[a],et.removeListener&&this.emit("removeListener",a,j.listener||$));else if(typeof j!="function"){for(tt=-1,rt=j.length-1;rt>=0;rt--)if(j[rt]===$||j[rt].listener===$){nt=j[rt].listener,tt=rt;break}if(tt<0)return this;tt===0?j.shift():spliceOne(j,tt),j.length===1&&(et[a]=j[0]),et.removeListener!==void 0&&this.emit("removeListener",a,nt||$)}return this};EventEmitter$1.prototype.off=EventEmitter$1.prototype.removeListener;EventEmitter$1.prototype.removeAllListeners=function(a){var $,j,et;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[a]),this;if(arguments.length===0){var tt=Object.keys(j),rt;for(et=0;et=0;et--)this.removeListener(a,$[et]);return this};function _listeners(_,a,$){var j=_._events;if(j===void 0)return[];var et=j[a];return et===void 0?[]:typeof et=="function"?$?[et.listener||et]:[et]:$?unwrapListeners(et):arrayClone(et,et.length)}EventEmitter$1.prototype.listeners=function(a){return _listeners(this,a,!0)};EventEmitter$1.prototype.rawListeners=function(a){return _listeners(this,a,!1)};EventEmitter$1.listenerCount=function(_,a){return typeof _.listenerCount=="function"?_.listenerCount(a):listenerCount.call(_,a)};EventEmitter$1.prototype.listenerCount=listenerCount;function listenerCount(_){var a=this._events;if(a!==void 0){var $=a[_];if(typeof $=="function")return 1;if($!==void 0)return $.length}return 0}EventEmitter$1.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(_,a){for(var $=new Array(a),j=0;j"u"||!getProto$4?undefined$4:getProto$4(Uint8Array),INTRINSICS$3={"%AggregateError%":typeof AggregateError>"u"?undefined$4:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$4:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$3&&getProto$4?getProto$4([][Symbol.iterator]()):undefined$4,"%AsyncFromSyncIteratorPrototype%":undefined$4,"%AsyncFunction%":needsEval$3,"%AsyncGenerator%":needsEval$3,"%AsyncGeneratorFunction%":needsEval$3,"%AsyncIteratorPrototype%":needsEval$3,"%Atomics%":typeof Atomics>"u"?undefined$4:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$4:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$4:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$4:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$4:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$4:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$4:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$4:FinalizationRegistry,"%Function%":$Function$3,"%GeneratorFunction%":needsEval$3,"%Int8Array%":typeof Int8Array>"u"?undefined$4:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$4:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$4:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols$3&&getProto$4?getProto$4(getProto$4([][Symbol.iterator]())):undefined$4,"%JSON%":typeof JSON=="object"?JSON:undefined$4,"%Map%":typeof Map>"u"?undefined$4:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols$3||!getProto$4?undefined$4:getProto$4(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$4:Promise,"%Proxy%":typeof Proxy>"u"?undefined$4:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$4:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$4:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols$3||!getProto$4?undefined$4:getProto$4(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$4:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$3&&getProto$4?getProto$4(""[Symbol.iterator]()):undefined$4,"%Symbol%":hasSymbols$3?Symbol:undefined$4,"%SyntaxError%":$SyntaxError$4,"%ThrowTypeError%":ThrowTypeError$3,"%TypedArray%":TypedArray$3,"%TypeError%":$TypeError$5,"%Uint8Array%":typeof Uint8Array>"u"?undefined$4:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$4:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$4:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$4:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$4:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$4:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$4:WeakSet};if(getProto$4)try{null.error}catch(_){var errorProto$3=getProto$4(getProto$4(_));INTRINSICS$3["%Error.prototype%"]=errorProto$3}var doEval$3=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor$3("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor$3("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor$3("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto$4&&($=getProto$4(et.prototype))}return INTRINSICS$3[a]=$,$},LEGACY_ALIASES$3={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$7=functionBind$4,hasOwn$4=src$3,$concat$3=bind$7.call(Function.call,Array.prototype.concat),$spliceApply$3=bind$7.call(Function.apply,Array.prototype.splice),$replace$3=bind$7.call(Function.call,String.prototype.replace),$strSlice$3=bind$7.call(Function.call,String.prototype.slice),$exec$3=bind$7.call(Function.call,RegExp.prototype.exec),rePropName$3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$3=/\\(\\)?/g,stringToPath$3=function(a){var $=$strSlice$3(a,0,1),j=$strSlice$3(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$4("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$4("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace$3(a,rePropName$3,function(tt,rt,nt,it){et[et.length]=nt?$replace$3(it,reEscapeChar$3,"$1"):rt||tt}),et},getBaseIntrinsic$3=function(a,$){var j=a,et;if(hasOwn$4(LEGACY_ALIASES$3,j)&&(et=LEGACY_ALIASES$3[j],j="%"+et[0]+"%"),hasOwn$4(INTRINSICS$3,j)){var tt=INTRINSICS$3[j];if(tt===needsEval$3&&(tt=doEval$3(j)),typeof tt>"u"&&!$)throw new $TypeError$5("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$4("intrinsic "+a+" does not exist!")},getIntrinsic$3=function(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$5("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$5('"allowMissing" argument must be a boolean');if($exec$3(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$4("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$3(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$3("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,ot=tt.alias;ot&&(et=ot[0],$spliceApply$3(j,$concat$3([0,1],ot)));for(var st=1,at=!0;st=j.length){var Et=$gOPD$4(nt,ut);at=!!Et,at&&"get"in Et&&!("originalValue"in Et.get)?nt=Et.get:nt=nt[ut]}else at=hasOwn$4(nt,ut),nt=nt[ut];at&&!it&&(INTRINSICS$3[rt]=nt)}}return nt},callBind$4={exports:{}};(function(_){var a=functionBind$4,$=getIntrinsic$3,j=$("%Function.prototype.apply%"),et=$("%Function.prototype.call%"),tt=$("%Reflect.apply%",!0)||a.call(et,j),rt=$("%Object.getOwnPropertyDescriptor%",!0),nt=$("%Object.defineProperty%",!0),it=$("%Math.max%");if(nt)try{nt({},"a",{value:1})}catch{nt=null}_.exports=function(at){var ut=tt(a,et,arguments);if(rt&&nt){var ht=rt(ut,"length");ht.configurable&&nt(ut,"length",{value:1+it(0,at.length-(arguments.length-1))})}return ut};var ot=function(){return tt(a,j,arguments)};nt?nt(_.exports,"apply",{value:ot}):_.exports.apply=ot})(callBind$4);var callBindExports$1=callBind$4.exports,GetIntrinsic$5=getIntrinsic$3,callBind$3=callBindExports$1,$indexOf$2=callBind$3(GetIntrinsic$5("String.prototype.indexOf")),callBound$5=function(a,$){var j=GetIntrinsic$5(a,!!$);return typeof j=="function"&&$indexOf$2(a,".prototype.")>-1?callBind$3(j):j},hasToStringTag$4=shams(),callBound$4=callBound$5,$toString$2=callBound$4("Object.prototype.toString"),isStandardArguments=function(a){return hasToStringTag$4&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:$toString$2(a)==="[object Arguments]"},isLegacyArguments=function(a){return isStandardArguments(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&$toString$2(a)!=="[object Array]"&&$toString$2(a.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments$1=supportsStandardArguments?isStandardArguments:isLegacyArguments,toStr$6=Object.prototype.toString,fnToStr$1=Function.prototype.toString,isFnRegex=/^\s*(?:function)?\*/,hasToStringTag$3=shams(),getProto$3=Object.getPrototypeOf,getGeneratorFunc=function(){if(!hasToStringTag$3)return!1;try{return Function("return function*() {}")()}catch{}},GeneratorFunction,isGeneratorFunction=function(a){if(typeof a!="function")return!1;if(isFnRegex.test(fnToStr$1.call(a)))return!0;if(!hasToStringTag$3){var $=toStr$6.call(a);return $==="[object GeneratorFunction]"}if(!getProto$3)return!1;if(typeof GeneratorFunction>"u"){var j=getGeneratorFunc();GeneratorFunction=j?getProto$3(j):!1}return getProto$3(a)===GeneratorFunction},fnToStr=Function.prototype.toString,reflectApply=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply=="function"&&typeof Object.defineProperty=="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(_){_!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(a){try{var $=fnToStr.call(a);return constructorRegex.test($)}catch{return!1}},tryFunctionObject=function(a){try{return isES6ClassFn(a)?!1:(fnToStr.call(a),!0)}catch{return!1}},toStr$5=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag$2=typeof Symbol=="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document=="object"){var all=document.all;toStr$5.call(all)===toStr$5.call(document.all)&&(isDDA=function(a){if((isIE68||!a)&&(typeof a>"u"||typeof a=="object"))try{var $=toStr$5.call(a);return($===ddaClass||$===ddaClass2||$===ddaClass3||$===objectClass)&&a("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(a){if(isDDA(a))return!0;if(!a||typeof a!="function"&&typeof a!="object")return!1;try{reflectApply(a,null,badArrayLike)}catch($){if($!==isCallableMarker)return!1}return!isES6ClassFn(a)&&tryFunctionObject(a)}:function(a){if(isDDA(a))return!0;if(!a||typeof a!="function"&&typeof a!="object")return!1;if(hasToStringTag$2)return tryFunctionObject(a);if(isES6ClassFn(a))return!1;var $=toStr$5.call(a);return $!==fnClass&&$!==genClass&&!/^\[object HTML/.test($)?!1:tryFunctionObject(a)},isCallable=isCallable$1,toStr$4=Object.prototype.toString,hasOwnProperty$2=Object.prototype.hasOwnProperty,forEachArray=function(a,$,j){for(var et=0,tt=a.length;et=3&&(et=j),toStr$4.call(a)==="[object Array]"?forEachArray(a,$,et):typeof a=="string"?forEachString(a,$,et):forEachObject(a,$,et)},forEach_1=forEach$4,possibleNames=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],g$3=typeof globalThis>"u"?commonjsGlobal:globalThis,availableTypedArrays$2=function(){for(var a=[],$=0;$"u"||!getProto$2?undefined$3:getProto$2(Uint8Array),INTRINSICS$2={"%AggregateError%":typeof AggregateError>"u"?undefined$3:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$3:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$2&&getProto$2?getProto$2([][Symbol.iterator]()):undefined$3,"%AsyncFromSyncIteratorPrototype%":undefined$3,"%AsyncFunction%":needsEval$2,"%AsyncGenerator%":needsEval$2,"%AsyncGeneratorFunction%":needsEval$2,"%AsyncIteratorPrototype%":needsEval$2,"%Atomics%":typeof Atomics>"u"?undefined$3:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$3:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$3:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$3:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$3:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$3:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$3:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$3:FinalizationRegistry,"%Function%":$Function$2,"%GeneratorFunction%":needsEval$2,"%Int8Array%":typeof Int8Array>"u"?undefined$3:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$3:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$3:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols$2&&getProto$2?getProto$2(getProto$2([][Symbol.iterator]())):undefined$3,"%JSON%":typeof JSON=="object"?JSON:undefined$3,"%Map%":typeof Map>"u"?undefined$3:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols$2||!getProto$2?undefined$3:getProto$2(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$3:Promise,"%Proxy%":typeof Proxy>"u"?undefined$3:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$3:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$3:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols$2||!getProto$2?undefined$3:getProto$2(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$3:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$2&&getProto$2?getProto$2(""[Symbol.iterator]()):undefined$3,"%Symbol%":hasSymbols$2?Symbol:undefined$3,"%SyntaxError%":$SyntaxError$3,"%ThrowTypeError%":ThrowTypeError$2,"%TypedArray%":TypedArray$2,"%TypeError%":$TypeError$4,"%Uint8Array%":typeof Uint8Array>"u"?undefined$3:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$3:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$3:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$3:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$3:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$3:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$3:WeakSet};if(getProto$2)try{null.error}catch(_){var errorProto$2=getProto$2(getProto$2(_));INTRINSICS$2["%Error.prototype%"]=errorProto$2}var doEval$2=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor$2("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor$2("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor$2("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto$2&&($=getProto$2(et.prototype))}return INTRINSICS$2[a]=$,$},LEGACY_ALIASES$2={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$6=functionBind$2,hasOwn$3=src$3,$concat$2=bind$6.call(Function.call,Array.prototype.concat),$spliceApply$2=bind$6.call(Function.apply,Array.prototype.splice),$replace$2=bind$6.call(Function.call,String.prototype.replace),$strSlice$2=bind$6.call(Function.call,String.prototype.slice),$exec$2=bind$6.call(Function.call,RegExp.prototype.exec),rePropName$2=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$2=/\\(\\)?/g,stringToPath$2=function(a){var $=$strSlice$2(a,0,1),j=$strSlice$2(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$3("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$3("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace$2(a,rePropName$2,function(tt,rt,nt,it){et[et.length]=nt?$replace$2(it,reEscapeChar$2,"$1"):rt||tt}),et},getBaseIntrinsic$2=function(a,$){var j=a,et;if(hasOwn$3(LEGACY_ALIASES$2,j)&&(et=LEGACY_ALIASES$2[j],j="%"+et[0]+"%"),hasOwn$3(INTRINSICS$2,j)){var tt=INTRINSICS$2[j];if(tt===needsEval$2&&(tt=doEval$2(j)),typeof tt>"u"&&!$)throw new $TypeError$4("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$3("intrinsic "+a+" does not exist!")},getIntrinsic$2=function(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$4("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$4('"allowMissing" argument must be a boolean');if($exec$2(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$3("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$2(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$2("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,ot=tt.alias;ot&&(et=ot[0],$spliceApply$2(j,$concat$2([0,1],ot)));for(var st=1,at=!0;st=j.length){var Et=$gOPD$3(nt,ut);at=!!Et,at&&"get"in Et&&!("originalValue"in Et.get)?nt=Et.get:nt=nt[ut]}else at=hasOwn$3(nt,ut),nt=nt[ut];at&&!it&&(INTRINSICS$2[rt]=nt)}}return nt},GetIntrinsic$4=getIntrinsic$2,$gOPD$2=GetIntrinsic$4("%Object.getOwnPropertyDescriptor%",!0);if($gOPD$2)try{$gOPD$2([],"length")}catch{$gOPD$2=null}var gopd$1=$gOPD$2,forEach$3=forEach_1,availableTypedArrays$1=availableTypedArrays$2,callBound$3=callBound$5,$toString$1=callBound$3("Object.prototype.toString"),hasToStringTag$1=shams(),gOPD$2=gopd$1,g$2=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays$1=availableTypedArrays$1(),$indexOf$1=callBound$3("Array.prototype.indexOf",!0)||function(a,$){for(var j=0;j-1}return gOPD$2?tryTypedArrays$1(a):!1},forEach$2=forEach_1,availableTypedArrays=availableTypedArrays$2,callBound$2=callBound$5,gOPD$1=gopd$1,$toString=callBound$2("Object.prototype.toString"),hasToStringTag=shams(),g$1=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays=availableTypedArrays(),$slice=callBound$2("String.prototype.slice"),toStrTags={},getPrototypeOf$5=Object.getPrototypeOf;hasToStringTag&&gOPD$1&&getPrototypeOf$5&&forEach$2(typedArrays,function(_){if(typeof g$1[_]=="function"){var a=new g$1[_];if(Symbol.toStringTag in a){var $=getPrototypeOf$5(a),j=gOPD$1($,Symbol.toStringTag);if(!j){var et=getPrototypeOf$5($);j=gOPD$1(et,Symbol.toStringTag)}toStrTags[_]=j.get}}});var tryTypedArrays=function(a){var $=!1;return forEach$2(toStrTags,function(j,et){if(!$)try{var tt=j.call(a);tt===et&&($=tt)}catch{}}),$},isTypedArray$2=isTypedArray$3,whichTypedArray=function(a){return isTypedArray$2(a)?!hasToStringTag||!(Symbol.toStringTag in a)?$slice($toString(a),8,-1):tryTypedArrays(a):!1};(function(_){var a=isArguments$1,$=isGeneratorFunction,j=whichTypedArray,et=isTypedArray$3;function tt(fr){return fr.call.bind(fr)}var rt=typeof BigInt<"u",nt=typeof Symbol<"u",it=tt(Object.prototype.toString),ot=tt(Number.prototype.valueOf),st=tt(String.prototype.valueOf),at=tt(Boolean.prototype.valueOf);if(rt)var ut=tt(BigInt.prototype.valueOf);if(nt)var ht=tt(Symbol.prototype.valueOf);function bt(fr,Er){if(typeof fr!="object")return!1;try{return Er(fr),!0}catch{return!1}}_.isArgumentsObject=a,_.isGeneratorFunction=$,_.isTypedArray=et;function Et(fr){return typeof Promise<"u"&&fr instanceof Promise||fr!==null&&typeof fr=="object"&&typeof fr.then=="function"&&typeof fr.catch=="function"}_.isPromise=Et;function Ct(fr){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(fr):et(fr)||Ot(fr)}_.isArrayBufferView=Ct;function Pt(fr){return j(fr)==="Uint8Array"}_.isUint8Array=Pt;function Tt(fr){return j(fr)==="Uint8ClampedArray"}_.isUint8ClampedArray=Tt;function It(fr){return j(fr)==="Uint16Array"}_.isUint16Array=It;function Lt(fr){return j(fr)==="Uint32Array"}_.isUint32Array=Lt;function Nt(fr){return j(fr)==="Int8Array"}_.isInt8Array=Nt;function Ut(fr){return j(fr)==="Int16Array"}_.isInt16Array=Ut;function jt(fr){return j(fr)==="Int32Array"}_.isInt32Array=jt;function Mt(fr){return j(fr)==="Float32Array"}_.isFloat32Array=Mt;function Dt(fr){return j(fr)==="Float64Array"}_.isFloat64Array=Dt;function Ft(fr){return j(fr)==="BigInt64Array"}_.isBigInt64Array=Ft;function Bt(fr){return j(fr)==="BigUint64Array"}_.isBigUint64Array=Bt;function yt(fr){return it(fr)==="[object Map]"}yt.working=typeof Map<"u"&&yt(new Map);function mt(fr){return typeof Map>"u"?!1:yt.working?yt(fr):fr instanceof Map}_.isMap=mt;function ct(fr){return it(fr)==="[object Set]"}ct.working=typeof Set<"u"&&ct(new Set);function dt(fr){return typeof Set>"u"?!1:ct.working?ct(fr):fr instanceof Set}_.isSet=dt;function vt(fr){return it(fr)==="[object WeakMap]"}vt.working=typeof WeakMap<"u"&&vt(new WeakMap);function St(fr){return typeof WeakMap>"u"?!1:vt.working?vt(fr):fr instanceof WeakMap}_.isWeakMap=St;function Rt(fr){return it(fr)==="[object WeakSet]"}Rt.working=typeof WeakSet<"u"&&Rt(new WeakSet);function $t(fr){return Rt(fr)}_.isWeakSet=$t;function xt(fr){return it(fr)==="[object ArrayBuffer]"}xt.working=typeof ArrayBuffer<"u"&&xt(new ArrayBuffer);function At(fr){return typeof ArrayBuffer>"u"?!1:xt.working?xt(fr):fr instanceof ArrayBuffer}_.isArrayBuffer=At;function wt(fr){return it(fr)==="[object DataView]"}wt.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&wt(new DataView(new ArrayBuffer(1),0,1));function Ot(fr){return typeof DataView>"u"?!1:wt.working?wt(fr):fr instanceof DataView}_.isDataView=Ot;var tr=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function nr(fr){return it(fr)==="[object SharedArrayBuffer]"}function ir(fr){return typeof tr>"u"?!1:(typeof nr.working>"u"&&(nr.working=nr(new tr)),nr.working?nr(fr):fr instanceof tr)}_.isSharedArrayBuffer=ir;function Wt(fr){return it(fr)==="[object AsyncFunction]"}_.isAsyncFunction=Wt;function Kt(fr){return it(fr)==="[object Map Iterator]"}_.isMapIterator=Kt;function Jt(fr){return it(fr)==="[object Set Iterator]"}_.isSetIterator=Jt;function Ht(fr){return it(fr)==="[object Generator]"}_.isGeneratorObject=Ht;function qt(fr){return it(fr)==="[object WebAssembly.Module]"}_.isWebAssemblyCompiledModule=qt;function Qt(fr){return bt(fr,ot)}_.isNumberObject=Qt;function dr(fr){return bt(fr,st)}_.isStringObject=dr;function xr(fr){return bt(fr,at)}_.isBooleanObject=xr;function pr(fr){return rt&&bt(fr,ut)}_.isBigIntObject=pr;function kr(fr){return nt&&bt(fr,ht)}_.isSymbolObject=kr;function Ir(fr){return Qt(fr)||dr(fr)||xr(fr)||pr(fr)||kr(fr)}_.isBoxedPrimitive=Ir;function lr(fr){return typeof Uint8Array<"u"&&(At(fr)||ir(fr))}_.isAnyArrayBuffer=lr,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(fr){Object.defineProperty(_,fr,{enumerable:!1,value:function(){throw new Error(fr+" is not supported in userland")}})})})(types$1);var isBufferBrowser=function(a){return a&&typeof a=="object"&&typeof a.copy=="function"&&typeof a.fill=="function"&&typeof a.readUInt8=="function"};(function(_){var a={},$=Object.getOwnPropertyDescriptors||function(tr){for(var nr=Object.keys(tr),ir={},Wt=0;Wt=Wt)return Ht;switch(Ht){case"%s":return String(ir[nr++]);case"%d":return Number(ir[nr++]);case"%j":try{return JSON.stringify(ir[nr++])}catch{return"[Circular]"}default:return Ht}}),Jt=ir[nr];nr"u")return function(){return _.deprecate(Ot,tr).apply(this,arguments)};var nr=!1;function ir(){if(!nr){if(process$1$1.throwDeprecation)throw new Error(tr);process$1$1.traceDeprecation?console.trace(tr):console.error(tr),nr=!0}return Ot.apply(this,arguments)}return ir};var et={},tt=/^$/;if(a.NODE_DEBUG){var rt=a.NODE_DEBUG;rt=rt.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),tt=new RegExp("^"+rt+"$","i")}_.debuglog=function(Ot){if(Ot=Ot.toUpperCase(),!et[Ot])if(tt.test(Ot)){var tr=process$1$1.pid;et[Ot]=function(){var nr=_.format.apply(_,arguments);console.error("%s %d: %s",Ot,tr,nr)}}else et[Ot]=function(){};return et[Ot]};function nt(Ot,tr){var nr={seen:[],stylize:ot};return arguments.length>=3&&(nr.depth=arguments[2]),arguments.length>=4&&(nr.colors=arguments[3]),Tt(tr)?nr.showHidden=tr:tr&&_._extend(nr,tr),Mt(nr.showHidden)&&(nr.showHidden=!1),Mt(nr.depth)&&(nr.depth=2),Mt(nr.colors)&&(nr.colors=!1),Mt(nr.customInspect)&&(nr.customInspect=!0),nr.colors&&(nr.stylize=it),at(nr,Ot,nr.depth)}_.inspect=nt,nt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},nt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function it(Ot,tr){var nr=nt.styles[tr];return nr?"\x1B["+nt.colors[nr][0]+"m"+Ot+"\x1B["+nt.colors[nr][1]+"m":Ot}function ot(Ot,tr){return Ot}function st(Ot){var tr={};return Ot.forEach(function(nr,ir){tr[nr]=!0}),tr}function at(Ot,tr,nr){if(Ot.customInspect&&tr&&mt(tr.inspect)&&tr.inspect!==_.inspect&&!(tr.constructor&&tr.constructor.prototype===tr)){var ir=tr.inspect(nr,Ot);return Ut(ir)||(ir=at(Ot,ir,nr)),ir}var Wt=ut(Ot,tr);if(Wt)return Wt;var Kt=Object.keys(tr),Jt=st(Kt);if(Ot.showHidden&&(Kt=Object.getOwnPropertyNames(tr)),yt(tr)&&(Kt.indexOf("message")>=0||Kt.indexOf("description")>=0))return ht(tr);if(Kt.length===0){if(mt(tr)){var Ht=tr.name?": "+tr.name:"";return Ot.stylize("[Function"+Ht+"]","special")}if(Dt(tr))return Ot.stylize(RegExp.prototype.toString.call(tr),"regexp");if(Bt(tr))return Ot.stylize(Date.prototype.toString.call(tr),"date");if(yt(tr))return ht(tr)}var qt="",Qt=!1,dr=["{","}"];if(Pt(tr)&&(Qt=!0,dr=["[","]"]),mt(tr)){var xr=tr.name?": "+tr.name:"";qt=" [Function"+xr+"]"}if(Dt(tr)&&(qt=" "+RegExp.prototype.toString.call(tr)),Bt(tr)&&(qt=" "+Date.prototype.toUTCString.call(tr)),yt(tr)&&(qt=" "+ht(tr)),Kt.length===0&&(!Qt||tr.length==0))return dr[0]+qt+dr[1];if(nr<0)return Dt(tr)?Ot.stylize(RegExp.prototype.toString.call(tr),"regexp"):Ot.stylize("[Object]","special");Ot.seen.push(tr);var pr;return Qt?pr=bt(Ot,tr,nr,Jt,Kt):pr=Kt.map(function(kr){return Et(Ot,tr,nr,Jt,kr,Qt)}),Ot.seen.pop(),Ct(pr,qt,dr)}function ut(Ot,tr){if(Mt(tr))return Ot.stylize("undefined","undefined");if(Ut(tr)){var nr="'"+JSON.stringify(tr).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return Ot.stylize(nr,"string")}if(Nt(tr))return Ot.stylize(""+tr,"number");if(Tt(tr))return Ot.stylize(""+tr,"boolean");if(It(tr))return Ot.stylize("null","null")}function ht(Ot){return"["+Error.prototype.toString.call(Ot)+"]"}function bt(Ot,tr,nr,ir,Wt){for(var Kt=[],Jt=0,Ht=tr.length;Jtet)throw new RangeError('The value "'+ar+'" is invalid for option "size"');const Yt=new Uint8Array(ar);return Object.setPrototypeOf(Yt,nt.prototype),Yt}function nt(ar,Yt,er){if(typeof ar=="number"){if(typeof Yt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ot(ar)}return it(ar,Yt,er)}nt.poolSize=8192;function it(ar,Yt,er){if(typeof ar=="string")return ut(ar,Yt);if(ArrayBuffer.isView(ar))return mt(ar);if(ar==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ar);if(Pr(ar,ArrayBuffer)||ar&&Pr(ar.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pr(ar,SharedArrayBuffer)||ar&&Pr(ar.buffer,SharedArrayBuffer)))return xt(ar,Yt,er);if(typeof ar=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Zt=ar.valueOf&&ar.valueOf();if(Zt!=null&&Zt!==ar)return nt.from(Zt,Yt,er);const qt=Ct(ar);if(qt)return qt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof ar[Symbol.toPrimitive]=="function")return nt.from(ar[Symbol.toPrimitive]("string"),Yt,er);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ar)}nt.from=function(ar,Yt,er){return it(ar,Yt,er)},Object.setPrototypeOf(nt.prototype,Uint8Array.prototype),Object.setPrototypeOf(nt,Uint8Array);function at(ar){if(typeof ar!="number")throw new TypeError('"size" argument must be of type number');if(ar<0)throw new RangeError('The value "'+ar+'" is invalid for option "size"')}function st(ar,Yt,er){return at(ar),ar<=0?rt(ar):Yt!==void 0?typeof er=="string"?rt(ar).fill(Yt,er):rt(ar).fill(Yt):rt(ar)}nt.alloc=function(ar,Yt,er){return st(ar,Yt,er)};function ot(ar){return at(ar),rt(ar<0?0:Pt(ar)|0)}nt.allocUnsafe=function(ar){return ot(ar)},nt.allocUnsafeSlow=function(ar){return ot(ar)};function ut(ar,Yt){if((typeof Yt!="string"||Yt==="")&&(Yt="utf8"),!nt.isEncoding(Yt))throw new TypeError("Unknown encoding: "+Yt);const er=kt(ar,Yt)|0;let Zt=rt(er);const qt=Zt.write(ar,Yt);return qt!==er&&(Zt=Zt.slice(0,qt)),Zt}function dt(ar){const Yt=ar.length<0?0:Pt(ar.length)|0,er=rt(Yt);for(let Zt=0;Zt=et)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et.toString(16)+" bytes");return ar|0}function Tt(ar){return+ar!=ar&&(ar=0),nt.alloc(+ar)}nt.isBuffer=function(Yt){return Yt!=null&&Yt._isBuffer===!0&&Yt!==nt.prototype},nt.compare=function(Yt,er){if(Pr(Yt,Uint8Array)&&(Yt=nt.from(Yt,Yt.offset,Yt.byteLength)),Pr(er,Uint8Array)&&(er=nt.from(er,er.offset,er.byteLength)),!nt.isBuffer(Yt)||!nt.isBuffer(er))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Yt===er)return 0;let Zt=Yt.length,qt=er.length;for(let Gt=0,or=Math.min(Zt,qt);Gtqt.length?(nt.isBuffer(or)||(or=nt.from(or)),or.copy(qt,Gt)):Uint8Array.prototype.set.call(qt,or,Gt);else if(nt.isBuffer(or))or.copy(qt,Gt);else throw new TypeError('"list" argument must be an Array of Buffers');Gt+=or.length}return qt};function kt(ar,Yt){if(nt.isBuffer(ar))return ar.length;if(ArrayBuffer.isView(ar)||Pr(ar,ArrayBuffer))return ar.byteLength;if(typeof ar!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof ar);const er=ar.length,Zt=arguments.length>2&&arguments[2]===!0;if(!Zt&&er===0)return 0;let qt=!1;for(;;)switch(Yt){case"ascii":case"latin1":case"binary":return er;case"utf8":case"utf-8":return kr(ar).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return er*2;case"hex":return er>>>1;case"base64":return Er(ar).length;default:if(qt)return Zt?-1:kr(ar).length;Yt=(""+Yt).toLowerCase(),qt=!0}}nt.byteLength=kt;function Lt(ar,Yt,er){let Zt=!1;if((Yt===void 0||Yt<0)&&(Yt=0),Yt>this.length||((er===void 0||er>this.length)&&(er=this.length),er<=0)||(er>>>=0,Yt>>>=0,er<=Yt))return"";for(ar||(ar="utf8");;)switch(ar){case"hex":return $t(this,Yt,er);case"utf8":case"utf-8":return ct(this,Yt,er);case"ascii":return St(this,Yt,er);case"latin1":case"binary":return Rt(this,Yt,er);case"base64":return bt(this,Yt,er);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Et(this,Yt,er);default:if(Zt)throw new TypeError("Unknown encoding: "+ar);ar=(ar+"").toLowerCase(),Zt=!0}}nt.prototype._isBuffer=!0;function Nt(ar,Yt,er){const Zt=ar[Yt];ar[Yt]=ar[er],ar[er]=Zt}nt.prototype.swap16=function(){const Yt=this.length;if(Yt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let er=0;erer&&(Yt+=" ... "),""},j&&(nt.prototype[j]=nt.prototype.inspect),nt.prototype.compare=function(Yt,er,Zt,qt,Gt){if(Pr(Yt,Uint8Array)&&(Yt=nt.from(Yt,Yt.offset,Yt.byteLength)),!nt.isBuffer(Yt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Yt);if(er===void 0&&(er=0),Zt===void 0&&(Zt=Yt?Yt.length:0),qt===void 0&&(qt=0),Gt===void 0&&(Gt=this.length),er<0||Zt>Yt.length||qt<0||Gt>this.length)throw new RangeError("out of range index");if(qt>=Gt&&er>=Zt)return 0;if(qt>=Gt)return-1;if(er>=Zt)return 1;if(er>>>=0,Zt>>>=0,qt>>>=0,Gt>>>=0,this===Yt)return 0;let or=Gt-qt,vr=Zt-er;const wr=Math.min(or,vr),Sr=this.slice(qt,Gt),Wr=Yt.slice(er,Zt);for(let Hr=0;Hr2147483647?er=2147483647:er<-2147483648&&(er=-2147483648),er=+er,Rr(er)&&(er=qt?0:ar.length-1),er<0&&(er=ar.length+er),er>=ar.length){if(qt)return-1;er=ar.length-1}else if(er<0)if(qt)er=0;else return-1;if(typeof Yt=="string"&&(Yt=nt.from(Yt,Zt)),nt.isBuffer(Yt))return Yt.length===0?-1:jt(ar,Yt,er,Zt,qt);if(typeof Yt=="number")return Yt=Yt&255,typeof Uint8Array.prototype.indexOf=="function"?qt?Uint8Array.prototype.indexOf.call(ar,Yt,er):Uint8Array.prototype.lastIndexOf.call(ar,Yt,er):jt(ar,[Yt],er,Zt,qt);throw new TypeError("val must be string, number or Buffer")}function jt(ar,Yt,er,Zt,qt){let Gt=1,or=ar.length,vr=Yt.length;if(Zt!==void 0&&(Zt=String(Zt).toLowerCase(),Zt==="ucs2"||Zt==="ucs-2"||Zt==="utf16le"||Zt==="utf-16le")){if(ar.length<2||Yt.length<2)return-1;Gt=2,or/=2,vr/=2,er/=2}function wr(Wr,Hr){return Gt===1?Wr[Hr]:Wr.readUInt16BE(Hr*Gt)}let Sr;if(qt){let Wr=-1;for(Sr=er;Sror&&(er=or-vr),Sr=er;Sr>=0;Sr--){let Wr=!0;for(let Hr=0;Hrqt&&(Zt=qt)):Zt=qt;const Gt=Yt.length;Zt>Gt/2&&(Zt=Gt/2);let or;for(or=0;or>>0,isFinite(Zt)?(Zt=Zt>>>0,qt===void 0&&(qt="utf8")):(qt=Zt,Zt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Gt=this.length-er;if((Zt===void 0||Zt>Gt)&&(Zt=Gt),Yt.length>0&&(Zt<0||er<0)||er>this.length)throw new RangeError("Attempt to write outside buffer bounds");qt||(qt="utf8");let or=!1;for(;;)switch(qt){case"hex":return Mt(this,Yt,er,Zt);case"utf8":case"utf-8":return Dt(this,Yt,er,Zt);case"ascii":case"latin1":case"binary":return Ft(this,Yt,er,Zt);case"base64":return Bt(this,Yt,er,Zt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yt(this,Yt,er,Zt);default:if(or)throw new TypeError("Unknown encoding: "+qt);qt=(""+qt).toLowerCase(),or=!0}},nt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function bt(ar,Yt,er){return Yt===0&&er===ar.length?a.fromByteArray(ar):a.fromByteArray(ar.slice(Yt,er))}function ct(ar,Yt,er){er=Math.min(ar.length,er);const Zt=[];let qt=Yt;for(;qt239?4:Gt>223?3:Gt>191?2:1;if(qt+vr<=er){let wr,Sr,Wr,Hr;switch(vr){case 1:Gt<128&&(or=Gt);break;case 2:wr=ar[qt+1],(wr&192)===128&&(Hr=(Gt&31)<<6|wr&63,Hr>127&&(or=Hr));break;case 3:wr=ar[qt+1],Sr=ar[qt+2],(wr&192)===128&&(Sr&192)===128&&(Hr=(Gt&15)<<12|(wr&63)<<6|Sr&63,Hr>2047&&(Hr<55296||Hr>57343)&&(or=Hr));break;case 4:wr=ar[qt+1],Sr=ar[qt+2],Wr=ar[qt+3],(wr&192)===128&&(Sr&192)===128&&(Wr&192)===128&&(Hr=(Gt&15)<<18|(wr&63)<<12|(Sr&63)<<6|Wr&63,Hr>65535&&Hr<1114112&&(or=Hr))}}or===null?(or=65533,vr=1):or>65535&&(or-=65536,Zt.push(or>>>10&1023|55296),or=56320|or&1023),Zt.push(or),qt+=vr}return vt(Zt)}const ht=4096;function vt(ar){const Yt=ar.length;if(Yt<=ht)return String.fromCharCode.apply(String,ar);let er="",Zt=0;for(;ZtZt)&&(er=Zt);let qt="";for(let Gt=Yt;GtZt&&(Yt=Zt),er<0?(er+=Zt,er<0&&(er=0)):er>Zt&&(er=Zt),erer)throw new RangeError("Trying to access beyond buffer length")}nt.prototype.readUintLE=nt.prototype.readUIntLE=function(Yt,er,Zt){Yt=Yt>>>0,er=er>>>0,Zt||At(Yt,er,this.length);let qt=this[Yt],Gt=1,or=0;for(;++or>>0,er=er>>>0,Zt||At(Yt,er,this.length);let qt=this[Yt+--er],Gt=1;for(;er>0&&(Gt*=256);)qt+=this[Yt+--er]*Gt;return qt},nt.prototype.readUint8=nt.prototype.readUInt8=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,1,this.length),this[Yt]},nt.prototype.readUint16LE=nt.prototype.readUInt16LE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,2,this.length),this[Yt]|this[Yt+1]<<8},nt.prototype.readUint16BE=nt.prototype.readUInt16BE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,2,this.length),this[Yt]<<8|this[Yt+1]},nt.prototype.readUint32LE=nt.prototype.readUInt32LE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),(this[Yt]|this[Yt+1]<<8|this[Yt+2]<<16)+this[Yt+3]*16777216},nt.prototype.readUint32BE=nt.prototype.readUInt32BE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),this[Yt]*16777216+(this[Yt+1]<<16|this[Yt+2]<<8|this[Yt+3])},nt.prototype.readBigUInt64LE=Or(function(Yt){Yt=Yt>>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const qt=er+this[++Yt]*2**8+this[++Yt]*2**16+this[++Yt]*2**24,Gt=this[++Yt]+this[++Yt]*2**8+this[++Yt]*2**16+Zt*2**24;return BigInt(qt)+(BigInt(Gt)<>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const qt=er*2**24+this[++Yt]*2**16+this[++Yt]*2**8+this[++Yt],Gt=this[++Yt]*2**24+this[++Yt]*2**16+this[++Yt]*2**8+Zt;return(BigInt(qt)<>>0,er=er>>>0,Zt||At(Yt,er,this.length);let qt=this[Yt],Gt=1,or=0;for(;++or=Gt&&(qt-=Math.pow(2,8*er)),qt},nt.prototype.readIntBE=function(Yt,er,Zt){Yt=Yt>>>0,er=er>>>0,Zt||At(Yt,er,this.length);let qt=er,Gt=1,or=this[Yt+--qt];for(;qt>0&&(Gt*=256);)or+=this[Yt+--qt]*Gt;return Gt*=128,or>=Gt&&(or-=Math.pow(2,8*er)),or},nt.prototype.readInt8=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,1,this.length),this[Yt]&128?(255-this[Yt]+1)*-1:this[Yt]},nt.prototype.readInt16LE=function(Yt,er){Yt=Yt>>>0,er||At(Yt,2,this.length);const Zt=this[Yt]|this[Yt+1]<<8;return Zt&32768?Zt|4294901760:Zt},nt.prototype.readInt16BE=function(Yt,er){Yt=Yt>>>0,er||At(Yt,2,this.length);const Zt=this[Yt+1]|this[Yt]<<8;return Zt&32768?Zt|4294901760:Zt},nt.prototype.readInt32LE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),this[Yt]|this[Yt+1]<<8|this[Yt+2]<<16|this[Yt+3]<<24},nt.prototype.readInt32BE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),this[Yt]<<24|this[Yt+1]<<16|this[Yt+2]<<8|this[Yt+3]},nt.prototype.readBigInt64LE=Or(function(Yt){Yt=Yt>>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const qt=this[Yt+4]+this[Yt+5]*2**8+this[Yt+6]*2**16+(Zt<<24);return(BigInt(qt)<>>0,dr(Yt,"offset");const er=this[Yt],Zt=this[Yt+7];(er===void 0||Zt===void 0)&&xr(Yt,this.length-8);const qt=(er<<24)+this[++Yt]*2**16+this[++Yt]*2**8+this[++Yt];return(BigInt(qt)<>>0,er||At(Yt,4,this.length),$.read(this,Yt,!0,23,4)},nt.prototype.readFloatBE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,4,this.length),$.read(this,Yt,!1,23,4)},nt.prototype.readDoubleLE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,8,this.length),$.read(this,Yt,!0,52,8)},nt.prototype.readDoubleBE=function(Yt,er){return Yt=Yt>>>0,er||At(Yt,8,this.length),$.read(this,Yt,!1,52,8)};function wt(ar,Yt,er,Zt,qt,Gt){if(!nt.isBuffer(ar))throw new TypeError('"buffer" argument must be a Buffer instance');if(Yt>qt||Ytar.length)throw new RangeError("Index out of range")}nt.prototype.writeUintLE=nt.prototype.writeUIntLE=function(Yt,er,Zt,qt){if(Yt=+Yt,er=er>>>0,Zt=Zt>>>0,!qt){const vr=Math.pow(2,8*Zt)-1;wt(this,Yt,er,Zt,vr,0)}let Gt=1,or=0;for(this[er]=Yt&255;++or>>0,Zt=Zt>>>0,!qt){const vr=Math.pow(2,8*Zt)-1;wt(this,Yt,er,Zt,vr,0)}let Gt=Zt-1,or=1;for(this[er+Gt]=Yt&255;--Gt>=0&&(or*=256);)this[er+Gt]=Yt/or&255;return er+Zt},nt.prototype.writeUint8=nt.prototype.writeUInt8=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,1,255,0),this[er]=Yt&255,er+1},nt.prototype.writeUint16LE=nt.prototype.writeUInt16LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,65535,0),this[er]=Yt&255,this[er+1]=Yt>>>8,er+2},nt.prototype.writeUint16BE=nt.prototype.writeUInt16BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,65535,0),this[er]=Yt>>>8,this[er+1]=Yt&255,er+2},nt.prototype.writeUint32LE=nt.prototype.writeUInt32LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,4294967295,0),this[er+3]=Yt>>>24,this[er+2]=Yt>>>16,this[er+1]=Yt>>>8,this[er]=Yt&255,er+4},nt.prototype.writeUint32BE=nt.prototype.writeUInt32BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,4294967295,0),this[er]=Yt>>>24,this[er+1]=Yt>>>16,this[er+2]=Yt>>>8,this[er+3]=Yt&255,er+4};function Ot(ar,Yt,er,Zt,qt){Qt(Yt,Zt,qt,ar,er,7);let Gt=Number(Yt&BigInt(4294967295));ar[er++]=Gt,Gt=Gt>>8,ar[er++]=Gt,Gt=Gt>>8,ar[er++]=Gt,Gt=Gt>>8,ar[er++]=Gt;let or=Number(Yt>>BigInt(32)&BigInt(4294967295));return ar[er++]=or,or=or>>8,ar[er++]=or,or=or>>8,ar[er++]=or,or=or>>8,ar[er++]=or,er}function tr(ar,Yt,er,Zt,qt){Qt(Yt,Zt,qt,ar,er,7);let Gt=Number(Yt&BigInt(4294967295));ar[er+7]=Gt,Gt=Gt>>8,ar[er+6]=Gt,Gt=Gt>>8,ar[er+5]=Gt,Gt=Gt>>8,ar[er+4]=Gt;let or=Number(Yt>>BigInt(32)&BigInt(4294967295));return ar[er+3]=or,or=or>>8,ar[er+2]=or,or=or>>8,ar[er+1]=or,or=or>>8,ar[er]=or,er+8}nt.prototype.writeBigUInt64LE=Or(function(Yt,er=0){return Ot(this,Yt,er,BigInt(0),BigInt("0xffffffffffffffff"))}),nt.prototype.writeBigUInt64BE=Or(function(Yt,er=0){return tr(this,Yt,er,BigInt(0),BigInt("0xffffffffffffffff"))}),nt.prototype.writeIntLE=function(Yt,er,Zt,qt){if(Yt=+Yt,er=er>>>0,!qt){const wr=Math.pow(2,8*Zt-1);wt(this,Yt,er,Zt,wr-1,-wr)}let Gt=0,or=1,vr=0;for(this[er]=Yt&255;++Gt>0)-vr&255;return er+Zt},nt.prototype.writeIntBE=function(Yt,er,Zt,qt){if(Yt=+Yt,er=er>>>0,!qt){const wr=Math.pow(2,8*Zt-1);wt(this,Yt,er,Zt,wr-1,-wr)}let Gt=Zt-1,or=1,vr=0;for(this[er+Gt]=Yt&255;--Gt>=0&&(or*=256);)Yt<0&&vr===0&&this[er+Gt+1]!==0&&(vr=1),this[er+Gt]=(Yt/or>>0)-vr&255;return er+Zt},nt.prototype.writeInt8=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,1,127,-128),Yt<0&&(Yt=255+Yt+1),this[er]=Yt&255,er+1},nt.prototype.writeInt16LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,32767,-32768),this[er]=Yt&255,this[er+1]=Yt>>>8,er+2},nt.prototype.writeInt16BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,2,32767,-32768),this[er]=Yt>>>8,this[er+1]=Yt&255,er+2},nt.prototype.writeInt32LE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,2147483647,-2147483648),this[er]=Yt&255,this[er+1]=Yt>>>8,this[er+2]=Yt>>>16,this[er+3]=Yt>>>24,er+4},nt.prototype.writeInt32BE=function(Yt,er,Zt){return Yt=+Yt,er=er>>>0,Zt||wt(this,Yt,er,4,2147483647,-2147483648),Yt<0&&(Yt=4294967295+Yt+1),this[er]=Yt>>>24,this[er+1]=Yt>>>16,this[er+2]=Yt>>>8,this[er+3]=Yt&255,er+4},nt.prototype.writeBigInt64LE=Or(function(Yt,er=0){return Ot(this,Yt,er,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),nt.prototype.writeBigInt64BE=Or(function(Yt,er=0){return tr(this,Yt,er,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nr(ar,Yt,er,Zt,qt,Gt){if(er+Zt>ar.length)throw new RangeError("Index out of range");if(er<0)throw new RangeError("Index out of range")}function ir(ar,Yt,er,Zt,qt){return Yt=+Yt,er=er>>>0,qt||nr(ar,Yt,er,4),$.write(ar,Yt,er,Zt,23,4),er+4}nt.prototype.writeFloatLE=function(Yt,er,Zt){return ir(this,Yt,er,!0,Zt)},nt.prototype.writeFloatBE=function(Yt,er,Zt){return ir(this,Yt,er,!1,Zt)};function Wt(ar,Yt,er,Zt,qt){return Yt=+Yt,er=er>>>0,qt||nr(ar,Yt,er,8),$.write(ar,Yt,er,Zt,52,8),er+8}nt.prototype.writeDoubleLE=function(Yt,er,Zt){return Wt(this,Yt,er,!0,Zt)},nt.prototype.writeDoubleBE=function(Yt,er,Zt){return Wt(this,Yt,er,!1,Zt)},nt.prototype.copy=function(Yt,er,Zt,qt){if(!nt.isBuffer(Yt))throw new TypeError("argument should be a Buffer");if(Zt||(Zt=0),!qt&&qt!==0&&(qt=this.length),er>=Yt.length&&(er=Yt.length),er||(er=0),qt>0&&qt=this.length)throw new RangeError("Index out of range");if(qt<0)throw new RangeError("sourceEnd out of bounds");qt>this.length&&(qt=this.length),Yt.length-er>>0,Zt=Zt===void 0?this.length:Zt>>>0,Yt||(Yt=0);let Gt;if(typeof Yt=="number")for(Gt=er;Gt2**32?qt=Ht(String(er)):typeof er=="bigint"&&(qt=String(er),(er>BigInt(2)**BigInt(32)||er<-(BigInt(2)**BigInt(32)))&&(qt=Ht(qt)),qt+="n"),Zt+=` It must be ${Yt}. Received ${qt}`,Zt},RangeError);function Ht(ar){let Yt="",er=ar.length;const Zt=ar[0]==="-"?1:0;for(;er>=Zt+4;er-=3)Yt=`_${ar.slice(er-3,er)}${Yt}`;return`${ar.slice(0,er)}${Yt}`}function Vt(ar,Yt,er){dr(Yt,"offset"),(ar[Yt]===void 0||ar[Yt+er]===void 0)&&xr(Yt,ar.length-(er+1))}function Qt(ar,Yt,er,Zt,qt,Gt){if(ar>er||ar= 0${or} and < 2${or} ** ${(Gt+1)*8}${or}`:vr=`>= -(2${or} ** ${(Gt+1)*8-1}${or}) and < 2 ** ${(Gt+1)*8-1}${or}`,new Kt.ERR_OUT_OF_RANGE("value",vr,ar)}Vt(Zt,qt,Gt)}function dr(ar,Yt){if(typeof ar!="number")throw new Kt.ERR_INVALID_ARG_TYPE(Yt,"number",ar)}function xr(ar,Yt,er){throw Math.floor(ar)!==ar?(dr(ar,er),new Kt.ERR_OUT_OF_RANGE("offset","an integer",ar)):Yt<0?new Kt.ERR_BUFFER_OUT_OF_BOUNDS:new Kt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Yt}`,ar)}const pr=/[^+/0-9A-Za-z-_]/g;function Ir(ar){if(ar=ar.split("=")[0],ar=ar.trim().replace(pr,""),ar.length<2)return"";for(;ar.length%4!==0;)ar=ar+"=";return ar}function kr(ar,Yt){Yt=Yt||1/0;let er;const Zt=ar.length;let qt=null;const Gt=[];for(let or=0;or55295&&er<57344){if(!qt){if(er>56319){(Yt-=3)>-1&&Gt.push(239,191,189);continue}else if(or+1===Zt){(Yt-=3)>-1&&Gt.push(239,191,189);continue}qt=er;continue}if(er<56320){(Yt-=3)>-1&&Gt.push(239,191,189),qt=er;continue}er=(qt-55296<<10|er-56320)+65536}else qt&&(Yt-=3)>-1&&Gt.push(239,191,189);if(qt=null,er<128){if((Yt-=1)<0)break;Gt.push(er)}else if(er<2048){if((Yt-=2)<0)break;Gt.push(er>>6|192,er&63|128)}else if(er<65536){if((Yt-=3)<0)break;Gt.push(er>>12|224,er>>6&63|128,er&63|128)}else if(er<1114112){if((Yt-=4)<0)break;Gt.push(er>>18|240,er>>12&63|128,er>>6&63|128,er&63|128)}else throw new Error("Invalid code point")}return Gt}function lr(ar){const Yt=[];for(let er=0;er>8,qt=er%256,Gt.push(qt),Gt.push(Zt);return Gt}function Er(ar){return a.toByteArray(Ir(ar))}function $r(ar,Yt,er,Zt){let qt;for(qt=0;qt=Yt.length||qt>=ar.length);++qt)Yt[qt+er]=ar[qt];return qt}function Pr(ar,Yt){return ar instanceof Yt||ar!=null&&ar.constructor!=null&&ar.constructor.name!=null&&ar.constructor.name===Yt.name}function Rr(ar){return ar!==ar}const Ar=function(){const ar="0123456789abcdef",Yt=new Array(256);for(let er=0;er<16;++er){const Zt=er*16;for(let qt=0;qt<16;++qt)Yt[Zt+qt]=ar[er]+ar[qt]}return Yt}();function Or(ar){return typeof BigInt>"u"?Lr:ar}function Lr(){throw new Error("BigInt not supported")}})(buffer$1);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(_,a){var $=buffer$1,j=$.Buffer;function et(rt,nt){for(var it in rt)nt[it]=rt[it]}j.from&&j.alloc&&j.allocUnsafe&&j.allocUnsafeSlow?_.exports=$:(et($,a),a.Buffer=tt);function tt(rt,nt,it){return j(rt,nt,it)}tt.prototype=Object.create(j.prototype),et(j,tt),tt.from=function(rt,nt,it){if(typeof rt=="number")throw new TypeError("Argument must not be a number");return j(rt,nt,it)},tt.alloc=function(rt,nt,it){if(typeof rt!="number")throw new TypeError("Argument must be a number");var at=j(rt);return nt!==void 0?typeof it=="string"?at.fill(nt,it):at.fill(nt):at.fill(0),at},tt.allocUnsafe=function(rt){if(typeof rt!="number")throw new TypeError("Argument must be a number");return j(rt)},tt.allocUnsafeSlow=function(rt){if(typeof rt!="number")throw new TypeError("Argument must be a number");return $.SlowBuffer(rt)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports=safeBuffer$2.exports,readableBrowser$1={exports:{}};function getDefaultExportFromCjs(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var browser$d={exports:{}},process$1=browser$d.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(_){if(cachedSetTimeout===setTimeout)return setTimeout(_,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(_,0);try{return cachedSetTimeout(_,0)}catch{try{return cachedSetTimeout.call(null,_,0)}catch{return cachedSetTimeout.call(this,_,0)}}}function runClearTimeout(_){if(cachedClearTimeout===clearTimeout)return clearTimeout(_);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(_);try{return cachedClearTimeout(_)}catch{try{return cachedClearTimeout.call(null,_)}catch{return cachedClearTimeout.call(this,_)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var _=runTimeout(cleanUpNextTick);draining=!0;for(var a=queue.length;a;){for(currentQueue=queue,queue=[];++queueIndex1)for(var $=1;$0&&(rt=$[0]),rt instanceof Error)throw rt;var nt=new Error("Unhandled error."+(rt?" ("+rt.message+")":""));throw nt.context=rt,nt}var it=tt[a];if(it===void 0)return!1;if(typeof it=="function")ReflectApply(it,this,$);else for(var at=it.length,st=arrayClone(it,at),j=0;j0&&rt.length>et&&!rt.warned){rt.warned=!0;var nt=new Error("Possible EventEmitter memory leak detected. "+rt.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");nt.name="MaxListenersExceededWarning",nt.emitter=_,nt.type=a,nt.count=rt.length,ProcessEmitWarning(nt)}return _}EventEmitter$1.prototype.addListener=function(a,$){return _addListener(this,a,$,!1)};EventEmitter$1.prototype.on=EventEmitter$1.prototype.addListener;EventEmitter$1.prototype.prependListener=function(a,$){return _addListener(this,a,$,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(_,a,$){var j={fired:!1,wrapFn:void 0,target:_,type:a,listener:$},et=onceWrapper.bind(j);return et.listener=$,j.wrapFn=et,et}EventEmitter$1.prototype.once=function(a,$){return checkListener($),this.on(a,_onceWrap(this,a,$)),this};EventEmitter$1.prototype.prependOnceListener=function(a,$){return checkListener($),this.prependListener(a,_onceWrap(this,a,$)),this};EventEmitter$1.prototype.removeListener=function(a,$){var j,et,tt,rt,nt;if(checkListener($),et=this._events,et===void 0)return this;if(j=et[a],j===void 0)return this;if(j===$||j.listener===$)--this._eventsCount===0?this._events=Object.create(null):(delete et[a],et.removeListener&&this.emit("removeListener",a,j.listener||$));else if(typeof j!="function"){for(tt=-1,rt=j.length-1;rt>=0;rt--)if(j[rt]===$||j[rt].listener===$){nt=j[rt].listener,tt=rt;break}if(tt<0)return this;tt===0?j.shift():spliceOne(j,tt),j.length===1&&(et[a]=j[0]),et.removeListener!==void 0&&this.emit("removeListener",a,nt||$)}return this};EventEmitter$1.prototype.off=EventEmitter$1.prototype.removeListener;EventEmitter$1.prototype.removeAllListeners=function(a){var $,j,et;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[a]),this;if(arguments.length===0){var tt=Object.keys(j),rt;for(et=0;et=0;et--)this.removeListener(a,$[et]);return this};function _listeners(_,a,$){var j=_._events;if(j===void 0)return[];var et=j[a];return et===void 0?[]:typeof et=="function"?$?[et.listener||et]:[et]:$?unwrapListeners(et):arrayClone(et,et.length)}EventEmitter$1.prototype.listeners=function(a){return _listeners(this,a,!0)};EventEmitter$1.prototype.rawListeners=function(a){return _listeners(this,a,!1)};EventEmitter$1.listenerCount=function(_,a){return typeof _.listenerCount=="function"?_.listenerCount(a):listenerCount.call(_,a)};EventEmitter$1.prototype.listenerCount=listenerCount;function listenerCount(_){var a=this._events;if(a!==void 0){var $=a[_];if(typeof $=="function")return 1;if($!==void 0)return $.length}return 0}EventEmitter$1.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(_,a){for(var $=new Array(a),j=0;j"u"||!getProto$4?undefined$4:getProto$4(Uint8Array),INTRINSICS$3={"%AggregateError%":typeof AggregateError>"u"?undefined$4:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$4:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$3&&getProto$4?getProto$4([][Symbol.iterator]()):undefined$4,"%AsyncFromSyncIteratorPrototype%":undefined$4,"%AsyncFunction%":needsEval$3,"%AsyncGenerator%":needsEval$3,"%AsyncGeneratorFunction%":needsEval$3,"%AsyncIteratorPrototype%":needsEval$3,"%Atomics%":typeof Atomics>"u"?undefined$4:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$4:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$4:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$4:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$4:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$4:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$4:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$4:FinalizationRegistry,"%Function%":$Function$3,"%GeneratorFunction%":needsEval$3,"%Int8Array%":typeof Int8Array>"u"?undefined$4:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$4:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$4:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols$3&&getProto$4?getProto$4(getProto$4([][Symbol.iterator]())):undefined$4,"%JSON%":typeof JSON=="object"?JSON:undefined$4,"%Map%":typeof Map>"u"?undefined$4:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols$3||!getProto$4?undefined$4:getProto$4(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$4:Promise,"%Proxy%":typeof Proxy>"u"?undefined$4:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$4:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$4:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols$3||!getProto$4?undefined$4:getProto$4(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$4:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$3&&getProto$4?getProto$4(""[Symbol.iterator]()):undefined$4,"%Symbol%":hasSymbols$3?Symbol:undefined$4,"%SyntaxError%":$SyntaxError$4,"%ThrowTypeError%":ThrowTypeError$3,"%TypedArray%":TypedArray$3,"%TypeError%":$TypeError$5,"%Uint8Array%":typeof Uint8Array>"u"?undefined$4:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$4:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$4:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$4:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$4:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$4:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$4:WeakSet};if(getProto$4)try{null.error}catch(_){var errorProto$3=getProto$4(getProto$4(_));INTRINSICS$3["%Error.prototype%"]=errorProto$3}var doEval$3=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor$3("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor$3("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor$3("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto$4&&($=getProto$4(et.prototype))}return INTRINSICS$3[a]=$,$},LEGACY_ALIASES$3={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$7=functionBind$4,hasOwn$4=src$3,$concat$3=bind$7.call(Function.call,Array.prototype.concat),$spliceApply$3=bind$7.call(Function.apply,Array.prototype.splice),$replace$3=bind$7.call(Function.call,String.prototype.replace),$strSlice$3=bind$7.call(Function.call,String.prototype.slice),$exec$3=bind$7.call(Function.call,RegExp.prototype.exec),rePropName$3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$3=/\\(\\)?/g,stringToPath$3=function(a){var $=$strSlice$3(a,0,1),j=$strSlice$3(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$4("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$4("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace$3(a,rePropName$3,function(tt,rt,nt,it){et[et.length]=nt?$replace$3(it,reEscapeChar$3,"$1"):rt||tt}),et},getBaseIntrinsic$3=function(a,$){var j=a,et;if(hasOwn$4(LEGACY_ALIASES$3,j)&&(et=LEGACY_ALIASES$3[j],j="%"+et[0]+"%"),hasOwn$4(INTRINSICS$3,j)){var tt=INTRINSICS$3[j];if(tt===needsEval$3&&(tt=doEval$3(j)),typeof tt>"u"&&!$)throw new $TypeError$5("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$4("intrinsic "+a+" does not exist!")},getIntrinsic$3=function(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$5("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$5('"allowMissing" argument must be a boolean');if($exec$3(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$4("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$3(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$3("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,at=tt.alias;at&&(et=at[0],$spliceApply$3(j,$concat$3([0,1],at)));for(var st=1,ot=!0;st=j.length){var xt=$gOPD$4(nt,ut);ot=!!xt,ot&&"get"in xt&&!("originalValue"in xt.get)?nt=xt.get:nt=nt[ut]}else ot=hasOwn$4(nt,ut),nt=nt[ut];ot&&!it&&(INTRINSICS$3[rt]=nt)}}return nt},callBind$4={exports:{}};(function(_){var a=functionBind$4,$=getIntrinsic$3,j=$("%Function.prototype.apply%"),et=$("%Function.prototype.call%"),tt=$("%Reflect.apply%",!0)||a.call(et,j),rt=$("%Object.getOwnPropertyDescriptor%",!0),nt=$("%Object.defineProperty%",!0),it=$("%Math.max%");if(nt)try{nt({},"a",{value:1})}catch{nt=null}_.exports=function(ot){var ut=tt(a,et,arguments);if(rt&&nt){var dt=rt(ut,"length");dt.configurable&&nt(ut,"length",{value:1+it(0,ot.length-(arguments.length-1))})}return ut};var at=function(){return tt(a,j,arguments)};nt?nt(_.exports,"apply",{value:at}):_.exports.apply=at})(callBind$4);var callBindExports$1=callBind$4.exports,GetIntrinsic$5=getIntrinsic$3,callBind$3=callBindExports$1,$indexOf$2=callBind$3(GetIntrinsic$5("String.prototype.indexOf")),callBound$5=function(a,$){var j=GetIntrinsic$5(a,!!$);return typeof j=="function"&&$indexOf$2(a,".prototype.")>-1?callBind$3(j):j},hasToStringTag$4=shams(),callBound$4=callBound$5,$toString$2=callBound$4("Object.prototype.toString"),isStandardArguments=function(a){return hasToStringTag$4&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:$toString$2(a)==="[object Arguments]"},isLegacyArguments=function(a){return isStandardArguments(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&$toString$2(a)!=="[object Array]"&&$toString$2(a.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments$1=supportsStandardArguments?isStandardArguments:isLegacyArguments,toStr$6=Object.prototype.toString,fnToStr$1=Function.prototype.toString,isFnRegex=/^\s*(?:function)?\*/,hasToStringTag$3=shams(),getProto$3=Object.getPrototypeOf,getGeneratorFunc=function(){if(!hasToStringTag$3)return!1;try{return Function("return function*() {}")()}catch{}},GeneratorFunction,isGeneratorFunction=function(a){if(typeof a!="function")return!1;if(isFnRegex.test(fnToStr$1.call(a)))return!0;if(!hasToStringTag$3){var $=toStr$6.call(a);return $==="[object GeneratorFunction]"}if(!getProto$3)return!1;if(typeof GeneratorFunction>"u"){var j=getGeneratorFunc();GeneratorFunction=j?getProto$3(j):!1}return getProto$3(a)===GeneratorFunction},fnToStr=Function.prototype.toString,reflectApply=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,badArrayLike,isCallableMarker;if(typeof reflectApply=="function"&&typeof Object.defineProperty=="function")try{badArrayLike=Object.defineProperty({},"length",{get:function(){throw isCallableMarker}}),isCallableMarker={},reflectApply(function(){throw 42},null,badArrayLike)}catch(_){_!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(a){try{var $=fnToStr.call(a);return constructorRegex.test($)}catch{return!1}},tryFunctionObject=function(a){try{return isES6ClassFn(a)?!1:(fnToStr.call(a),!0)}catch{return!1}},toStr$5=Object.prototype.toString,objectClass="[object Object]",fnClass="[object Function]",genClass="[object GeneratorFunction]",ddaClass="[object HTMLAllCollection]",ddaClass2="[object HTML document.all class]",ddaClass3="[object HTMLCollection]",hasToStringTag$2=typeof Symbol=="function"&&!!Symbol.toStringTag,isIE68=!(0 in[,]),isDDA=function(){return!1};if(typeof document=="object"){var all=document.all;toStr$5.call(all)===toStr$5.call(document.all)&&(isDDA=function(a){if((isIE68||!a)&&(typeof a>"u"||typeof a=="object"))try{var $=toStr$5.call(a);return($===ddaClass||$===ddaClass2||$===ddaClass3||$===objectClass)&&a("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(a){if(isDDA(a))return!0;if(!a||typeof a!="function"&&typeof a!="object")return!1;try{reflectApply(a,null,badArrayLike)}catch($){if($!==isCallableMarker)return!1}return!isES6ClassFn(a)&&tryFunctionObject(a)}:function(a){if(isDDA(a))return!0;if(!a||typeof a!="function"&&typeof a!="object")return!1;if(hasToStringTag$2)return tryFunctionObject(a);if(isES6ClassFn(a))return!1;var $=toStr$5.call(a);return $!==fnClass&&$!==genClass&&!/^\[object HTML/.test($)?!1:tryFunctionObject(a)},isCallable=isCallable$1,toStr$4=Object.prototype.toString,hasOwnProperty$2=Object.prototype.hasOwnProperty,forEachArray=function(a,$,j){for(var et=0,tt=a.length;et=3&&(et=j),toStr$4.call(a)==="[object Array]"?forEachArray(a,$,et):typeof a=="string"?forEachString(a,$,et):forEachObject(a,$,et)},forEach_1=forEach$4,possibleNames=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],g$3=typeof globalThis>"u"?commonjsGlobal:globalThis,availableTypedArrays$2=function(){for(var a=[],$=0;$"u"||!getProto$2?undefined$3:getProto$2(Uint8Array),INTRINSICS$2={"%AggregateError%":typeof AggregateError>"u"?undefined$3:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$3:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$2&&getProto$2?getProto$2([][Symbol.iterator]()):undefined$3,"%AsyncFromSyncIteratorPrototype%":undefined$3,"%AsyncFunction%":needsEval$2,"%AsyncGenerator%":needsEval$2,"%AsyncGeneratorFunction%":needsEval$2,"%AsyncIteratorPrototype%":needsEval$2,"%Atomics%":typeof Atomics>"u"?undefined$3:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$3:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$3:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$3:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$3:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$3:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$3:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$3:FinalizationRegistry,"%Function%":$Function$2,"%GeneratorFunction%":needsEval$2,"%Int8Array%":typeof Int8Array>"u"?undefined$3:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$3:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$3:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols$2&&getProto$2?getProto$2(getProto$2([][Symbol.iterator]())):undefined$3,"%JSON%":typeof JSON=="object"?JSON:undefined$3,"%Map%":typeof Map>"u"?undefined$3:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols$2||!getProto$2?undefined$3:getProto$2(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$3:Promise,"%Proxy%":typeof Proxy>"u"?undefined$3:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$3:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$3:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols$2||!getProto$2?undefined$3:getProto$2(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$3:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$2&&getProto$2?getProto$2(""[Symbol.iterator]()):undefined$3,"%Symbol%":hasSymbols$2?Symbol:undefined$3,"%SyntaxError%":$SyntaxError$3,"%ThrowTypeError%":ThrowTypeError$2,"%TypedArray%":TypedArray$2,"%TypeError%":$TypeError$4,"%Uint8Array%":typeof Uint8Array>"u"?undefined$3:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$3:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$3:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$3:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$3:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$3:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$3:WeakSet};if(getProto$2)try{null.error}catch(_){var errorProto$2=getProto$2(getProto$2(_));INTRINSICS$2["%Error.prototype%"]=errorProto$2}var doEval$2=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor$2("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor$2("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor$2("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto$2&&($=getProto$2(et.prototype))}return INTRINSICS$2[a]=$,$},LEGACY_ALIASES$2={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$6=functionBind$2,hasOwn$3=src$3,$concat$2=bind$6.call(Function.call,Array.prototype.concat),$spliceApply$2=bind$6.call(Function.apply,Array.prototype.splice),$replace$2=bind$6.call(Function.call,String.prototype.replace),$strSlice$2=bind$6.call(Function.call,String.prototype.slice),$exec$2=bind$6.call(Function.call,RegExp.prototype.exec),rePropName$2=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$2=/\\(\\)?/g,stringToPath$2=function(a){var $=$strSlice$2(a,0,1),j=$strSlice$2(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$3("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$3("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace$2(a,rePropName$2,function(tt,rt,nt,it){et[et.length]=nt?$replace$2(it,reEscapeChar$2,"$1"):rt||tt}),et},getBaseIntrinsic$2=function(a,$){var j=a,et;if(hasOwn$3(LEGACY_ALIASES$2,j)&&(et=LEGACY_ALIASES$2[j],j="%"+et[0]+"%"),hasOwn$3(INTRINSICS$2,j)){var tt=INTRINSICS$2[j];if(tt===needsEval$2&&(tt=doEval$2(j)),typeof tt>"u"&&!$)throw new $TypeError$4("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$3("intrinsic "+a+" does not exist!")},getIntrinsic$2=function(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$4("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$4('"allowMissing" argument must be a boolean');if($exec$2(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$3("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$2(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$2("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,at=tt.alias;at&&(et=at[0],$spliceApply$2(j,$concat$2([0,1],at)));for(var st=1,ot=!0;st=j.length){var xt=$gOPD$3(nt,ut);ot=!!xt,ot&&"get"in xt&&!("originalValue"in xt.get)?nt=xt.get:nt=nt[ut]}else ot=hasOwn$3(nt,ut),nt=nt[ut];ot&&!it&&(INTRINSICS$2[rt]=nt)}}return nt},GetIntrinsic$4=getIntrinsic$2,$gOPD$2=GetIntrinsic$4("%Object.getOwnPropertyDescriptor%",!0);if($gOPD$2)try{$gOPD$2([],"length")}catch{$gOPD$2=null}var gopd$1=$gOPD$2,forEach$3=forEach_1,availableTypedArrays$1=availableTypedArrays$2,callBound$3=callBound$5,$toString$1=callBound$3("Object.prototype.toString"),hasToStringTag$1=shams(),gOPD$2=gopd$1,g$2=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays$1=availableTypedArrays$1(),$indexOf$1=callBound$3("Array.prototype.indexOf",!0)||function(a,$){for(var j=0;j-1}return gOPD$2?tryTypedArrays$1(a):!1},forEach$2=forEach_1,availableTypedArrays=availableTypedArrays$2,callBound$2=callBound$5,gOPD$1=gopd$1,$toString=callBound$2("Object.prototype.toString"),hasToStringTag=shams(),g$1=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays=availableTypedArrays(),$slice=callBound$2("String.prototype.slice"),toStrTags={},getPrototypeOf$5=Object.getPrototypeOf;hasToStringTag&&gOPD$1&&getPrototypeOf$5&&forEach$2(typedArrays,function(_){if(typeof g$1[_]=="function"){var a=new g$1[_];if(Symbol.toStringTag in a){var $=getPrototypeOf$5(a),j=gOPD$1($,Symbol.toStringTag);if(!j){var et=getPrototypeOf$5($);j=gOPD$1(et,Symbol.toStringTag)}toStrTags[_]=j.get}}});var tryTypedArrays=function(a){var $=!1;return forEach$2(toStrTags,function(j,et){if(!$)try{var tt=j.call(a);tt===et&&($=tt)}catch{}}),$},isTypedArray$2=isTypedArray$3,whichTypedArray=function(a){return isTypedArray$2(a)?!hasToStringTag||!(Symbol.toStringTag in a)?$slice($toString(a),8,-1):tryTypedArrays(a):!1};(function(_){var a=isArguments$1,$=isGeneratorFunction,j=whichTypedArray,et=isTypedArray$3;function tt(fr){return fr.call.bind(fr)}var rt=typeof BigInt<"u",nt=typeof Symbol<"u",it=tt(Object.prototype.toString),at=tt(Number.prototype.valueOf),st=tt(String.prototype.valueOf),ot=tt(Boolean.prototype.valueOf);if(rt)var ut=tt(BigInt.prototype.valueOf);if(nt)var dt=tt(Symbol.prototype.valueOf);function mt(fr,Er){if(typeof fr!="object")return!1;try{return Er(fr),!0}catch{return!1}}_.isArgumentsObject=a,_.isGeneratorFunction=$,_.isTypedArray=et;function xt(fr){return typeof Promise<"u"&&fr instanceof Promise||fr!==null&&typeof fr=="object"&&typeof fr.then=="function"&&typeof fr.catch=="function"}_.isPromise=xt;function Ct(fr){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(fr):et(fr)||Ot(fr)}_.isArrayBufferView=Ct;function Pt(fr){return j(fr)==="Uint8Array"}_.isUint8Array=Pt;function Tt(fr){return j(fr)==="Uint8ClampedArray"}_.isUint8ClampedArray=Tt;function kt(fr){return j(fr)==="Uint16Array"}_.isUint16Array=kt;function Lt(fr){return j(fr)==="Uint32Array"}_.isUint32Array=Lt;function Nt(fr){return j(fr)==="Int8Array"}_.isInt8Array=Nt;function zt(fr){return j(fr)==="Int16Array"}_.isInt16Array=zt;function jt(fr){return j(fr)==="Int32Array"}_.isInt32Array=jt;function Mt(fr){return j(fr)==="Float32Array"}_.isFloat32Array=Mt;function Dt(fr){return j(fr)==="Float64Array"}_.isFloat64Array=Dt;function Ft(fr){return j(fr)==="BigInt64Array"}_.isBigInt64Array=Ft;function Bt(fr){return j(fr)==="BigUint64Array"}_.isBigUint64Array=Bt;function yt(fr){return it(fr)==="[object Map]"}yt.working=typeof Map<"u"&&yt(new Map);function bt(fr){return typeof Map>"u"?!1:yt.working?yt(fr):fr instanceof Map}_.isMap=bt;function ct(fr){return it(fr)==="[object Set]"}ct.working=typeof Set<"u"&&ct(new Set);function ht(fr){return typeof Set>"u"?!1:ct.working?ct(fr):fr instanceof Set}_.isSet=ht;function vt(fr){return it(fr)==="[object WeakMap]"}vt.working=typeof WeakMap<"u"&&vt(new WeakMap);function St(fr){return typeof WeakMap>"u"?!1:vt.working?vt(fr):fr instanceof WeakMap}_.isWeakMap=St;function Rt(fr){return it(fr)==="[object WeakSet]"}Rt.working=typeof WeakSet<"u"&&Rt(new WeakSet);function $t(fr){return Rt(fr)}_.isWeakSet=$t;function Et(fr){return it(fr)==="[object ArrayBuffer]"}Et.working=typeof ArrayBuffer<"u"&&Et(new ArrayBuffer);function At(fr){return typeof ArrayBuffer>"u"?!1:Et.working?Et(fr):fr instanceof ArrayBuffer}_.isArrayBuffer=At;function wt(fr){return it(fr)==="[object DataView]"}wt.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&wt(new DataView(new ArrayBuffer(1),0,1));function Ot(fr){return typeof DataView>"u"?!1:wt.working?wt(fr):fr instanceof DataView}_.isDataView=Ot;var tr=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function nr(fr){return it(fr)==="[object SharedArrayBuffer]"}function ir(fr){return typeof tr>"u"?!1:(typeof nr.working>"u"&&(nr.working=nr(new tr)),nr.working?nr(fr):fr instanceof tr)}_.isSharedArrayBuffer=ir;function Wt(fr){return it(fr)==="[object AsyncFunction]"}_.isAsyncFunction=Wt;function Kt(fr){return it(fr)==="[object Map Iterator]"}_.isMapIterator=Kt;function Jt(fr){return it(fr)==="[object Set Iterator]"}_.isSetIterator=Jt;function Ht(fr){return it(fr)==="[object Generator]"}_.isGeneratorObject=Ht;function Vt(fr){return it(fr)==="[object WebAssembly.Module]"}_.isWebAssemblyCompiledModule=Vt;function Qt(fr){return mt(fr,at)}_.isNumberObject=Qt;function dr(fr){return mt(fr,st)}_.isStringObject=dr;function xr(fr){return mt(fr,ot)}_.isBooleanObject=xr;function pr(fr){return rt&&mt(fr,ut)}_.isBigIntObject=pr;function Ir(fr){return nt&&mt(fr,dt)}_.isSymbolObject=Ir;function kr(fr){return Qt(fr)||dr(fr)||xr(fr)||pr(fr)||Ir(fr)}_.isBoxedPrimitive=kr;function lr(fr){return typeof Uint8Array<"u"&&(At(fr)||ir(fr))}_.isAnyArrayBuffer=lr,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(fr){Object.defineProperty(_,fr,{enumerable:!1,value:function(){throw new Error(fr+" is not supported in userland")}})})})(types$1);var isBufferBrowser=function(a){return a&&typeof a=="object"&&typeof a.copy=="function"&&typeof a.fill=="function"&&typeof a.readUInt8=="function"};(function(_){var a={},$=Object.getOwnPropertyDescriptors||function(tr){for(var nr=Object.keys(tr),ir={},Wt=0;Wt=Wt)return Ht;switch(Ht){case"%s":return String(ir[nr++]);case"%d":return Number(ir[nr++]);case"%j":try{return JSON.stringify(ir[nr++])}catch{return"[Circular]"}default:return Ht}}),Jt=ir[nr];nr"u")return function(){return _.deprecate(Ot,tr).apply(this,arguments)};var nr=!1;function ir(){if(!nr){if(process$1$1.throwDeprecation)throw new Error(tr);process$1$1.traceDeprecation?console.trace(tr):console.error(tr),nr=!0}return Ot.apply(this,arguments)}return ir};var et={},tt=/^$/;if(a.NODE_DEBUG){var rt=a.NODE_DEBUG;rt=rt.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),tt=new RegExp("^"+rt+"$","i")}_.debuglog=function(Ot){if(Ot=Ot.toUpperCase(),!et[Ot])if(tt.test(Ot)){var tr=process$1$1.pid;et[Ot]=function(){var nr=_.format.apply(_,arguments);console.error("%s %d: %s",Ot,tr,nr)}}else et[Ot]=function(){};return et[Ot]};function nt(Ot,tr){var nr={seen:[],stylize:at};return arguments.length>=3&&(nr.depth=arguments[2]),arguments.length>=4&&(nr.colors=arguments[3]),Tt(tr)?nr.showHidden=tr:tr&&_._extend(nr,tr),Mt(nr.showHidden)&&(nr.showHidden=!1),Mt(nr.depth)&&(nr.depth=2),Mt(nr.colors)&&(nr.colors=!1),Mt(nr.customInspect)&&(nr.customInspect=!0),nr.colors&&(nr.stylize=it),ot(nr,Ot,nr.depth)}_.inspect=nt,nt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},nt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function it(Ot,tr){var nr=nt.styles[tr];return nr?"\x1B["+nt.colors[nr][0]+"m"+Ot+"\x1B["+nt.colors[nr][1]+"m":Ot}function at(Ot,tr){return Ot}function st(Ot){var tr={};return Ot.forEach(function(nr,ir){tr[nr]=!0}),tr}function ot(Ot,tr,nr){if(Ot.customInspect&&tr&&bt(tr.inspect)&&tr.inspect!==_.inspect&&!(tr.constructor&&tr.constructor.prototype===tr)){var ir=tr.inspect(nr,Ot);return zt(ir)||(ir=ot(Ot,ir,nr)),ir}var Wt=ut(Ot,tr);if(Wt)return Wt;var Kt=Object.keys(tr),Jt=st(Kt);if(Ot.showHidden&&(Kt=Object.getOwnPropertyNames(tr)),yt(tr)&&(Kt.indexOf("message")>=0||Kt.indexOf("description")>=0))return dt(tr);if(Kt.length===0){if(bt(tr)){var Ht=tr.name?": "+tr.name:"";return Ot.stylize("[Function"+Ht+"]","special")}if(Dt(tr))return Ot.stylize(RegExp.prototype.toString.call(tr),"regexp");if(Bt(tr))return Ot.stylize(Date.prototype.toString.call(tr),"date");if(yt(tr))return dt(tr)}var Vt="",Qt=!1,dr=["{","}"];if(Pt(tr)&&(Qt=!0,dr=["[","]"]),bt(tr)){var xr=tr.name?": "+tr.name:"";Vt=" [Function"+xr+"]"}if(Dt(tr)&&(Vt=" "+RegExp.prototype.toString.call(tr)),Bt(tr)&&(Vt=" "+Date.prototype.toUTCString.call(tr)),yt(tr)&&(Vt=" "+dt(tr)),Kt.length===0&&(!Qt||tr.length==0))return dr[0]+Vt+dr[1];if(nr<0)return Dt(tr)?Ot.stylize(RegExp.prototype.toString.call(tr),"regexp"):Ot.stylize("[Object]","special");Ot.seen.push(tr);var pr;return Qt?pr=mt(Ot,tr,nr,Jt,Kt):pr=Kt.map(function(Ir){return xt(Ot,tr,nr,Jt,Ir,Qt)}),Ot.seen.pop(),Ct(pr,Vt,dr)}function ut(Ot,tr){if(Mt(tr))return Ot.stylize("undefined","undefined");if(zt(tr)){var nr="'"+JSON.stringify(tr).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return Ot.stylize(nr,"string")}if(Nt(tr))return Ot.stylize(""+tr,"number");if(Tt(tr))return Ot.stylize(""+tr,"boolean");if(kt(tr))return Ot.stylize("null","null")}function dt(Ot){return"["+Error.prototype.toString.call(Ot)+"]"}function mt(Ot,tr,nr,ir,Wt){for(var Kt=[],Jt=0,Ht=tr.length;Jt-1&&(Kt?Ht=Ht.split(` `).map(function(Qt){return" "+Qt}).join(` `).slice(2):Ht=` @@ -436,24 +436,24 @@ function print() { __p += __j.call(arguments, '') } `))):Ht=Ot.stylize("[Circular]","special")),Mt(Jt)){if(Kt&&Wt.match(/^\d+$/))return Ht;Jt=JSON.stringify(""+Wt),Jt.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Jt=Jt.slice(1,-1),Jt=Ot.stylize(Jt,"name")):(Jt=Jt.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Jt=Ot.stylize(Jt,"string"))}return Jt+": "+Ht}function Ct(Ot,tr,nr){var ir=Ot.reduce(function(Wt,Kt){return Kt.indexOf(` `)>=0,Wt+Kt.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ir>60?nr[0]+(tr===""?"":tr+` `)+" "+Ot.join(`, - `)+" "+nr[1]:nr[0]+tr+" "+Ot.join(", ")+" "+nr[1]}_.types=types$1;function Pt(Ot){return Array.isArray(Ot)}_.isArray=Pt;function Tt(Ot){return typeof Ot=="boolean"}_.isBoolean=Tt;function It(Ot){return Ot===null}_.isNull=It;function Lt(Ot){return Ot==null}_.isNullOrUndefined=Lt;function Nt(Ot){return typeof Ot=="number"}_.isNumber=Nt;function Ut(Ot){return typeof Ot=="string"}_.isString=Ut;function jt(Ot){return typeof Ot=="symbol"}_.isSymbol=jt;function Mt(Ot){return Ot===void 0}_.isUndefined=Mt;function Dt(Ot){return Ft(Ot)&&dt(Ot)==="[object RegExp]"}_.isRegExp=Dt,_.types.isRegExp=Dt;function Ft(Ot){return typeof Ot=="object"&&Ot!==null}_.isObject=Ft;function Bt(Ot){return Ft(Ot)&&dt(Ot)==="[object Date]"}_.isDate=Bt,_.types.isDate=Bt;function yt(Ot){return Ft(Ot)&&(dt(Ot)==="[object Error]"||Ot instanceof Error)}_.isError=yt,_.types.isNativeError=yt;function mt(Ot){return typeof Ot=="function"}_.isFunction=mt;function ct(Ot){return Ot===null||typeof Ot=="boolean"||typeof Ot=="number"||typeof Ot=="string"||typeof Ot=="symbol"||typeof Ot>"u"}_.isPrimitive=ct,_.isBuffer=isBufferBrowser;function dt(Ot){return Object.prototype.toString.call(Ot)}function vt(Ot){return Ot<10?"0"+Ot.toString(10):Ot.toString(10)}var St=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Rt(){var Ot=new Date,tr=[vt(Ot.getHours()),vt(Ot.getMinutes()),vt(Ot.getSeconds())].join(":");return[Ot.getDate(),St[Ot.getMonth()],tr].join(" ")}_.log=function(){console.log("%s - %s",Rt(),_.format.apply(_,arguments))},_.inherits=inherits_browserExports,_._extend=function(Ot,tr){if(!tr||!Ft(tr))return Ot;for(var nr=Object.keys(tr),ir=nr.length;ir--;)Ot[nr[ir]]=tr[nr[ir]];return Ot};function $t(Ot,tr){return Object.prototype.hasOwnProperty.call(Ot,tr)}var xt=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;_.promisify=function(tr){if(typeof tr!="function")throw new TypeError('The "original" argument must be of type Function');if(xt&&tr[xt]){var nr=tr[xt];if(typeof nr!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(nr,xt,{value:nr,enumerable:!1,writable:!1,configurable:!0}),nr}function nr(){for(var ir,Wt,Kt=new Promise(function(qt,Qt){ir=qt,Wt=Qt}),Jt=[],Ht=0;Ht0?this.tail.next=Pt:this.head=Pt,this.tail=Pt,++this.length}},{key:"unshift",value:function(Ct){var Pt={data:Ct,next:this.head};this.length===0&&(this.tail=Pt),this.head=Pt,++this.length}},{key:"shift",value:function(){if(this.length!==0){var Ct=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Ct}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(Ct){if(this.length===0)return"";for(var Pt=this.head,Tt=""+Pt.data;Pt=Pt.next;)Tt+=Ct+Pt.data;return Tt}},{key:"concat",value:function(Ct){if(this.length===0)return ot.alloc(0);for(var Pt=ot.allocUnsafe(Ct>>>0),Tt=this.head,It=0;Tt;)ht(Tt.data,Pt,It),It+=Tt.data.length,Tt=Tt.next;return Pt}},{key:"consume",value:function(Ct,Pt){var Tt;return CtLt.length?Lt.length:Ct;if(Nt===Lt.length?It+=Lt:It+=Lt.slice(0,Ct),Ct-=Nt,Ct===0){Nt===Lt.length?(++Tt,Pt.next?this.head=Pt.next:this.head=this.tail=null):(this.head=Pt,Pt.data=Lt.slice(Nt));break}++Tt}return this.length-=Tt,It}},{key:"_getBuffer",value:function(Ct){var Pt=ot.allocUnsafe(Ct),Tt=this.head,It=1;for(Tt.data.copy(Pt),Ct-=Tt.data.length;Tt=Tt.next;){var Lt=Tt.data,Nt=Ct>Lt.length?Lt.length:Ct;if(Lt.copy(Pt,Pt.length-Ct,0,Nt),Ct-=Nt,Ct===0){Nt===Lt.length?(++It,Tt.next?this.head=Tt.next:this.head=this.tail=null):(this.head=Tt,Tt.data=Lt.slice(Nt));break}++It}return this.length-=It,Pt}},{key:ut,value:function(Ct,Pt){return at(this,a(a({},Pt),{},{depth:0,customInspect:!1}))}}]),bt}(),buffer_list}function destroy(_,a){var $=this,j=this._readableState&&this._readableState.destroyed,et=this._writableState&&this._writableState.destroyed;return j||et?(a?a(_):_&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(emitErrorNT,this,_)):process$1$1.nextTick(emitErrorNT,this,_)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(_||null,function(tt){!a&&tt?$._writableState?$._writableState.errorEmitted?process$1$1.nextTick(emitCloseNT,$):($._writableState.errorEmitted=!0,process$1$1.nextTick(emitErrorAndCloseNT,$,tt)):process$1$1.nextTick(emitErrorAndCloseNT,$,tt):a?(process$1$1.nextTick(emitCloseNT,$),a(tt)):process$1$1.nextTick(emitCloseNT,$)}),this)}function emitErrorAndCloseNT(_,a){emitErrorNT(_,a),emitCloseNT(_)}function emitCloseNT(_){_._writableState&&!_._writableState.emitClose||_._readableState&&!_._readableState.emitClose||_.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(_,a){_.emit("error",a)}function errorOrDestroy(_,a){var $=_._readableState,j=_._writableState;$&&$.autoDestroy||j&&j.autoDestroy?_.destroy(a):_.emit("error",a)}var destroy_1$1={destroy,undestroy,errorOrDestroy},errorsBrowser={};function _inheritsLoose(_,a){_.prototype=Object.create(a.prototype),_.prototype.constructor=_,_.__proto__=a}var codes={};function createErrorType(_,a,$){$||($=Error);function j(tt,rt,nt){return typeof a=="string"?a:a(tt,rt,nt)}var et=function(tt){_inheritsLoose(rt,tt);function rt(nt,it,ot){return tt.call(this,j(nt,it,ot))||this}return rt}($);et.prototype.name=$.name,et.prototype.code=_,codes[_]=et}function oneOf(_,a){if(Array.isArray(_)){var $=_.length;return _=_.map(function(j){return String(j)}),$>2?"one of ".concat(a," ").concat(_.slice(0,$-1).join(", "),", or ")+_[$-1]:$===2?"one of ".concat(a," ").concat(_[0]," or ").concat(_[1]):"of ".concat(a," ").concat(_[0])}else return"of ".concat(a," ").concat(String(_))}function startsWith(_,a,$){return _.substr(0,a.length)===a}function endsWith$2(_,a,$){return($===void 0||$>_.length)&&($=_.length),_.substring($-a.length,$)===a}function includes(_,a,$){return typeof $!="number"&&($=0),$+a.length>_.length?!1:_.indexOf(a,$)!==-1}createErrorType("ERR_INVALID_OPT_VALUE",function(_,a){return'The value "'+a+'" is invalid for option "'+_+'"'},TypeError);createErrorType("ERR_INVALID_ARG_TYPE",function(_,a,$){var j;typeof a=="string"&&startsWith(a,"not ")?(j="must not be",a=a.replace(/^not /,"")):j="must be";var et;if(endsWith$2(_," argument"))et="The ".concat(_," ").concat(j," ").concat(oneOf(a,"type"));else{var tt=includes(_,".")?"property":"argument";et='The "'.concat(_,'" ').concat(tt," ").concat(j," ").concat(oneOf(a,"type"))}return et+=". Received type ".concat(typeof $),et},TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(_){return"The "+_+" method is not implemented"});createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",function(_){return"Cannot call "+_+" after a stream was destroyed"});createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",function(_){return"Unknown encoding: "+_},TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");errorsBrowser.codes=codes;var ERR_INVALID_OPT_VALUE=errorsBrowser.codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(_,a,$){return _.highWaterMark!=null?_.highWaterMark:a?_[$]:null}function getHighWaterMark(_,a,$,j){var et=highWaterMarkFrom(a,j,$);if(et!=null){if(!(isFinite(et)&&Math.floor(et)===et)||et<0){var tt=j?$:"highWaterMark";throw new ERR_INVALID_OPT_VALUE(tt,et)}return Math.floor(et)}return _.objectMode?16:16*1024}var state={getHighWaterMark},browser$c=deprecate;function deprecate(_,a){if(config$3("noDeprecation"))return _;var $=!1;function j(){if(!$){if(config$3("throwDeprecation"))throw new Error(a);config$3("traceDeprecation")?console.trace(a):console.warn(a),$=!0}return _.apply(this,arguments)}return j}function config$3(_){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var a=commonjsGlobal.localStorage[_];return a==null?!1:String(a).toLowerCase()==="true"}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=Mt;function _(ir){var Wt=this;this.next=null,this.entry=null,this.finish=function(){nr(Wt,ir)}}var a;Mt.WritableState=Ut;var $={deprecate:browser$c},j=streamBrowser$1,et=buffer$1.Buffer,tt=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function rt(ir){return et.from(ir)}function nt(ir){return et.isBuffer(ir)||ir instanceof tt}var it=destroy_1$1,ot=state,st=ot.getHighWaterMark,at=errorsBrowser.codes,ut=at.ERR_INVALID_ARG_TYPE,ht=at.ERR_METHOD_NOT_IMPLEMENTED,bt=at.ERR_MULTIPLE_CALLBACK,Et=at.ERR_STREAM_CANNOT_PIPE,Ct=at.ERR_STREAM_DESTROYED,Pt=at.ERR_STREAM_NULL_VALUES,Tt=at.ERR_STREAM_WRITE_AFTER_END,It=at.ERR_UNKNOWN_ENCODING,Lt=it.errorOrDestroy;inherits_browserExports(Mt,j);function Nt(){}function Ut(ir,Wt,Kt){a=a||require_stream_duplex$1(),ir=ir||{},typeof Kt!="boolean"&&(Kt=Wt instanceof a),this.objectMode=!!ir.objectMode,Kt&&(this.objectMode=this.objectMode||!!ir.writableObjectMode),this.highWaterMark=st(this,ir,"writableHighWaterMark",Kt),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Jt=ir.decodeStrings===!1;this.decodeStrings=!Jt,this.defaultEncoding=ir.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ht){vt(Wt,Ht)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=ir.emitClose!==!1,this.autoDestroy=!!ir.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new _(this)}Ut.prototype.getBuffer=function(){for(var Wt=this.bufferedRequest,Kt=[];Wt;)Kt.push(Wt),Wt=Wt.next;return Kt},function(){try{Object.defineProperty(Ut.prototype,"buffer",{get:$.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var jt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(jt=Function.prototype[Symbol.hasInstance],Object.defineProperty(Mt,Symbol.hasInstance,{value:function(Wt){return jt.call(this,Wt)?!0:this!==Mt?!1:Wt&&Wt._writableState instanceof Ut}})):jt=function(Wt){return Wt instanceof this};function Mt(ir){a=a||require_stream_duplex$1();var Wt=this instanceof a;if(!Wt&&!jt.call(Mt,this))return new Mt(ir);this._writableState=new Ut(ir,this,Wt),this.writable=!0,ir&&(typeof ir.write=="function"&&(this._write=ir.write),typeof ir.writev=="function"&&(this._writev=ir.writev),typeof ir.destroy=="function"&&(this._destroy=ir.destroy),typeof ir.final=="function"&&(this._final=ir.final)),j.call(this)}Mt.prototype.pipe=function(){Lt(this,new Et)};function Dt(ir,Wt){var Kt=new Tt;Lt(ir,Kt),process$1$1.nextTick(Wt,Kt)}function Ft(ir,Wt,Kt,Jt){var Ht;return Kt===null?Ht=new Pt:typeof Kt!="string"&&!Wt.objectMode&&(Ht=new ut("chunk",["string","Buffer"],Kt)),Ht?(Lt(ir,Ht),process$1$1.nextTick(Jt,Ht),!1):!0}Mt.prototype.write=function(ir,Wt,Kt){var Jt=this._writableState,Ht=!1,qt=!Jt.objectMode&&nt(ir);return qt&&!et.isBuffer(ir)&&(ir=rt(ir)),typeof Wt=="function"&&(Kt=Wt,Wt=null),qt?Wt="buffer":Wt||(Wt=Jt.defaultEncoding),typeof Kt!="function"&&(Kt=Nt),Jt.ending?Dt(this,Kt):(qt||Ft(this,Jt,ir,Kt))&&(Jt.pendingcb++,Ht=yt(this,Jt,qt,ir,Wt,Kt)),Ht},Mt.prototype.cork=function(){this._writableState.corked++},Mt.prototype.uncork=function(){var ir=this._writableState;ir.corked&&(ir.corked--,!ir.writing&&!ir.corked&&!ir.bufferProcessing&&ir.bufferedRequest&&$t(this,ir))},Mt.prototype.setDefaultEncoding=function(Wt){if(typeof Wt=="string"&&(Wt=Wt.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Wt+"").toLowerCase())>-1))throw new It(Wt);return this._writableState.defaultEncoding=Wt,this},Object.defineProperty(Mt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Bt(ir,Wt,Kt){return!ir.objectMode&&ir.decodeStrings!==!1&&typeof Wt=="string"&&(Wt=et.from(Wt,Kt)),Wt}Object.defineProperty(Mt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function yt(ir,Wt,Kt,Jt,Ht,qt){if(!Kt){var Qt=Bt(Wt,Jt,Ht);Jt!==Qt&&(Kt=!0,Ht="buffer",Jt=Qt)}var dr=Wt.objectMode?1:Jt.length;Wt.length+=dr;var xr=Wt.length>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function utf8CheckIncomplete(_,a,$){var j=a.length-1;if(j<$)return 0;var et=utf8CheckByte(a[j]);return et>=0?(et>0&&(_.lastNeed=et-1),et):--j<$||et===-2?0:(et=utf8CheckByte(a[j]),et>=0?(et>0&&(_.lastNeed=et-2),et):--j<$||et===-2?0:(et=utf8CheckByte(a[j]),et>=0?(et>0&&(et===2?et=0:_.lastNeed=et-3),et):0))}function utf8CheckExtraBytes(_,a,$){if((a[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&a.length>1){if((a[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&a.length>2&&(a[2]&192)!==128)return _.lastNeed=2,"�"}}function utf8FillLast(_){var a=this.lastTotal-this.lastNeed,$=utf8CheckExtraBytes(this,_);if($!==void 0)return $;if(this.lastNeed<=_.length)return _.copy(this.lastChar,a,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,a,0,_.length),this.lastNeed-=_.length}function utf8Text(_,a){var $=utf8CheckIncomplete(this,_,a);if(!this.lastNeed)return _.toString("utf8",a);this.lastTotal=$;var j=_.length-($-this.lastNeed);return _.copy(this.lastChar,0,j),_.toString("utf8",a,j)}function utf8End(_){var a=_&&_.length?this.write(_):"";return this.lastNeed?a+"�":a}function utf16Text(_,a){if((_.length-a)%2===0){var $=_.toString("utf16le",a);if($){var j=$.charCodeAt($.length-1);if(j>=55296&&j<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],$.slice(0,-1)}return $}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",a,_.length-1)}function utf16End(_){var a=_&&_.length?this.write(_):"";if(this.lastNeed){var $=this.lastTotal-this.lastNeed;return a+this.lastChar.toString("utf16le",0,$)}return a}function base64Text(_,a){var $=(_.length-a)%3;return $===0?_.toString("base64",a):(this.lastNeed=3-$,this.lastTotal=3,$===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",a,_.length-$))}function base64End(_){var a=_&&_.length?this.write(_):"";return this.lastNeed?a+this.lastChar.toString("base64",0,3-this.lastNeed):a}function simpleWrite(_){return _.toString(this.encoding)}function simpleEnd(_){return _&&_.length?this.write(_):""}var ERR_STREAM_PREMATURE_CLOSE=errorsBrowser.codes.ERR_STREAM_PREMATURE_CLOSE;function once$1(_){var a=!1;return function(){if(!a){a=!0;for(var $=arguments.length,j=new Array($),et=0;et<$;et++)j[et]=arguments[et];_.apply(this,j)}}}function noop$9(){}function isRequest$2(_){return _.setHeader&&typeof _.abort=="function"}function eos$1(_,a,$){if(typeof a=="function")return eos$1(_,null,a);a||(a={}),$=once$1($||noop$9);var j=a.readable||a.readable!==!1&&_.readable,et=a.writable||a.writable!==!1&&_.writable,tt=function(){_.writable||nt()},rt=_._writableState&&_._writableState.finished,nt=function(){et=!1,rt=!0,j||$.call(_)},it=_._readableState&&_._readableState.endEmitted,ot=function(){j=!1,it=!0,et||$.call(_)},st=function(bt){$.call(_,bt)},at=function(){var bt;if(j&&!it)return(!_._readableState||!_._readableState.ended)&&(bt=new ERR_STREAM_PREMATURE_CLOSE),$.call(_,bt);if(et&&!rt)return(!_._writableState||!_._writableState.ended)&&(bt=new ERR_STREAM_PREMATURE_CLOSE),$.call(_,bt)},ut=function(){_.req.on("finish",nt)};return isRequest$2(_)?(_.on("complete",nt),_.on("abort",at),_.req?ut():_.on("request",ut)):et&&!_._writableState&&(_.on("end",tt),_.on("close",tt)),_.on("end",ot),_.on("finish",nt),a.error!==!1&&_.on("error",st),_.on("close",at),function(){_.removeListener("complete",nt),_.removeListener("abort",at),_.removeListener("request",ut),_.req&&_.req.removeListener("finish",nt),_.removeListener("end",tt),_.removeListener("close",tt),_.removeListener("finish",nt),_.removeListener("end",ot),_.removeListener("error",st),_.removeListener("close",at)}}var endOfStream=eos$1,async_iterator,hasRequiredAsync_iterator;function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;hasRequiredAsync_iterator=1;var _;function a(It,Lt,Nt){return Lt=$(Lt),Lt in It?Object.defineProperty(It,Lt,{value:Nt,enumerable:!0,configurable:!0,writable:!0}):It[Lt]=Nt,It}function $(It){var Lt=j(It,"string");return typeof Lt=="symbol"?Lt:String(Lt)}function j(It,Lt){if(typeof It!="object"||It===null)return It;var Nt=It[Symbol.toPrimitive];if(Nt!==void 0){var Ut=Nt.call(It,Lt||"default");if(typeof Ut!="object")return Ut;throw new TypeError("@@toPrimitive must return a primitive value.")}return(Lt==="string"?String:Number)(It)}var et=endOfStream,tt=Symbol("lastResolve"),rt=Symbol("lastReject"),nt=Symbol("error"),it=Symbol("ended"),ot=Symbol("lastPromise"),st=Symbol("handlePromise"),at=Symbol("stream");function ut(It,Lt){return{value:It,done:Lt}}function ht(It){var Lt=It[tt];if(Lt!==null){var Nt=It[at].read();Nt!==null&&(It[ot]=null,It[tt]=null,It[rt]=null,Lt(ut(Nt,!1)))}}function bt(It){process$1$1.nextTick(ht,It)}function Et(It,Lt){return function(Nt,Ut){It.then(function(){if(Lt[it]){Nt(ut(void 0,!0));return}Lt[st](Nt,Ut)},Ut)}}var Ct=Object.getPrototypeOf(function(){}),Pt=Object.setPrototypeOf((_={get stream(){return this[at]},next:function(){var Lt=this,Nt=this[nt];if(Nt!==null)return Promise.reject(Nt);if(this[it])return Promise.resolve(ut(void 0,!0));if(this[at].destroyed)return new Promise(function(Dt,Ft){process$1$1.nextTick(function(){Lt[nt]?Ft(Lt[nt]):Dt(ut(void 0,!0))})});var Ut=this[ot],jt;if(Ut)jt=new Promise(Et(Ut,this));else{var Mt=this[at].read();if(Mt!==null)return Promise.resolve(ut(Mt,!1));jt=new Promise(this[st])}return this[ot]=jt,jt}},a(_,Symbol.asyncIterator,function(){return this}),a(_,"return",function(){var Lt=this;return new Promise(function(Nt,Ut){Lt[at].destroy(null,function(jt){if(jt){Ut(jt);return}Nt(ut(void 0,!0))})})}),_),Ct),Tt=function(Lt){var Nt,Ut=Object.create(Pt,(Nt={},a(Nt,at,{value:Lt,writable:!0}),a(Nt,tt,{value:null,writable:!0}),a(Nt,rt,{value:null,writable:!0}),a(Nt,nt,{value:null,writable:!0}),a(Nt,it,{value:Lt._readableState.endEmitted,writable:!0}),a(Nt,st,{value:function(Mt,Dt){var Ft=Ut[at].read();Ft?(Ut[ot]=null,Ut[tt]=null,Ut[rt]=null,Mt(ut(Ft,!1))):(Ut[tt]=Mt,Ut[rt]=Dt)},writable:!0}),Nt));return Ut[ot]=null,et(Lt,function(jt){if(jt&&jt.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Mt=Ut[rt];Mt!==null&&(Ut[ot]=null,Ut[tt]=null,Ut[rt]=null,Mt(jt)),Ut[nt]=jt;return}var Dt=Ut[tt];Dt!==null&&(Ut[ot]=null,Ut[tt]=null,Ut[rt]=null,Dt(ut(void 0,!0))),Ut[it]=!0}),Lt.on("readable",bt.bind(null,Ut)),Ut};return async_iterator=Tt,async_iterator}var fromBrowser,hasRequiredFromBrowser;function requireFromBrowser(){return hasRequiredFromBrowser||(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")}),fromBrowser}var _stream_readable$1,hasRequired_stream_readable$1;function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;hasRequired_stream_readable$1=1,_stream_readable$1=Dt;var _;Dt.ReadableState=Mt,eventsExports.EventEmitter;var a=function(Qt,dr){return Qt.listeners(dr).length},$=streamBrowser$1,j=buffer$1.Buffer,et=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function tt(qt){return j.from(qt)}function rt(qt){return j.isBuffer(qt)||qt instanceof et}var nt=util$5,it;nt&&nt.debuglog?it=nt.debuglog("stream"):it=function(){};var ot=requireBuffer_list(),st=destroy_1$1,at=state,ut=at.getHighWaterMark,ht=errorsBrowser.codes,bt=ht.ERR_INVALID_ARG_TYPE,Et=ht.ERR_STREAM_PUSH_AFTER_EOF,Ct=ht.ERR_METHOD_NOT_IMPLEMENTED,Pt=ht.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Tt,It,Lt;inherits_browserExports(Dt,$);var Nt=st.errorOrDestroy,Ut=["error","close","destroy","pause","resume"];function jt(qt,Qt,dr){if(typeof qt.prependListener=="function")return qt.prependListener(Qt,dr);!qt._events||!qt._events[Qt]?qt.on(Qt,dr):Array.isArray(qt._events[Qt])?qt._events[Qt].unshift(dr):qt._events[Qt]=[dr,qt._events[Qt]]}function Mt(qt,Qt,dr){_=_||require_stream_duplex$1(),qt=qt||{},typeof dr!="boolean"&&(dr=Qt instanceof _),this.objectMode=!!qt.objectMode,dr&&(this.objectMode=this.objectMode||!!qt.readableObjectMode),this.highWaterMark=ut(this,qt,"readableHighWaterMark",dr),this.buffer=new ot,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=qt.emitClose!==!1,this.autoDestroy=!!qt.autoDestroy,this.destroyed=!1,this.defaultEncoding=qt.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,qt.encoding&&(Tt||(Tt=string_decoder$1.StringDecoder),this.decoder=new Tt(qt.encoding),this.encoding=qt.encoding)}function Dt(qt){if(_=_||require_stream_duplex$1(),!(this instanceof Dt))return new Dt(qt);var Qt=this instanceof _;this._readableState=new Mt(qt,this,Qt),this.readable=!0,qt&&(typeof qt.read=="function"&&(this._read=qt.read),typeof qt.destroy=="function"&&(this._destroy=qt.destroy)),$.call(this)}Object.defineProperty(Dt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Qt){this._readableState&&(this._readableState.destroyed=Qt)}}),Dt.prototype.destroy=st.destroy,Dt.prototype._undestroy=st.undestroy,Dt.prototype._destroy=function(qt,Qt){Qt(qt)},Dt.prototype.push=function(qt,Qt){var dr=this._readableState,xr;return dr.objectMode?xr=!0:typeof qt=="string"&&(Qt=Qt||dr.defaultEncoding,Qt!==dr.encoding&&(qt=j.from(qt,Qt),Qt=""),xr=!0),Ft(this,qt,Qt,!1,xr)},Dt.prototype.unshift=function(qt){return Ft(this,qt,null,!0,!1)};function Ft(qt,Qt,dr,xr,pr){it("readableAddChunk",Qt);var kr=qt._readableState;if(Qt===null)kr.reading=!1,vt(qt,kr);else{var Ir;if(pr||(Ir=yt(kr,Qt)),Ir)Nt(qt,Ir);else if(kr.objectMode||Qt&&Qt.length>0)if(typeof Qt!="string"&&!kr.objectMode&&Object.getPrototypeOf(Qt)!==j.prototype&&(Qt=tt(Qt)),xr)kr.endEmitted?Nt(qt,new Pt):Bt(qt,kr,Qt,!0);else if(kr.ended)Nt(qt,new Et);else{if(kr.destroyed)return!1;kr.reading=!1,kr.decoder&&!dr?(Qt=kr.decoder.write(Qt),kr.objectMode||Qt.length!==0?Bt(qt,kr,Qt,!1):$t(qt,kr)):Bt(qt,kr,Qt,!1)}else xr||(kr.reading=!1,$t(qt,kr))}return!kr.ended&&(kr.length=mt?qt=mt:(qt--,qt|=qt>>>1,qt|=qt>>>2,qt|=qt>>>4,qt|=qt>>>8,qt|=qt>>>16,qt++),qt}function dt(qt,Qt){return qt<=0||Qt.length===0&&Qt.ended?0:Qt.objectMode?1:qt!==qt?Qt.flowing&&Qt.length?Qt.buffer.head.data.length:Qt.length:(qt>Qt.highWaterMark&&(Qt.highWaterMark=ct(qt)),qt<=Qt.length?qt:Qt.ended?Qt.length:(Qt.needReadable=!0,0))}Dt.prototype.read=function(qt){it("read",qt),qt=parseInt(qt,10);var Qt=this._readableState,dr=qt;if(qt!==0&&(Qt.emittedReadable=!1),qt===0&&Qt.needReadable&&((Qt.highWaterMark!==0?Qt.length>=Qt.highWaterMark:Qt.length>0)||Qt.ended))return it("read: emitReadable",Qt.length,Qt.ended),Qt.length===0&&Qt.ended?Kt(this):St(this),null;if(qt=dt(qt,Qt),qt===0&&Qt.ended)return Qt.length===0&&Kt(this),null;var xr=Qt.needReadable;it("need readable",xr),(Qt.length===0||Qt.length-qt0?pr=Wt(qt,Qt):pr=null,pr===null?(Qt.needReadable=Qt.length<=Qt.highWaterMark,qt=0):(Qt.length-=qt,Qt.awaitDrain=0),Qt.length===0&&(Qt.ended||(Qt.needReadable=!0),dr!==qt&&Qt.ended&&Kt(this)),pr!==null&&this.emit("data",pr),pr};function vt(qt,Qt){if(it("onEofChunk"),!Qt.ended){if(Qt.decoder){var dr=Qt.decoder.end();dr&&dr.length&&(Qt.buffer.push(dr),Qt.length+=Qt.objectMode?1:dr.length)}Qt.ended=!0,Qt.sync?St(qt):(Qt.needReadable=!1,Qt.emittedReadable||(Qt.emittedReadable=!0,Rt(qt)))}}function St(qt){var Qt=qt._readableState;it("emitReadable",Qt.needReadable,Qt.emittedReadable),Qt.needReadable=!1,Qt.emittedReadable||(it("emitReadable",Qt.flowing),Qt.emittedReadable=!0,process$1$1.nextTick(Rt,qt))}function Rt(qt){var Qt=qt._readableState;it("emitReadable_",Qt.destroyed,Qt.length,Qt.ended),!Qt.destroyed&&(Qt.length||Qt.ended)&&(qt.emit("readable"),Qt.emittedReadable=!1),Qt.needReadable=!Qt.flowing&&!Qt.ended&&Qt.length<=Qt.highWaterMark,ir(qt)}function $t(qt,Qt){Qt.readingMore||(Qt.readingMore=!0,process$1$1.nextTick(xt,qt,Qt))}function xt(qt,Qt){for(;!Qt.reading&&!Qt.ended&&(Qt.length1&&Ht(xr.pipes,qt)!==-1)&&!Er&&(it("false write response, pause",xr.awaitDrain),xr.awaitDrain++),dr.pause())}function Rr(or){it("onerror",or),Lr(),qt.removeListener("error",Rr),a(qt,"error")===0&&Nt(qt,or)}jt(qt,"error",Rr);function Ar(){qt.removeListener("finish",Or),Lr()}qt.once("close",Ar);function Or(){it("onfinish"),qt.removeListener("close",Ar),Lr()}qt.once("finish",Or);function Lr(){it("unpipe"),dr.unpipe(qt)}return qt.emit("pipe",dr),xr.flowing||(it("pipe resume"),dr.resume()),qt};function At(qt){return function(){var dr=qt._readableState;it("pipeOnDrain",dr.awaitDrain),dr.awaitDrain&&dr.awaitDrain--,dr.awaitDrain===0&&a(qt,"data")&&(dr.flowing=!0,ir(qt))}}Dt.prototype.unpipe=function(qt){var Qt=this._readableState,dr={hasUnpiped:!1};if(Qt.pipesCount===0)return this;if(Qt.pipesCount===1)return qt&&qt!==Qt.pipes?this:(qt||(qt=Qt.pipes),Qt.pipes=null,Qt.pipesCount=0,Qt.flowing=!1,qt&&qt.emit("unpipe",this,dr),this);if(!qt){var xr=Qt.pipes,pr=Qt.pipesCount;Qt.pipes=null,Qt.pipesCount=0,Qt.flowing=!1;for(var kr=0;kr0,xr.flowing!==!1&&this.resume()):qt==="readable"&&!xr.endEmitted&&!xr.readableListening&&(xr.readableListening=xr.needReadable=!0,xr.flowing=!1,xr.emittedReadable=!1,it("on readable",xr.length,xr.reading),xr.length?St(this):xr.reading||process$1$1.nextTick(Ot,this)),dr},Dt.prototype.addListener=Dt.prototype.on,Dt.prototype.removeListener=function(qt,Qt){var dr=$.prototype.removeListener.call(this,qt,Qt);return qt==="readable"&&process$1$1.nextTick(wt,this),dr},Dt.prototype.removeAllListeners=function(qt){var Qt=$.prototype.removeAllListeners.apply(this,arguments);return(qt==="readable"||qt===void 0)&&process$1$1.nextTick(wt,this),Qt};function wt(qt){var Qt=qt._readableState;Qt.readableListening=qt.listenerCount("readable")>0,Qt.resumeScheduled&&!Qt.paused?Qt.flowing=!0:qt.listenerCount("data")>0&&qt.resume()}function Ot(qt){it("readable nexttick read 0"),qt.read(0)}Dt.prototype.resume=function(){var qt=this._readableState;return qt.flowing||(it("resume"),qt.flowing=!qt.readableListening,tr(this,qt)),qt.paused=!1,this};function tr(qt,Qt){Qt.resumeScheduled||(Qt.resumeScheduled=!0,process$1$1.nextTick(nr,qt,Qt))}function nr(qt,Qt){it("resume",Qt.reading),Qt.reading||qt.read(0),Qt.resumeScheduled=!1,qt.emit("resume"),ir(qt),Qt.flowing&&!Qt.reading&&qt.read(0)}Dt.prototype.pause=function(){return it("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(it("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function ir(qt){var Qt=qt._readableState;for(it("flow",Qt.flowing);Qt.flowing&&qt.read()!==null;);}Dt.prototype.wrap=function(qt){var Qt=this,dr=this._readableState,xr=!1;qt.on("end",function(){if(it("wrapped end"),dr.decoder&&!dr.ended){var Ir=dr.decoder.end();Ir&&Ir.length&&Qt.push(Ir)}Qt.push(null)}),qt.on("data",function(Ir){if(it("wrapped data"),dr.decoder&&(Ir=dr.decoder.write(Ir)),!(dr.objectMode&&Ir==null)&&!(!dr.objectMode&&(!Ir||!Ir.length))){var lr=Qt.push(Ir);lr||(xr=!0,qt.pause())}});for(var pr in qt)this[pr]===void 0&&typeof qt[pr]=="function"&&(this[pr]=function(lr){return function(){return qt[lr].apply(qt,arguments)}}(pr));for(var kr=0;kr=Qt.length?(Qt.decoder?dr=Qt.buffer.join(""):Qt.buffer.length===1?dr=Qt.buffer.first():dr=Qt.buffer.concat(Qt.length),Qt.buffer.clear()):dr=Qt.buffer.consume(qt,Qt.decoder),dr}function Kt(qt){var Qt=qt._readableState;it("endReadable",Qt.endEmitted),Qt.endEmitted||(Qt.ended=!0,process$1$1.nextTick(Jt,Qt,qt))}function Jt(qt,Qt){if(it("endReadableNT",qt.endEmitted,qt.length),!qt.endEmitted&&qt.length===0&&(qt.endEmitted=!0,Qt.readable=!1,Qt.emit("end"),qt.autoDestroy)){var dr=Qt._writableState;(!dr||dr.autoDestroy&&dr.finished)&&Qt.destroy()}}typeof Symbol=="function"&&(Dt.from=function(qt,Qt){return Lt===void 0&&(Lt=requireFromBrowser()),Lt(Dt,qt,Qt)});function Ht(qt,Qt){for(var dr=0,xr=qt.length;dr0;return destroyer(rt,it,ot,function(st){et||(et=st),st&&tt.forEach(call$1),!it&&(tt.forEach(call$1),j(et))})});return a.reduce(pipe)}var pipeline_1=pipeline;(function(_,a){a=_.exports=require_stream_readable$1(),a.Stream=a,a.Readable=a,a.Writable=require_stream_writable$1(),a.Duplex=require_stream_duplex$1(),a.Transform=_stream_transform$1,a.PassThrough=_stream_passthrough$1,a.finished=endOfStream,a.pipeline=pipeline_1})(readableBrowser$1,readableBrowser$1.exports);var readableBrowserExports=readableBrowser$1.exports,Buffer$e=safeBufferExports.Buffer,Transform$1=readableBrowserExports.Transform,inherits$k=inherits_browserExports;function throwIfNotStringOrBuffer(_,a){if(!Buffer$e.isBuffer(_)&&typeof _!="string")throw new TypeError(a+" must be a string or a buffer")}function HashBase$2(_){Transform$1.call(this),this._block=Buffer$e.allocUnsafe(_),this._blockSize=_,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$k(HashBase$2,Transform$1);HashBase$2.prototype._transform=function(_,a,$){var j=null;try{this.update(_,a)}catch(et){j=et}$(j)};HashBase$2.prototype._flush=function(_){var a=null;try{this.push(this.digest())}catch($){a=$}_(a)};HashBase$2.prototype.update=function(_,a){if(throwIfNotStringOrBuffer(_,"Data"),this._finalized)throw new Error("Digest already called");Buffer$e.isBuffer(_)||(_=Buffer$e.from(_,a));for(var $=this._block,j=0;this._blockOffset+_.length-j>=this._blockSize;){for(var et=this._blockOffset;et0;++tt)this._length[tt]+=rt,rt=this._length[tt]/4294967296|0,rt>0&&(this._length[tt]-=4294967296*rt);return this};HashBase$2.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$2.prototype.digest=function(_){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();_!==void 0&&(a=a.toString(_)),this._block.fill(0),this._blockOffset=0;for(var $=0;$<4;++$)this._length[$]=0;return a};HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$j=inherits_browserExports,HashBase$1=hashBase,Buffer$d=safeBufferExports.Buffer,ARRAY16$1=new Array(16);function MD5$2(){HashBase$1.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$j(MD5$2,HashBase$1);MD5$2.prototype._update=function(){for(var _=ARRAY16$1,a=0;a<16;++a)_[a]=this._block.readInt32LE(a*4);var $=this._a,j=this._b,et=this._c,tt=this._d;$=fnF($,j,et,tt,_[0],3614090360,7),tt=fnF(tt,$,j,et,_[1],3905402710,12),et=fnF(et,tt,$,j,_[2],606105819,17),j=fnF(j,et,tt,$,_[3],3250441966,22),$=fnF($,j,et,tt,_[4],4118548399,7),tt=fnF(tt,$,j,et,_[5],1200080426,12),et=fnF(et,tt,$,j,_[6],2821735955,17),j=fnF(j,et,tt,$,_[7],4249261313,22),$=fnF($,j,et,tt,_[8],1770035416,7),tt=fnF(tt,$,j,et,_[9],2336552879,12),et=fnF(et,tt,$,j,_[10],4294925233,17),j=fnF(j,et,tt,$,_[11],2304563134,22),$=fnF($,j,et,tt,_[12],1804603682,7),tt=fnF(tt,$,j,et,_[13],4254626195,12),et=fnF(et,tt,$,j,_[14],2792965006,17),j=fnF(j,et,tt,$,_[15],1236535329,22),$=fnG($,j,et,tt,_[1],4129170786,5),tt=fnG(tt,$,j,et,_[6],3225465664,9),et=fnG(et,tt,$,j,_[11],643717713,14),j=fnG(j,et,tt,$,_[0],3921069994,20),$=fnG($,j,et,tt,_[5],3593408605,5),tt=fnG(tt,$,j,et,_[10],38016083,9),et=fnG(et,tt,$,j,_[15],3634488961,14),j=fnG(j,et,tt,$,_[4],3889429448,20),$=fnG($,j,et,tt,_[9],568446438,5),tt=fnG(tt,$,j,et,_[14],3275163606,9),et=fnG(et,tt,$,j,_[3],4107603335,14),j=fnG(j,et,tt,$,_[8],1163531501,20),$=fnG($,j,et,tt,_[13],2850285829,5),tt=fnG(tt,$,j,et,_[2],4243563512,9),et=fnG(et,tt,$,j,_[7],1735328473,14),j=fnG(j,et,tt,$,_[12],2368359562,20),$=fnH($,j,et,tt,_[5],4294588738,4),tt=fnH(tt,$,j,et,_[8],2272392833,11),et=fnH(et,tt,$,j,_[11],1839030562,16),j=fnH(j,et,tt,$,_[14],4259657740,23),$=fnH($,j,et,tt,_[1],2763975236,4),tt=fnH(tt,$,j,et,_[4],1272893353,11),et=fnH(et,tt,$,j,_[7],4139469664,16),j=fnH(j,et,tt,$,_[10],3200236656,23),$=fnH($,j,et,tt,_[13],681279174,4),tt=fnH(tt,$,j,et,_[0],3936430074,11),et=fnH(et,tt,$,j,_[3],3572445317,16),j=fnH(j,et,tt,$,_[6],76029189,23),$=fnH($,j,et,tt,_[9],3654602809,4),tt=fnH(tt,$,j,et,_[12],3873151461,11),et=fnH(et,tt,$,j,_[15],530742520,16),j=fnH(j,et,tt,$,_[2],3299628645,23),$=fnI($,j,et,tt,_[0],4096336452,6),tt=fnI(tt,$,j,et,_[7],1126891415,10),et=fnI(et,tt,$,j,_[14],2878612391,15),j=fnI(j,et,tt,$,_[5],4237533241,21),$=fnI($,j,et,tt,_[12],1700485571,6),tt=fnI(tt,$,j,et,_[3],2399980690,10),et=fnI(et,tt,$,j,_[10],4293915773,15),j=fnI(j,et,tt,$,_[1],2240044497,21),$=fnI($,j,et,tt,_[8],1873313359,6),tt=fnI(tt,$,j,et,_[15],4264355552,10),et=fnI(et,tt,$,j,_[6],2734768916,15),j=fnI(j,et,tt,$,_[13],1309151649,21),$=fnI($,j,et,tt,_[4],4149444226,6),tt=fnI(tt,$,j,et,_[11],3174756917,10),et=fnI(et,tt,$,j,_[2],718787259,15),j=fnI(j,et,tt,$,_[9],3951481745,21),this._a=this._a+$|0,this._b=this._b+j|0,this._c=this._c+et|0,this._d=this._d+tt|0};MD5$2.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var _=Buffer$d.allocUnsafe(16);return _.writeInt32LE(this._a,0),_.writeInt32LE(this._b,4),_.writeInt32LE(this._c,8),_.writeInt32LE(this._d,12),_};function rotl$1(_,a){return _<>>32-a}function fnF(_,a,$,j,et,tt,rt){return rotl$1(_+(a&$|~a&j)+et+tt|0,rt)+a|0}function fnG(_,a,$,j,et,tt,rt){return rotl$1(_+(a&j|$&~j)+et+tt|0,rt)+a|0}function fnH(_,a,$,j,et,tt,rt){return rotl$1(_+(a^$^j)+et+tt|0,rt)+a|0}function fnI(_,a,$,j,et,tt,rt){return rotl$1(_+($^(a|~j))+et+tt|0,rt)+a|0}var md5_js=MD5$2,Buffer$c=buffer$1.Buffer,inherits$i=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160$3(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$i(RIPEMD160$3,HashBase);RIPEMD160$3.prototype._update=function(){for(var _=ARRAY16,a=0;a<16;++a)_[a]=this._block.readInt32LE(a*4);for(var $=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=this._a|0,it=this._b|0,ot=this._c|0,st=this._d|0,at=this._e|0,ut=0;ut<80;ut+=1){var ht,bt;ut<16?(ht=fn1($,j,et,tt,rt,_[zl[ut]],hl[0],sl[ut]),bt=fn5(nt,it,ot,st,at,_[zr[ut]],hr[0],sr[ut])):ut<32?(ht=fn2($,j,et,tt,rt,_[zl[ut]],hl[1],sl[ut]),bt=fn4(nt,it,ot,st,at,_[zr[ut]],hr[1],sr[ut])):ut<48?(ht=fn3($,j,et,tt,rt,_[zl[ut]],hl[2],sl[ut]),bt=fn3(nt,it,ot,st,at,_[zr[ut]],hr[2],sr[ut])):ut<64?(ht=fn4($,j,et,tt,rt,_[zl[ut]],hl[3],sl[ut]),bt=fn2(nt,it,ot,st,at,_[zr[ut]],hr[3],sr[ut])):(ht=fn5($,j,et,tt,rt,_[zl[ut]],hl[4],sl[ut]),bt=fn1(nt,it,ot,st,at,_[zr[ut]],hr[4],sr[ut])),$=rt,rt=tt,tt=rotl(et,10),et=j,j=ht,nt=at,at=st,st=rotl(ot,10),ot=it,it=bt}var Et=this._b+et+st|0;this._b=this._c+tt+at|0,this._c=this._d+rt+nt|0,this._d=this._e+$+it|0,this._e=this._a+j+ot|0,this._a=Et};RIPEMD160$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var _=Buffer$c.alloc?Buffer$c.alloc(20):new Buffer$c(20);return _.writeInt32LE(this._a,0),_.writeInt32LE(this._b,4),_.writeInt32LE(this._c,8),_.writeInt32LE(this._d,12),_.writeInt32LE(this._e,16),_};function rotl(_,a){return _<>>32-a}function fn1(_,a,$,j,et,tt,rt,nt){return rotl(_+(a^$^j)+tt+rt|0,nt)+et|0}function fn2(_,a,$,j,et,tt,rt,nt){return rotl(_+(a&$|~a&j)+tt+rt|0,nt)+et|0}function fn3(_,a,$,j,et,tt,rt,nt){return rotl(_+((a|~$)^j)+tt+rt|0,nt)+et|0}function fn4(_,a,$,j,et,tt,rt,nt){return rotl(_+(a&j|$&~j)+tt+rt|0,nt)+et|0}function fn5(_,a,$,j,et,tt,rt,nt){return rotl(_+(a^($|~j))+tt+rt|0,nt)+et|0}var ripemd160=RIPEMD160$3,sha_js={exports:{}},Buffer$b=safeBufferExports.Buffer;function Hash$8(_,a){this._block=Buffer$b.alloc(_),this._finalSize=a,this._blockSize=_,this._len=0}Hash$8.prototype.update=function(_,a){typeof _=="string"&&(a=a||"utf8",_=Buffer$b.from(_,a));for(var $=this._block,j=this._blockSize,et=_.length,tt=this._len,rt=0;rt=this._finalSize&&(this._update(this._block),this._block.fill(0));var $=this._len*8;if($<=4294967295)this._block.writeUInt32BE($,this._blockSize-4);else{var j=($&4294967295)>>>0,et=($-j)/4294967296;this._block.writeUInt32BE(et,this._blockSize-8),this._block.writeUInt32BE(j,this._blockSize-4)}this._update(this._block);var tt=this._hash();return _?tt.toString(_):tt};Hash$8.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$8=Hash$8,inherits$h=inherits_browserExports,Hash$7=hash$8,Buffer$a=safeBufferExports.Buffer,K$5=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$7.call(this,64,56)}inherits$h(Sha,Hash$7);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(_){return _<<5|_>>>27}function rotl30$1(_){return _<<30|_>>>2}function ft$1(_,a,$,j){return _===0?a&$|~a&j:_===2?a&$|a&j|$&j:a^$^j}Sha.prototype._update=function(_){for(var a=this._w,$=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=0;nt<16;++nt)a[nt]=_.readInt32BE(nt*4);for(;nt<80;++nt)a[nt]=a[nt-3]^a[nt-8]^a[nt-14]^a[nt-16];for(var it=0;it<80;++it){var ot=~~(it/20),st=rotl5$1($)+ft$1(ot,j,et,tt)+rt+a[it]+K$5[ot]|0;rt=tt,tt=et,et=rotl30$1(j),j=$,$=st}this._a=$+this._a|0,this._b=j+this._b|0,this._c=et+this._c|0,this._d=tt+this._d|0,this._e=rt+this._e|0};Sha.prototype._hash=function(){var _=Buffer$a.allocUnsafe(20);return _.writeInt32BE(this._a|0,0),_.writeInt32BE(this._b|0,4),_.writeInt32BE(this._c|0,8),_.writeInt32BE(this._d|0,12),_.writeInt32BE(this._e|0,16),_};var sha$3=Sha,inherits$g=inherits_browserExports,Hash$6=hash$8,Buffer$9=safeBufferExports.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$6.call(this,64,56)}inherits$g(Sha1,Hash$6);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(_){return _<<1|_>>>31}function rotl5(_){return _<<5|_>>>27}function rotl30(_){return _<<30|_>>>2}function ft(_,a,$,j){return _===0?a&$|~a&j:_===2?a&$|a&j|$&j:a^$^j}Sha1.prototype._update=function(_){for(var a=this._w,$=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=0;nt<16;++nt)a[nt]=_.readInt32BE(nt*4);for(;nt<80;++nt)a[nt]=rotl1(a[nt-3]^a[nt-8]^a[nt-14]^a[nt-16]);for(var it=0;it<80;++it){var ot=~~(it/20),st=rotl5($)+ft(ot,j,et,tt)+rt+a[it]+K$4[ot]|0;rt=tt,tt=et,et=rotl30(j),j=$,$=st}this._a=$+this._a|0,this._b=j+this._b|0,this._c=et+this._c|0,this._d=tt+this._d|0,this._e=rt+this._e|0};Sha1.prototype._hash=function(){var _=Buffer$9.allocUnsafe(20);return _.writeInt32BE(this._a|0,0),_.writeInt32BE(this._b|0,4),_.writeInt32BE(this._c|0,8),_.writeInt32BE(this._d|0,12),_.writeInt32BE(this._e|0,16),_};var sha1=Sha1,inherits$f=inherits_browserExports,Hash$5=hash$8,Buffer$8=safeBufferExports.Buffer,K$3=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$5.call(this,64,56)}inherits$f(Sha256$1,Hash$5);Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(_,a,$){return $^_&(a^$)}function maj$1(_,a,$){return _&a|$&(_|a)}function sigma0$1(_){return(_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10)}function sigma1$1(_){return(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7)}function gamma0(_){return(_>>>7|_<<25)^(_>>>18|_<<14)^_>>>3}function gamma1(_){return(_>>>17|_<<15)^(_>>>19|_<<13)^_>>>10}Sha256$1.prototype._update=function(_){for(var a=this._w,$=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=this._f|0,it=this._g|0,ot=this._h|0,st=0;st<16;++st)a[st]=_.readInt32BE(st*4);for(;st<64;++st)a[st]=gamma1(a[st-2])+a[st-7]+gamma0(a[st-15])+a[st-16]|0;for(var at=0;at<64;++at){var ut=ot+sigma1$1(rt)+ch(rt,nt,it)+K$3[at]+a[at]|0,ht=sigma0$1($)+maj$1($,j,et)|0;ot=it,it=nt,nt=rt,rt=tt+ut|0,tt=et,et=j,j=$,$=ut+ht|0}this._a=$+this._a|0,this._b=j+this._b|0,this._c=et+this._c|0,this._d=tt+this._d|0,this._e=rt+this._e|0,this._f=nt+this._f|0,this._g=it+this._g|0,this._h=ot+this._h|0};Sha256$1.prototype._hash=function(){var _=Buffer$8.allocUnsafe(32);return _.writeInt32BE(this._a,0),_.writeInt32BE(this._b,4),_.writeInt32BE(this._c,8),_.writeInt32BE(this._d,12),_.writeInt32BE(this._e,16),_.writeInt32BE(this._f,20),_.writeInt32BE(this._g,24),_.writeInt32BE(this._h,28),_};var sha256$5=Sha256$1,inherits$e=inherits_browserExports,Sha256=sha256$5,Hash$4=hash$8,Buffer$7=safeBufferExports.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$4.call(this,64,56)}inherits$e(Sha224,Sha256);Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Sha224.prototype._hash=function(){var _=Buffer$7.allocUnsafe(28);return _.writeInt32BE(this._a,0),_.writeInt32BE(this._b,4),_.writeInt32BE(this._c,8),_.writeInt32BE(this._d,12),_.writeInt32BE(this._e,16),_.writeInt32BE(this._f,20),_.writeInt32BE(this._g,24),_};var sha224$1=Sha224,inherits$d=inherits_browserExports,Hash$3=hash$8,Buffer$6=safeBufferExports.Buffer,K$2=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$3.call(this,128,112)}inherits$d(Sha512,Hash$3);Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(_,a,$){return $^_&(a^$)}function maj(_,a,$){return _&a|$&(_|a)}function sigma0(_,a){return(_>>>28|a<<4)^(a>>>2|_<<30)^(a>>>7|_<<25)}function sigma1(_,a){return(_>>>14|a<<18)^(_>>>18|a<<14)^(a>>>9|_<<23)}function Gamma0(_,a){return(_>>>1|a<<31)^(_>>>8|a<<24)^_>>>7}function Gamma0l(_,a){return(_>>>1|a<<31)^(_>>>8|a<<24)^(_>>>7|a<<25)}function Gamma1(_,a){return(_>>>19|a<<13)^(a>>>29|_<<3)^_>>>6}function Gamma1l(_,a){return(_>>>19|a<<13)^(a>>>29|_<<3)^(_>>>6|a<<26)}function getCarry(_,a){return _>>>0>>0?1:0}Sha512.prototype._update=function(_){for(var a=this._w,$=this._ah|0,j=this._bh|0,et=this._ch|0,tt=this._dh|0,rt=this._eh|0,nt=this._fh|0,it=this._gh|0,ot=this._hh|0,st=this._al|0,at=this._bl|0,ut=this._cl|0,ht=this._dl|0,bt=this._el|0,Et=this._fl|0,Ct=this._gl|0,Pt=this._hl|0,Tt=0;Tt<32;Tt+=2)a[Tt]=_.readInt32BE(Tt*4),a[Tt+1]=_.readInt32BE(Tt*4+4);for(;Tt<160;Tt+=2){var It=a[Tt-30],Lt=a[Tt-15*2+1],Nt=Gamma0(It,Lt),Ut=Gamma0l(Lt,It);It=a[Tt-2*2],Lt=a[Tt-2*2+1];var jt=Gamma1(It,Lt),Mt=Gamma1l(Lt,It),Dt=a[Tt-7*2],Ft=a[Tt-7*2+1],Bt=a[Tt-16*2],yt=a[Tt-16*2+1],mt=Ut+Ft|0,ct=Nt+Dt+getCarry(mt,Ut)|0;mt=mt+Mt|0,ct=ct+jt+getCarry(mt,Mt)|0,mt=mt+yt|0,ct=ct+Bt+getCarry(mt,yt)|0,a[Tt]=ct,a[Tt+1]=mt}for(var dt=0;dt<160;dt+=2){ct=a[dt],mt=a[dt+1];var vt=maj($,j,et),St=maj(st,at,ut),Rt=sigma0($,st),$t=sigma0(st,$),xt=sigma1(rt,bt),At=sigma1(bt,rt),wt=K$2[dt],Ot=K$2[dt+1],tr=Ch(rt,nt,it),nr=Ch(bt,Et,Ct),ir=Pt+At|0,Wt=ot+xt+getCarry(ir,Pt)|0;ir=ir+nr|0,Wt=Wt+tr+getCarry(ir,nr)|0,ir=ir+Ot|0,Wt=Wt+wt+getCarry(ir,Ot)|0,ir=ir+mt|0,Wt=Wt+ct+getCarry(ir,mt)|0;var Kt=$t+St|0,Jt=Rt+vt+getCarry(Kt,$t)|0;ot=it,Pt=Ct,it=nt,Ct=Et,nt=rt,Et=bt,bt=ht+ir|0,rt=tt+Wt+getCarry(bt,ht)|0,tt=et,ht=ut,et=j,ut=at,j=$,at=st,st=ir+Kt|0,$=Wt+Jt+getCarry(st,ir)|0}this._al=this._al+st|0,this._bl=this._bl+at|0,this._cl=this._cl+ut|0,this._dl=this._dl+ht|0,this._el=this._el+bt|0,this._fl=this._fl+Et|0,this._gl=this._gl+Ct|0,this._hl=this._hl+Pt|0,this._ah=this._ah+$+getCarry(this._al,st)|0,this._bh=this._bh+j+getCarry(this._bl,at)|0,this._ch=this._ch+et+getCarry(this._cl,ut)|0,this._dh=this._dh+tt+getCarry(this._dl,ht)|0,this._eh=this._eh+rt+getCarry(this._el,bt)|0,this._fh=this._fh+nt+getCarry(this._fl,Et)|0,this._gh=this._gh+it+getCarry(this._gl,Ct)|0,this._hh=this._hh+ot+getCarry(this._hl,Pt)|0};Sha512.prototype._hash=function(){var _=Buffer$6.allocUnsafe(64);function a($,j,et){_.writeInt32BE($,et),_.writeInt32BE(j,et+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),a(this._gh,this._gl,48),a(this._hh,this._hl,56),_};var sha512$4=Sha512,inherits$c=inherits_browserExports,SHA512$3=sha512$4,Hash$2=hash$8,Buffer$5=safeBufferExports.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$2.call(this,128,112)}inherits$c(Sha384,SHA512$3);Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Sha384.prototype._hash=function(){var _=Buffer$5.allocUnsafe(48);function a($,j,et){_.writeInt32BE($,et),_.writeInt32BE(j,et+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),_};var sha384$1=Sha384,exports=sha_js.exports=function(a){a=a.toLowerCase();var $=exports[a];if(!$)throw new Error(a+" is not supported (we accept pull requests)");return new $};exports.sha=sha$3;exports.sha1=sha1;exports.sha224=sha224$1;exports.sha256=sha256$5;exports.sha384=sha384$1;exports.sha512=sha512$4;var sha_jsExports=sha_js.exports,streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$b=inherits_browserExports;inherits$b(Stream,EE);Stream.Readable=require_stream_readable$1();Stream.Writable=require_stream_writable$1();Stream.Duplex=require_stream_duplex$1();Stream.Transform=_stream_transform$1;Stream.PassThrough=_stream_passthrough$1;Stream.finished=endOfStream;Stream.pipeline=pipeline_1;Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(_,a){var $=this;function j(st){_.writable&&_.write(st)===!1&&$.pause&&$.pause()}$.on("data",j);function et(){$.readable&&$.resume&&$.resume()}_.on("drain",et),!_._isStdio&&(!a||a.end!==!1)&&($.on("end",rt),$.on("close",nt));var tt=!1;function rt(){tt||(tt=!0,_.end())}function nt(){tt||(tt=!0,typeof _.destroy=="function"&&_.destroy())}function it(st){if(ot(),EE.listenerCount(this,"error")===0)throw st}$.on("error",it),_.on("error",it);function ot(){$.removeListener("data",j),_.removeListener("drain",et),$.removeListener("end",rt),$.removeListener("close",nt),$.removeListener("error",it),_.removeListener("error",it),$.removeListener("end",ot),$.removeListener("close",ot),_.removeListener("close",ot)}return $.on("end",ot),$.on("close",ot),_.on("close",ot),_.emit("pipe",$),_};var Buffer$4=safeBufferExports.Buffer,Transform=streamBrowserify.Transform,StringDecoder=string_decoder$1.StringDecoder,inherits$a=inherits_browserExports;function CipherBase(_){Transform.call(this),this.hashMode=typeof _=="string",this.hashMode?this[_]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$a(CipherBase,Transform);CipherBase.prototype.update=function(_,a,$){typeof _=="string"&&(_=Buffer$4.from(_,a));var j=this._update(_);return this.hashMode?this:($&&(j=this._toString(j,$)),j)};CipherBase.prototype.setAutoPadding=function(){};CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase.prototype._transform=function(_,a,$){var j;try{this.hashMode?this._update(_):this.push(this._update(_))}catch(et){j=et}finally{$(j)}};CipherBase.prototype._flush=function(_){var a;try{this.push(this.__final())}catch($){a=$}_(a)};CipherBase.prototype._finalOrDigest=function(_){var a=this.__final()||Buffer$4.alloc(0);return _&&(a=this._toString(a,_,!0)),a};CipherBase.prototype._toString=function(_,a,$){if(this._decoder||(this._decoder=new StringDecoder(a),this._encoding=a),this._encoding!==a)throw new Error("can't switch encodings");var j=this._decoder.write(_);return $&&(j+=this._decoder.end()),j};var cipherBase=CipherBase,inherits$9=inherits_browserExports,MD5$1=md5_js,RIPEMD160$2=ripemd160,sha$2=sha_jsExports,Base$6=cipherBase;function Hash$1(_){Base$6.call(this,"digest"),this._hash=_}inherits$9(Hash$1,Base$6);Hash$1.prototype._update=function(_){this._hash.update(_)};Hash$1.prototype._final=function(){return this._hash.digest()};var browser$b=function(a){return a=a.toLowerCase(),a==="md5"?new MD5$1:a==="rmd160"||a==="ripemd160"?new RIPEMD160$2:new Hash$1(sha$2(a))},_Buffer=safeBufferExports.Buffer;function base$8(_){if(_.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),$=0;$>>0,It=new Uint8Array(Tt);Ct!==Pt;){for(var Lt=ht[Ct],Nt=0,Ut=Tt-1;(Lt!==0||Nt>>0,It[Ut]=Lt%rt>>>0,Lt=Lt/rt>>>0;if(Lt!==0)throw new Error("Non-zero carry");Et=Nt,Ct++}for(var jt=Tt-Et;jt!==Tt&&It[jt]===0;)jt++;for(var Mt=nt.repeat(bt);jt>>0,Tt=new Uint8Array(Pt);ht[bt];){var It=a[ht.charCodeAt(bt)];if(It===255)return;for(var Lt=0,Nt=Pt-1;(It!==0||Lt>>0,Tt[Nt]=It%256>>>0,It=It/256>>>0;if(It!==0)throw new Error("Non-zero carry");Ct=Lt,bt++}for(var Ut=Pt-Ct;Ut!==Pt&&Tt[Ut]===0;)Ut++;var jt=_Buffer.allocUnsafe(Et+(Pt-Ut));jt.fill(0,0,Et);for(var Mt=Et;Ut!==Pt;)jt[Mt++]=Tt[Ut++];return jt}function ut(ht){var bt=at(ht);if(bt)return bt;throw new Error("Non-base"+rt+" character")}return{encode:st,decodeUnsafe:at,decode:ut}}var src$2=base$8,basex$1=src$2,ALPHABET$3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$1=basex$1(ALPHABET$3),base58$1=bs58$1,Buffer$3=safeBufferExports.Buffer,base$7=function(_){function a(tt){var rt=_(tt);return base58$1.encode(Buffer$3.concat([tt,rt],tt.length+4))}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=_(rt);if(!(nt[0]^it[0]|nt[1]^it[1]|nt[2]^it[2]|nt[3]^it[3]))return rt}function j(tt){var rt=base58$1.decodeUnsafe(tt);if(rt)return $(rt)}function et(tt){var rt=base58$1.decode(tt),nt=$(rt);if(!nt)throw new Error("Invalid checksum");return nt}return{encode:a,decode:et,decodeUnsafe:j}},createHash=browser$b,bs58checkBase$1=base$7;function sha256x2$1(_){var a=createHash("sha256").update(_).digest();return createHash("sha256").update(a).digest()}var bs58check$2=bs58checkBase$1(sha256x2$1),nacl={},box={},x25519={},random={},system={},browser$a={};Object.defineProperty(browser$a,"__esModule",{value:!0});browser$a.BrowserRandomSource=void 0;const QUOTA=65536;class BrowserRandomSource{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const a=typeof self<"u"?self.crypto||self.msCrypto:null;a&&a.getRandomValues!==void 0&&(this._crypto=a,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(a){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const $=new Uint8Array(a);for(let j=0;j<$.length;j+=QUOTA)this._crypto.getRandomValues($.subarray(j,j+Math.min($.length-j,QUOTA)));return $}}browser$a.BrowserRandomSource=BrowserRandomSource;function commonjsRequire(_){throw new Error('Could not dynamically require "'+_+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var node$2={},wipe$1={};Object.defineProperty(wipe$1,"__esModule",{value:!0});function wipe(_){for(var a=0;a<_.length;a++)_[a]=0;return _}wipe$1.wipe=wipe;var cryptoBrowserify={},browser$9={exports:{}},hasRequiredBrowser$8;function requireBrowser$8(){if(hasRequiredBrowser$8)return browser$9.exports;hasRequiredBrowser$8=1;var _=65536,a=4294967295;function $(){throw new Error(`Secure random number generation is not supported by this browser. -Use Chrome, Firefox or Internet Explorer 11`)}var j=safeBufferExports.Buffer,et=commonjsGlobal.crypto||commonjsGlobal.msCrypto;et&&et.getRandomValues?browser$9.exports=tt:browser$9.exports=$;function tt(rt,nt){if(rt>a)throw new RangeError("requested too many random bytes");var it=j.allocUnsafe(rt);if(rt>0)if(rt>_)for(var ot=0;otet?nt=rt(nt):nt.lengthat){var ut=ot==="rmd160"?new tt:rt(ot);st=ut.update(st).digest()}else st.lengthMAX_ALLOC||a!==a)throw new TypeError("Bad key length")},defaultEncoding$2;if(commonjsGlobal.process&&commonjsGlobal.process.browser)defaultEncoding$2="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var pVersionMajor=parseInt(process$1$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$2=safeBufferExports.Buffer,toBuffer$4=function(_,a,$){if(Buffer$2.isBuffer(_))return _;if(typeof _=="string")return Buffer$2.from(_,a);if(ArrayBuffer.isView(_))return Buffer$2.from(_.buffer);throw new TypeError($+" must be a string, a Buffer, a typed array or a DataView")},md5$2=md5$3,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$1=safeBufferExports.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$3=toBuffer$4,ZEROS=Buffer$1.alloc(128),sizes$1={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac$1(_,a,$){var j=getDigest(_),et=_==="sha512"||_==="sha384"?128:64;a.length>et?a=j(a):a.length>>0},utils$I.writeUInt32BE=function(et,tt,rt){et[0+rt]=tt>>>24,et[1+rt]=tt>>>16&255,et[2+rt]=tt>>>8&255,et[3+rt]=tt&255},utils$I.ip=function(et,tt,rt,nt){for(var it=0,ot=0,st=6;st>=0;st-=2){for(var at=0;at<=24;at+=8)it<<=1,it|=tt>>>at+st&1;for(var at=0;at<=24;at+=8)it<<=1,it|=et>>>at+st&1}for(var st=6;st>=0;st-=2){for(var at=1;at<=25;at+=8)ot<<=1,ot|=tt>>>at+st&1;for(var at=1;at<=25;at+=8)ot<<=1,ot|=et>>>at+st&1}rt[nt+0]=it>>>0,rt[nt+1]=ot>>>0},utils$I.rip=function(et,tt,rt,nt){for(var it=0,ot=0,st=0;st<4;st++)for(var at=24;at>=0;at-=8)it<<=1,it|=tt>>>at+st&1,it<<=1,it|=et>>>at+st&1;for(var st=4;st<8;st++)for(var at=24;at>=0;at-=8)ot<<=1,ot|=tt>>>at+st&1,ot<<=1,ot|=et>>>at+st&1;rt[nt+0]=it>>>0,rt[nt+1]=ot>>>0},utils$I.pc1=function(et,tt,rt,nt){for(var it=0,ot=0,st=7;st>=5;st--){for(var at=0;at<=24;at+=8)it<<=1,it|=tt>>at+st&1;for(var at=0;at<=24;at+=8)it<<=1,it|=et>>at+st&1}for(var at=0;at<=24;at+=8)it<<=1,it|=tt>>at+st&1;for(var st=1;st<=3;st++){for(var at=0;at<=24;at+=8)ot<<=1,ot|=tt>>at+st&1;for(var at=0;at<=24;at+=8)ot<<=1,ot|=et>>at+st&1}for(var at=0;at<=24;at+=8)ot<<=1,ot|=et>>at+st&1;rt[nt+0]=it>>>0,rt[nt+1]=ot>>>0},utils$I.r28shl=function(et,tt){return et<>>28-tt};var _=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$I.pc2=function(et,tt,rt,nt){for(var it=0,ot=0,st=_.length>>>1,at=0;at>>_[at]&1;for(var at=st;at<_.length;at++)ot<<=1,ot|=tt>>>_[at]&1;rt[nt+0]=it>>>0,rt[nt+1]=ot>>>0},utils$I.expand=function(et,tt,rt){var nt=0,it=0;nt=(et&1)<<5|et>>>27;for(var ot=23;ot>=15;ot-=4)nt<<=6,nt|=et>>>ot&63;for(var ot=11;ot>=3;ot-=4)it|=et>>>ot&63,it<<=6;it|=(et&31)<<1|et>>>31,tt[rt+0]=nt>>>0,tt[rt+1]=it>>>0};var a=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$I.substitute=function(et,tt){for(var rt=0,nt=0;nt<4;nt++){var it=et>>>18-nt*6&63,ot=a[nt*64+it];rt<<=4,rt|=ot}for(var nt=0;nt<4;nt++){var it=tt>>>18-nt*6&63,ot=a[4*64+nt*64+it];rt<<=4,rt|=ot}return rt>>>0};var $=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$I.permute=function(et){for(var tt=0,rt=0;rt<$.length;rt++)tt<<=1,tt|=et>>>$[rt]&1;return tt>>>0},utils$I.padSplit=function(et,tt,rt){for(var nt=et.toString(2);nt.length0;rt--)et+=this._buffer(j,et),tt+=this._flushBuffer(nt,tt);return et+=this._buffer(j,et),nt},a.prototype.final=function(j){var et;j&&(et=this.update(j));var tt;return this.type==="encrypt"?tt=this._finalEncrypt():tt=this._finalDecrypt(),et?et.concat(tt):tt},a.prototype._pad=function(j,et){if(et===0)return!1;for(;et>>1];st=$.r28shl(st,ht),at=$.r28shl(at,ht),$.pc2(st,at,it.keys,ut)}},tt.prototype._update=function(it,ot,st,at){var ut=this._desState,ht=$.readUInt32BE(it,ot),bt=$.readUInt32BE(it,ot+4);$.ip(ht,bt,ut.tmp,0),ht=ut.tmp[0],bt=ut.tmp[1],this.type==="encrypt"?this._encrypt(ut,ht,bt,ut.tmp,0):this._decrypt(ut,ht,bt,ut.tmp,0),ht=ut.tmp[0],bt=ut.tmp[1],$.writeUInt32BE(st,ht,at),$.writeUInt32BE(st,bt,at+4)},tt.prototype._pad=function(it,ot){if(this.padding===!1)return!1;for(var st=it.length-ot,at=ot;at>>0,ht=Lt}$.rip(bt,ht,at,ut)},tt.prototype._decrypt=function(it,ot,st,at,ut){for(var ht=st,bt=ot,Et=it.keys.length-2;Et>=0;Et-=2){var Ct=it.keys[Et],Pt=it.keys[Et+1];$.expand(ht,it.tmp,0),Ct^=it.tmp[0],Pt^=it.tmp[1];var Tt=$.substitute(Ct,Pt),It=$.permute(Tt),Lt=ht;ht=(bt^It)>>>0,bt=Lt}$.rip(ht,bt,at,ut)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var _=minimalisticAssert,a=inherits_browserExports,$={};function j(tt){_.equal(tt.length,8,"Invalid IV length"),this.iv=new Array(8);for(var rt=0;rt>nt%8,j._prev=$(j._prev,tt?st:at);return ot}function $(j,et){var tt=j.length,rt=-1,nt=_.allocUnsafe(j.length);for(j=_.concat([j,_.from([et])]);++rt>7;return nt}return cfb1.encrypt=function(j,et,tt){for(var rt=et.length,nt=_.allocUnsafe(rt),it=-1;++it>>24]^ht[Pt>>>16&255]^bt[Tt>>>8&255]^Et[It&255]^it[Mt++],Nt=ut[Pt>>>24]^ht[Tt>>>16&255]^bt[It>>>8&255]^Et[Ct&255]^it[Mt++],Ut=ut[Tt>>>24]^ht[It>>>16&255]^bt[Ct>>>8&255]^Et[Pt&255]^it[Mt++],jt=ut[It>>>24]^ht[Ct>>>16&255]^bt[Pt>>>8&255]^Et[Tt&255]^it[Mt++],Ct=Lt,Pt=Nt,Tt=Ut,It=jt;return Lt=(st[Ct>>>24]<<24|st[Pt>>>16&255]<<16|st[Tt>>>8&255]<<8|st[It&255])^it[Mt++],Nt=(st[Pt>>>24]<<24|st[Tt>>>16&255]<<16|st[It>>>8&255]<<8|st[Ct&255])^it[Mt++],Ut=(st[Tt>>>24]<<24|st[It>>>16&255]<<16|st[Ct>>>8&255]<<8|st[Pt&255])^it[Mt++],jt=(st[It>>>24]<<24|st[Ct>>>16&255]<<16|st[Pt>>>8&255]<<8|st[Tt&255])^it[Mt++],Lt=Lt>>>0,Nt=Nt>>>0,Ut=Ut>>>0,jt=jt>>>0,[Lt,Nt,Ut,jt]}var et=[0,1,2,4,8,16,32,64,128,27,54],tt=function(){for(var nt=new Array(256),it=0;it<256;it++)it<128?nt[it]=it<<1:nt[it]=it<<1^283;for(var ot=[],st=[],at=[[],[],[],[]],ut=[[],[],[],[]],ht=0,bt=0,Et=0;Et<256;++Et){var Ct=bt^bt<<1^bt<<2^bt<<3^bt<<4;Ct=Ct>>>8^Ct&255^99,ot[ht]=Ct,st[Ct]=ht;var Pt=nt[ht],Tt=nt[Pt],It=nt[Tt],Lt=nt[Ct]*257^Ct*16843008;at[0][ht]=Lt<<24|Lt>>>8,at[1][ht]=Lt<<16|Lt>>>16,at[2][ht]=Lt<<8|Lt>>>24,at[3][ht]=Lt,Lt=It*16843009^Tt*65537^Pt*257^ht*16843008,ut[0][Ct]=Lt<<24|Lt>>>8,ut[1][Ct]=Lt<<16|Lt>>>16,ut[2][Ct]=Lt<<8|Lt>>>24,ut[3][Ct]=Lt,ht===0?ht=bt=1:(ht=Pt^nt[nt[nt[It^Pt]]],bt^=nt[nt[bt]])}return{SBOX:ot,INV_SBOX:st,SUB_MIX:at,INV_SUB_MIX:ut}}();function rt(nt){this._key=a(nt),this._reset()}return rt.blockSize=4*4,rt.keySize=256/8,rt.prototype.blockSize=rt.blockSize,rt.prototype.keySize=rt.keySize,rt.prototype._reset=function(){for(var nt=this._key,it=nt.length,ot=it+6,st=(ot+1)*4,at=[],ut=0;ut>>24,ht=tt.SBOX[ht>>>24]<<24|tt.SBOX[ht>>>16&255]<<16|tt.SBOX[ht>>>8&255]<<8|tt.SBOX[ht&255],ht^=et[ut/it|0]<<24):it>6&&ut%it===4&&(ht=tt.SBOX[ht>>>24]<<24|tt.SBOX[ht>>>16&255]<<16|tt.SBOX[ht>>>8&255]<<8|tt.SBOX[ht&255]),at[ut]=at[ut-it]^ht}for(var bt=[],Et=0;Et>>24]]^tt.INV_SUB_MIX[1][tt.SBOX[Pt>>>16&255]]^tt.INV_SUB_MIX[2][tt.SBOX[Pt>>>8&255]]^tt.INV_SUB_MIX[3][tt.SBOX[Pt&255]]}this._nRounds=ot,this._keySchedule=at,this._invKeySchedule=bt},rt.prototype.encryptBlockRaw=function(nt){return nt=a(nt),j(nt,this._keySchedule,tt.SUB_MIX,tt.SBOX,this._nRounds)},rt.prototype.encryptBlock=function(nt){var it=this.encryptBlockRaw(nt),ot=_.allocUnsafe(16);return ot.writeUInt32BE(it[0],0),ot.writeUInt32BE(it[1],4),ot.writeUInt32BE(it[2],8),ot.writeUInt32BE(it[3],12),ot},rt.prototype.decryptBlock=function(nt){nt=a(nt);var it=nt[1];nt[1]=nt[3],nt[3]=it;var ot=j(nt,this._invKeySchedule,tt.INV_SUB_MIX,tt.INV_SBOX,this._nRounds),st=_.allocUnsafe(16);return st.writeUInt32BE(ot[0],0),st.writeUInt32BE(ot[3],4),st.writeUInt32BE(ot[2],8),st.writeUInt32BE(ot[1],12),st},rt.prototype.scrub=function(){$(this._keySchedule),$(this._invKeySchedule),$(this._key)},aes.AES=rt,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var _=safeBufferExports.Buffer,a=_.alloc(16,0);function $(tt){return[tt.readUInt32BE(0),tt.readUInt32BE(4),tt.readUInt32BE(8),tt.readUInt32BE(12)]}function j(tt){var rt=_.allocUnsafe(16);return rt.writeUInt32BE(tt[0]>>>0,0),rt.writeUInt32BE(tt[1]>>>0,4),rt.writeUInt32BE(tt[2]>>>0,8),rt.writeUInt32BE(tt[3]>>>0,12),rt}function et(tt){this.h=tt,this.state=_.alloc(16,0),this.cache=_.allocUnsafe(0)}return et.prototype.ghash=function(tt){for(var rt=-1;++rt0;nt--)tt[nt]=tt[nt]>>>1|(tt[nt-1]&1)<<31;tt[0]=tt[0]>>>1,ot&&(tt[0]=tt[0]^225<<24)}this.state=j(rt)},et.prototype.update=function(tt){this.cache=_.concat([this.cache,tt]);for(var rt;this.cache.length>=16;)rt=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(rt)},et.prototype.final=function(tt,rt){return this.cache.length&&this.ghash(_.concat([this.cache,a],16)),this.ghash(j([0,tt,0,rt])),this.state},ghash=et,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var _=requireAes(),a=safeBufferExports.Buffer,$=cipherBase,j=inherits_browserExports,et=requireGhash(),tt=requireBufferXor(),rt=requireIncr32();function nt(st,at){var ut=0;st.length!==at.length&&ut++;for(var ht=Math.min(st.length,at.length),bt=0;bt0||rt>0;){var at=new a;at.update(st),at.update(j),et&&at.update(et),st=at.digest();var ut=0;if(nt>0){var ht=it.length-nt;ut=Math.min(nt,st.length),st.copy(it,ht,0,ut),nt-=ut}if(ut0){var bt=ot.length-rt,Et=Math.min(rt,st.length-ut);st.copy(ot,bt,ut,ut+Et),rt-=Et}}return st.fill(0),{key:it,iv:ot}}return evp_bytestokey=$,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var _=requireModes$1(),a=requireAuthCipher(),$=safeBufferExports.Buffer,j=requireStreamCipher(),et=cipherBase,tt=requireAes(),rt=requireEvp_bytestokey(),nt=inherits_browserExports;function it(ht,bt,Et){et.call(this),this._cache=new st,this._cipher=new tt.AES(bt),this._prev=$.from(Et),this._mode=ht,this._autopadding=!0}nt(it,et),it.prototype._update=function(ht){this._cache.add(ht);for(var bt,Et,Ct=[];bt=this._cache.get();)Et=this._mode.encrypt(this,bt),Ct.push(Et);return $.concat(Ct)};var ot=$.alloc(16,16);it.prototype._final=function(){var ht=this._cache.flush();if(this._autopadding)return ht=this._mode.encrypt(this,ht),this._cipher.scrub(),ht;if(!ht.equals(ot))throw this._cipher.scrub(),new Error("data not multiple of block length")},it.prototype.setAutoPadding=function(ht){return this._autopadding=!!ht,this};function st(){this.cache=$.allocUnsafe(0)}st.prototype.add=function(ht){this.cache=$.concat([this.cache,ht])},st.prototype.get=function(){if(this.cache.length>15){var ht=this.cache.slice(0,16);return this.cache=this.cache.slice(16),ht}return null},st.prototype.flush=function(){for(var ht=16-this.cache.length,bt=$.allocUnsafe(ht),Et=-1;++Et16)return bt=this.cache.slice(0,16),this.cache=this.cache.slice(16),bt}else if(this.cache.length>=16)return bt=this.cache.slice(0,16),this.cache=this.cache.slice(16),bt;return null},ot.prototype.flush=function(){if(this.cache.length)return this.cache};function st(ht){var bt=ht[15];if(bt<1||bt>16)throw new Error("unable to decrypt data");for(var Et=-1;++Et0?yt:mt},tt.min=function(yt,mt){return yt.cmp(mt)<0?yt:mt},tt.prototype._init=function(yt,mt,ct){if(typeof yt=="number")return this._initNumber(yt,mt,ct);if(typeof yt=="object")return this._initArray(yt,mt,ct);mt==="hex"&&(mt=16),j(mt===(mt|0)&&mt>=2&&mt<=36),yt=yt.toString().replace(/\s+/g,"");var dt=0;yt[0]==="-"&&(dt++,this.negative=1),dt=0;dt-=3)St=yt[dt]|yt[dt-1]<<8|yt[dt-2]<<16,this.words[vt]|=St<>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);else if(ct==="le")for(dt=0,vt=0;dt>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);return this.strip()};function nt(Bt,yt){var mt=Bt.charCodeAt(yt);return mt>=65&&mt<=70?mt-55:mt>=97&&mt<=102?mt-87:mt-48&15}function it(Bt,yt,mt){var ct=nt(Bt,mt);return mt-1>=yt&&(ct|=nt(Bt,mt-1)<<4),ct}tt.prototype._parseHex=function(yt,mt,ct){this.length=Math.ceil((yt.length-mt)/6),this.words=new Array(this.length);for(var dt=0;dt=mt;dt-=2)Rt=it(yt,mt,dt)<=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8;else{var $t=yt.length-mt;for(dt=$t%2===0?mt+1:mt;dt=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8}this.strip()};function ot(Bt,yt,mt,ct){for(var dt=0,vt=Math.min(Bt.length,mt),St=yt;St=49?dt+=Rt-49+10:Rt>=17?dt+=Rt-17+10:dt+=Rt}return dt}tt.prototype._parseBase=function(yt,mt,ct){this.words=[0],this.length=1;for(var dt=0,vt=1;vt<=67108863;vt*=mt)dt++;dt--,vt=vt/mt|0;for(var St=yt.length-ct,Rt=St%dt,$t=Math.min(St,St-Rt)+ct,xt=0,At=ct;At<$t;At+=dt)xt=ot(yt,At,At+dt,mt),this.imuln(vt),this.words[0]+xt<67108864?this.words[0]+=xt:this._iaddn(xt);if(Rt!==0){var wt=1;for(xt=ot(yt,At,yt.length,mt),At=0;At1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},tt.prototype.inspect=function(){return(this.red?""};var st=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],at=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ut=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(yt,mt){yt=yt||10,mt=mt|0||1;var ct;if(yt===16||yt==="hex"){ct="";for(var dt=0,vt=0,St=0;St>>24-dt&16777215,vt!==0||St!==this.length-1?ct=st[6-$t.length]+$t+ct:ct=$t+ct,dt+=2,dt>=26&&(dt-=26,St--)}for(vt!==0&&(ct=vt.toString(16)+ct);ct.length%mt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}if(yt===(yt|0)&&yt>=2&&yt<=36){var xt=at[yt],At=ut[yt];ct="";var wt=this.clone();for(wt.negative=0;!wt.isZero();){var Ot=wt.modn(At).toString(yt);wt=wt.idivn(At),wt.isZero()?ct=Ot+ct:ct=st[xt-Ot.length]+Ot+ct}for(this.isZero()&&(ct="0"+ct);ct.length%mt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var yt=this.words[0];return this.length===2?yt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?yt+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-yt:yt},tt.prototype.toJSON=function(){return this.toString(16)},tt.prototype.toBuffer=function(yt,mt){return j(typeof rt<"u"),this.toArrayLike(rt,yt,mt)},tt.prototype.toArray=function(yt,mt){return this.toArrayLike(Array,yt,mt)},tt.prototype.toArrayLike=function(yt,mt,ct){var dt=this.byteLength(),vt=ct||Math.max(1,dt);j(dt<=vt,"byte array longer than desired length"),j(vt>0,"Requested array length <= 0"),this.strip();var St=mt==="le",Rt=new yt(vt),$t,xt,At=this.clone();if(St){for(xt=0;!At.isZero();xt++)$t=At.andln(255),At.iushrn(8),Rt[xt]=$t;for(;xt=4096&&(ct+=13,mt>>>=13),mt>=64&&(ct+=7,mt>>>=7),mt>=8&&(ct+=4,mt>>>=4),mt>=2&&(ct+=2,mt>>>=2),ct+mt},tt.prototype._zeroBits=function(yt){if(yt===0)return 26;var mt=yt,ct=0;return mt&8191||(ct+=13,mt>>>=13),mt&127||(ct+=7,mt>>>=7),mt&15||(ct+=4,mt>>>=4),mt&3||(ct+=2,mt>>>=2),mt&1||ct++,ct},tt.prototype.bitLength=function(){var yt=this.words[this.length-1],mt=this._countBits(yt);return(this.length-1)*26+mt};function ht(Bt){for(var yt=new Array(Bt.bitLength()),mt=0;mt>>dt}return yt}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var yt=0,mt=0;mtyt.length?this.clone().ior(yt):yt.clone().ior(this)},tt.prototype.uor=function(yt){return this.length>yt.length?this.clone().iuor(yt):yt.clone().iuor(this)},tt.prototype.iuand=function(yt){var mt;this.length>yt.length?mt=yt:mt=this;for(var ct=0;ctyt.length?this.clone().iand(yt):yt.clone().iand(this)},tt.prototype.uand=function(yt){return this.length>yt.length?this.clone().iuand(yt):yt.clone().iuand(this)},tt.prototype.iuxor=function(yt){var mt,ct;this.length>yt.length?(mt=this,ct=yt):(mt=yt,ct=this);for(var dt=0;dtyt.length?this.clone().ixor(yt):yt.clone().ixor(this)},tt.prototype.uxor=function(yt){return this.length>yt.length?this.clone().iuxor(yt):yt.clone().iuxor(this)},tt.prototype.inotn=function(yt){j(typeof yt=="number"&&yt>=0);var mt=Math.ceil(yt/26)|0,ct=yt%26;this._expand(mt),ct>0&&mt--;for(var dt=0;dt0&&(this.words[dt]=~this.words[dt]&67108863>>26-ct),this.strip()},tt.prototype.notn=function(yt){return this.clone().inotn(yt)},tt.prototype.setn=function(yt,mt){j(typeof yt=="number"&&yt>=0);var ct=yt/26|0,dt=yt%26;return this._expand(ct+1),mt?this.words[ct]=this.words[ct]|1<yt.length?(ct=this,dt=yt):(ct=yt,dt=this);for(var vt=0,St=0;St>>26;for(;vt!==0&&St>>26;if(this.length=ct.length,vt!==0)this.words[this.length]=vt,this.length++;else if(ct!==this)for(;Styt.length?this.clone().iadd(yt):yt.clone().iadd(this)},tt.prototype.isub=function(yt){if(yt.negative!==0){yt.negative=0;var mt=this.iadd(yt);return yt.negative=1,mt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(yt),this.negative=1,this._normSign();var ct=this.cmp(yt);if(ct===0)return this.negative=0,this.length=1,this.words[0]=0,this;var dt,vt;ct>0?(dt=this,vt=yt):(dt=yt,vt=this);for(var St=0,Rt=0;Rt>26,this.words[Rt]=mt&67108863;for(;St!==0&&Rt>26,this.words[Rt]=mt&67108863;if(St===0&&Rt>>26,wt=$t&67108863,Ot=Math.min(xt,yt.length-1),tr=Math.max(0,xt-Bt.length+1);tr<=Ot;tr++){var nr=xt-tr|0;dt=Bt.words[nr]|0,vt=yt.words[tr]|0,St=dt*vt+wt,At+=St/67108864|0,wt=St&67108863}mt.words[xt]=wt|0,$t=At|0}return $t!==0?mt.words[xt]=$t|0:mt.length--,mt.strip()}var Et=function(yt,mt,ct){var dt=yt.words,vt=mt.words,St=ct.words,Rt=0,$t,xt,At,wt=dt[0]|0,Ot=wt&8191,tr=wt>>>13,nr=dt[1]|0,ir=nr&8191,Wt=nr>>>13,Kt=dt[2]|0,Jt=Kt&8191,Ht=Kt>>>13,qt=dt[3]|0,Qt=qt&8191,dr=qt>>>13,xr=dt[4]|0,pr=xr&8191,kr=xr>>>13,Ir=dt[5]|0,lr=Ir&8191,fr=Ir>>>13,Er=dt[6]|0,$r=Er&8191,Pr=Er>>>13,Rr=dt[7]|0,Ar=Rr&8191,Or=Rr>>>13,Lr=dt[8]|0,or=Lr&8191,Yt=Lr>>>13,er=dt[9]|0,Zt=er&8191,Vt=er>>>13,Gt=vt[0]|0,ar=Gt&8191,br=Gt>>>13,wr=vt[1]|0,Sr=wr&8191,Wr=wr>>>13,Hr=vt[2]|0,Fr=Hr&8191,pn=Hr>>>13,Jr=vt[3]|0,Qr=Jr&8191,mn=Jr>>>13,ln=vt[4]|0,qr=ln&8191,wn=ln>>>13,un=vt[5]|0,Vr=un&8191,hn=un>>>13,fn=vt[6]|0,Kr=fn&8191,$n=fn>>>13,dn=vt[7]|0,Gr=dn&8191,gn=dn>>>13,an=vt[8]|0,Zr=an&8191,Rn=an>>>13,Sn=vt[9]|0,nn=Sn&8191,Tn=Sn>>>13;ct.negative=yt.negative^mt.negative,ct.length=19,$t=Math.imul(Ot,ar),xt=Math.imul(Ot,br),xt=xt+Math.imul(tr,ar)|0,At=Math.imul(tr,br);var yn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(yn>>>26)|0,yn&=67108863,$t=Math.imul(ir,ar),xt=Math.imul(ir,br),xt=xt+Math.imul(Wt,ar)|0,At=Math.imul(Wt,br),$t=$t+Math.imul(Ot,Sr)|0,xt=xt+Math.imul(Ot,Wr)|0,xt=xt+Math.imul(tr,Sr)|0,At=At+Math.imul(tr,Wr)|0;var En=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(En>>>26)|0,En&=67108863,$t=Math.imul(Jt,ar),xt=Math.imul(Jt,br),xt=xt+Math.imul(Ht,ar)|0,At=Math.imul(Ht,br),$t=$t+Math.imul(ir,Sr)|0,xt=xt+Math.imul(ir,Wr)|0,xt=xt+Math.imul(Wt,Sr)|0,At=At+Math.imul(Wt,Wr)|0,$t=$t+Math.imul(Ot,Fr)|0,xt=xt+Math.imul(Ot,pn)|0,xt=xt+Math.imul(tr,Fr)|0,At=At+Math.imul(tr,pn)|0;var ds=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ds>>>26)|0,ds&=67108863,$t=Math.imul(Qt,ar),xt=Math.imul(Qt,br),xt=xt+Math.imul(dr,ar)|0,At=Math.imul(dr,br),$t=$t+Math.imul(Jt,Sr)|0,xt=xt+Math.imul(Jt,Wr)|0,xt=xt+Math.imul(Ht,Sr)|0,At=At+Math.imul(Ht,Wr)|0,$t=$t+Math.imul(ir,Fr)|0,xt=xt+Math.imul(ir,pn)|0,xt=xt+Math.imul(Wt,Fr)|0,At=At+Math.imul(Wt,pn)|0,$t=$t+Math.imul(Ot,Qr)|0,xt=xt+Math.imul(Ot,mn)|0,xt=xt+Math.imul(tr,Qr)|0,At=At+Math.imul(tr,mn)|0;var fs=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(fs>>>26)|0,fs&=67108863,$t=Math.imul(pr,ar),xt=Math.imul(pr,br),xt=xt+Math.imul(kr,ar)|0,At=Math.imul(kr,br),$t=$t+Math.imul(Qt,Sr)|0,xt=xt+Math.imul(Qt,Wr)|0,xt=xt+Math.imul(dr,Sr)|0,At=At+Math.imul(dr,Wr)|0,$t=$t+Math.imul(Jt,Fr)|0,xt=xt+Math.imul(Jt,pn)|0,xt=xt+Math.imul(Ht,Fr)|0,At=At+Math.imul(Ht,pn)|0,$t=$t+Math.imul(ir,Qr)|0,xt=xt+Math.imul(ir,mn)|0,xt=xt+Math.imul(Wt,Qr)|0,At=At+Math.imul(Wt,mn)|0,$t=$t+Math.imul(Ot,qr)|0,xt=xt+Math.imul(Ot,wn)|0,xt=xt+Math.imul(tr,qr)|0,At=At+Math.imul(tr,wn)|0;var hs=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(hs>>>26)|0,hs&=67108863,$t=Math.imul(lr,ar),xt=Math.imul(lr,br),xt=xt+Math.imul(fr,ar)|0,At=Math.imul(fr,br),$t=$t+Math.imul(pr,Sr)|0,xt=xt+Math.imul(pr,Wr)|0,xt=xt+Math.imul(kr,Sr)|0,At=At+Math.imul(kr,Wr)|0,$t=$t+Math.imul(Qt,Fr)|0,xt=xt+Math.imul(Qt,pn)|0,xt=xt+Math.imul(dr,Fr)|0,At=At+Math.imul(dr,pn)|0,$t=$t+Math.imul(Jt,Qr)|0,xt=xt+Math.imul(Jt,mn)|0,xt=xt+Math.imul(Ht,Qr)|0,At=At+Math.imul(Ht,mn)|0,$t=$t+Math.imul(ir,qr)|0,xt=xt+Math.imul(ir,wn)|0,xt=xt+Math.imul(Wt,qr)|0,At=At+Math.imul(Wt,wn)|0,$t=$t+Math.imul(Ot,Vr)|0,xt=xt+Math.imul(Ot,hn)|0,xt=xt+Math.imul(tr,Vr)|0,At=At+Math.imul(tr,hn)|0;var ps=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ps>>>26)|0,ps&=67108863,$t=Math.imul($r,ar),xt=Math.imul($r,br),xt=xt+Math.imul(Pr,ar)|0,At=Math.imul(Pr,br),$t=$t+Math.imul(lr,Sr)|0,xt=xt+Math.imul(lr,Wr)|0,xt=xt+Math.imul(fr,Sr)|0,At=At+Math.imul(fr,Wr)|0,$t=$t+Math.imul(pr,Fr)|0,xt=xt+Math.imul(pr,pn)|0,xt=xt+Math.imul(kr,Fr)|0,At=At+Math.imul(kr,pn)|0,$t=$t+Math.imul(Qt,Qr)|0,xt=xt+Math.imul(Qt,mn)|0,xt=xt+Math.imul(dr,Qr)|0,At=At+Math.imul(dr,mn)|0,$t=$t+Math.imul(Jt,qr)|0,xt=xt+Math.imul(Jt,wn)|0,xt=xt+Math.imul(Ht,qr)|0,At=At+Math.imul(Ht,wn)|0,$t=$t+Math.imul(ir,Vr)|0,xt=xt+Math.imul(ir,hn)|0,xt=xt+Math.imul(Wt,Vr)|0,At=At+Math.imul(Wt,hn)|0,$t=$t+Math.imul(Ot,Kr)|0,xt=xt+Math.imul(Ot,$n)|0,xt=xt+Math.imul(tr,Kr)|0,At=At+Math.imul(tr,$n)|0;var Vn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,$t=Math.imul(Ar,ar),xt=Math.imul(Ar,br),xt=xt+Math.imul(Or,ar)|0,At=Math.imul(Or,br),$t=$t+Math.imul($r,Sr)|0,xt=xt+Math.imul($r,Wr)|0,xt=xt+Math.imul(Pr,Sr)|0,At=At+Math.imul(Pr,Wr)|0,$t=$t+Math.imul(lr,Fr)|0,xt=xt+Math.imul(lr,pn)|0,xt=xt+Math.imul(fr,Fr)|0,At=At+Math.imul(fr,pn)|0,$t=$t+Math.imul(pr,Qr)|0,xt=xt+Math.imul(pr,mn)|0,xt=xt+Math.imul(kr,Qr)|0,At=At+Math.imul(kr,mn)|0,$t=$t+Math.imul(Qt,qr)|0,xt=xt+Math.imul(Qt,wn)|0,xt=xt+Math.imul(dr,qr)|0,At=At+Math.imul(dr,wn)|0,$t=$t+Math.imul(Jt,Vr)|0,xt=xt+Math.imul(Jt,hn)|0,xt=xt+Math.imul(Ht,Vr)|0,At=At+Math.imul(Ht,hn)|0,$t=$t+Math.imul(ir,Kr)|0,xt=xt+Math.imul(ir,$n)|0,xt=xt+Math.imul(Wt,Kr)|0,At=At+Math.imul(Wt,$n)|0,$t=$t+Math.imul(Ot,Gr)|0,xt=xt+Math.imul(Ot,gn)|0,xt=xt+Math.imul(tr,Gr)|0,At=At+Math.imul(tr,gn)|0;var ss=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ss>>>26)|0,ss&=67108863,$t=Math.imul(or,ar),xt=Math.imul(or,br),xt=xt+Math.imul(Yt,ar)|0,At=Math.imul(Yt,br),$t=$t+Math.imul(Ar,Sr)|0,xt=xt+Math.imul(Ar,Wr)|0,xt=xt+Math.imul(Or,Sr)|0,At=At+Math.imul(Or,Wr)|0,$t=$t+Math.imul($r,Fr)|0,xt=xt+Math.imul($r,pn)|0,xt=xt+Math.imul(Pr,Fr)|0,At=At+Math.imul(Pr,pn)|0,$t=$t+Math.imul(lr,Qr)|0,xt=xt+Math.imul(lr,mn)|0,xt=xt+Math.imul(fr,Qr)|0,At=At+Math.imul(fr,mn)|0,$t=$t+Math.imul(pr,qr)|0,xt=xt+Math.imul(pr,wn)|0,xt=xt+Math.imul(kr,qr)|0,At=At+Math.imul(kr,wn)|0,$t=$t+Math.imul(Qt,Vr)|0,xt=xt+Math.imul(Qt,hn)|0,xt=xt+Math.imul(dr,Vr)|0,At=At+Math.imul(dr,hn)|0,$t=$t+Math.imul(Jt,Kr)|0,xt=xt+Math.imul(Jt,$n)|0,xt=xt+Math.imul(Ht,Kr)|0,At=At+Math.imul(Ht,$n)|0,$t=$t+Math.imul(ir,Gr)|0,xt=xt+Math.imul(ir,gn)|0,xt=xt+Math.imul(Wt,Gr)|0,At=At+Math.imul(Wt,gn)|0,$t=$t+Math.imul(Ot,Zr)|0,xt=xt+Math.imul(Ot,Rn)|0,xt=xt+Math.imul(tr,Zr)|0,At=At+Math.imul(tr,Rn)|0;var Jn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,$t=Math.imul(Zt,ar),xt=Math.imul(Zt,br),xt=xt+Math.imul(Vt,ar)|0,At=Math.imul(Vt,br),$t=$t+Math.imul(or,Sr)|0,xt=xt+Math.imul(or,Wr)|0,xt=xt+Math.imul(Yt,Sr)|0,At=At+Math.imul(Yt,Wr)|0,$t=$t+Math.imul(Ar,Fr)|0,xt=xt+Math.imul(Ar,pn)|0,xt=xt+Math.imul(Or,Fr)|0,At=At+Math.imul(Or,pn)|0,$t=$t+Math.imul($r,Qr)|0,xt=xt+Math.imul($r,mn)|0,xt=xt+Math.imul(Pr,Qr)|0,At=At+Math.imul(Pr,mn)|0,$t=$t+Math.imul(lr,qr)|0,xt=xt+Math.imul(lr,wn)|0,xt=xt+Math.imul(fr,qr)|0,At=At+Math.imul(fr,wn)|0,$t=$t+Math.imul(pr,Vr)|0,xt=xt+Math.imul(pr,hn)|0,xt=xt+Math.imul(kr,Vr)|0,At=At+Math.imul(kr,hn)|0,$t=$t+Math.imul(Qt,Kr)|0,xt=xt+Math.imul(Qt,$n)|0,xt=xt+Math.imul(dr,Kr)|0,At=At+Math.imul(dr,$n)|0,$t=$t+Math.imul(Jt,Gr)|0,xt=xt+Math.imul(Jt,gn)|0,xt=xt+Math.imul(Ht,Gr)|0,At=At+Math.imul(Ht,gn)|0,$t=$t+Math.imul(ir,Zr)|0,xt=xt+Math.imul(ir,Rn)|0,xt=xt+Math.imul(Wt,Zr)|0,At=At+Math.imul(Wt,Rn)|0,$t=$t+Math.imul(Ot,nn)|0,xt=xt+Math.imul(Ot,Tn)|0,xt=xt+Math.imul(tr,nn)|0,At=At+Math.imul(tr,Tn)|0;var Yn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,$t=Math.imul(Zt,Sr),xt=Math.imul(Zt,Wr),xt=xt+Math.imul(Vt,Sr)|0,At=Math.imul(Vt,Wr),$t=$t+Math.imul(or,Fr)|0,xt=xt+Math.imul(or,pn)|0,xt=xt+Math.imul(Yt,Fr)|0,At=At+Math.imul(Yt,pn)|0,$t=$t+Math.imul(Ar,Qr)|0,xt=xt+Math.imul(Ar,mn)|0,xt=xt+Math.imul(Or,Qr)|0,At=At+Math.imul(Or,mn)|0,$t=$t+Math.imul($r,qr)|0,xt=xt+Math.imul($r,wn)|0,xt=xt+Math.imul(Pr,qr)|0,At=At+Math.imul(Pr,wn)|0,$t=$t+Math.imul(lr,Vr)|0,xt=xt+Math.imul(lr,hn)|0,xt=xt+Math.imul(fr,Vr)|0,At=At+Math.imul(fr,hn)|0,$t=$t+Math.imul(pr,Kr)|0,xt=xt+Math.imul(pr,$n)|0,xt=xt+Math.imul(kr,Kr)|0,At=At+Math.imul(kr,$n)|0,$t=$t+Math.imul(Qt,Gr)|0,xt=xt+Math.imul(Qt,gn)|0,xt=xt+Math.imul(dr,Gr)|0,At=At+Math.imul(dr,gn)|0,$t=$t+Math.imul(Jt,Zr)|0,xt=xt+Math.imul(Jt,Rn)|0,xt=xt+Math.imul(Ht,Zr)|0,At=At+Math.imul(Ht,Rn)|0,$t=$t+Math.imul(ir,nn)|0,xt=xt+Math.imul(ir,Tn)|0,xt=xt+Math.imul(Wt,nn)|0,At=At+Math.imul(Wt,Tn)|0;var ms=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ms>>>26)|0,ms&=67108863,$t=Math.imul(Zt,Fr),xt=Math.imul(Zt,pn),xt=xt+Math.imul(Vt,Fr)|0,At=Math.imul(Vt,pn),$t=$t+Math.imul(or,Qr)|0,xt=xt+Math.imul(or,mn)|0,xt=xt+Math.imul(Yt,Qr)|0,At=At+Math.imul(Yt,mn)|0,$t=$t+Math.imul(Ar,qr)|0,xt=xt+Math.imul(Ar,wn)|0,xt=xt+Math.imul(Or,qr)|0,At=At+Math.imul(Or,wn)|0,$t=$t+Math.imul($r,Vr)|0,xt=xt+Math.imul($r,hn)|0,xt=xt+Math.imul(Pr,Vr)|0,At=At+Math.imul(Pr,hn)|0,$t=$t+Math.imul(lr,Kr)|0,xt=xt+Math.imul(lr,$n)|0,xt=xt+Math.imul(fr,Kr)|0,At=At+Math.imul(fr,$n)|0,$t=$t+Math.imul(pr,Gr)|0,xt=xt+Math.imul(pr,gn)|0,xt=xt+Math.imul(kr,Gr)|0,At=At+Math.imul(kr,gn)|0,$t=$t+Math.imul(Qt,Zr)|0,xt=xt+Math.imul(Qt,Rn)|0,xt=xt+Math.imul(dr,Zr)|0,At=At+Math.imul(dr,Rn)|0,$t=$t+Math.imul(Jt,nn)|0,xt=xt+Math.imul(Jt,Tn)|0,xt=xt+Math.imul(Ht,nn)|0,At=At+Math.imul(Ht,Tn)|0;var Qn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,$t=Math.imul(Zt,Qr),xt=Math.imul(Zt,mn),xt=xt+Math.imul(Vt,Qr)|0,At=Math.imul(Vt,mn),$t=$t+Math.imul(or,qr)|0,xt=xt+Math.imul(or,wn)|0,xt=xt+Math.imul(Yt,qr)|0,At=At+Math.imul(Yt,wn)|0,$t=$t+Math.imul(Ar,Vr)|0,xt=xt+Math.imul(Ar,hn)|0,xt=xt+Math.imul(Or,Vr)|0,At=At+Math.imul(Or,hn)|0,$t=$t+Math.imul($r,Kr)|0,xt=xt+Math.imul($r,$n)|0,xt=xt+Math.imul(Pr,Kr)|0,At=At+Math.imul(Pr,$n)|0,$t=$t+Math.imul(lr,Gr)|0,xt=xt+Math.imul(lr,gn)|0,xt=xt+Math.imul(fr,Gr)|0,At=At+Math.imul(fr,gn)|0,$t=$t+Math.imul(pr,Zr)|0,xt=xt+Math.imul(pr,Rn)|0,xt=xt+Math.imul(kr,Zr)|0,At=At+Math.imul(kr,Rn)|0,$t=$t+Math.imul(Qt,nn)|0,xt=xt+Math.imul(Qt,Tn)|0,xt=xt+Math.imul(dr,nn)|0,At=At+Math.imul(dr,Tn)|0;var es=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(es>>>26)|0,es&=67108863,$t=Math.imul(Zt,qr),xt=Math.imul(Zt,wn),xt=xt+Math.imul(Vt,qr)|0,At=Math.imul(Vt,wn),$t=$t+Math.imul(or,Vr)|0,xt=xt+Math.imul(or,hn)|0,xt=xt+Math.imul(Yt,Vr)|0,At=At+Math.imul(Yt,hn)|0,$t=$t+Math.imul(Ar,Kr)|0,xt=xt+Math.imul(Ar,$n)|0,xt=xt+Math.imul(Or,Kr)|0,At=At+Math.imul(Or,$n)|0,$t=$t+Math.imul($r,Gr)|0,xt=xt+Math.imul($r,gn)|0,xt=xt+Math.imul(Pr,Gr)|0,At=At+Math.imul(Pr,gn)|0,$t=$t+Math.imul(lr,Zr)|0,xt=xt+Math.imul(lr,Rn)|0,xt=xt+Math.imul(fr,Zr)|0,At=At+Math.imul(fr,Rn)|0,$t=$t+Math.imul(pr,nn)|0,xt=xt+Math.imul(pr,Tn)|0,xt=xt+Math.imul(kr,nn)|0,At=At+Math.imul(kr,Tn)|0;var ls=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ls>>>26)|0,ls&=67108863,$t=Math.imul(Zt,Vr),xt=Math.imul(Zt,hn),xt=xt+Math.imul(Vt,Vr)|0,At=Math.imul(Vt,hn),$t=$t+Math.imul(or,Kr)|0,xt=xt+Math.imul(or,$n)|0,xt=xt+Math.imul(Yt,Kr)|0,At=At+Math.imul(Yt,$n)|0,$t=$t+Math.imul(Ar,Gr)|0,xt=xt+Math.imul(Ar,gn)|0,xt=xt+Math.imul(Or,Gr)|0,At=At+Math.imul(Or,gn)|0,$t=$t+Math.imul($r,Zr)|0,xt=xt+Math.imul($r,Rn)|0,xt=xt+Math.imul(Pr,Zr)|0,At=At+Math.imul(Pr,Rn)|0,$t=$t+Math.imul(lr,nn)|0,xt=xt+Math.imul(lr,Tn)|0,xt=xt+Math.imul(fr,nn)|0,At=At+Math.imul(fr,Tn)|0;var us=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(us>>>26)|0,us&=67108863,$t=Math.imul(Zt,Kr),xt=Math.imul(Zt,$n),xt=xt+Math.imul(Vt,Kr)|0,At=Math.imul(Vt,$n),$t=$t+Math.imul(or,Gr)|0,xt=xt+Math.imul(or,gn)|0,xt=xt+Math.imul(Yt,Gr)|0,At=At+Math.imul(Yt,gn)|0,$t=$t+Math.imul(Ar,Zr)|0,xt=xt+Math.imul(Ar,Rn)|0,xt=xt+Math.imul(Or,Zr)|0,At=At+Math.imul(Or,Rn)|0,$t=$t+Math.imul($r,nn)|0,xt=xt+Math.imul($r,Tn)|0,xt=xt+Math.imul(Pr,nn)|0,At=At+Math.imul(Pr,Tn)|0;var Wn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,$t=Math.imul(Zt,Gr),xt=Math.imul(Zt,gn),xt=xt+Math.imul(Vt,Gr)|0,At=Math.imul(Vt,gn),$t=$t+Math.imul(or,Zr)|0,xt=xt+Math.imul(or,Rn)|0,xt=xt+Math.imul(Yt,Zr)|0,At=At+Math.imul(Yt,Rn)|0,$t=$t+Math.imul(Ar,nn)|0,xt=xt+Math.imul(Ar,Tn)|0,xt=xt+Math.imul(Or,nn)|0,At=At+Math.imul(Or,Tn)|0;var as=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(as>>>26)|0,as&=67108863,$t=Math.imul(Zt,Zr),xt=Math.imul(Zt,Rn),xt=xt+Math.imul(Vt,Zr)|0,At=Math.imul(Vt,Rn),$t=$t+Math.imul(or,nn)|0,xt=xt+Math.imul(or,Tn)|0,xt=xt+Math.imul(Yt,nn)|0,At=At+Math.imul(Yt,Tn)|0;var gs=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(gs>>>26)|0,gs&=67108863,$t=Math.imul(Zt,nn),xt=Math.imul(Zt,Tn),xt=xt+Math.imul(Vt,nn)|0,At=Math.imul(Vt,Tn);var vs=(Rt+$t|0)+((xt&8191)<<13)|0;return Rt=(At+(xt>>>13)|0)+(vs>>>26)|0,vs&=67108863,St[0]=yn,St[1]=En,St[2]=ds,St[3]=fs,St[4]=hs,St[5]=ps,St[6]=Vn,St[7]=ss,St[8]=Jn,St[9]=Yn,St[10]=ms,St[11]=Qn,St[12]=es,St[13]=ls,St[14]=us,St[15]=Wn,St[16]=as,St[17]=gs,St[18]=vs,Rt!==0&&(St[19]=Rt,ct.length++),ct};Math.imul||(Et=bt);function Ct(Bt,yt,mt){mt.negative=yt.negative^Bt.negative,mt.length=Bt.length+yt.length;for(var ct=0,dt=0,vt=0;vt>>26)|0,dt+=St>>>26,St&=67108863}mt.words[vt]=Rt,ct=St,St=dt}return ct!==0?mt.words[vt]=ct:mt.length--,mt.strip()}function Pt(Bt,yt,mt){var ct=new Tt;return ct.mulp(Bt,yt,mt)}tt.prototype.mulTo=function(yt,mt){var ct,dt=this.length+yt.length;return this.length===10&&yt.length===10?ct=Et(this,yt,mt):dt<63?ct=bt(this,yt,mt):dt<1024?ct=Ct(this,yt,mt):ct=Pt(this,yt,mt),ct};function Tt(Bt,yt){this.x=Bt,this.y=yt}Tt.prototype.makeRBT=function(yt){for(var mt=new Array(yt),ct=tt.prototype._countBits(yt)-1,dt=0;dt>=1;return dt},Tt.prototype.permute=function(yt,mt,ct,dt,vt,St){for(var Rt=0;Rt>>1)vt++;return 1<>>13,ct[2*St+1]=vt&8191,vt=vt>>>13;for(St=2*mt;St>=26,mt+=dt/67108864|0,mt+=vt>>>26,this.words[ct]=vt&67108863}return mt!==0&&(this.words[ct]=mt,this.length++),this},tt.prototype.muln=function(yt){return this.clone().imuln(yt)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(yt){var mt=ht(yt);if(mt.length===0)return new tt(1);for(var ct=this,dt=0;dt=0);var mt=yt%26,ct=(yt-mt)/26,dt=67108863>>>26-mt<<26-mt,vt;if(mt!==0){var St=0;for(vt=0;vt>>26-mt}St&&(this.words[vt]=St,this.length++)}if(ct!==0){for(vt=this.length-1;vt>=0;vt--)this.words[vt+ct]=this.words[vt];for(vt=0;vt=0);var dt;mt?dt=(mt-mt%26)/26:dt=0;var vt=yt%26,St=Math.min((yt-vt)/26,this.length),Rt=67108863^67108863>>>vt<St)for(this.length-=St,xt=0;xt=0&&(At!==0||xt>=dt);xt--){var wt=this.words[xt]|0;this.words[xt]=At<<26-vt|wt>>>vt,At=wt&Rt}return $t&&At!==0&&($t.words[$t.length++]=At),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},tt.prototype.ishrn=function(yt,mt,ct){return j(this.negative===0),this.iushrn(yt,mt,ct)},tt.prototype.shln=function(yt){return this.clone().ishln(yt)},tt.prototype.ushln=function(yt){return this.clone().iushln(yt)},tt.prototype.shrn=function(yt){return this.clone().ishrn(yt)},tt.prototype.ushrn=function(yt){return this.clone().iushrn(yt)},tt.prototype.testn=function(yt){j(typeof yt=="number"&&yt>=0);var mt=yt%26,ct=(yt-mt)/26,dt=1<=0);var mt=yt%26,ct=(yt-mt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=ct)return this;if(mt!==0&&ct++,this.length=Math.min(ct,this.length),mt!==0){var dt=67108863^67108863>>>mt<=67108864;mt++)this.words[mt]-=67108864,mt===this.length-1?this.words[mt+1]=1:this.words[mt+1]++;return this.length=Math.max(this.length,mt+1),this},tt.prototype.isubn=function(yt){if(j(typeof yt=="number"),j(yt<67108864),yt<0)return this.iaddn(-yt);if(this.negative!==0)return this.negative=0,this.iaddn(yt),this.negative=1,this;if(this.words[0]-=yt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var mt=0;mt>26)-($t/67108864|0),this.words[vt+ct]=St&67108863}for(;vt>26,this.words[vt+ct]=St&67108863;if(Rt===0)return this.strip();for(j(Rt===-1),Rt=0,vt=0;vt>26,this.words[vt]=St&67108863;return this.negative=1,this.strip()},tt.prototype._wordDiv=function(yt,mt){var ct=this.length-yt.length,dt=this.clone(),vt=yt,St=vt.words[vt.length-1]|0,Rt=this._countBits(St);ct=26-Rt,ct!==0&&(vt=vt.ushln(ct),dt.iushln(ct),St=vt.words[vt.length-1]|0);var $t=dt.length-vt.length,xt;if(mt!=="mod"){xt=new tt(null),xt.length=$t+1,xt.words=new Array(xt.length);for(var At=0;At=0;Ot--){var tr=(dt.words[vt.length+Ot]|0)*67108864+(dt.words[vt.length+Ot-1]|0);for(tr=Math.min(tr/St|0,67108863),dt._ishlnsubmul(vt,tr,Ot);dt.negative!==0;)tr--,dt.negative=0,dt._ishlnsubmul(vt,1,Ot),dt.isZero()||(dt.negative^=1);xt&&(xt.words[Ot]=tr)}return xt&&xt.strip(),dt.strip(),mt!=="div"&&ct!==0&&dt.iushrn(ct),{div:xt||null,mod:dt}},tt.prototype.divmod=function(yt,mt,ct){if(j(!yt.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var dt,vt,St;return this.negative!==0&&yt.negative===0?(St=this.neg().divmod(yt,mt),mt!=="mod"&&(dt=St.div.neg()),mt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.iadd(yt)),{div:dt,mod:vt}):this.negative===0&&yt.negative!==0?(St=this.divmod(yt.neg(),mt),mt!=="mod"&&(dt=St.div.neg()),{div:dt,mod:St.mod}):this.negative&yt.negative?(St=this.neg().divmod(yt.neg(),mt),mt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.isub(yt)),{div:St.div,mod:vt}):yt.length>this.length||this.cmp(yt)<0?{div:new tt(0),mod:this}:yt.length===1?mt==="div"?{div:this.divn(yt.words[0]),mod:null}:mt==="mod"?{div:null,mod:new tt(this.modn(yt.words[0]))}:{div:this.divn(yt.words[0]),mod:new tt(this.modn(yt.words[0]))}:this._wordDiv(yt,mt)},tt.prototype.div=function(yt){return this.divmod(yt,"div",!1).div},tt.prototype.mod=function(yt){return this.divmod(yt,"mod",!1).mod},tt.prototype.umod=function(yt){return this.divmod(yt,"mod",!0).mod},tt.prototype.divRound=function(yt){var mt=this.divmod(yt);if(mt.mod.isZero())return mt.div;var ct=mt.div.negative!==0?mt.mod.isub(yt):mt.mod,dt=yt.ushrn(1),vt=yt.andln(1),St=ct.cmp(dt);return St<0||vt===1&&St===0?mt.div:mt.div.negative!==0?mt.div.isubn(1):mt.div.iaddn(1)},tt.prototype.modn=function(yt){j(yt<=67108863);for(var mt=(1<<26)%yt,ct=0,dt=this.length-1;dt>=0;dt--)ct=(mt*ct+(this.words[dt]|0))%yt;return ct},tt.prototype.idivn=function(yt){j(yt<=67108863);for(var mt=0,ct=this.length-1;ct>=0;ct--){var dt=(this.words[ct]|0)+mt*67108864;this.words[ct]=dt/yt|0,mt=dt%yt}return this.strip()},tt.prototype.divn=function(yt){return this.clone().idivn(yt)},tt.prototype.egcd=function(yt){j(yt.negative===0),j(!yt.isZero());var mt=this,ct=yt.clone();mt.negative!==0?mt=mt.umod(yt):mt=mt.clone();for(var dt=new tt(1),vt=new tt(0),St=new tt(0),Rt=new tt(1),$t=0;mt.isEven()&&ct.isEven();)mt.iushrn(1),ct.iushrn(1),++$t;for(var xt=ct.clone(),At=mt.clone();!mt.isZero();){for(var wt=0,Ot=1;!(mt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(mt.iushrn(wt);wt-- >0;)(dt.isOdd()||vt.isOdd())&&(dt.iadd(xt),vt.isub(At)),dt.iushrn(1),vt.iushrn(1);for(var tr=0,nr=1;!(ct.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ct.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(xt),Rt.isub(At)),St.iushrn(1),Rt.iushrn(1);mt.cmp(ct)>=0?(mt.isub(ct),dt.isub(St),vt.isub(Rt)):(ct.isub(mt),St.isub(dt),Rt.isub(vt))}return{a:St,b:Rt,gcd:ct.iushln($t)}},tt.prototype._invmp=function(yt){j(yt.negative===0),j(!yt.isZero());var mt=this,ct=yt.clone();mt.negative!==0?mt=mt.umod(yt):mt=mt.clone();for(var dt=new tt(1),vt=new tt(0),St=ct.clone();mt.cmpn(1)>0&&ct.cmpn(1)>0;){for(var Rt=0,$t=1;!(mt.words[0]&$t)&&Rt<26;++Rt,$t<<=1);if(Rt>0)for(mt.iushrn(Rt);Rt-- >0;)dt.isOdd()&&dt.iadd(St),dt.iushrn(1);for(var xt=0,At=1;!(ct.words[0]&At)&&xt<26;++xt,At<<=1);if(xt>0)for(ct.iushrn(xt);xt-- >0;)vt.isOdd()&&vt.iadd(St),vt.iushrn(1);mt.cmp(ct)>=0?(mt.isub(ct),dt.isub(vt)):(ct.isub(mt),vt.isub(dt))}var wt;return mt.cmpn(1)===0?wt=dt:wt=vt,wt.cmpn(0)<0&&wt.iadd(yt),wt},tt.prototype.gcd=function(yt){if(this.isZero())return yt.abs();if(yt.isZero())return this.abs();var mt=this.clone(),ct=yt.clone();mt.negative=0,ct.negative=0;for(var dt=0;mt.isEven()&&ct.isEven();dt++)mt.iushrn(1),ct.iushrn(1);do{for(;mt.isEven();)mt.iushrn(1);for(;ct.isEven();)ct.iushrn(1);var vt=mt.cmp(ct);if(vt<0){var St=mt;mt=ct,ct=St}else if(vt===0||ct.cmpn(1)===0)break;mt.isub(ct)}while(!0);return ct.iushln(dt)},tt.prototype.invm=function(yt){return this.egcd(yt).a.umod(yt)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(yt){return this.words[0]&yt},tt.prototype.bincn=function(yt){j(typeof yt=="number");var mt=yt%26,ct=(yt-mt)/26,dt=1<>>26,Rt&=67108863,this.words[St]=Rt}return vt!==0&&(this.words[St]=vt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(yt){var mt=yt<0;if(this.negative!==0&&!mt)return-1;if(this.negative===0&&mt)return 1;this.strip();var ct;if(this.length>1)ct=1;else{mt&&(yt=-yt),j(yt<=67108863,"Number is too big");var dt=this.words[0]|0;ct=dt===yt?0:dtyt.length)return 1;if(this.length=0;ct--){var dt=this.words[ct]|0,vt=yt.words[ct]|0;if(dt!==vt){dtvt&&(mt=1);break}}return mt},tt.prototype.gtn=function(yt){return this.cmpn(yt)===1},tt.prototype.gt=function(yt){return this.cmp(yt)===1},tt.prototype.gten=function(yt){return this.cmpn(yt)>=0},tt.prototype.gte=function(yt){return this.cmp(yt)>=0},tt.prototype.ltn=function(yt){return this.cmpn(yt)===-1},tt.prototype.lt=function(yt){return this.cmp(yt)===-1},tt.prototype.lten=function(yt){return this.cmpn(yt)<=0},tt.prototype.lte=function(yt){return this.cmp(yt)<=0},tt.prototype.eqn=function(yt){return this.cmpn(yt)===0},tt.prototype.eq=function(yt){return this.cmp(yt)===0},tt.red=function(yt){return new Dt(yt)},tt.prototype.toRed=function(yt){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),yt.convertTo(this)._forceRed(yt)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(yt){return this.red=yt,this},tt.prototype.forceRed=function(yt){return j(!this.red,"Already a number in reduction context"),this._forceRed(yt)},tt.prototype.redAdd=function(yt){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,yt)},tt.prototype.redIAdd=function(yt){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,yt)},tt.prototype.redSub=function(yt){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,yt)},tt.prototype.redISub=function(yt){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,yt)},tt.prototype.redShl=function(yt){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,yt)},tt.prototype.redMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.mul(this,yt)},tt.prototype.redIMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.imul(this,yt)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(yt){return j(this.red&&!yt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,yt)};var It={k256:null,p224:null,p192:null,p25519:null};function Lt(Bt,yt){this.name=Bt,this.p=new tt(yt,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Lt.prototype._tmp=function(){var yt=new tt(null);return yt.words=new Array(Math.ceil(this.n/13)),yt},Lt.prototype.ireduce=function(yt){var mt=yt,ct;do this.split(mt,this.tmp),mt=this.imulK(mt),mt=mt.iadd(this.tmp),ct=mt.bitLength();while(ct>this.n);var dt=ct0?mt.isub(this.p):mt.strip!==void 0?mt.strip():mt._strip(),mt},Lt.prototype.split=function(yt,mt){yt.iushrn(this.n,0,mt)},Lt.prototype.imulK=function(yt){return yt.imul(this.k)};function Nt(){Lt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Nt,Lt),Nt.prototype.split=function(yt,mt){for(var ct=4194303,dt=Math.min(yt.length,9),vt=0;vt>>22,St=Rt}St>>>=22,yt.words[vt-10]=St,St===0&&yt.length>10?yt.length-=10:yt.length-=9},Nt.prototype.imulK=function(yt){yt.words[yt.length]=0,yt.words[yt.length+1]=0,yt.length+=2;for(var mt=0,ct=0;ct>>=26,yt.words[ct]=vt,mt=dt}return mt!==0&&(yt.words[yt.length++]=mt),yt},tt._prime=function(yt){if(It[yt])return It[yt];var mt;if(yt==="k256")mt=new Nt;else if(yt==="p224")mt=new Ut;else if(yt==="p192")mt=new jt;else if(yt==="p25519")mt=new Mt;else throw new Error("Unknown prime "+yt);return It[yt]=mt,mt};function Dt(Bt){if(typeof Bt=="string"){var yt=tt._prime(Bt);this.m=yt.p,this.prime=yt}else j(Bt.gtn(1),"modulus must be greater than 1"),this.m=Bt,this.prime=null}Dt.prototype._verify1=function(yt){j(yt.negative===0,"red works only with positives"),j(yt.red,"red works only with red numbers")},Dt.prototype._verify2=function(yt,mt){j((yt.negative|mt.negative)===0,"red works only with positives"),j(yt.red&&yt.red===mt.red,"red works only with red numbers")},Dt.prototype.imod=function(yt){return this.prime?this.prime.ireduce(yt)._forceRed(this):yt.umod(this.m)._forceRed(this)},Dt.prototype.neg=function(yt){return yt.isZero()?yt.clone():this.m.sub(yt)._forceRed(this)},Dt.prototype.add=function(yt,mt){this._verify2(yt,mt);var ct=yt.add(mt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct._forceRed(this)},Dt.prototype.iadd=function(yt,mt){this._verify2(yt,mt);var ct=yt.iadd(mt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct},Dt.prototype.sub=function(yt,mt){this._verify2(yt,mt);var ct=yt.sub(mt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct._forceRed(this)},Dt.prototype.isub=function(yt,mt){this._verify2(yt,mt);var ct=yt.isub(mt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct},Dt.prototype.shl=function(yt,mt){return this._verify1(yt),this.imod(yt.ushln(mt))},Dt.prototype.imul=function(yt,mt){return this._verify2(yt,mt),this.imod(yt.imul(mt))},Dt.prototype.mul=function(yt,mt){return this._verify2(yt,mt),this.imod(yt.mul(mt))},Dt.prototype.isqr=function(yt){return this.imul(yt,yt.clone())},Dt.prototype.sqr=function(yt){return this.mul(yt,yt)},Dt.prototype.sqrt=function(yt){if(yt.isZero())return yt.clone();var mt=this.m.andln(3);if(j(mt%2===1),mt===3){var ct=this.m.add(new tt(1)).iushrn(2);return this.pow(yt,ct)}for(var dt=this.m.subn(1),vt=0;!dt.isZero()&&dt.andln(1)===0;)vt++,dt.iushrn(1);j(!dt.isZero());var St=new tt(1).toRed(this),Rt=St.redNeg(),$t=this.m.subn(1).iushrn(1),xt=this.m.bitLength();for(xt=new tt(2*xt*xt).toRed(this);this.pow(xt,$t).cmp(Rt)!==0;)xt.redIAdd(Rt);for(var At=this.pow(xt,dt),wt=this.pow(yt,dt.addn(1).iushrn(1)),Ot=this.pow(yt,dt),tr=vt;Ot.cmp(St)!==0;){for(var nr=Ot,ir=0;nr.cmp(St)!==0;ir++)nr=nr.redSqr();j(ir=0;vt--){for(var At=mt.words[vt],wt=xt-1;wt>=0;wt--){var Ot=At>>wt&1;if(St!==dt[0]&&(St=this.sqr(St)),Ot===0&&Rt===0){$t=0;continue}Rt<<=1,Rt|=Ot,$t++,!($t!==ct&&(vt!==0||wt!==0))&&(St=this.mul(St,dt[Rt]),$t=0,Rt=0)}xt=26}return St},Dt.prototype.convertTo=function(yt){var mt=yt.umod(this.m);return mt===yt?mt.clone():mt},Dt.prototype.convertFrom=function(yt){var mt=yt.clone();return mt.red=null,mt},tt.mont=function(yt){return new Ft(yt)};function Ft(Bt){Dt.call(this,Bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(Ft,Dt),Ft.prototype.convertTo=function(yt){return this.imod(yt.ushln(this.shift))},Ft.prototype.convertFrom=function(yt){var mt=this.imod(yt.mul(this.rinv));return mt.red=null,mt},Ft.prototype.imul=function(yt,mt){if(yt.isZero()||mt.isZero())return yt.words[0]=0,yt.length=1,yt;var ct=yt.imul(mt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(dt).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.mul=function(yt,mt){if(yt.isZero()||mt.isZero())return new tt(0)._forceRed(this);var ct=yt.mul(mt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(dt).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.invm=function(yt){var mt=this.imod(yt._invmp(this.m).mul(this.r2));return mt._forceRed(this)}})(_,commonjsGlobal)})(bn$4);var bnExports$1=bn$4.exports;const BN$h=getDefaultExportFromCjs$1(bnExports$1);var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var _;brorand.exports=function(et){return _||(_=new a(null)),_.generate(et)};function a(j){this.rand=j}if(brorand.exports.Rand=a,a.prototype.generate=function(et){return this._rand(et)},a.prototype._rand=function(et){if(this.rand.getBytes)return this.rand.getBytes(et);for(var tt=new Uint8Array(et),rt=0;rt=0);return nt},$.prototype._randrange=function(et,tt){var rt=tt.sub(et);return et.add(this._randbelow(rt))},$.prototype.test=function(et,tt,rt){var nt=et.bitLength(),it=_.mont(et),ot=new _(1).toRed(it);tt||(tt=Math.max(1,nt/48|0));for(var st=et.subn(1),at=0;!st.testn(at);at++);for(var ut=et.shrn(at),ht=st.toRed(it),bt=!0;tt>0;tt--){var Et=this._randrange(new _(2),st);rt&&rt(Et);var Ct=Et.toRed(it).redPow(ut);if(!(Ct.cmp(ot)===0||Ct.cmp(ht)===0)){for(var Pt=1;Pt0;tt--){var ht=this._randrange(new _(2),ot),bt=et.gcd(ht);if(bt.cmpn(1)!==0)return bt;var Et=ht.toRed(nt).redPow(at);if(!(Et.cmp(it)===0||Et.cmp(ut)===0)){for(var Ct=1;CtPt;)It.ishrn(1);if(It.isEven()&&It.iadd(tt),It.testn(1)||It.iadd(rt),Tt.cmp(rt)){if(!Tt.cmp(nt))for(;It.mod(it).cmp(ot);)It.iadd(at)}else for(;It.mod($).cmp(st);)It.iadd(at);if(Lt=It.shrn(1),bt(Lt)&&bt(It)&&Et(Lt)&&Et(It)&&et.test(Lt)&&et.test(It))return It}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$2={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var _=bnExports$1,a=requireMr(),$=new a,j=new _(24),et=new _(11),tt=new _(10),rt=new _(3),nt=new _(7),it=requireGeneratePrime(),ot=requireBrowser$8();dh=bt;function st(Ct,Pt){return Pt=Pt||"utf8",Buffer$g.isBuffer(Ct)||(Ct=new Buffer$g(Ct,Pt)),this._pub=new _(Ct),this}function at(Ct,Pt){return Pt=Pt||"utf8",Buffer$g.isBuffer(Ct)||(Ct=new Buffer$g(Ct,Pt)),this._priv=new _(Ct),this}var ut={};function ht(Ct,Pt){var Tt=Pt.toString("hex"),It=[Tt,Ct.toString(16)].join("_");if(It in ut)return ut[It];var Lt=0;if(Ct.isEven()||!it.simpleSieve||!it.fermatTest(Ct)||!$.test(Ct))return Lt+=1,Tt==="02"||Tt==="05"?Lt+=8:Lt+=4,ut[It]=Lt,Lt;$.test(Ct.shrn(1))||(Lt+=2);var Nt;switch(Tt){case"02":Ct.mod(j).cmp(et)&&(Lt+=8);break;case"05":Nt=Ct.mod(tt),Nt.cmp(rt)&&Nt.cmp(nt)&&(Lt+=8);break;default:Lt+=4}return ut[It]=Lt,Lt}function bt(Ct,Pt,Tt){this.setGenerator(Pt),this.__prime=new _(Ct),this._prime=_.mont(this.__prime),this._primeLen=Ct.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,Tt?(this.setPublicKey=st,this.setPrivateKey=at):this._primeCode=8}Object.defineProperty(bt.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=ht(this.__prime,this.__gen)),this._primeCode}}),bt.prototype.generateKeys=function(){return this._priv||(this._priv=new _(ot(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},bt.prototype.computeSecret=function(Ct){Ct=new _(Ct),Ct=Ct.toRed(this._prime);var Pt=Ct.redPow(this._priv).fromRed(),Tt=new Buffer$g(Pt.toArray()),It=this.getPrime();if(Tt.length"u"||!process$1$1.version||process$1$1.version.indexOf("v0.")===0||process$1$1.version.indexOf("v1.")===0&&process$1$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:_}:processNextickArgs.exports=process$1$1;function _(a,$,j,et){if(typeof a!="function")throw new TypeError('"callback" argument must be a function');var tt=arguments.length,rt,nt;switch(tt){case 0:case 1:return process$1$1.nextTick(a);case 2:return process$1$1.nextTick(function(){a.call(null,$)});case 3:return process$1$1.nextTick(function(){a.call(null,$,j)});case 4:return process$1$1.nextTick(function(){a.call(null,$,j,et)});default:for(rt=new Array(tt-1),nt=0;nt"u"}util$4.isPrimitive=ht,util$4.isBuffer=buffer$1.Buffer.isBuffer;function bt(Et){return Object.prototype.toString.call(Et)}return util$4}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(_){function a(tt,rt){if(!(tt instanceof rt))throw new TypeError("Cannot call a class as a function")}var $=requireSafeBuffer$1().Buffer,j=util$5;function et(tt,rt,nt){tt.copy(rt,nt)}_.exports=function(){function tt(){a(this,tt),this.head=null,this.tail=null,this.length=0}return tt.prototype.push=function(nt){var it={data:nt,next:null};this.length>0?this.tail.next=it:this.head=it,this.tail=it,++this.length},tt.prototype.unshift=function(nt){var it={data:nt,next:this.head};this.length===0&&(this.tail=it),this.head=it,++this.length},tt.prototype.shift=function(){if(this.length!==0){var nt=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,nt}},tt.prototype.clear=function(){this.head=this.tail=null,this.length=0},tt.prototype.join=function(nt){if(this.length===0)return"";for(var it=this.head,ot=""+it.data;it=it.next;)ot+=nt+it.data;return ot},tt.prototype.concat=function(nt){if(this.length===0)return $.alloc(0);for(var it=$.allocUnsafe(nt>>>0),ot=this.head,st=0;ot;)et(ot.data,it,st),st+=ot.data.length,ot=ot.next;return it},tt}(),j&&j.inspect&&j.inspect.custom&&(_.exports.prototype[j.inspect.custom]=function(){var tt=j.inspect({length:this.length});return this.constructor.name+" "+tt})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var _=requireProcessNextickArgs();function a(et,tt){var rt=this,nt=this._readableState&&this._readableState.destroyed,it=this._writableState&&this._writableState.destroyed;return nt||it?(tt?tt(et):et&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,_.nextTick(j,this,et)):_.nextTick(j,this,et)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(et||null,function(ot){!tt&&ot?rt._writableState?rt._writableState.errorEmitted||(rt._writableState.errorEmitted=!0,_.nextTick(j,rt,ot)):_.nextTick(j,rt,ot):tt&&tt(ot)}),this)}function $(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function j(et,tt){et.emit("error",tt)}return destroy_1={destroy:a,undestroy:$},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var _=requireProcessNextickArgs();_stream_writable=Et;function a(St){var Rt=this;this.next=null,this.entry=null,this.finish=function(){vt(Rt,St)}}var $=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:_.nextTick,j;Et.WritableState=ht;var et=Object.create(requireUtil());et.inherits=inherits_browserExports;var tt={deprecate:browser$c},rt=requireStreamBrowser(),nt=requireSafeBuffer$1().Buffer,it=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ot(St){return nt.from(St)}function st(St){return nt.isBuffer(St)||St instanceof it}var at=requireDestroy();et.inherits(Et,rt);function ut(){}function ht(St,Rt){j=j||require_stream_duplex(),St=St||{};var $t=Rt instanceof j;this.objectMode=!!St.objectMode,$t&&(this.objectMode=this.objectMode||!!St.writableObjectMode);var xt=St.highWaterMark,At=St.writableHighWaterMark,wt=this.objectMode?16:16*1024;xt||xt===0?this.highWaterMark=xt:$t&&(At||At===0)?this.highWaterMark=At:this.highWaterMark=wt,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ot=St.decodeStrings===!1;this.decodeStrings=!Ot,this.defaultEncoding=St.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(tr){jt(Rt,tr)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}ht.prototype.getBuffer=function(){for(var Rt=this.bufferedRequest,$t=[];Rt;)$t.push(Rt),Rt=Rt.next;return $t},function(){try{Object.defineProperty(ht.prototype,"buffer",{get:tt.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var bt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(bt=Function.prototype[Symbol.hasInstance],Object.defineProperty(Et,Symbol.hasInstance,{value:function(St){return bt.call(this,St)?!0:this!==Et?!1:St&&St._writableState instanceof ht}})):bt=function(St){return St instanceof this};function Et(St){if(j=j||require_stream_duplex(),!bt.call(Et,this)&&!(this instanceof j))return new Et(St);this._writableState=new ht(St,this),this.writable=!0,St&&(typeof St.write=="function"&&(this._write=St.write),typeof St.writev=="function"&&(this._writev=St.writev),typeof St.destroy=="function"&&(this._destroy=St.destroy),typeof St.final=="function"&&(this._final=St.final)),rt.call(this)}Et.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Ct(St,Rt){var $t=new Error("write after end");St.emit("error",$t),_.nextTick(Rt,$t)}function Pt(St,Rt,$t,xt){var At=!0,wt=!1;return $t===null?wt=new TypeError("May not write null values to stream"):typeof $t!="string"&&$t!==void 0&&!Rt.objectMode&&(wt=new TypeError("Invalid non-string/buffer chunk")),wt&&(St.emit("error",wt),_.nextTick(xt,wt),At=!1),At}Et.prototype.write=function(St,Rt,$t){var xt=this._writableState,At=!1,wt=!xt.objectMode&&st(St);return wt&&!nt.isBuffer(St)&&(St=ot(St)),typeof Rt=="function"&&($t=Rt,Rt=null),wt?Rt="buffer":Rt||(Rt=xt.defaultEncoding),typeof $t!="function"&&($t=ut),xt.ended?Ct(this,$t):(wt||Pt(this,xt,St,$t))&&(xt.pendingcb++,At=It(this,xt,wt,St,Rt,$t)),At},Et.prototype.cork=function(){var St=this._writableState;St.corked++},Et.prototype.uncork=function(){var St=this._writableState;St.corked&&(St.corked--,!St.writing&&!St.corked&&!St.bufferProcessing&&St.bufferedRequest&&Ft(this,St))},Et.prototype.setDefaultEncoding=function(Rt){if(typeof Rt=="string"&&(Rt=Rt.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Rt+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Rt);return this._writableState.defaultEncoding=Rt,this};function Tt(St,Rt,$t){return!St.objectMode&&St.decodeStrings!==!1&&typeof Rt=="string"&&(Rt=nt.from(Rt,$t)),Rt}Object.defineProperty(Et.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function It(St,Rt,$t,xt,At,wt){if(!$t){var Ot=Tt(Rt,xt,At);xt!==Ot&&($t=!0,At="buffer",xt=Ot)}var tr=Rt.objectMode?1:xt.length;Rt.length+=tr;var nr=Rt.length>5===6?2:Pt>>4===14?3:Pt>>3===30?4:Pt>>6===2?-1:-2}function rt(Pt,Tt,It){var Lt=Tt.length-1;if(Lt=0?(Nt>0&&(Pt.lastNeed=Nt-1),Nt):--Lt=0?(Nt>0&&(Pt.lastNeed=Nt-2),Nt):--Lt=0?(Nt>0&&(Nt===2?Nt=0:Pt.lastNeed=Nt-3),Nt):0))}function nt(Pt,Tt,It){if((Tt[0]&192)!==128)return Pt.lastNeed=0,"�";if(Pt.lastNeed>1&&Tt.length>1){if((Tt[1]&192)!==128)return Pt.lastNeed=1,"�";if(Pt.lastNeed>2&&Tt.length>2&&(Tt[2]&192)!==128)return Pt.lastNeed=2,"�"}}function it(Pt){var Tt=this.lastTotal-this.lastNeed,It=nt(this,Pt);if(It!==void 0)return It;if(this.lastNeed<=Pt.length)return Pt.copy(this.lastChar,Tt,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Pt.copy(this.lastChar,Tt,0,Pt.length),this.lastNeed-=Pt.length}function ot(Pt,Tt){var It=rt(this,Pt,Tt);if(!this.lastNeed)return Pt.toString("utf8",Tt);this.lastTotal=It;var Lt=Pt.length-(It-this.lastNeed);return Pt.copy(this.lastChar,0,Lt),Pt.toString("utf8",Tt,Lt)}function st(Pt){var Tt=Pt&&Pt.length?this.write(Pt):"";return this.lastNeed?Tt+"�":Tt}function at(Pt,Tt){if((Pt.length-Tt)%2===0){var It=Pt.toString("utf16le",Tt);if(It){var Lt=It.charCodeAt(It.length-1);if(Lt>=55296&&Lt<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=Pt[Pt.length-2],this.lastChar[1]=Pt[Pt.length-1],It.slice(0,-1)}return It}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=Pt[Pt.length-1],Pt.toString("utf16le",Tt,Pt.length-1)}function ut(Pt){var Tt=Pt&&Pt.length?this.write(Pt):"";if(this.lastNeed){var It=this.lastTotal-this.lastNeed;return Tt+this.lastChar.toString("utf16le",0,It)}return Tt}function ht(Pt,Tt){var It=(Pt.length-Tt)%3;return It===0?Pt.toString("base64",Tt):(this.lastNeed=3-It,this.lastTotal=3,It===1?this.lastChar[0]=Pt[Pt.length-1]:(this.lastChar[0]=Pt[Pt.length-2],this.lastChar[1]=Pt[Pt.length-1]),Pt.toString("base64",Tt,Pt.length-It))}function bt(Pt){var Tt=Pt&&Pt.length?this.write(Pt):"";return this.lastNeed?Tt+this.lastChar.toString("base64",0,3-this.lastNeed):Tt}function Et(Pt){return Pt.toString(this.encoding)}function Ct(Pt){return Pt&&Pt.length?this.write(Pt):""}return string_decoder}var _stream_readable,hasRequired_stream_readable;function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var _=requireProcessNextickArgs();_stream_readable=Tt;var a=requireIsarray(),$;Tt.ReadableState=Pt,eventsExports.EventEmitter;var j=function(Wt,Kt){return Wt.listeners(Kt).length},et=requireStreamBrowser(),tt=requireSafeBuffer$1().Buffer,rt=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function nt(Wt){return tt.from(Wt)}function it(Wt){return tt.isBuffer(Wt)||Wt instanceof rt}var ot=Object.create(requireUtil());ot.inherits=inherits_browserExports;var st=util$5,at=void 0;st&&st.debuglog?at=st.debuglog("stream"):at=function(){};var ut=requireBufferList(),ht=requireDestroy(),bt;ot.inherits(Tt,et);var Et=["error","close","destroy","pause","resume"];function Ct(Wt,Kt,Jt){if(typeof Wt.prependListener=="function")return Wt.prependListener(Kt,Jt);!Wt._events||!Wt._events[Kt]?Wt.on(Kt,Jt):a(Wt._events[Kt])?Wt._events[Kt].unshift(Jt):Wt._events[Kt]=[Jt,Wt._events[Kt]]}function Pt(Wt,Kt){$=$||require_stream_duplex(),Wt=Wt||{};var Jt=Kt instanceof $;this.objectMode=!!Wt.objectMode,Jt&&(this.objectMode=this.objectMode||!!Wt.readableObjectMode);var Ht=Wt.highWaterMark,qt=Wt.readableHighWaterMark,Qt=this.objectMode?16:16*1024;Ht||Ht===0?this.highWaterMark=Ht:Jt&&(qt||qt===0)?this.highWaterMark=qt:this.highWaterMark=Qt,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new ut,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=Wt.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Wt.encoding&&(bt||(bt=requireString_decoder().StringDecoder),this.decoder=new bt(Wt.encoding),this.encoding=Wt.encoding)}function Tt(Wt){if($=$||require_stream_duplex(),!(this instanceof Tt))return new Tt(Wt);this._readableState=new Pt(Wt,this),this.readable=!0,Wt&&(typeof Wt.read=="function"&&(this._read=Wt.read),typeof Wt.destroy=="function"&&(this._destroy=Wt.destroy)),et.call(this)}Object.defineProperty(Tt.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Wt){this._readableState&&(this._readableState.destroyed=Wt)}}),Tt.prototype.destroy=ht.destroy,Tt.prototype._undestroy=ht.undestroy,Tt.prototype._destroy=function(Wt,Kt){this.push(null),Kt(Wt)},Tt.prototype.push=function(Wt,Kt){var Jt=this._readableState,Ht;return Jt.objectMode?Ht=!0:typeof Wt=="string"&&(Kt=Kt||Jt.defaultEncoding,Kt!==Jt.encoding&&(Wt=tt.from(Wt,Kt),Kt=""),Ht=!0),It(this,Wt,Kt,!1,Ht)},Tt.prototype.unshift=function(Wt){return It(this,Wt,null,!0,!1)};function It(Wt,Kt,Jt,Ht,qt){var Qt=Wt._readableState;if(Kt===null)Qt.reading=!1,Ft(Wt,Qt);else{var dr;qt||(dr=Nt(Qt,Kt)),dr?Wt.emit("error",dr):Qt.objectMode||Kt&&Kt.length>0?(typeof Kt!="string"&&!Qt.objectMode&&Object.getPrototypeOf(Kt)!==tt.prototype&&(Kt=nt(Kt)),Ht?Qt.endEmitted?Wt.emit("error",new Error("stream.unshift() after end event")):Lt(Wt,Qt,Kt,!0):Qt.ended?Wt.emit("error",new Error("stream.push() after EOF")):(Qt.reading=!1,Qt.decoder&&!Jt?(Kt=Qt.decoder.write(Kt),Qt.objectMode||Kt.length!==0?Lt(Wt,Qt,Kt,!1):mt(Wt,Qt)):Lt(Wt,Qt,Kt,!1))):Ht||(Qt.reading=!1)}return Ut(Qt)}function Lt(Wt,Kt,Jt,Ht){Kt.flowing&&Kt.length===0&&!Kt.sync?(Wt.emit("data",Jt),Wt.read(0)):(Kt.length+=Kt.objectMode?1:Jt.length,Ht?Kt.buffer.unshift(Jt):Kt.buffer.push(Jt),Kt.needReadable&&Bt(Wt)),mt(Wt,Kt)}function Nt(Wt,Kt){var Jt;return!it(Kt)&&typeof Kt!="string"&&Kt!==void 0&&!Wt.objectMode&&(Jt=new TypeError("Invalid non-string/buffer chunk")),Jt}function Ut(Wt){return!Wt.ended&&(Wt.needReadable||Wt.length=jt?Wt=jt:(Wt--,Wt|=Wt>>>1,Wt|=Wt>>>2,Wt|=Wt>>>4,Wt|=Wt>>>8,Wt|=Wt>>>16,Wt++),Wt}function Dt(Wt,Kt){return Wt<=0||Kt.length===0&&Kt.ended?0:Kt.objectMode?1:Wt!==Wt?Kt.flowing&&Kt.length?Kt.buffer.head.data.length:Kt.length:(Wt>Kt.highWaterMark&&(Kt.highWaterMark=Mt(Wt)),Wt<=Kt.length?Wt:Kt.ended?Kt.length:(Kt.needReadable=!0,0))}Tt.prototype.read=function(Wt){at("read",Wt),Wt=parseInt(Wt,10);var Kt=this._readableState,Jt=Wt;if(Wt!==0&&(Kt.emittedReadable=!1),Wt===0&&Kt.needReadable&&(Kt.length>=Kt.highWaterMark||Kt.ended))return at("read: emitReadable",Kt.length,Kt.ended),Kt.length===0&&Kt.ended?tr(this):Bt(this),null;if(Wt=Dt(Wt,Kt),Wt===0&&Kt.ended)return Kt.length===0&&tr(this),null;var Ht=Kt.needReadable;at("need readable",Ht),(Kt.length===0||Kt.length-Wt0?qt=xt(Wt,Kt):qt=null,qt===null?(Kt.needReadable=!0,Wt=0):Kt.length-=Wt,Kt.length===0&&(Kt.ended||(Kt.needReadable=!0),Jt!==Wt&&Kt.ended&&tr(this)),qt!==null&&this.emit("data",qt),qt};function Ft(Wt,Kt){if(!Kt.ended){if(Kt.decoder){var Jt=Kt.decoder.end();Jt&&Jt.length&&(Kt.buffer.push(Jt),Kt.length+=Kt.objectMode?1:Jt.length)}Kt.ended=!0,Bt(Wt)}}function Bt(Wt){var Kt=Wt._readableState;Kt.needReadable=!1,Kt.emittedReadable||(at("emitReadable",Kt.flowing),Kt.emittedReadable=!0,Kt.sync?_.nextTick(yt,Wt):yt(Wt))}function yt(Wt){at("emit readable"),Wt.emit("readable"),$t(Wt)}function mt(Wt,Kt){Kt.readingMore||(Kt.readingMore=!0,_.nextTick(ct,Wt,Kt))}function ct(Wt,Kt){for(var Jt=Kt.length;!Kt.reading&&!Kt.flowing&&!Kt.ended&&Kt.length1&&ir(Ht.pipes,Wt)!==-1)&&!kr&&(at("false write response, pause",Ht.awaitDrain),Ht.awaitDrain++,lr=!0),Jt.pause())}function Er(Ar){at("onerror",Ar),Rr(),Wt.removeListener("error",Er),j(Wt,"error")===0&&Wt.emit("error",Ar)}Ct(Wt,"error",Er);function $r(){Wt.removeListener("finish",Pr),Rr()}Wt.once("close",$r);function Pr(){at("onfinish"),Wt.removeListener("close",$r),Rr()}Wt.once("finish",Pr);function Rr(){at("unpipe"),Jt.unpipe(Wt)}return Wt.emit("pipe",Jt),Ht.flowing||(at("pipe resume"),Jt.resume()),Wt};function dt(Wt){return function(){var Kt=Wt._readableState;at("pipeOnDrain",Kt.awaitDrain),Kt.awaitDrain&&Kt.awaitDrain--,Kt.awaitDrain===0&&j(Wt,"data")&&(Kt.flowing=!0,$t(Wt))}}Tt.prototype.unpipe=function(Wt){var Kt=this._readableState,Jt={hasUnpiped:!1};if(Kt.pipesCount===0)return this;if(Kt.pipesCount===1)return Wt&&Wt!==Kt.pipes?this:(Wt||(Wt=Kt.pipes),Kt.pipes=null,Kt.pipesCount=0,Kt.flowing=!1,Wt&&Wt.emit("unpipe",this,Jt),this);if(!Wt){var Ht=Kt.pipes,qt=Kt.pipesCount;Kt.pipes=null,Kt.pipesCount=0,Kt.flowing=!1;for(var Qt=0;Qt=Kt.length?(Kt.decoder?Jt=Kt.buffer.join(""):Kt.buffer.length===1?Jt=Kt.buffer.head.data:Jt=Kt.buffer.concat(Kt.length),Kt.buffer.clear()):Jt=At(Wt,Kt.buffer,Kt.decoder),Jt}function At(Wt,Kt,Jt){var Ht;return WtQt.length?Qt.length:Wt;if(dr===Qt.length?qt+=Qt:qt+=Qt.slice(0,Wt),Wt-=dr,Wt===0){dr===Qt.length?(++Ht,Jt.next?Kt.head=Jt.next:Kt.head=Kt.tail=null):(Kt.head=Jt,Jt.data=Qt.slice(dr));break}++Ht}return Kt.length-=Ht,qt}function Ot(Wt,Kt){var Jt=tt.allocUnsafe(Wt),Ht=Kt.head,qt=1;for(Ht.data.copy(Jt),Wt-=Ht.data.length;Ht=Ht.next;){var Qt=Ht.data,dr=Wt>Qt.length?Qt.length:Wt;if(Qt.copy(Jt,Jt.length-Wt,0,dr),Wt-=dr,Wt===0){dr===Qt.length?(++qt,Ht.next?Kt.head=Ht.next:Kt.head=Kt.tail=null):(Kt.head=Ht,Ht.data=Qt.slice(dr));break}++qt}return Kt.length-=qt,Jt}function tr(Wt){var Kt=Wt._readableState;if(Kt.length>0)throw new Error('"endReadable()" called on non-empty stream');Kt.endEmitted||(Kt.ended=!0,_.nextTick(nr,Kt,Wt))}function nr(Wt,Kt){!Wt.endEmitted&&Wt.length===0&&(Wt.endEmitted=!0,Kt.readable=!1,Kt.emit("end"))}function ir(Wt,Kt){for(var Jt=0,Ht=Wt.length;Jt0?ct:dt},tt.min=function(ct,dt){return ct.cmp(dt)<0?ct:dt},tt.prototype._init=function(ct,dt,vt){if(typeof ct=="number")return this._initNumber(ct,dt,vt);if(typeof ct=="object")return this._initArray(ct,dt,vt);dt==="hex"&&(dt=16),j(dt===(dt|0)&&dt>=2&&dt<=36),ct=ct.toString().replace(/\s+/g,"");var St=0;ct[0]==="-"&&(St++,this.negative=1),St=0;St-=3)$t=ct[St]|ct[St-1]<<8|ct[St-2]<<16,this.words[Rt]|=$t<>>26-xt&67108863,xt+=24,xt>=26&&(xt-=26,Rt++);else if(vt==="le")for(St=0,Rt=0;St>>26-xt&67108863,xt+=24,xt>=26&&(xt-=26,Rt++);return this._strip()};function nt(mt,ct){var dt=mt.charCodeAt(ct);if(dt>=48&&dt<=57)return dt-48;if(dt>=65&&dt<=70)return dt-55;if(dt>=97&&dt<=102)return dt-87;j(!1,"Invalid character in "+mt)}function it(mt,ct,dt){var vt=nt(mt,dt);return dt-1>=ct&&(vt|=nt(mt,dt-1)<<4),vt}tt.prototype._parseHex=function(ct,dt,vt){this.length=Math.ceil((ct.length-dt)/6),this.words=new Array(this.length);for(var St=0;St=dt;St-=2)xt=it(ct,dt,St)<=18?(Rt-=18,$t+=1,this.words[$t]|=xt>>>26):Rt+=8;else{var At=ct.length-dt;for(St=At%2===0?dt+1:dt;St=18?(Rt-=18,$t+=1,this.words[$t]|=xt>>>26):Rt+=8}this._strip()};function ot(mt,ct,dt,vt){for(var St=0,Rt=0,$t=Math.min(mt.length,dt),xt=ct;xt<$t;xt++){var At=mt.charCodeAt(xt)-48;St*=vt,At>=49?Rt=At-49+10:At>=17?Rt=At-17+10:Rt=At,j(At>=0&&Rt1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=at}catch{tt.prototype.inspect=at}else tt.prototype.inspect=at;function at(){return(this.red?""}var ut=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ht=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],bt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(ct,dt){ct=ct||10,dt=dt|0||1;var vt;if(ct===16||ct==="hex"){vt="";for(var St=0,Rt=0,$t=0;$t>>24-St&16777215,St+=2,St>=26&&(St-=26,$t--),Rt!==0||$t!==this.length-1?vt=ut[6-At.length]+At+vt:vt=At+vt}for(Rt!==0&&(vt=Rt.toString(16)+vt);vt.length%dt!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}if(ct===(ct|0)&&ct>=2&&ct<=36){var wt=ht[ct],Ot=bt[ct];vt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var nr=tr.modrn(Ot).toString(ct);tr=tr.idivn(Ot),tr.isZero()?vt=nr+vt:vt=ut[wt-nr.length]+nr+vt}for(this.isZero()&&(vt="0"+vt);vt.length%dt!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var ct=this.words[0];return this.length===2?ct+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ct+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-ct:ct},tt.prototype.toJSON=function(){return this.toString(16,2)},rt&&(tt.prototype.toBuffer=function(ct,dt){return this.toArrayLike(rt,ct,dt)}),tt.prototype.toArray=function(ct,dt){return this.toArrayLike(Array,ct,dt)};var Et=function(ct,dt){return ct.allocUnsafe?ct.allocUnsafe(dt):new ct(dt)};tt.prototype.toArrayLike=function(ct,dt,vt){this._strip();var St=this.byteLength(),Rt=vt||Math.max(1,St);j(St<=Rt,"byte array longer than desired length"),j(Rt>0,"Requested array length <= 0");var $t=Et(ct,Rt),xt=dt==="le"?"LE":"BE";return this["_toArrayLike"+xt]($t,St),$t},tt.prototype._toArrayLikeLE=function(ct,dt){for(var vt=0,St=0,Rt=0,$t=0;Rt>8&255),vt>16&255),$t===6?(vt>24&255),St=0,$t=0):(St=xt>>>24,$t+=2)}if(vt=0&&(ct[vt--]=xt>>8&255),vt>=0&&(ct[vt--]=xt>>16&255),$t===6?(vt>=0&&(ct[vt--]=xt>>24&255),St=0,$t=0):(St=xt>>>24,$t+=2)}if(vt>=0)for(ct[vt--]=St;vt>=0;)ct[vt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var dt=ct,vt=0;return dt>=4096&&(vt+=13,dt>>>=13),dt>=64&&(vt+=7,dt>>>=7),dt>=8&&(vt+=4,dt>>>=4),dt>=2&&(vt+=2,dt>>>=2),vt+dt},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var dt=ct,vt=0;return dt&8191||(vt+=13,dt>>>=13),dt&127||(vt+=7,dt>>>=7),dt&15||(vt+=4,dt>>>=4),dt&3||(vt+=2,dt>>>=2),dt&1||vt++,vt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],dt=this._countBits(ct);return(this.length-1)*26+dt};function Ct(mt){for(var ct=new Array(mt.bitLength()),dt=0;dt>>St&1}return ct}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var ct=0,dt=0;dtct.length?this.clone().ior(ct):ct.clone().ior(this)},tt.prototype.uor=function(ct){return this.length>ct.length?this.clone().iuor(ct):ct.clone().iuor(this)},tt.prototype.iuand=function(ct){var dt;this.length>ct.length?dt=ct:dt=this;for(var vt=0;vtct.length?this.clone().iand(ct):ct.clone().iand(this)},tt.prototype.uand=function(ct){return this.length>ct.length?this.clone().iuand(ct):ct.clone().iuand(this)},tt.prototype.iuxor=function(ct){var dt,vt;this.length>ct.length?(dt=this,vt=ct):(dt=ct,vt=this);for(var St=0;Stct.length?this.clone().ixor(ct):ct.clone().ixor(this)},tt.prototype.uxor=function(ct){return this.length>ct.length?this.clone().iuxor(ct):ct.clone().iuxor(this)},tt.prototype.inotn=function(ct){j(typeof ct=="number"&&ct>=0);var dt=Math.ceil(ct/26)|0,vt=ct%26;this._expand(dt),vt>0&&dt--;for(var St=0;St0&&(this.words[St]=~this.words[St]&67108863>>26-vt),this._strip()},tt.prototype.notn=function(ct){return this.clone().inotn(ct)},tt.prototype.setn=function(ct,dt){j(typeof ct=="number"&&ct>=0);var vt=ct/26|0,St=ct%26;return this._expand(vt+1),dt?this.words[vt]=this.words[vt]|1<ct.length?(vt=this,St=ct):(vt=ct,St=this);for(var Rt=0,$t=0;$t>>26;for(;Rt!==0&&$t>>26;if(this.length=vt.length,Rt!==0)this.words[this.length]=Rt,this.length++;else if(vt!==this)for(;$tct.length?this.clone().iadd(ct):ct.clone().iadd(this)},tt.prototype.isub=function(ct){if(ct.negative!==0){ct.negative=0;var dt=this.iadd(ct);return ct.negative=1,dt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(ct),this.negative=1,this._normSign();var vt=this.cmp(ct);if(vt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Rt;vt>0?(St=this,Rt=ct):(St=ct,Rt=this);for(var $t=0,xt=0;xt>26,this.words[xt]=dt&67108863;for(;$t!==0&&xt>26,this.words[xt]=dt&67108863;if($t===0&&xt>>26,tr=At&67108863,nr=Math.min(wt,ct.length-1),ir=Math.max(0,wt-mt.length+1);ir<=nr;ir++){var Wt=wt-ir|0;St=mt.words[Wt]|0,Rt=ct.words[ir]|0,$t=St*Rt+tr,Ot+=$t/67108864|0,tr=$t&67108863}dt.words[wt]=tr|0,At=Ot|0}return At!==0?dt.words[wt]=At|0:dt.length--,dt._strip()}var Tt=function(ct,dt,vt){var St=ct.words,Rt=dt.words,$t=vt.words,xt=0,At,wt,Ot,tr=St[0]|0,nr=tr&8191,ir=tr>>>13,Wt=St[1]|0,Kt=Wt&8191,Jt=Wt>>>13,Ht=St[2]|0,qt=Ht&8191,Qt=Ht>>>13,dr=St[3]|0,xr=dr&8191,pr=dr>>>13,kr=St[4]|0,Ir=kr&8191,lr=kr>>>13,fr=St[5]|0,Er=fr&8191,$r=fr>>>13,Pr=St[6]|0,Rr=Pr&8191,Ar=Pr>>>13,Or=St[7]|0,Lr=Or&8191,or=Or>>>13,Yt=St[8]|0,er=Yt&8191,Zt=Yt>>>13,Vt=St[9]|0,Gt=Vt&8191,ar=Vt>>>13,br=Rt[0]|0,wr=br&8191,Sr=br>>>13,Wr=Rt[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=Rt[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=Rt[3]|0,ln=mn&8191,qr=mn>>>13,wn=Rt[4]|0,un=wn&8191,Vr=wn>>>13,hn=Rt[5]|0,fn=hn&8191,Kr=hn>>>13,$n=Rt[6]|0,dn=$n&8191,Gr=$n>>>13,gn=Rt[7]|0,an=gn&8191,Zr=gn>>>13,Rn=Rt[8]|0,Sn=Rn&8191,nn=Rn>>>13,Tn=Rt[9]|0,yn=Tn&8191,En=Tn>>>13;vt.negative=ct.negative^dt.negative,vt.length=19,At=Math.imul(nr,wr),wt=Math.imul(nr,Sr),wt=wt+Math.imul(ir,wr)|0,Ot=Math.imul(ir,Sr);var ds=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ds>>>26)|0,ds&=67108863,At=Math.imul(Kt,wr),wt=Math.imul(Kt,Sr),wt=wt+Math.imul(Jt,wr)|0,Ot=Math.imul(Jt,Sr),At=At+Math.imul(nr,Hr)|0,wt=wt+Math.imul(nr,Fr)|0,wt=wt+Math.imul(ir,Hr)|0,Ot=Ot+Math.imul(ir,Fr)|0;var fs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(fs>>>26)|0,fs&=67108863,At=Math.imul(qt,wr),wt=Math.imul(qt,Sr),wt=wt+Math.imul(Qt,wr)|0,Ot=Math.imul(Qt,Sr),At=At+Math.imul(Kt,Hr)|0,wt=wt+Math.imul(Kt,Fr)|0,wt=wt+Math.imul(Jt,Hr)|0,Ot=Ot+Math.imul(Jt,Fr)|0,At=At+Math.imul(nr,Jr)|0,wt=wt+Math.imul(nr,Qr)|0,wt=wt+Math.imul(ir,Jr)|0,Ot=Ot+Math.imul(ir,Qr)|0;var hs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(hs>>>26)|0,hs&=67108863,At=Math.imul(xr,wr),wt=Math.imul(xr,Sr),wt=wt+Math.imul(pr,wr)|0,Ot=Math.imul(pr,Sr),At=At+Math.imul(qt,Hr)|0,wt=wt+Math.imul(qt,Fr)|0,wt=wt+Math.imul(Qt,Hr)|0,Ot=Ot+Math.imul(Qt,Fr)|0,At=At+Math.imul(Kt,Jr)|0,wt=wt+Math.imul(Kt,Qr)|0,wt=wt+Math.imul(Jt,Jr)|0,Ot=Ot+Math.imul(Jt,Qr)|0,At=At+Math.imul(nr,ln)|0,wt=wt+Math.imul(nr,qr)|0,wt=wt+Math.imul(ir,ln)|0,Ot=Ot+Math.imul(ir,qr)|0;var ps=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ps>>>26)|0,ps&=67108863,At=Math.imul(Ir,wr),wt=Math.imul(Ir,Sr),wt=wt+Math.imul(lr,wr)|0,Ot=Math.imul(lr,Sr),At=At+Math.imul(xr,Hr)|0,wt=wt+Math.imul(xr,Fr)|0,wt=wt+Math.imul(pr,Hr)|0,Ot=Ot+Math.imul(pr,Fr)|0,At=At+Math.imul(qt,Jr)|0,wt=wt+Math.imul(qt,Qr)|0,wt=wt+Math.imul(Qt,Jr)|0,Ot=Ot+Math.imul(Qt,Qr)|0,At=At+Math.imul(Kt,ln)|0,wt=wt+Math.imul(Kt,qr)|0,wt=wt+Math.imul(Jt,ln)|0,Ot=Ot+Math.imul(Jt,qr)|0,At=At+Math.imul(nr,un)|0,wt=wt+Math.imul(nr,Vr)|0,wt=wt+Math.imul(ir,un)|0,Ot=Ot+Math.imul(ir,Vr)|0;var Vn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,At=Math.imul(Er,wr),wt=Math.imul(Er,Sr),wt=wt+Math.imul($r,wr)|0,Ot=Math.imul($r,Sr),At=At+Math.imul(Ir,Hr)|0,wt=wt+Math.imul(Ir,Fr)|0,wt=wt+Math.imul(lr,Hr)|0,Ot=Ot+Math.imul(lr,Fr)|0,At=At+Math.imul(xr,Jr)|0,wt=wt+Math.imul(xr,Qr)|0,wt=wt+Math.imul(pr,Jr)|0,Ot=Ot+Math.imul(pr,Qr)|0,At=At+Math.imul(qt,ln)|0,wt=wt+Math.imul(qt,qr)|0,wt=wt+Math.imul(Qt,ln)|0,Ot=Ot+Math.imul(Qt,qr)|0,At=At+Math.imul(Kt,un)|0,wt=wt+Math.imul(Kt,Vr)|0,wt=wt+Math.imul(Jt,un)|0,Ot=Ot+Math.imul(Jt,Vr)|0,At=At+Math.imul(nr,fn)|0,wt=wt+Math.imul(nr,Kr)|0,wt=wt+Math.imul(ir,fn)|0,Ot=Ot+Math.imul(ir,Kr)|0;var ss=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ss>>>26)|0,ss&=67108863,At=Math.imul(Rr,wr),wt=Math.imul(Rr,Sr),wt=wt+Math.imul(Ar,wr)|0,Ot=Math.imul(Ar,Sr),At=At+Math.imul(Er,Hr)|0,wt=wt+Math.imul(Er,Fr)|0,wt=wt+Math.imul($r,Hr)|0,Ot=Ot+Math.imul($r,Fr)|0,At=At+Math.imul(Ir,Jr)|0,wt=wt+Math.imul(Ir,Qr)|0,wt=wt+Math.imul(lr,Jr)|0,Ot=Ot+Math.imul(lr,Qr)|0,At=At+Math.imul(xr,ln)|0,wt=wt+Math.imul(xr,qr)|0,wt=wt+Math.imul(pr,ln)|0,Ot=Ot+Math.imul(pr,qr)|0,At=At+Math.imul(qt,un)|0,wt=wt+Math.imul(qt,Vr)|0,wt=wt+Math.imul(Qt,un)|0,Ot=Ot+Math.imul(Qt,Vr)|0,At=At+Math.imul(Kt,fn)|0,wt=wt+Math.imul(Kt,Kr)|0,wt=wt+Math.imul(Jt,fn)|0,Ot=Ot+Math.imul(Jt,Kr)|0,At=At+Math.imul(nr,dn)|0,wt=wt+Math.imul(nr,Gr)|0,wt=wt+Math.imul(ir,dn)|0,Ot=Ot+Math.imul(ir,Gr)|0;var Jn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,At=Math.imul(Lr,wr),wt=Math.imul(Lr,Sr),wt=wt+Math.imul(or,wr)|0,Ot=Math.imul(or,Sr),At=At+Math.imul(Rr,Hr)|0,wt=wt+Math.imul(Rr,Fr)|0,wt=wt+Math.imul(Ar,Hr)|0,Ot=Ot+Math.imul(Ar,Fr)|0,At=At+Math.imul(Er,Jr)|0,wt=wt+Math.imul(Er,Qr)|0,wt=wt+Math.imul($r,Jr)|0,Ot=Ot+Math.imul($r,Qr)|0,At=At+Math.imul(Ir,ln)|0,wt=wt+Math.imul(Ir,qr)|0,wt=wt+Math.imul(lr,ln)|0,Ot=Ot+Math.imul(lr,qr)|0,At=At+Math.imul(xr,un)|0,wt=wt+Math.imul(xr,Vr)|0,wt=wt+Math.imul(pr,un)|0,Ot=Ot+Math.imul(pr,Vr)|0,At=At+Math.imul(qt,fn)|0,wt=wt+Math.imul(qt,Kr)|0,wt=wt+Math.imul(Qt,fn)|0,Ot=Ot+Math.imul(Qt,Kr)|0,At=At+Math.imul(Kt,dn)|0,wt=wt+Math.imul(Kt,Gr)|0,wt=wt+Math.imul(Jt,dn)|0,Ot=Ot+Math.imul(Jt,Gr)|0,At=At+Math.imul(nr,an)|0,wt=wt+Math.imul(nr,Zr)|0,wt=wt+Math.imul(ir,an)|0,Ot=Ot+Math.imul(ir,Zr)|0;var Yn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,At=Math.imul(er,wr),wt=Math.imul(er,Sr),wt=wt+Math.imul(Zt,wr)|0,Ot=Math.imul(Zt,Sr),At=At+Math.imul(Lr,Hr)|0,wt=wt+Math.imul(Lr,Fr)|0,wt=wt+Math.imul(or,Hr)|0,Ot=Ot+Math.imul(or,Fr)|0,At=At+Math.imul(Rr,Jr)|0,wt=wt+Math.imul(Rr,Qr)|0,wt=wt+Math.imul(Ar,Jr)|0,Ot=Ot+Math.imul(Ar,Qr)|0,At=At+Math.imul(Er,ln)|0,wt=wt+Math.imul(Er,qr)|0,wt=wt+Math.imul($r,ln)|0,Ot=Ot+Math.imul($r,qr)|0,At=At+Math.imul(Ir,un)|0,wt=wt+Math.imul(Ir,Vr)|0,wt=wt+Math.imul(lr,un)|0,Ot=Ot+Math.imul(lr,Vr)|0,At=At+Math.imul(xr,fn)|0,wt=wt+Math.imul(xr,Kr)|0,wt=wt+Math.imul(pr,fn)|0,Ot=Ot+Math.imul(pr,Kr)|0,At=At+Math.imul(qt,dn)|0,wt=wt+Math.imul(qt,Gr)|0,wt=wt+Math.imul(Qt,dn)|0,Ot=Ot+Math.imul(Qt,Gr)|0,At=At+Math.imul(Kt,an)|0,wt=wt+Math.imul(Kt,Zr)|0,wt=wt+Math.imul(Jt,an)|0,Ot=Ot+Math.imul(Jt,Zr)|0,At=At+Math.imul(nr,Sn)|0,wt=wt+Math.imul(nr,nn)|0,wt=wt+Math.imul(ir,Sn)|0,Ot=Ot+Math.imul(ir,nn)|0;var ms=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ms>>>26)|0,ms&=67108863,At=Math.imul(Gt,wr),wt=Math.imul(Gt,Sr),wt=wt+Math.imul(ar,wr)|0,Ot=Math.imul(ar,Sr),At=At+Math.imul(er,Hr)|0,wt=wt+Math.imul(er,Fr)|0,wt=wt+Math.imul(Zt,Hr)|0,Ot=Ot+Math.imul(Zt,Fr)|0,At=At+Math.imul(Lr,Jr)|0,wt=wt+Math.imul(Lr,Qr)|0,wt=wt+Math.imul(or,Jr)|0,Ot=Ot+Math.imul(or,Qr)|0,At=At+Math.imul(Rr,ln)|0,wt=wt+Math.imul(Rr,qr)|0,wt=wt+Math.imul(Ar,ln)|0,Ot=Ot+Math.imul(Ar,qr)|0,At=At+Math.imul(Er,un)|0,wt=wt+Math.imul(Er,Vr)|0,wt=wt+Math.imul($r,un)|0,Ot=Ot+Math.imul($r,Vr)|0,At=At+Math.imul(Ir,fn)|0,wt=wt+Math.imul(Ir,Kr)|0,wt=wt+Math.imul(lr,fn)|0,Ot=Ot+Math.imul(lr,Kr)|0,At=At+Math.imul(xr,dn)|0,wt=wt+Math.imul(xr,Gr)|0,wt=wt+Math.imul(pr,dn)|0,Ot=Ot+Math.imul(pr,Gr)|0,At=At+Math.imul(qt,an)|0,wt=wt+Math.imul(qt,Zr)|0,wt=wt+Math.imul(Qt,an)|0,Ot=Ot+Math.imul(Qt,Zr)|0,At=At+Math.imul(Kt,Sn)|0,wt=wt+Math.imul(Kt,nn)|0,wt=wt+Math.imul(Jt,Sn)|0,Ot=Ot+Math.imul(Jt,nn)|0,At=At+Math.imul(nr,yn)|0,wt=wt+Math.imul(nr,En)|0,wt=wt+Math.imul(ir,yn)|0,Ot=Ot+Math.imul(ir,En)|0;var Qn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,At=Math.imul(Gt,Hr),wt=Math.imul(Gt,Fr),wt=wt+Math.imul(ar,Hr)|0,Ot=Math.imul(ar,Fr),At=At+Math.imul(er,Jr)|0,wt=wt+Math.imul(er,Qr)|0,wt=wt+Math.imul(Zt,Jr)|0,Ot=Ot+Math.imul(Zt,Qr)|0,At=At+Math.imul(Lr,ln)|0,wt=wt+Math.imul(Lr,qr)|0,wt=wt+Math.imul(or,ln)|0,Ot=Ot+Math.imul(or,qr)|0,At=At+Math.imul(Rr,un)|0,wt=wt+Math.imul(Rr,Vr)|0,wt=wt+Math.imul(Ar,un)|0,Ot=Ot+Math.imul(Ar,Vr)|0,At=At+Math.imul(Er,fn)|0,wt=wt+Math.imul(Er,Kr)|0,wt=wt+Math.imul($r,fn)|0,Ot=Ot+Math.imul($r,Kr)|0,At=At+Math.imul(Ir,dn)|0,wt=wt+Math.imul(Ir,Gr)|0,wt=wt+Math.imul(lr,dn)|0,Ot=Ot+Math.imul(lr,Gr)|0,At=At+Math.imul(xr,an)|0,wt=wt+Math.imul(xr,Zr)|0,wt=wt+Math.imul(pr,an)|0,Ot=Ot+Math.imul(pr,Zr)|0,At=At+Math.imul(qt,Sn)|0,wt=wt+Math.imul(qt,nn)|0,wt=wt+Math.imul(Qt,Sn)|0,Ot=Ot+Math.imul(Qt,nn)|0,At=At+Math.imul(Kt,yn)|0,wt=wt+Math.imul(Kt,En)|0,wt=wt+Math.imul(Jt,yn)|0,Ot=Ot+Math.imul(Jt,En)|0;var es=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(es>>>26)|0,es&=67108863,At=Math.imul(Gt,Jr),wt=Math.imul(Gt,Qr),wt=wt+Math.imul(ar,Jr)|0,Ot=Math.imul(ar,Qr),At=At+Math.imul(er,ln)|0,wt=wt+Math.imul(er,qr)|0,wt=wt+Math.imul(Zt,ln)|0,Ot=Ot+Math.imul(Zt,qr)|0,At=At+Math.imul(Lr,un)|0,wt=wt+Math.imul(Lr,Vr)|0,wt=wt+Math.imul(or,un)|0,Ot=Ot+Math.imul(or,Vr)|0,At=At+Math.imul(Rr,fn)|0,wt=wt+Math.imul(Rr,Kr)|0,wt=wt+Math.imul(Ar,fn)|0,Ot=Ot+Math.imul(Ar,Kr)|0,At=At+Math.imul(Er,dn)|0,wt=wt+Math.imul(Er,Gr)|0,wt=wt+Math.imul($r,dn)|0,Ot=Ot+Math.imul($r,Gr)|0,At=At+Math.imul(Ir,an)|0,wt=wt+Math.imul(Ir,Zr)|0,wt=wt+Math.imul(lr,an)|0,Ot=Ot+Math.imul(lr,Zr)|0,At=At+Math.imul(xr,Sn)|0,wt=wt+Math.imul(xr,nn)|0,wt=wt+Math.imul(pr,Sn)|0,Ot=Ot+Math.imul(pr,nn)|0,At=At+Math.imul(qt,yn)|0,wt=wt+Math.imul(qt,En)|0,wt=wt+Math.imul(Qt,yn)|0,Ot=Ot+Math.imul(Qt,En)|0;var ls=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ls>>>26)|0,ls&=67108863,At=Math.imul(Gt,ln),wt=Math.imul(Gt,qr),wt=wt+Math.imul(ar,ln)|0,Ot=Math.imul(ar,qr),At=At+Math.imul(er,un)|0,wt=wt+Math.imul(er,Vr)|0,wt=wt+Math.imul(Zt,un)|0,Ot=Ot+Math.imul(Zt,Vr)|0,At=At+Math.imul(Lr,fn)|0,wt=wt+Math.imul(Lr,Kr)|0,wt=wt+Math.imul(or,fn)|0,Ot=Ot+Math.imul(or,Kr)|0,At=At+Math.imul(Rr,dn)|0,wt=wt+Math.imul(Rr,Gr)|0,wt=wt+Math.imul(Ar,dn)|0,Ot=Ot+Math.imul(Ar,Gr)|0,At=At+Math.imul(Er,an)|0,wt=wt+Math.imul(Er,Zr)|0,wt=wt+Math.imul($r,an)|0,Ot=Ot+Math.imul($r,Zr)|0,At=At+Math.imul(Ir,Sn)|0,wt=wt+Math.imul(Ir,nn)|0,wt=wt+Math.imul(lr,Sn)|0,Ot=Ot+Math.imul(lr,nn)|0,At=At+Math.imul(xr,yn)|0,wt=wt+Math.imul(xr,En)|0,wt=wt+Math.imul(pr,yn)|0,Ot=Ot+Math.imul(pr,En)|0;var us=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(us>>>26)|0,us&=67108863,At=Math.imul(Gt,un),wt=Math.imul(Gt,Vr),wt=wt+Math.imul(ar,un)|0,Ot=Math.imul(ar,Vr),At=At+Math.imul(er,fn)|0,wt=wt+Math.imul(er,Kr)|0,wt=wt+Math.imul(Zt,fn)|0,Ot=Ot+Math.imul(Zt,Kr)|0,At=At+Math.imul(Lr,dn)|0,wt=wt+Math.imul(Lr,Gr)|0,wt=wt+Math.imul(or,dn)|0,Ot=Ot+Math.imul(or,Gr)|0,At=At+Math.imul(Rr,an)|0,wt=wt+Math.imul(Rr,Zr)|0,wt=wt+Math.imul(Ar,an)|0,Ot=Ot+Math.imul(Ar,Zr)|0,At=At+Math.imul(Er,Sn)|0,wt=wt+Math.imul(Er,nn)|0,wt=wt+Math.imul($r,Sn)|0,Ot=Ot+Math.imul($r,nn)|0,At=At+Math.imul(Ir,yn)|0,wt=wt+Math.imul(Ir,En)|0,wt=wt+Math.imul(lr,yn)|0,Ot=Ot+Math.imul(lr,En)|0;var Wn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,At=Math.imul(Gt,fn),wt=Math.imul(Gt,Kr),wt=wt+Math.imul(ar,fn)|0,Ot=Math.imul(ar,Kr),At=At+Math.imul(er,dn)|0,wt=wt+Math.imul(er,Gr)|0,wt=wt+Math.imul(Zt,dn)|0,Ot=Ot+Math.imul(Zt,Gr)|0,At=At+Math.imul(Lr,an)|0,wt=wt+Math.imul(Lr,Zr)|0,wt=wt+Math.imul(or,an)|0,Ot=Ot+Math.imul(or,Zr)|0,At=At+Math.imul(Rr,Sn)|0,wt=wt+Math.imul(Rr,nn)|0,wt=wt+Math.imul(Ar,Sn)|0,Ot=Ot+Math.imul(Ar,nn)|0,At=At+Math.imul(Er,yn)|0,wt=wt+Math.imul(Er,En)|0,wt=wt+Math.imul($r,yn)|0,Ot=Ot+Math.imul($r,En)|0;var as=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(as>>>26)|0,as&=67108863,At=Math.imul(Gt,dn),wt=Math.imul(Gt,Gr),wt=wt+Math.imul(ar,dn)|0,Ot=Math.imul(ar,Gr),At=At+Math.imul(er,an)|0,wt=wt+Math.imul(er,Zr)|0,wt=wt+Math.imul(Zt,an)|0,Ot=Ot+Math.imul(Zt,Zr)|0,At=At+Math.imul(Lr,Sn)|0,wt=wt+Math.imul(Lr,nn)|0,wt=wt+Math.imul(or,Sn)|0,Ot=Ot+Math.imul(or,nn)|0,At=At+Math.imul(Rr,yn)|0,wt=wt+Math.imul(Rr,En)|0,wt=wt+Math.imul(Ar,yn)|0,Ot=Ot+Math.imul(Ar,En)|0;var gs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(gs>>>26)|0,gs&=67108863,At=Math.imul(Gt,an),wt=Math.imul(Gt,Zr),wt=wt+Math.imul(ar,an)|0,Ot=Math.imul(ar,Zr),At=At+Math.imul(er,Sn)|0,wt=wt+Math.imul(er,nn)|0,wt=wt+Math.imul(Zt,Sn)|0,Ot=Ot+Math.imul(Zt,nn)|0,At=At+Math.imul(Lr,yn)|0,wt=wt+Math.imul(Lr,En)|0,wt=wt+Math.imul(or,yn)|0,Ot=Ot+Math.imul(or,En)|0;var vs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(vs>>>26)|0,vs&=67108863,At=Math.imul(Gt,Sn),wt=Math.imul(Gt,nn),wt=wt+Math.imul(ar,Sn)|0,Ot=Math.imul(ar,nn),At=At+Math.imul(er,yn)|0,wt=wt+Math.imul(er,En)|0,wt=wt+Math.imul(Zt,yn)|0,Ot=Ot+Math.imul(Zt,En)|0;var Ps=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,At=Math.imul(Gt,yn),wt=Math.imul(Gt,En),wt=wt+Math.imul(ar,yn)|0,Ot=Math.imul(ar,En);var As=(xt+At|0)+((wt&8191)<<13)|0;return xt=(Ot+(wt>>>13)|0)+(As>>>26)|0,As&=67108863,$t[0]=ds,$t[1]=fs,$t[2]=hs,$t[3]=ps,$t[4]=Vn,$t[5]=ss,$t[6]=Jn,$t[7]=Yn,$t[8]=ms,$t[9]=Qn,$t[10]=es,$t[11]=ls,$t[12]=us,$t[13]=Wn,$t[14]=as,$t[15]=gs,$t[16]=vs,$t[17]=Ps,$t[18]=As,xt!==0&&($t[19]=xt,vt.length++),vt};Math.imul||(Tt=Pt);function It(mt,ct,dt){dt.negative=ct.negative^mt.negative,dt.length=mt.length+ct.length;for(var vt=0,St=0,Rt=0;Rt>>26)|0,St+=$t>>>26,$t&=67108863}dt.words[Rt]=xt,vt=$t,$t=St}return vt!==0?dt.words[Rt]=vt:dt.length--,dt._strip()}function Lt(mt,ct,dt){return It(mt,ct,dt)}tt.prototype.mulTo=function(ct,dt){var vt,St=this.length+ct.length;return this.length===10&&ct.length===10?vt=Tt(this,ct,dt):St<63?vt=Pt(this,ct,dt):St<1024?vt=It(this,ct,dt):vt=Lt(this,ct,dt),vt},tt.prototype.mul=function(ct){var dt=new tt(null);return dt.words=new Array(this.length+ct.length),this.mulTo(ct,dt)},tt.prototype.mulf=function(ct){var dt=new tt(null);return dt.words=new Array(this.length+ct.length),Lt(this,ct,dt)},tt.prototype.imul=function(ct){return this.clone().mulTo(ct,this)},tt.prototype.imuln=function(ct){var dt=ct<0;dt&&(ct=-ct),j(typeof ct=="number"),j(ct<67108864);for(var vt=0,St=0;St>=26,vt+=Rt/67108864|0,vt+=$t>>>26,this.words[St]=$t&67108863}return vt!==0&&(this.words[St]=vt,this.length++),dt?this.ineg():this},tt.prototype.muln=function(ct){return this.clone().imuln(ct)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(ct){var dt=Ct(ct);if(dt.length===0)return new tt(1);for(var vt=this,St=0;St=0);var dt=ct%26,vt=(ct-dt)/26,St=67108863>>>26-dt<<26-dt,Rt;if(dt!==0){var $t=0;for(Rt=0;Rt>>26-dt}$t&&(this.words[Rt]=$t,this.length++)}if(vt!==0){for(Rt=this.length-1;Rt>=0;Rt--)this.words[Rt+vt]=this.words[Rt];for(Rt=0;Rt=0);var St;dt?St=(dt-dt%26)/26:St=0;var Rt=ct%26,$t=Math.min((ct-Rt)/26,this.length),xt=67108863^67108863>>>Rt<$t)for(this.length-=$t,wt=0;wt=0&&(Ot!==0||wt>=St);wt--){var tr=this.words[wt]|0;this.words[wt]=Ot<<26-Rt|tr>>>Rt,Ot=tr&xt}return At&&Ot!==0&&(At.words[At.length++]=Ot),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,dt,vt){return j(this.negative===0),this.iushrn(ct,dt,vt)},tt.prototype.shln=function(ct){return this.clone().ishln(ct)},tt.prototype.ushln=function(ct){return this.clone().iushln(ct)},tt.prototype.shrn=function(ct){return this.clone().ishrn(ct)},tt.prototype.ushrn=function(ct){return this.clone().iushrn(ct)},tt.prototype.testn=function(ct){j(typeof ct=="number"&&ct>=0);var dt=ct%26,vt=(ct-dt)/26,St=1<=0);var dt=ct%26,vt=(ct-dt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=vt)return this;if(dt!==0&&vt++,this.length=Math.min(vt,this.length),dt!==0){var St=67108863^67108863>>>dt<=67108864;dt++)this.words[dt]-=67108864,dt===this.length-1?this.words[dt+1]=1:this.words[dt+1]++;return this.length=Math.max(this.length,dt+1),this},tt.prototype.isubn=function(ct){if(j(typeof ct=="number"),j(ct<67108864),ct<0)return this.iaddn(-ct);if(this.negative!==0)return this.negative=0,this.iaddn(ct),this.negative=1,this;if(this.words[0]-=ct,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var dt=0;dt>26)-(At/67108864|0),this.words[Rt+vt]=$t&67108863}for(;Rt>26,this.words[Rt+vt]=$t&67108863;if(xt===0)return this._strip();for(j(xt===-1),xt=0,Rt=0;Rt>26,this.words[Rt]=$t&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,dt){var vt=this.length-ct.length,St=this.clone(),Rt=ct,$t=Rt.words[Rt.length-1]|0,xt=this._countBits($t);vt=26-xt,vt!==0&&(Rt=Rt.ushln(vt),St.iushln(vt),$t=Rt.words[Rt.length-1]|0);var At=St.length-Rt.length,wt;if(dt!=="mod"){wt=new tt(null),wt.length=At+1,wt.words=new Array(wt.length);for(var Ot=0;Ot=0;nr--){var ir=(St.words[Rt.length+nr]|0)*67108864+(St.words[Rt.length+nr-1]|0);for(ir=Math.min(ir/$t|0,67108863),St._ishlnsubmul(Rt,ir,nr);St.negative!==0;)ir--,St.negative=0,St._ishlnsubmul(Rt,1,nr),St.isZero()||(St.negative^=1);wt&&(wt.words[nr]=ir)}return wt&&wt._strip(),St._strip(),dt!=="div"&&vt!==0&&St.iushrn(vt),{div:wt||null,mod:St}},tt.prototype.divmod=function(ct,dt,vt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var St,Rt,$t;return this.negative!==0&&ct.negative===0?($t=this.neg().divmod(ct,dt),dt!=="mod"&&(St=$t.div.neg()),dt!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.iadd(ct)),{div:St,mod:Rt}):this.negative===0&&ct.negative!==0?($t=this.divmod(ct.neg(),dt),dt!=="mod"&&(St=$t.div.neg()),{div:St,mod:$t.mod}):this.negative&ct.negative?($t=this.neg().divmod(ct.neg(),dt),dt!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.isub(ct)),{div:$t.div,mod:Rt}):ct.length>this.length||this.cmp(ct)<0?{div:new tt(0),mod:this}:ct.length===1?dt==="div"?{div:this.divn(ct.words[0]),mod:null}:dt==="mod"?{div:null,mod:new tt(this.modrn(ct.words[0]))}:{div:this.divn(ct.words[0]),mod:new tt(this.modrn(ct.words[0]))}:this._wordDiv(ct,dt)},tt.prototype.div=function(ct){return this.divmod(ct,"div",!1).div},tt.prototype.mod=function(ct){return this.divmod(ct,"mod",!1).mod},tt.prototype.umod=function(ct){return this.divmod(ct,"mod",!0).mod},tt.prototype.divRound=function(ct){var dt=this.divmod(ct);if(dt.mod.isZero())return dt.div;var vt=dt.div.negative!==0?dt.mod.isub(ct):dt.mod,St=ct.ushrn(1),Rt=ct.andln(1),$t=vt.cmp(St);return $t<0||Rt===1&&$t===0?dt.div:dt.div.negative!==0?dt.div.isubn(1):dt.div.iaddn(1)},tt.prototype.modrn=function(ct){var dt=ct<0;dt&&(ct=-ct),j(ct<=67108863);for(var vt=(1<<26)%ct,St=0,Rt=this.length-1;Rt>=0;Rt--)St=(vt*St+(this.words[Rt]|0))%ct;return dt?-St:St},tt.prototype.modn=function(ct){return this.modrn(ct)},tt.prototype.idivn=function(ct){var dt=ct<0;dt&&(ct=-ct),j(ct<=67108863);for(var vt=0,St=this.length-1;St>=0;St--){var Rt=(this.words[St]|0)+vt*67108864;this.words[St]=Rt/ct|0,vt=Rt%ct}return this._strip(),dt?this.ineg():this},tt.prototype.divn=function(ct){return this.clone().idivn(ct)},tt.prototype.egcd=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,vt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var St=new tt(1),Rt=new tt(0),$t=new tt(0),xt=new tt(1),At=0;dt.isEven()&&vt.isEven();)dt.iushrn(1),vt.iushrn(1),++At;for(var wt=vt.clone(),Ot=dt.clone();!dt.isZero();){for(var tr=0,nr=1;!(dt.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(dt.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(wt),Rt.isub(Ot)),St.iushrn(1),Rt.iushrn(1);for(var ir=0,Wt=1;!(vt.words[0]&Wt)&&ir<26;++ir,Wt<<=1);if(ir>0)for(vt.iushrn(ir);ir-- >0;)($t.isOdd()||xt.isOdd())&&($t.iadd(wt),xt.isub(Ot)),$t.iushrn(1),xt.iushrn(1);dt.cmp(vt)>=0?(dt.isub(vt),St.isub($t),Rt.isub(xt)):(vt.isub(dt),$t.isub(St),xt.isub(Rt))}return{a:$t,b:xt,gcd:vt.iushln(At)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,vt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var St=new tt(1),Rt=new tt(0),$t=vt.clone();dt.cmpn(1)>0&&vt.cmpn(1)>0;){for(var xt=0,At=1;!(dt.words[0]&At)&&xt<26;++xt,At<<=1);if(xt>0)for(dt.iushrn(xt);xt-- >0;)St.isOdd()&&St.iadd($t),St.iushrn(1);for(var wt=0,Ot=1;!(vt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(vt.iushrn(wt);wt-- >0;)Rt.isOdd()&&Rt.iadd($t),Rt.iushrn(1);dt.cmp(vt)>=0?(dt.isub(vt),St.isub(Rt)):(vt.isub(dt),Rt.isub(St))}var tr;return dt.cmpn(1)===0?tr=St:tr=Rt,tr.cmpn(0)<0&&tr.iadd(ct),tr},tt.prototype.gcd=function(ct){if(this.isZero())return ct.abs();if(ct.isZero())return this.abs();var dt=this.clone(),vt=ct.clone();dt.negative=0,vt.negative=0;for(var St=0;dt.isEven()&&vt.isEven();St++)dt.iushrn(1),vt.iushrn(1);do{for(;dt.isEven();)dt.iushrn(1);for(;vt.isEven();)vt.iushrn(1);var Rt=dt.cmp(vt);if(Rt<0){var $t=dt;dt=vt,vt=$t}else if(Rt===0||vt.cmpn(1)===0)break;dt.isub(vt)}while(!0);return vt.iushln(St)},tt.prototype.invm=function(ct){return this.egcd(ct).a.umod(ct)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(ct){return this.words[0]&ct},tt.prototype.bincn=function(ct){j(typeof ct=="number");var dt=ct%26,vt=(ct-dt)/26,St=1<>>26,xt&=67108863,this.words[$t]=xt}return Rt!==0&&(this.words[$t]=Rt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(ct){var dt=ct<0;if(this.negative!==0&&!dt)return-1;if(this.negative===0&&dt)return 1;this._strip();var vt;if(this.length>1)vt=1;else{dt&&(ct=-ct),j(ct<=67108863,"Number is too big");var St=this.words[0]|0;vt=St===ct?0:Stct.length)return 1;if(this.length=0;vt--){var St=this.words[vt]|0,Rt=ct.words[vt]|0;if(St!==Rt){StRt&&(dt=1);break}}return dt},tt.prototype.gtn=function(ct){return this.cmpn(ct)===1},tt.prototype.gt=function(ct){return this.cmp(ct)===1},tt.prototype.gten=function(ct){return this.cmpn(ct)>=0},tt.prototype.gte=function(ct){return this.cmp(ct)>=0},tt.prototype.ltn=function(ct){return this.cmpn(ct)===-1},tt.prototype.lt=function(ct){return this.cmp(ct)===-1},tt.prototype.lten=function(ct){return this.cmpn(ct)<=0},tt.prototype.lte=function(ct){return this.cmp(ct)<=0},tt.prototype.eqn=function(ct){return this.cmpn(ct)===0},tt.prototype.eq=function(ct){return this.cmp(ct)===0},tt.red=function(ct){return new Bt(ct)},tt.prototype.toRed=function(ct){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),ct.convertTo(this)._forceRed(ct)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(ct){return this.red=ct,this},tt.prototype.forceRed=function(ct){return j(!this.red,"Already a number in reduction context"),this._forceRed(ct)},tt.prototype.redAdd=function(ct){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,ct)},tt.prototype.redIAdd=function(ct){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,ct)},tt.prototype.redSub=function(ct){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,ct)},tt.prototype.redISub=function(ct){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,ct)},tt.prototype.redShl=function(ct){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,ct)},tt.prototype.redMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.mul(this,ct)},tt.prototype.redIMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.imul(this,ct)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(ct){return j(this.red&&!ct.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,ct)};var Nt={k256:null,p224:null,p192:null,p25519:null};function Ut(mt,ct){this.name=mt,this.p=new tt(ct,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Ut.prototype._tmp=function(){var ct=new tt(null);return ct.words=new Array(Math.ceil(this.n/13)),ct},Ut.prototype.ireduce=function(ct){var dt=ct,vt;do this.split(dt,this.tmp),dt=this.imulK(dt),dt=dt.iadd(this.tmp),vt=dt.bitLength();while(vt>this.n);var St=vt0?dt.isub(this.p):dt.strip!==void 0?dt.strip():dt._strip(),dt},Ut.prototype.split=function(ct,dt){ct.iushrn(this.n,0,dt)},Ut.prototype.imulK=function(ct){return ct.imul(this.k)};function jt(){Ut.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(jt,Ut),jt.prototype.split=function(ct,dt){for(var vt=4194303,St=Math.min(ct.length,9),Rt=0;Rt>>22,$t=xt}$t>>>=22,ct.words[Rt-10]=$t,$t===0&&ct.length>10?ct.length-=10:ct.length-=9},jt.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var dt=0,vt=0;vt>>=26,ct.words[vt]=Rt,dt=St}return dt!==0&&(ct.words[ct.length++]=dt),ct},tt._prime=function(ct){if(Nt[ct])return Nt[ct];var dt;if(ct==="k256")dt=new jt;else if(ct==="p224")dt=new Mt;else if(ct==="p192")dt=new Dt;else if(ct==="p25519")dt=new Ft;else throw new Error("Unknown prime "+ct);return Nt[ct]=dt,dt};function Bt(mt){if(typeof mt=="string"){var ct=tt._prime(mt);this.m=ct.p,this.prime=ct}else j(mt.gtn(1),"modulus must be greater than 1"),this.m=mt,this.prime=null}Bt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},Bt.prototype._verify2=function(ct,dt){j((ct.negative|dt.negative)===0,"red works only with positives"),j(ct.red&&ct.red===dt.red,"red works only with red numbers")},Bt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(st(ct,ct.umod(this.m)._forceRed(this)),ct)},Bt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},Bt.prototype.add=function(ct,dt){this._verify2(ct,dt);var vt=ct.add(dt);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt._forceRed(this)},Bt.prototype.iadd=function(ct,dt){this._verify2(ct,dt);var vt=ct.iadd(dt);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt},Bt.prototype.sub=function(ct,dt){this._verify2(ct,dt);var vt=ct.sub(dt);return vt.cmpn(0)<0&&vt.iadd(this.m),vt._forceRed(this)},Bt.prototype.isub=function(ct,dt){this._verify2(ct,dt);var vt=ct.isub(dt);return vt.cmpn(0)<0&&vt.iadd(this.m),vt},Bt.prototype.shl=function(ct,dt){return this._verify1(ct),this.imod(ct.ushln(dt))},Bt.prototype.imul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.imul(dt))},Bt.prototype.mul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.mul(dt))},Bt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},Bt.prototype.sqr=function(ct){return this.mul(ct,ct)},Bt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var dt=this.m.andln(3);if(j(dt%2===1),dt===3){var vt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,vt)}for(var St=this.m.subn(1),Rt=0;!St.isZero()&&St.andln(1)===0;)Rt++,St.iushrn(1);j(!St.isZero());var $t=new tt(1).toRed(this),xt=$t.redNeg(),At=this.m.subn(1).iushrn(1),wt=this.m.bitLength();for(wt=new tt(2*wt*wt).toRed(this);this.pow(wt,At).cmp(xt)!==0;)wt.redIAdd(xt);for(var Ot=this.pow(wt,St),tr=this.pow(ct,St.addn(1).iushrn(1)),nr=this.pow(ct,St),ir=Rt;nr.cmp($t)!==0;){for(var Wt=nr,Kt=0;Wt.cmp($t)!==0;Kt++)Wt=Wt.redSqr();j(Kt=0;Rt--){for(var Ot=dt.words[Rt],tr=wt-1;tr>=0;tr--){var nr=Ot>>tr&1;if($t!==St[0]&&($t=this.sqr($t)),nr===0&&xt===0){At=0;continue}xt<<=1,xt|=nr,At++,!(At!==vt&&(Rt!==0||tr!==0))&&($t=this.mul($t,St[xt]),At=0,xt=0)}wt=26}return $t},Bt.prototype.convertTo=function(ct){var dt=ct.umod(this.m);return dt===ct?dt.clone():dt},Bt.prototype.convertFrom=function(ct){var dt=ct.clone();return dt.red=null,dt},tt.mont=function(ct){return new yt(ct)};function yt(mt){Bt.call(this,mt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(yt,Bt),yt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},yt.prototype.convertFrom=function(ct){var dt=this.imod(ct.mul(this.rinv));return dt.red=null,dt},yt.prototype.imul=function(ct,dt){if(ct.isZero()||dt.isZero())return ct.words[0]=0,ct.length=1,ct;var vt=ct.imul(dt),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.mul=function(ct,dt){if(ct.isZero()||dt.isZero())return new tt(0)._forceRed(this);var vt=ct.mul(dt),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.invm=function(ct){var dt=this.imod(ct._invmp(this.m).mul(this.r2));return dt._forceRed(this)}})(_,commonjsGlobal)}(bn$3)),bn$3.exports}var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var _=requireBn$2(),a=requireBrowser$8();function $(tt){var rt=j(tt),nt=rt.toRed(_.mont(tt.modulus)).redPow(new _(tt.publicExponent)).fromRed();return{blinder:nt,unblinder:rt.invm(tt.modulus)}}function j(tt){var rt=tt.modulus.byteLength(),nt;do nt=new _(a(rt));while(nt.cmp(tt.modulus)>=0||!nt.umod(tt.prime1)||!nt.umod(tt.prime2));return nt}function et(tt,rt){var nt=$(rt),it=rt.modulus.byteLength(),ot=new _(tt).mul(nt.blinder).umod(rt.modulus),st=ot.toRed(_.mont(rt.prime1)),at=ot.toRed(_.mont(rt.prime2)),ut=rt.coefficient,ht=rt.prime1,bt=rt.prime2,Et=st.redPow(rt.exponent1).fromRed(),Ct=at.redPow(rt.exponent2).fromRed(),Pt=Et.isub(Ct).imul(ut).umod(ht).imul(bt);return Ct.iadd(Pt).imul(nt.unblinder).umod(rt.modulus).toArrayLike(Buffer$g,"be",it)}return et.getr=j,browserifyRsa=et,browserifyRsa}var elliptic$4={};const name$4="elliptic",version$4="6.5.5",description$4="EC cryptography",main$4="lib/elliptic.js",files$3=["lib"],scripts$4={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository$4={type:"git",url:"git@github.com:indutny/elliptic"},keywords$3=["EC","Elliptic","curve","Cryptography"],author$4="Fedor Indutny ",license$4="MIT",bugs$3={url:"https://github.com/indutny/elliptic/issues"},homepage$4="https://github.com/indutny/elliptic",devDependencies$4={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$4={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$4={name:name$4,version:version$4,description:description$4,main:main$4,files:files$3,scripts:scripts$4,repository:repository$4,keywords:keywords$3,author:author$4,license:license$4,bugs:bugs$3,homepage:homepage$4,devDependencies:devDependencies$4,dependencies:dependencies$4};var utils$H={},bn$2={exports:{}};bn$2.exports;var hasRequiredBn$1;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(_){(function(a,$){function j(Bt,yt){if(!Bt)throw new Error(yt||"Assertion failed")}function et(Bt,yt){Bt.super_=yt;var mt=function(){};mt.prototype=yt.prototype,Bt.prototype=new mt,Bt.prototype.constructor=Bt}function tt(Bt,yt,mt){if(tt.isBN(Bt))return Bt;this.negative=0,this.words=null,this.length=0,this.red=null,Bt!==null&&((yt==="le"||yt==="be")&&(mt=yt,yt=10),this._init(Bt||0,yt||10,mt||"be"))}typeof a=="object"?a.exports=tt:$.BN=tt,tt.BN=tt,tt.wordSize=26;var rt;try{typeof window<"u"&&typeof window.Buffer<"u"?rt=window.Buffer:rt=require$$0$5.Buffer}catch{}tt.isBN=function(yt){return yt instanceof tt?!0:yt!==null&&typeof yt=="object"&&yt.constructor.wordSize===tt.wordSize&&Array.isArray(yt.words)},tt.max=function(yt,mt){return yt.cmp(mt)>0?yt:mt},tt.min=function(yt,mt){return yt.cmp(mt)<0?yt:mt},tt.prototype._init=function(yt,mt,ct){if(typeof yt=="number")return this._initNumber(yt,mt,ct);if(typeof yt=="object")return this._initArray(yt,mt,ct);mt==="hex"&&(mt=16),j(mt===(mt|0)&&mt>=2&&mt<=36),yt=yt.toString().replace(/\s+/g,"");var dt=0;yt[0]==="-"&&(dt++,this.negative=1),dt=0;dt-=3)St=yt[dt]|yt[dt-1]<<8|yt[dt-2]<<16,this.words[vt]|=St<>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);else if(ct==="le")for(dt=0,vt=0;dt>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);return this.strip()};function nt(Bt,yt){var mt=Bt.charCodeAt(yt);return mt>=65&&mt<=70?mt-55:mt>=97&&mt<=102?mt-87:mt-48&15}function it(Bt,yt,mt){var ct=nt(Bt,mt);return mt-1>=yt&&(ct|=nt(Bt,mt-1)<<4),ct}tt.prototype._parseHex=function(yt,mt,ct){this.length=Math.ceil((yt.length-mt)/6),this.words=new Array(this.length);for(var dt=0;dt=mt;dt-=2)Rt=it(yt,mt,dt)<=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8;else{var $t=yt.length-mt;for(dt=$t%2===0?mt+1:mt;dt=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8}this.strip()};function ot(Bt,yt,mt,ct){for(var dt=0,vt=Math.min(Bt.length,mt),St=yt;St=49?dt+=Rt-49+10:Rt>=17?dt+=Rt-17+10:dt+=Rt}return dt}tt.prototype._parseBase=function(yt,mt,ct){this.words=[0],this.length=1;for(var dt=0,vt=1;vt<=67108863;vt*=mt)dt++;dt--,vt=vt/mt|0;for(var St=yt.length-ct,Rt=St%dt,$t=Math.min(St,St-Rt)+ct,xt=0,At=ct;At<$t;At+=dt)xt=ot(yt,At,At+dt,mt),this.imuln(vt),this.words[0]+xt<67108864?this.words[0]+=xt:this._iaddn(xt);if(Rt!==0){var wt=1;for(xt=ot(yt,At,yt.length,mt),At=0;At1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},tt.prototype.inspect=function(){return(this.red?""};var st=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],at=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ut=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(yt,mt){yt=yt||10,mt=mt|0||1;var ct;if(yt===16||yt==="hex"){ct="";for(var dt=0,vt=0,St=0;St>>24-dt&16777215,vt!==0||St!==this.length-1?ct=st[6-$t.length]+$t+ct:ct=$t+ct,dt+=2,dt>=26&&(dt-=26,St--)}for(vt!==0&&(ct=vt.toString(16)+ct);ct.length%mt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}if(yt===(yt|0)&&yt>=2&&yt<=36){var xt=at[yt],At=ut[yt];ct="";var wt=this.clone();for(wt.negative=0;!wt.isZero();){var Ot=wt.modn(At).toString(yt);wt=wt.idivn(At),wt.isZero()?ct=Ot+ct:ct=st[xt-Ot.length]+Ot+ct}for(this.isZero()&&(ct="0"+ct);ct.length%mt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var yt=this.words[0];return this.length===2?yt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?yt+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-yt:yt},tt.prototype.toJSON=function(){return this.toString(16)},tt.prototype.toBuffer=function(yt,mt){return j(typeof rt<"u"),this.toArrayLike(rt,yt,mt)},tt.prototype.toArray=function(yt,mt){return this.toArrayLike(Array,yt,mt)},tt.prototype.toArrayLike=function(yt,mt,ct){var dt=this.byteLength(),vt=ct||Math.max(1,dt);j(dt<=vt,"byte array longer than desired length"),j(vt>0,"Requested array length <= 0"),this.strip();var St=mt==="le",Rt=new yt(vt),$t,xt,At=this.clone();if(St){for(xt=0;!At.isZero();xt++)$t=At.andln(255),At.iushrn(8),Rt[xt]=$t;for(;xt=4096&&(ct+=13,mt>>>=13),mt>=64&&(ct+=7,mt>>>=7),mt>=8&&(ct+=4,mt>>>=4),mt>=2&&(ct+=2,mt>>>=2),ct+mt},tt.prototype._zeroBits=function(yt){if(yt===0)return 26;var mt=yt,ct=0;return mt&8191||(ct+=13,mt>>>=13),mt&127||(ct+=7,mt>>>=7),mt&15||(ct+=4,mt>>>=4),mt&3||(ct+=2,mt>>>=2),mt&1||ct++,ct},tt.prototype.bitLength=function(){var yt=this.words[this.length-1],mt=this._countBits(yt);return(this.length-1)*26+mt};function ht(Bt){for(var yt=new Array(Bt.bitLength()),mt=0;mt>>dt}return yt}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var yt=0,mt=0;mtyt.length?this.clone().ior(yt):yt.clone().ior(this)},tt.prototype.uor=function(yt){return this.length>yt.length?this.clone().iuor(yt):yt.clone().iuor(this)},tt.prototype.iuand=function(yt){var mt;this.length>yt.length?mt=yt:mt=this;for(var ct=0;ctyt.length?this.clone().iand(yt):yt.clone().iand(this)},tt.prototype.uand=function(yt){return this.length>yt.length?this.clone().iuand(yt):yt.clone().iuand(this)},tt.prototype.iuxor=function(yt){var mt,ct;this.length>yt.length?(mt=this,ct=yt):(mt=yt,ct=this);for(var dt=0;dtyt.length?this.clone().ixor(yt):yt.clone().ixor(this)},tt.prototype.uxor=function(yt){return this.length>yt.length?this.clone().iuxor(yt):yt.clone().iuxor(this)},tt.prototype.inotn=function(yt){j(typeof yt=="number"&&yt>=0);var mt=Math.ceil(yt/26)|0,ct=yt%26;this._expand(mt),ct>0&&mt--;for(var dt=0;dt0&&(this.words[dt]=~this.words[dt]&67108863>>26-ct),this.strip()},tt.prototype.notn=function(yt){return this.clone().inotn(yt)},tt.prototype.setn=function(yt,mt){j(typeof yt=="number"&&yt>=0);var ct=yt/26|0,dt=yt%26;return this._expand(ct+1),mt?this.words[ct]=this.words[ct]|1<yt.length?(ct=this,dt=yt):(ct=yt,dt=this);for(var vt=0,St=0;St>>26;for(;vt!==0&&St>>26;if(this.length=ct.length,vt!==0)this.words[this.length]=vt,this.length++;else if(ct!==this)for(;Styt.length?this.clone().iadd(yt):yt.clone().iadd(this)},tt.prototype.isub=function(yt){if(yt.negative!==0){yt.negative=0;var mt=this.iadd(yt);return yt.negative=1,mt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(yt),this.negative=1,this._normSign();var ct=this.cmp(yt);if(ct===0)return this.negative=0,this.length=1,this.words[0]=0,this;var dt,vt;ct>0?(dt=this,vt=yt):(dt=yt,vt=this);for(var St=0,Rt=0;Rt>26,this.words[Rt]=mt&67108863;for(;St!==0&&Rt>26,this.words[Rt]=mt&67108863;if(St===0&&Rt>>26,wt=$t&67108863,Ot=Math.min(xt,yt.length-1),tr=Math.max(0,xt-Bt.length+1);tr<=Ot;tr++){var nr=xt-tr|0;dt=Bt.words[nr]|0,vt=yt.words[tr]|0,St=dt*vt+wt,At+=St/67108864|0,wt=St&67108863}mt.words[xt]=wt|0,$t=At|0}return $t!==0?mt.words[xt]=$t|0:mt.length--,mt.strip()}var Et=function(yt,mt,ct){var dt=yt.words,vt=mt.words,St=ct.words,Rt=0,$t,xt,At,wt=dt[0]|0,Ot=wt&8191,tr=wt>>>13,nr=dt[1]|0,ir=nr&8191,Wt=nr>>>13,Kt=dt[2]|0,Jt=Kt&8191,Ht=Kt>>>13,qt=dt[3]|0,Qt=qt&8191,dr=qt>>>13,xr=dt[4]|0,pr=xr&8191,kr=xr>>>13,Ir=dt[5]|0,lr=Ir&8191,fr=Ir>>>13,Er=dt[6]|0,$r=Er&8191,Pr=Er>>>13,Rr=dt[7]|0,Ar=Rr&8191,Or=Rr>>>13,Lr=dt[8]|0,or=Lr&8191,Yt=Lr>>>13,er=dt[9]|0,Zt=er&8191,Vt=er>>>13,Gt=vt[0]|0,ar=Gt&8191,br=Gt>>>13,wr=vt[1]|0,Sr=wr&8191,Wr=wr>>>13,Hr=vt[2]|0,Fr=Hr&8191,pn=Hr>>>13,Jr=vt[3]|0,Qr=Jr&8191,mn=Jr>>>13,ln=vt[4]|0,qr=ln&8191,wn=ln>>>13,un=vt[5]|0,Vr=un&8191,hn=un>>>13,fn=vt[6]|0,Kr=fn&8191,$n=fn>>>13,dn=vt[7]|0,Gr=dn&8191,gn=dn>>>13,an=vt[8]|0,Zr=an&8191,Rn=an>>>13,Sn=vt[9]|0,nn=Sn&8191,Tn=Sn>>>13;ct.negative=yt.negative^mt.negative,ct.length=19,$t=Math.imul(Ot,ar),xt=Math.imul(Ot,br),xt=xt+Math.imul(tr,ar)|0,At=Math.imul(tr,br);var yn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(yn>>>26)|0,yn&=67108863,$t=Math.imul(ir,ar),xt=Math.imul(ir,br),xt=xt+Math.imul(Wt,ar)|0,At=Math.imul(Wt,br),$t=$t+Math.imul(Ot,Sr)|0,xt=xt+Math.imul(Ot,Wr)|0,xt=xt+Math.imul(tr,Sr)|0,At=At+Math.imul(tr,Wr)|0;var En=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(En>>>26)|0,En&=67108863,$t=Math.imul(Jt,ar),xt=Math.imul(Jt,br),xt=xt+Math.imul(Ht,ar)|0,At=Math.imul(Ht,br),$t=$t+Math.imul(ir,Sr)|0,xt=xt+Math.imul(ir,Wr)|0,xt=xt+Math.imul(Wt,Sr)|0,At=At+Math.imul(Wt,Wr)|0,$t=$t+Math.imul(Ot,Fr)|0,xt=xt+Math.imul(Ot,pn)|0,xt=xt+Math.imul(tr,Fr)|0,At=At+Math.imul(tr,pn)|0;var ds=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ds>>>26)|0,ds&=67108863,$t=Math.imul(Qt,ar),xt=Math.imul(Qt,br),xt=xt+Math.imul(dr,ar)|0,At=Math.imul(dr,br),$t=$t+Math.imul(Jt,Sr)|0,xt=xt+Math.imul(Jt,Wr)|0,xt=xt+Math.imul(Ht,Sr)|0,At=At+Math.imul(Ht,Wr)|0,$t=$t+Math.imul(ir,Fr)|0,xt=xt+Math.imul(ir,pn)|0,xt=xt+Math.imul(Wt,Fr)|0,At=At+Math.imul(Wt,pn)|0,$t=$t+Math.imul(Ot,Qr)|0,xt=xt+Math.imul(Ot,mn)|0,xt=xt+Math.imul(tr,Qr)|0,At=At+Math.imul(tr,mn)|0;var fs=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(fs>>>26)|0,fs&=67108863,$t=Math.imul(pr,ar),xt=Math.imul(pr,br),xt=xt+Math.imul(kr,ar)|0,At=Math.imul(kr,br),$t=$t+Math.imul(Qt,Sr)|0,xt=xt+Math.imul(Qt,Wr)|0,xt=xt+Math.imul(dr,Sr)|0,At=At+Math.imul(dr,Wr)|0,$t=$t+Math.imul(Jt,Fr)|0,xt=xt+Math.imul(Jt,pn)|0,xt=xt+Math.imul(Ht,Fr)|0,At=At+Math.imul(Ht,pn)|0,$t=$t+Math.imul(ir,Qr)|0,xt=xt+Math.imul(ir,mn)|0,xt=xt+Math.imul(Wt,Qr)|0,At=At+Math.imul(Wt,mn)|0,$t=$t+Math.imul(Ot,qr)|0,xt=xt+Math.imul(Ot,wn)|0,xt=xt+Math.imul(tr,qr)|0,At=At+Math.imul(tr,wn)|0;var hs=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(hs>>>26)|0,hs&=67108863,$t=Math.imul(lr,ar),xt=Math.imul(lr,br),xt=xt+Math.imul(fr,ar)|0,At=Math.imul(fr,br),$t=$t+Math.imul(pr,Sr)|0,xt=xt+Math.imul(pr,Wr)|0,xt=xt+Math.imul(kr,Sr)|0,At=At+Math.imul(kr,Wr)|0,$t=$t+Math.imul(Qt,Fr)|0,xt=xt+Math.imul(Qt,pn)|0,xt=xt+Math.imul(dr,Fr)|0,At=At+Math.imul(dr,pn)|0,$t=$t+Math.imul(Jt,Qr)|0,xt=xt+Math.imul(Jt,mn)|0,xt=xt+Math.imul(Ht,Qr)|0,At=At+Math.imul(Ht,mn)|0,$t=$t+Math.imul(ir,qr)|0,xt=xt+Math.imul(ir,wn)|0,xt=xt+Math.imul(Wt,qr)|0,At=At+Math.imul(Wt,wn)|0,$t=$t+Math.imul(Ot,Vr)|0,xt=xt+Math.imul(Ot,hn)|0,xt=xt+Math.imul(tr,Vr)|0,At=At+Math.imul(tr,hn)|0;var ps=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ps>>>26)|0,ps&=67108863,$t=Math.imul($r,ar),xt=Math.imul($r,br),xt=xt+Math.imul(Pr,ar)|0,At=Math.imul(Pr,br),$t=$t+Math.imul(lr,Sr)|0,xt=xt+Math.imul(lr,Wr)|0,xt=xt+Math.imul(fr,Sr)|0,At=At+Math.imul(fr,Wr)|0,$t=$t+Math.imul(pr,Fr)|0,xt=xt+Math.imul(pr,pn)|0,xt=xt+Math.imul(kr,Fr)|0,At=At+Math.imul(kr,pn)|0,$t=$t+Math.imul(Qt,Qr)|0,xt=xt+Math.imul(Qt,mn)|0,xt=xt+Math.imul(dr,Qr)|0,At=At+Math.imul(dr,mn)|0,$t=$t+Math.imul(Jt,qr)|0,xt=xt+Math.imul(Jt,wn)|0,xt=xt+Math.imul(Ht,qr)|0,At=At+Math.imul(Ht,wn)|0,$t=$t+Math.imul(ir,Vr)|0,xt=xt+Math.imul(ir,hn)|0,xt=xt+Math.imul(Wt,Vr)|0,At=At+Math.imul(Wt,hn)|0,$t=$t+Math.imul(Ot,Kr)|0,xt=xt+Math.imul(Ot,$n)|0,xt=xt+Math.imul(tr,Kr)|0,At=At+Math.imul(tr,$n)|0;var Vn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,$t=Math.imul(Ar,ar),xt=Math.imul(Ar,br),xt=xt+Math.imul(Or,ar)|0,At=Math.imul(Or,br),$t=$t+Math.imul($r,Sr)|0,xt=xt+Math.imul($r,Wr)|0,xt=xt+Math.imul(Pr,Sr)|0,At=At+Math.imul(Pr,Wr)|0,$t=$t+Math.imul(lr,Fr)|0,xt=xt+Math.imul(lr,pn)|0,xt=xt+Math.imul(fr,Fr)|0,At=At+Math.imul(fr,pn)|0,$t=$t+Math.imul(pr,Qr)|0,xt=xt+Math.imul(pr,mn)|0,xt=xt+Math.imul(kr,Qr)|0,At=At+Math.imul(kr,mn)|0,$t=$t+Math.imul(Qt,qr)|0,xt=xt+Math.imul(Qt,wn)|0,xt=xt+Math.imul(dr,qr)|0,At=At+Math.imul(dr,wn)|0,$t=$t+Math.imul(Jt,Vr)|0,xt=xt+Math.imul(Jt,hn)|0,xt=xt+Math.imul(Ht,Vr)|0,At=At+Math.imul(Ht,hn)|0,$t=$t+Math.imul(ir,Kr)|0,xt=xt+Math.imul(ir,$n)|0,xt=xt+Math.imul(Wt,Kr)|0,At=At+Math.imul(Wt,$n)|0,$t=$t+Math.imul(Ot,Gr)|0,xt=xt+Math.imul(Ot,gn)|0,xt=xt+Math.imul(tr,Gr)|0,At=At+Math.imul(tr,gn)|0;var ss=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ss>>>26)|0,ss&=67108863,$t=Math.imul(or,ar),xt=Math.imul(or,br),xt=xt+Math.imul(Yt,ar)|0,At=Math.imul(Yt,br),$t=$t+Math.imul(Ar,Sr)|0,xt=xt+Math.imul(Ar,Wr)|0,xt=xt+Math.imul(Or,Sr)|0,At=At+Math.imul(Or,Wr)|0,$t=$t+Math.imul($r,Fr)|0,xt=xt+Math.imul($r,pn)|0,xt=xt+Math.imul(Pr,Fr)|0,At=At+Math.imul(Pr,pn)|0,$t=$t+Math.imul(lr,Qr)|0,xt=xt+Math.imul(lr,mn)|0,xt=xt+Math.imul(fr,Qr)|0,At=At+Math.imul(fr,mn)|0,$t=$t+Math.imul(pr,qr)|0,xt=xt+Math.imul(pr,wn)|0,xt=xt+Math.imul(kr,qr)|0,At=At+Math.imul(kr,wn)|0,$t=$t+Math.imul(Qt,Vr)|0,xt=xt+Math.imul(Qt,hn)|0,xt=xt+Math.imul(dr,Vr)|0,At=At+Math.imul(dr,hn)|0,$t=$t+Math.imul(Jt,Kr)|0,xt=xt+Math.imul(Jt,$n)|0,xt=xt+Math.imul(Ht,Kr)|0,At=At+Math.imul(Ht,$n)|0,$t=$t+Math.imul(ir,Gr)|0,xt=xt+Math.imul(ir,gn)|0,xt=xt+Math.imul(Wt,Gr)|0,At=At+Math.imul(Wt,gn)|0,$t=$t+Math.imul(Ot,Zr)|0,xt=xt+Math.imul(Ot,Rn)|0,xt=xt+Math.imul(tr,Zr)|0,At=At+Math.imul(tr,Rn)|0;var Jn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,$t=Math.imul(Zt,ar),xt=Math.imul(Zt,br),xt=xt+Math.imul(Vt,ar)|0,At=Math.imul(Vt,br),$t=$t+Math.imul(or,Sr)|0,xt=xt+Math.imul(or,Wr)|0,xt=xt+Math.imul(Yt,Sr)|0,At=At+Math.imul(Yt,Wr)|0,$t=$t+Math.imul(Ar,Fr)|0,xt=xt+Math.imul(Ar,pn)|0,xt=xt+Math.imul(Or,Fr)|0,At=At+Math.imul(Or,pn)|0,$t=$t+Math.imul($r,Qr)|0,xt=xt+Math.imul($r,mn)|0,xt=xt+Math.imul(Pr,Qr)|0,At=At+Math.imul(Pr,mn)|0,$t=$t+Math.imul(lr,qr)|0,xt=xt+Math.imul(lr,wn)|0,xt=xt+Math.imul(fr,qr)|0,At=At+Math.imul(fr,wn)|0,$t=$t+Math.imul(pr,Vr)|0,xt=xt+Math.imul(pr,hn)|0,xt=xt+Math.imul(kr,Vr)|0,At=At+Math.imul(kr,hn)|0,$t=$t+Math.imul(Qt,Kr)|0,xt=xt+Math.imul(Qt,$n)|0,xt=xt+Math.imul(dr,Kr)|0,At=At+Math.imul(dr,$n)|0,$t=$t+Math.imul(Jt,Gr)|0,xt=xt+Math.imul(Jt,gn)|0,xt=xt+Math.imul(Ht,Gr)|0,At=At+Math.imul(Ht,gn)|0,$t=$t+Math.imul(ir,Zr)|0,xt=xt+Math.imul(ir,Rn)|0,xt=xt+Math.imul(Wt,Zr)|0,At=At+Math.imul(Wt,Rn)|0,$t=$t+Math.imul(Ot,nn)|0,xt=xt+Math.imul(Ot,Tn)|0,xt=xt+Math.imul(tr,nn)|0,At=At+Math.imul(tr,Tn)|0;var Yn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,$t=Math.imul(Zt,Sr),xt=Math.imul(Zt,Wr),xt=xt+Math.imul(Vt,Sr)|0,At=Math.imul(Vt,Wr),$t=$t+Math.imul(or,Fr)|0,xt=xt+Math.imul(or,pn)|0,xt=xt+Math.imul(Yt,Fr)|0,At=At+Math.imul(Yt,pn)|0,$t=$t+Math.imul(Ar,Qr)|0,xt=xt+Math.imul(Ar,mn)|0,xt=xt+Math.imul(Or,Qr)|0,At=At+Math.imul(Or,mn)|0,$t=$t+Math.imul($r,qr)|0,xt=xt+Math.imul($r,wn)|0,xt=xt+Math.imul(Pr,qr)|0,At=At+Math.imul(Pr,wn)|0,$t=$t+Math.imul(lr,Vr)|0,xt=xt+Math.imul(lr,hn)|0,xt=xt+Math.imul(fr,Vr)|0,At=At+Math.imul(fr,hn)|0,$t=$t+Math.imul(pr,Kr)|0,xt=xt+Math.imul(pr,$n)|0,xt=xt+Math.imul(kr,Kr)|0,At=At+Math.imul(kr,$n)|0,$t=$t+Math.imul(Qt,Gr)|0,xt=xt+Math.imul(Qt,gn)|0,xt=xt+Math.imul(dr,Gr)|0,At=At+Math.imul(dr,gn)|0,$t=$t+Math.imul(Jt,Zr)|0,xt=xt+Math.imul(Jt,Rn)|0,xt=xt+Math.imul(Ht,Zr)|0,At=At+Math.imul(Ht,Rn)|0,$t=$t+Math.imul(ir,nn)|0,xt=xt+Math.imul(ir,Tn)|0,xt=xt+Math.imul(Wt,nn)|0,At=At+Math.imul(Wt,Tn)|0;var ms=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ms>>>26)|0,ms&=67108863,$t=Math.imul(Zt,Fr),xt=Math.imul(Zt,pn),xt=xt+Math.imul(Vt,Fr)|0,At=Math.imul(Vt,pn),$t=$t+Math.imul(or,Qr)|0,xt=xt+Math.imul(or,mn)|0,xt=xt+Math.imul(Yt,Qr)|0,At=At+Math.imul(Yt,mn)|0,$t=$t+Math.imul(Ar,qr)|0,xt=xt+Math.imul(Ar,wn)|0,xt=xt+Math.imul(Or,qr)|0,At=At+Math.imul(Or,wn)|0,$t=$t+Math.imul($r,Vr)|0,xt=xt+Math.imul($r,hn)|0,xt=xt+Math.imul(Pr,Vr)|0,At=At+Math.imul(Pr,hn)|0,$t=$t+Math.imul(lr,Kr)|0,xt=xt+Math.imul(lr,$n)|0,xt=xt+Math.imul(fr,Kr)|0,At=At+Math.imul(fr,$n)|0,$t=$t+Math.imul(pr,Gr)|0,xt=xt+Math.imul(pr,gn)|0,xt=xt+Math.imul(kr,Gr)|0,At=At+Math.imul(kr,gn)|0,$t=$t+Math.imul(Qt,Zr)|0,xt=xt+Math.imul(Qt,Rn)|0,xt=xt+Math.imul(dr,Zr)|0,At=At+Math.imul(dr,Rn)|0,$t=$t+Math.imul(Jt,nn)|0,xt=xt+Math.imul(Jt,Tn)|0,xt=xt+Math.imul(Ht,nn)|0,At=At+Math.imul(Ht,Tn)|0;var Qn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,$t=Math.imul(Zt,Qr),xt=Math.imul(Zt,mn),xt=xt+Math.imul(Vt,Qr)|0,At=Math.imul(Vt,mn),$t=$t+Math.imul(or,qr)|0,xt=xt+Math.imul(or,wn)|0,xt=xt+Math.imul(Yt,qr)|0,At=At+Math.imul(Yt,wn)|0,$t=$t+Math.imul(Ar,Vr)|0,xt=xt+Math.imul(Ar,hn)|0,xt=xt+Math.imul(Or,Vr)|0,At=At+Math.imul(Or,hn)|0,$t=$t+Math.imul($r,Kr)|0,xt=xt+Math.imul($r,$n)|0,xt=xt+Math.imul(Pr,Kr)|0,At=At+Math.imul(Pr,$n)|0,$t=$t+Math.imul(lr,Gr)|0,xt=xt+Math.imul(lr,gn)|0,xt=xt+Math.imul(fr,Gr)|0,At=At+Math.imul(fr,gn)|0,$t=$t+Math.imul(pr,Zr)|0,xt=xt+Math.imul(pr,Rn)|0,xt=xt+Math.imul(kr,Zr)|0,At=At+Math.imul(kr,Rn)|0,$t=$t+Math.imul(Qt,nn)|0,xt=xt+Math.imul(Qt,Tn)|0,xt=xt+Math.imul(dr,nn)|0,At=At+Math.imul(dr,Tn)|0;var es=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(es>>>26)|0,es&=67108863,$t=Math.imul(Zt,qr),xt=Math.imul(Zt,wn),xt=xt+Math.imul(Vt,qr)|0,At=Math.imul(Vt,wn),$t=$t+Math.imul(or,Vr)|0,xt=xt+Math.imul(or,hn)|0,xt=xt+Math.imul(Yt,Vr)|0,At=At+Math.imul(Yt,hn)|0,$t=$t+Math.imul(Ar,Kr)|0,xt=xt+Math.imul(Ar,$n)|0,xt=xt+Math.imul(Or,Kr)|0,At=At+Math.imul(Or,$n)|0,$t=$t+Math.imul($r,Gr)|0,xt=xt+Math.imul($r,gn)|0,xt=xt+Math.imul(Pr,Gr)|0,At=At+Math.imul(Pr,gn)|0,$t=$t+Math.imul(lr,Zr)|0,xt=xt+Math.imul(lr,Rn)|0,xt=xt+Math.imul(fr,Zr)|0,At=At+Math.imul(fr,Rn)|0,$t=$t+Math.imul(pr,nn)|0,xt=xt+Math.imul(pr,Tn)|0,xt=xt+Math.imul(kr,nn)|0,At=At+Math.imul(kr,Tn)|0;var ls=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(ls>>>26)|0,ls&=67108863,$t=Math.imul(Zt,Vr),xt=Math.imul(Zt,hn),xt=xt+Math.imul(Vt,Vr)|0,At=Math.imul(Vt,hn),$t=$t+Math.imul(or,Kr)|0,xt=xt+Math.imul(or,$n)|0,xt=xt+Math.imul(Yt,Kr)|0,At=At+Math.imul(Yt,$n)|0,$t=$t+Math.imul(Ar,Gr)|0,xt=xt+Math.imul(Ar,gn)|0,xt=xt+Math.imul(Or,Gr)|0,At=At+Math.imul(Or,gn)|0,$t=$t+Math.imul($r,Zr)|0,xt=xt+Math.imul($r,Rn)|0,xt=xt+Math.imul(Pr,Zr)|0,At=At+Math.imul(Pr,Rn)|0,$t=$t+Math.imul(lr,nn)|0,xt=xt+Math.imul(lr,Tn)|0,xt=xt+Math.imul(fr,nn)|0,At=At+Math.imul(fr,Tn)|0;var us=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(us>>>26)|0,us&=67108863,$t=Math.imul(Zt,Kr),xt=Math.imul(Zt,$n),xt=xt+Math.imul(Vt,Kr)|0,At=Math.imul(Vt,$n),$t=$t+Math.imul(or,Gr)|0,xt=xt+Math.imul(or,gn)|0,xt=xt+Math.imul(Yt,Gr)|0,At=At+Math.imul(Yt,gn)|0,$t=$t+Math.imul(Ar,Zr)|0,xt=xt+Math.imul(Ar,Rn)|0,xt=xt+Math.imul(Or,Zr)|0,At=At+Math.imul(Or,Rn)|0,$t=$t+Math.imul($r,nn)|0,xt=xt+Math.imul($r,Tn)|0,xt=xt+Math.imul(Pr,nn)|0,At=At+Math.imul(Pr,Tn)|0;var Wn=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,$t=Math.imul(Zt,Gr),xt=Math.imul(Zt,gn),xt=xt+Math.imul(Vt,Gr)|0,At=Math.imul(Vt,gn),$t=$t+Math.imul(or,Zr)|0,xt=xt+Math.imul(or,Rn)|0,xt=xt+Math.imul(Yt,Zr)|0,At=At+Math.imul(Yt,Rn)|0,$t=$t+Math.imul(Ar,nn)|0,xt=xt+Math.imul(Ar,Tn)|0,xt=xt+Math.imul(Or,nn)|0,At=At+Math.imul(Or,Tn)|0;var as=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(as>>>26)|0,as&=67108863,$t=Math.imul(Zt,Zr),xt=Math.imul(Zt,Rn),xt=xt+Math.imul(Vt,Zr)|0,At=Math.imul(Vt,Rn),$t=$t+Math.imul(or,nn)|0,xt=xt+Math.imul(or,Tn)|0,xt=xt+Math.imul(Yt,nn)|0,At=At+Math.imul(Yt,Tn)|0;var gs=(Rt+$t|0)+((xt&8191)<<13)|0;Rt=(At+(xt>>>13)|0)+(gs>>>26)|0,gs&=67108863,$t=Math.imul(Zt,nn),xt=Math.imul(Zt,Tn),xt=xt+Math.imul(Vt,nn)|0,At=Math.imul(Vt,Tn);var vs=(Rt+$t|0)+((xt&8191)<<13)|0;return Rt=(At+(xt>>>13)|0)+(vs>>>26)|0,vs&=67108863,St[0]=yn,St[1]=En,St[2]=ds,St[3]=fs,St[4]=hs,St[5]=ps,St[6]=Vn,St[7]=ss,St[8]=Jn,St[9]=Yn,St[10]=ms,St[11]=Qn,St[12]=es,St[13]=ls,St[14]=us,St[15]=Wn,St[16]=as,St[17]=gs,St[18]=vs,Rt!==0&&(St[19]=Rt,ct.length++),ct};Math.imul||(Et=bt);function Ct(Bt,yt,mt){mt.negative=yt.negative^Bt.negative,mt.length=Bt.length+yt.length;for(var ct=0,dt=0,vt=0;vt>>26)|0,dt+=St>>>26,St&=67108863}mt.words[vt]=Rt,ct=St,St=dt}return ct!==0?mt.words[vt]=ct:mt.length--,mt.strip()}function Pt(Bt,yt,mt){var ct=new Tt;return ct.mulp(Bt,yt,mt)}tt.prototype.mulTo=function(yt,mt){var ct,dt=this.length+yt.length;return this.length===10&&yt.length===10?ct=Et(this,yt,mt):dt<63?ct=bt(this,yt,mt):dt<1024?ct=Ct(this,yt,mt):ct=Pt(this,yt,mt),ct};function Tt(Bt,yt){this.x=Bt,this.y=yt}Tt.prototype.makeRBT=function(yt){for(var mt=new Array(yt),ct=tt.prototype._countBits(yt)-1,dt=0;dt>=1;return dt},Tt.prototype.permute=function(yt,mt,ct,dt,vt,St){for(var Rt=0;Rt>>1)vt++;return 1<>>13,ct[2*St+1]=vt&8191,vt=vt>>>13;for(St=2*mt;St>=26,mt+=dt/67108864|0,mt+=vt>>>26,this.words[ct]=vt&67108863}return mt!==0&&(this.words[ct]=mt,this.length++),this},tt.prototype.muln=function(yt){return this.clone().imuln(yt)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(yt){var mt=ht(yt);if(mt.length===0)return new tt(1);for(var ct=this,dt=0;dt=0);var mt=yt%26,ct=(yt-mt)/26,dt=67108863>>>26-mt<<26-mt,vt;if(mt!==0){var St=0;for(vt=0;vt>>26-mt}St&&(this.words[vt]=St,this.length++)}if(ct!==0){for(vt=this.length-1;vt>=0;vt--)this.words[vt+ct]=this.words[vt];for(vt=0;vt=0);var dt;mt?dt=(mt-mt%26)/26:dt=0;var vt=yt%26,St=Math.min((yt-vt)/26,this.length),Rt=67108863^67108863>>>vt<St)for(this.length-=St,xt=0;xt=0&&(At!==0||xt>=dt);xt--){var wt=this.words[xt]|0;this.words[xt]=At<<26-vt|wt>>>vt,At=wt&Rt}return $t&&At!==0&&($t.words[$t.length++]=At),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},tt.prototype.ishrn=function(yt,mt,ct){return j(this.negative===0),this.iushrn(yt,mt,ct)},tt.prototype.shln=function(yt){return this.clone().ishln(yt)},tt.prototype.ushln=function(yt){return this.clone().iushln(yt)},tt.prototype.shrn=function(yt){return this.clone().ishrn(yt)},tt.prototype.ushrn=function(yt){return this.clone().iushrn(yt)},tt.prototype.testn=function(yt){j(typeof yt=="number"&&yt>=0);var mt=yt%26,ct=(yt-mt)/26,dt=1<=0);var mt=yt%26,ct=(yt-mt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=ct)return this;if(mt!==0&&ct++,this.length=Math.min(ct,this.length),mt!==0){var dt=67108863^67108863>>>mt<=67108864;mt++)this.words[mt]-=67108864,mt===this.length-1?this.words[mt+1]=1:this.words[mt+1]++;return this.length=Math.max(this.length,mt+1),this},tt.prototype.isubn=function(yt){if(j(typeof yt=="number"),j(yt<67108864),yt<0)return this.iaddn(-yt);if(this.negative!==0)return this.negative=0,this.iaddn(yt),this.negative=1,this;if(this.words[0]-=yt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var mt=0;mt>26)-($t/67108864|0),this.words[vt+ct]=St&67108863}for(;vt>26,this.words[vt+ct]=St&67108863;if(Rt===0)return this.strip();for(j(Rt===-1),Rt=0,vt=0;vt>26,this.words[vt]=St&67108863;return this.negative=1,this.strip()},tt.prototype._wordDiv=function(yt,mt){var ct=this.length-yt.length,dt=this.clone(),vt=yt,St=vt.words[vt.length-1]|0,Rt=this._countBits(St);ct=26-Rt,ct!==0&&(vt=vt.ushln(ct),dt.iushln(ct),St=vt.words[vt.length-1]|0);var $t=dt.length-vt.length,xt;if(mt!=="mod"){xt=new tt(null),xt.length=$t+1,xt.words=new Array(xt.length);for(var At=0;At=0;Ot--){var tr=(dt.words[vt.length+Ot]|0)*67108864+(dt.words[vt.length+Ot-1]|0);for(tr=Math.min(tr/St|0,67108863),dt._ishlnsubmul(vt,tr,Ot);dt.negative!==0;)tr--,dt.negative=0,dt._ishlnsubmul(vt,1,Ot),dt.isZero()||(dt.negative^=1);xt&&(xt.words[Ot]=tr)}return xt&&xt.strip(),dt.strip(),mt!=="div"&&ct!==0&&dt.iushrn(ct),{div:xt||null,mod:dt}},tt.prototype.divmod=function(yt,mt,ct){if(j(!yt.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var dt,vt,St;return this.negative!==0&&yt.negative===0?(St=this.neg().divmod(yt,mt),mt!=="mod"&&(dt=St.div.neg()),mt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.iadd(yt)),{div:dt,mod:vt}):this.negative===0&&yt.negative!==0?(St=this.divmod(yt.neg(),mt),mt!=="mod"&&(dt=St.div.neg()),{div:dt,mod:St.mod}):this.negative&yt.negative?(St=this.neg().divmod(yt.neg(),mt),mt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.isub(yt)),{div:St.div,mod:vt}):yt.length>this.length||this.cmp(yt)<0?{div:new tt(0),mod:this}:yt.length===1?mt==="div"?{div:this.divn(yt.words[0]),mod:null}:mt==="mod"?{div:null,mod:new tt(this.modn(yt.words[0]))}:{div:this.divn(yt.words[0]),mod:new tt(this.modn(yt.words[0]))}:this._wordDiv(yt,mt)},tt.prototype.div=function(yt){return this.divmod(yt,"div",!1).div},tt.prototype.mod=function(yt){return this.divmod(yt,"mod",!1).mod},tt.prototype.umod=function(yt){return this.divmod(yt,"mod",!0).mod},tt.prototype.divRound=function(yt){var mt=this.divmod(yt);if(mt.mod.isZero())return mt.div;var ct=mt.div.negative!==0?mt.mod.isub(yt):mt.mod,dt=yt.ushrn(1),vt=yt.andln(1),St=ct.cmp(dt);return St<0||vt===1&&St===0?mt.div:mt.div.negative!==0?mt.div.isubn(1):mt.div.iaddn(1)},tt.prototype.modn=function(yt){j(yt<=67108863);for(var mt=(1<<26)%yt,ct=0,dt=this.length-1;dt>=0;dt--)ct=(mt*ct+(this.words[dt]|0))%yt;return ct},tt.prototype.idivn=function(yt){j(yt<=67108863);for(var mt=0,ct=this.length-1;ct>=0;ct--){var dt=(this.words[ct]|0)+mt*67108864;this.words[ct]=dt/yt|0,mt=dt%yt}return this.strip()},tt.prototype.divn=function(yt){return this.clone().idivn(yt)},tt.prototype.egcd=function(yt){j(yt.negative===0),j(!yt.isZero());var mt=this,ct=yt.clone();mt.negative!==0?mt=mt.umod(yt):mt=mt.clone();for(var dt=new tt(1),vt=new tt(0),St=new tt(0),Rt=new tt(1),$t=0;mt.isEven()&&ct.isEven();)mt.iushrn(1),ct.iushrn(1),++$t;for(var xt=ct.clone(),At=mt.clone();!mt.isZero();){for(var wt=0,Ot=1;!(mt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(mt.iushrn(wt);wt-- >0;)(dt.isOdd()||vt.isOdd())&&(dt.iadd(xt),vt.isub(At)),dt.iushrn(1),vt.iushrn(1);for(var tr=0,nr=1;!(ct.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ct.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(xt),Rt.isub(At)),St.iushrn(1),Rt.iushrn(1);mt.cmp(ct)>=0?(mt.isub(ct),dt.isub(St),vt.isub(Rt)):(ct.isub(mt),St.isub(dt),Rt.isub(vt))}return{a:St,b:Rt,gcd:ct.iushln($t)}},tt.prototype._invmp=function(yt){j(yt.negative===0),j(!yt.isZero());var mt=this,ct=yt.clone();mt.negative!==0?mt=mt.umod(yt):mt=mt.clone();for(var dt=new tt(1),vt=new tt(0),St=ct.clone();mt.cmpn(1)>0&&ct.cmpn(1)>0;){for(var Rt=0,$t=1;!(mt.words[0]&$t)&&Rt<26;++Rt,$t<<=1);if(Rt>0)for(mt.iushrn(Rt);Rt-- >0;)dt.isOdd()&&dt.iadd(St),dt.iushrn(1);for(var xt=0,At=1;!(ct.words[0]&At)&&xt<26;++xt,At<<=1);if(xt>0)for(ct.iushrn(xt);xt-- >0;)vt.isOdd()&&vt.iadd(St),vt.iushrn(1);mt.cmp(ct)>=0?(mt.isub(ct),dt.isub(vt)):(ct.isub(mt),vt.isub(dt))}var wt;return mt.cmpn(1)===0?wt=dt:wt=vt,wt.cmpn(0)<0&&wt.iadd(yt),wt},tt.prototype.gcd=function(yt){if(this.isZero())return yt.abs();if(yt.isZero())return this.abs();var mt=this.clone(),ct=yt.clone();mt.negative=0,ct.negative=0;for(var dt=0;mt.isEven()&&ct.isEven();dt++)mt.iushrn(1),ct.iushrn(1);do{for(;mt.isEven();)mt.iushrn(1);for(;ct.isEven();)ct.iushrn(1);var vt=mt.cmp(ct);if(vt<0){var St=mt;mt=ct,ct=St}else if(vt===0||ct.cmpn(1)===0)break;mt.isub(ct)}while(!0);return ct.iushln(dt)},tt.prototype.invm=function(yt){return this.egcd(yt).a.umod(yt)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(yt){return this.words[0]&yt},tt.prototype.bincn=function(yt){j(typeof yt=="number");var mt=yt%26,ct=(yt-mt)/26,dt=1<>>26,Rt&=67108863,this.words[St]=Rt}return vt!==0&&(this.words[St]=vt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(yt){var mt=yt<0;if(this.negative!==0&&!mt)return-1;if(this.negative===0&&mt)return 1;this.strip();var ct;if(this.length>1)ct=1;else{mt&&(yt=-yt),j(yt<=67108863,"Number is too big");var dt=this.words[0]|0;ct=dt===yt?0:dtyt.length)return 1;if(this.length=0;ct--){var dt=this.words[ct]|0,vt=yt.words[ct]|0;if(dt!==vt){dtvt&&(mt=1);break}}return mt},tt.prototype.gtn=function(yt){return this.cmpn(yt)===1},tt.prototype.gt=function(yt){return this.cmp(yt)===1},tt.prototype.gten=function(yt){return this.cmpn(yt)>=0},tt.prototype.gte=function(yt){return this.cmp(yt)>=0},tt.prototype.ltn=function(yt){return this.cmpn(yt)===-1},tt.prototype.lt=function(yt){return this.cmp(yt)===-1},tt.prototype.lten=function(yt){return this.cmpn(yt)<=0},tt.prototype.lte=function(yt){return this.cmp(yt)<=0},tt.prototype.eqn=function(yt){return this.cmpn(yt)===0},tt.prototype.eq=function(yt){return this.cmp(yt)===0},tt.red=function(yt){return new Dt(yt)},tt.prototype.toRed=function(yt){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),yt.convertTo(this)._forceRed(yt)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(yt){return this.red=yt,this},tt.prototype.forceRed=function(yt){return j(!this.red,"Already a number in reduction context"),this._forceRed(yt)},tt.prototype.redAdd=function(yt){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,yt)},tt.prototype.redIAdd=function(yt){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,yt)},tt.prototype.redSub=function(yt){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,yt)},tt.prototype.redISub=function(yt){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,yt)},tt.prototype.redShl=function(yt){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,yt)},tt.prototype.redMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.mul(this,yt)},tt.prototype.redIMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.imul(this,yt)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(yt){return j(this.red&&!yt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,yt)};var It={k256:null,p224:null,p192:null,p25519:null};function Lt(Bt,yt){this.name=Bt,this.p=new tt(yt,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Lt.prototype._tmp=function(){var yt=new tt(null);return yt.words=new Array(Math.ceil(this.n/13)),yt},Lt.prototype.ireduce=function(yt){var mt=yt,ct;do this.split(mt,this.tmp),mt=this.imulK(mt),mt=mt.iadd(this.tmp),ct=mt.bitLength();while(ct>this.n);var dt=ct0?mt.isub(this.p):mt.strip!==void 0?mt.strip():mt._strip(),mt},Lt.prototype.split=function(yt,mt){yt.iushrn(this.n,0,mt)},Lt.prototype.imulK=function(yt){return yt.imul(this.k)};function Nt(){Lt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Nt,Lt),Nt.prototype.split=function(yt,mt){for(var ct=4194303,dt=Math.min(yt.length,9),vt=0;vt>>22,St=Rt}St>>>=22,yt.words[vt-10]=St,St===0&&yt.length>10?yt.length-=10:yt.length-=9},Nt.prototype.imulK=function(yt){yt.words[yt.length]=0,yt.words[yt.length+1]=0,yt.length+=2;for(var mt=0,ct=0;ct>>=26,yt.words[ct]=vt,mt=dt}return mt!==0&&(yt.words[yt.length++]=mt),yt},tt._prime=function(yt){if(It[yt])return It[yt];var mt;if(yt==="k256")mt=new Nt;else if(yt==="p224")mt=new Ut;else if(yt==="p192")mt=new jt;else if(yt==="p25519")mt=new Mt;else throw new Error("Unknown prime "+yt);return It[yt]=mt,mt};function Dt(Bt){if(typeof Bt=="string"){var yt=tt._prime(Bt);this.m=yt.p,this.prime=yt}else j(Bt.gtn(1),"modulus must be greater than 1"),this.m=Bt,this.prime=null}Dt.prototype._verify1=function(yt){j(yt.negative===0,"red works only with positives"),j(yt.red,"red works only with red numbers")},Dt.prototype._verify2=function(yt,mt){j((yt.negative|mt.negative)===0,"red works only with positives"),j(yt.red&&yt.red===mt.red,"red works only with red numbers")},Dt.prototype.imod=function(yt){return this.prime?this.prime.ireduce(yt)._forceRed(this):yt.umod(this.m)._forceRed(this)},Dt.prototype.neg=function(yt){return yt.isZero()?yt.clone():this.m.sub(yt)._forceRed(this)},Dt.prototype.add=function(yt,mt){this._verify2(yt,mt);var ct=yt.add(mt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct._forceRed(this)},Dt.prototype.iadd=function(yt,mt){this._verify2(yt,mt);var ct=yt.iadd(mt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct},Dt.prototype.sub=function(yt,mt){this._verify2(yt,mt);var ct=yt.sub(mt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct._forceRed(this)},Dt.prototype.isub=function(yt,mt){this._verify2(yt,mt);var ct=yt.isub(mt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct},Dt.prototype.shl=function(yt,mt){return this._verify1(yt),this.imod(yt.ushln(mt))},Dt.prototype.imul=function(yt,mt){return this._verify2(yt,mt),this.imod(yt.imul(mt))},Dt.prototype.mul=function(yt,mt){return this._verify2(yt,mt),this.imod(yt.mul(mt))},Dt.prototype.isqr=function(yt){return this.imul(yt,yt.clone())},Dt.prototype.sqr=function(yt){return this.mul(yt,yt)},Dt.prototype.sqrt=function(yt){if(yt.isZero())return yt.clone();var mt=this.m.andln(3);if(j(mt%2===1),mt===3){var ct=this.m.add(new tt(1)).iushrn(2);return this.pow(yt,ct)}for(var dt=this.m.subn(1),vt=0;!dt.isZero()&&dt.andln(1)===0;)vt++,dt.iushrn(1);j(!dt.isZero());var St=new tt(1).toRed(this),Rt=St.redNeg(),$t=this.m.subn(1).iushrn(1),xt=this.m.bitLength();for(xt=new tt(2*xt*xt).toRed(this);this.pow(xt,$t).cmp(Rt)!==0;)xt.redIAdd(Rt);for(var At=this.pow(xt,dt),wt=this.pow(yt,dt.addn(1).iushrn(1)),Ot=this.pow(yt,dt),tr=vt;Ot.cmp(St)!==0;){for(var nr=Ot,ir=0;nr.cmp(St)!==0;ir++)nr=nr.redSqr();j(ir=0;vt--){for(var At=mt.words[vt],wt=xt-1;wt>=0;wt--){var Ot=At>>wt&1;if(St!==dt[0]&&(St=this.sqr(St)),Ot===0&&Rt===0){$t=0;continue}Rt<<=1,Rt|=Ot,$t++,!($t!==ct&&(vt!==0||wt!==0))&&(St=this.mul(St,dt[Rt]),$t=0,Rt=0)}xt=26}return St},Dt.prototype.convertTo=function(yt){var mt=yt.umod(this.m);return mt===yt?mt.clone():mt},Dt.prototype.convertFrom=function(yt){var mt=yt.clone();return mt.red=null,mt},tt.mont=function(yt){return new Ft(yt)};function Ft(Bt){Dt.call(this,Bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(Ft,Dt),Ft.prototype.convertTo=function(yt){return this.imod(yt.ushln(this.shift))},Ft.prototype.convertFrom=function(yt){var mt=this.imod(yt.mul(this.rinv));return mt.red=null,mt},Ft.prototype.imul=function(yt,mt){if(yt.isZero()||mt.isZero())return yt.words[0]=0,yt.length=1,yt;var ct=yt.imul(mt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(dt).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.mul=function(yt,mt){if(yt.isZero()||mt.isZero())return new tt(0)._forceRed(this);var ct=yt.mul(mt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(dt).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.invm=function(yt){var mt=this.imod(yt._invmp(this.m).mul(this.r2));return mt._forceRed(this)}})(_,commonjsGlobal)}(bn$2)),bn$2.exports}var utils$G={};(function(_){var a=_;function $(tt,rt){if(Array.isArray(tt))return tt.slice();if(!tt)return[];var nt=[];if(typeof tt!="string"){for(var it=0;it>8,at=ot&255;st?nt.push(st,at):nt.push(at)}return nt}a.toArray=$;function j(tt){return tt.length===1?"0"+tt:tt}a.zero2=j;function et(tt){for(var rt="",nt=0;nt(Et>>1)-1?Pt=(Et>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,ht[bt]=Pt,Ct.iushrn(1)}return ht}a.getNAF=tt;function rt(st,at){var ut=[[],[]];st=st.clone(),at=at.clone();for(var ht=0,bt=0,Et;st.cmpn(-ht)>0||at.cmpn(-bt)>0;){var Ct=st.andln(3)+ht&3,Pt=at.andln(3)+bt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(Et=st.andln(7)+ht&7,(Et===3||Et===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var It;Pt&1?(Et=at.andln(7)+bt&7,(Et===3||Et===5)&&Ct===2?It=-Pt:It=Pt):It=0,ut[1].push(It),2*ht===Tt+1&&(ht=1-ht),2*bt===It+1&&(bt=1-bt),st.iushrn(1),at.iushrn(1)}return ut}a.getJSF=rt;function nt(st,at,ut){var ht="_"+at;st.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function ot(st){return new $(st,"hex","le")}a.intFromLE=ot}(utils$H)),utils$H}var curve$3={},base$6,hasRequiredBase$2;function requireBase$2(){if(hasRequiredBase$2)return base$6;hasRequiredBase$2=1;var _=requireBn$1(),a=requireUtils$1(),$=a.getNAF,j=a.getJSF,et=a.assert;function tt(nt,it){this.type=nt,this.p=new _(it.p,16),this.red=it.prime?_.red(it.prime):_.mont(this.p),this.zero=new _(0).toRed(this.red),this.one=new _(1).toRed(this.red),this.two=new _(2).toRed(this.red),this.n=it.n&&new _(it.n,16),this.g=it.g&&this.pointFromJSON(it.g,it.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var ot=this.n&&this.p.div(this.n);!ot||ot.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$6=tt,tt.prototype.point=function(){throw new Error("Not implemented")},tt.prototype.validate=function(){throw new Error("Not implemented")},tt.prototype._fixedNafMul=function(it,ot){et(it.precomputed);var st=it._getDoubles(),at=$(ot,1,this._bitLength),ut=(1<=bt;Ct--)Et=(Et<<1)+at[Ct];ht.push(Et)}for(var Pt=this.jpoint(null,null,null),Tt=this.jpoint(null,null,null),It=ut;It>0;It--){for(bt=0;bt=0;Et--){for(var Ct=0;Et>=0&&ht[Et]===0;Et--)Ct++;if(Et>=0&&Ct++,bt=bt.dblp(Ct),Et<0)break;var Pt=ht[Et];et(Pt!==0),it.type==="affine"?Pt>0?bt=bt.mixedAdd(ut[Pt-1>>1]):bt=bt.mixedAdd(ut[-Pt-1>>1].neg()):Pt>0?bt=bt.add(ut[Pt-1>>1]):bt=bt.add(ut[-Pt-1>>1].neg())}return it.type==="affine"?bt.toP():bt},tt.prototype._wnafMulAdd=function(it,ot,st,at,ut){var ht=this._wnafT1,bt=this._wnafT2,Et=this._wnafT3,Ct=0,Pt,Tt,It;for(Pt=0;Pt=1;Pt-=2){var Nt=Pt-1,Ut=Pt;if(ht[Nt]!==1||ht[Ut]!==1){Et[Nt]=$(st[Nt],ht[Nt],this._bitLength),Et[Ut]=$(st[Ut],ht[Ut],this._bitLength),Ct=Math.max(Et[Nt].length,Ct),Ct=Math.max(Et[Ut].length,Ct);continue}var jt=[ot[Nt],null,null,ot[Ut]];ot[Nt].y.cmp(ot[Ut].y)===0?(jt[1]=ot[Nt].add(ot[Ut]),jt[2]=ot[Nt].toJ().mixedAdd(ot[Ut].neg())):ot[Nt].y.cmp(ot[Ut].y.redNeg())===0?(jt[1]=ot[Nt].toJ().mixedAdd(ot[Ut]),jt[2]=ot[Nt].add(ot[Ut].neg())):(jt[1]=ot[Nt].toJ().mixedAdd(ot[Ut]),jt[2]=ot[Nt].toJ().mixedAdd(ot[Ut].neg()));var Mt=[-3,-1,-5,-7,0,7,5,1,3],Dt=j(st[Nt],st[Ut]);for(Ct=Math.max(Dt[0].length,Ct),Et[Nt]=new Array(Ct),Et[Ut]=new Array(Ct),Tt=0;Tt=0;Pt--){for(var ct=0;Pt>=0;){var dt=!0;for(Tt=0;Tt=0&&ct++,yt=yt.dblp(ct),Pt<0)break;for(Tt=0;Tt0?It=bt[Tt][vt-1>>1]:vt<0&&(It=bt[Tt][-vt-1>>1].neg()),It.type==="affine"?yt=yt.mixedAdd(It):yt=yt.add(It))}}for(Pt=0;Pt=Math.ceil((it.bitLength()+1)/ot.step):!1},rt.prototype._getDoubles=function(it,ot){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var st=[this],at=this,ut=0;ut=0&&(Nt=Pt,Ut=Tt),It.negative&&(It=It.neg(),Lt=Lt.neg()),Nt.negative&&(Nt=Nt.neg(),Ut=Ut.neg()),[{a:It,b:Lt},{a:Nt,b:Ut}]},tt.prototype._endoSplit=function(ot){var st=this.endo.basis,at=st[0],ut=st[1],ht=ut.b.mul(ot).divRound(this.n),bt=at.b.neg().mul(ot).divRound(this.n),Et=ht.mul(at.a),Ct=bt.mul(ut.a),Pt=ht.mul(at.b),Tt=bt.mul(ut.b),It=ot.sub(Et).sub(Ct),Lt=Pt.add(Tt).neg();return{k1:It,k2:Lt}},tt.prototype.pointFromX=function(ot,st){ot=new a(ot,16),ot.red||(ot=ot.toRed(this.red));var at=ot.redSqr().redMul(ot).redIAdd(ot.redMul(this.a)).redIAdd(this.b),ut=at.redSqrt();if(ut.redSqr().redSub(at).cmp(this.zero)!==0)throw new Error("invalid point");var ht=ut.fromRed().isOdd();return(st&&!ht||!st&&ht)&&(ut=ut.redNeg()),this.point(ot,ut)},tt.prototype.validate=function(ot){if(ot.inf)return!0;var st=ot.x,at=ot.y,ut=this.a.redMul(st),ht=st.redSqr().redMul(st).redIAdd(ut).redIAdd(this.b);return at.redSqr().redISub(ht).cmpn(0)===0},tt.prototype._endoWnafMulAdd=function(ot,st,at){for(var ut=this._endoWnafT1,ht=this._endoWnafT2,bt=0;bt":""},rt.prototype.isInfinity=function(){return this.inf},rt.prototype.add=function(ot){if(this.inf)return ot;if(ot.inf)return this;if(this.eq(ot))return this.dbl();if(this.neg().eq(ot))return this.curve.point(null,null);if(this.x.cmp(ot.x)===0)return this.curve.point(null,null);var st=this.y.redSub(ot.y);st.cmpn(0)!==0&&(st=st.redMul(this.x.redSub(ot.x).redInvm()));var at=st.redSqr().redISub(this.x).redISub(ot.x),ut=st.redMul(this.x.redSub(at)).redISub(this.y);return this.curve.point(at,ut)},rt.prototype.dbl=function(){if(this.inf)return this;var ot=this.y.redAdd(this.y);if(ot.cmpn(0)===0)return this.curve.point(null,null);var st=this.curve.a,at=this.x.redSqr(),ut=ot.redInvm(),ht=at.redAdd(at).redIAdd(at).redIAdd(st).redMul(ut),bt=ht.redSqr().redISub(this.x.redAdd(this.x)),Et=ht.redMul(this.x.redSub(bt)).redISub(this.y);return this.curve.point(bt,Et)},rt.prototype.getX=function(){return this.x.fromRed()},rt.prototype.getY=function(){return this.y.fromRed()},rt.prototype.mul=function(ot){return ot=new a(ot,16),this.isInfinity()?this:this._hasDoubles(ot)?this.curve._fixedNafMul(this,ot):this.curve.endo?this.curve._endoWnafMulAdd([this],[ot]):this.curve._wnafMul(this,ot)},rt.prototype.mulAdd=function(ot,st,at){var ut=[this,st],ht=[ot,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht):this.curve._wnafMulAdd(1,ut,ht,2)},rt.prototype.jmulAdd=function(ot,st,at){var ut=[this,st],ht=[ot,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht,!0):this.curve._wnafMulAdd(1,ut,ht,2,!0)},rt.prototype.eq=function(ot){return this===ot||this.inf===ot.inf&&(this.inf||this.x.cmp(ot.x)===0&&this.y.cmp(ot.y)===0)},rt.prototype.neg=function(ot){if(this.inf)return this;var st=this.curve.point(this.x,this.y.redNeg());if(ot&&this.precomputed){var at=this.precomputed,ut=function(ht){return ht.neg()};st.precomputed={naf:at.naf&&{wnd:at.naf.wnd,points:at.naf.points.map(ut)},doubles:at.doubles&&{step:at.doubles.step,points:at.doubles.points.map(ut)}}}return st},rt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var ot=this.curve.jpoint(this.x,this.y,this.curve.one);return ot};function nt(it,ot,st,at){j.BasePoint.call(this,it,"jacobian"),ot===null&&st===null&&at===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new a(0)):(this.x=new a(ot,16),this.y=new a(st,16),this.z=new a(at,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return $(nt,j.BasePoint),tt.prototype.jpoint=function(ot,st,at){return new nt(this,ot,st,at)},nt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var ot=this.z.redInvm(),st=ot.redSqr(),at=this.x.redMul(st),ut=this.y.redMul(st).redMul(ot);return this.curve.point(at,ut)},nt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},nt.prototype.add=function(ot){if(this.isInfinity())return ot;if(ot.isInfinity())return this;var st=ot.z.redSqr(),at=this.z.redSqr(),ut=this.x.redMul(st),ht=ot.x.redMul(at),bt=this.y.redMul(st.redMul(ot.z)),Et=ot.y.redMul(at.redMul(this.z)),Ct=ut.redSub(ht),Pt=bt.redSub(Et);if(Ct.cmpn(0)===0)return Pt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Tt=Ct.redSqr(),It=Tt.redMul(Ct),Lt=ut.redMul(Tt),Nt=Pt.redSqr().redIAdd(It).redISub(Lt).redISub(Lt),Ut=Pt.redMul(Lt.redISub(Nt)).redISub(bt.redMul(It)),jt=this.z.redMul(ot.z).redMul(Ct);return this.curve.jpoint(Nt,Ut,jt)},nt.prototype.mixedAdd=function(ot){if(this.isInfinity())return ot.toJ();if(ot.isInfinity())return this;var st=this.z.redSqr(),at=this.x,ut=ot.x.redMul(st),ht=this.y,bt=ot.y.redMul(st).redMul(this.z),Et=at.redSub(ut),Ct=ht.redSub(bt);if(Et.cmpn(0)===0)return Ct.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Pt=Et.redSqr(),Tt=Pt.redMul(Et),It=at.redMul(Pt),Lt=Ct.redSqr().redIAdd(Tt).redISub(It).redISub(It),Nt=Ct.redMul(It.redISub(Lt)).redISub(ht.redMul(Tt)),Ut=this.z.redMul(Et);return this.curve.jpoint(Lt,Nt,Ut)},nt.prototype.dblp=function(ot){if(ot===0)return this;if(this.isInfinity())return this;if(!ot)return this.dbl();var st;if(this.curve.zeroA||this.curve.threeA){var at=this;for(st=0;st=0)return!1;if(at.redIAdd(ht),this.x.cmp(at)===0)return!0}},nt.prototype.inspect=function(){return this.isInfinity()?"":""},nt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short$3}var mont$3,hasRequiredMont$1;function requireMont$1(){if(hasRequiredMont$1)return mont$3;hasRequiredMont$1=1;var _=requireBn$1(),a=inherits_browserExports,$=requireBase$2(),j=requireUtils$1();function et(rt){$.call(this,"mont",rt),this.a=new _(rt.a,16).toRed(this.red),this.b=new _(rt.b,16).toRed(this.red),this.i4=new _(4).toRed(this.red).redInvm(),this.two=new _(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}a(et,$),mont$3=et,et.prototype.validate=function(nt){var it=nt.normalize().x,ot=it.redSqr(),st=ot.redMul(it).redAdd(ot.redMul(this.a)).redAdd(it),at=st.redSqrt();return at.redSqr().cmp(st)===0};function tt(rt,nt,it){$.BasePoint.call(this,rt,"projective"),nt===null&&it===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _(nt,16),this.z=new _(it,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return a(tt,$.BasePoint),et.prototype.decodePoint=function(nt,it){return this.point(j.toArray(nt,it),1)},et.prototype.point=function(nt,it){return new tt(this,nt,it)},et.prototype.pointFromJSON=function(nt){return tt.fromJSON(this,nt)},tt.prototype.precompute=function(){},tt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},tt.fromJSON=function(nt,it){return new tt(nt,it[0],it[1]||nt.one)},tt.prototype.inspect=function(){return this.isInfinity()?"":""},tt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},tt.prototype.dbl=function(){var nt=this.x.redAdd(this.z),it=nt.redSqr(),ot=this.x.redSub(this.z),st=ot.redSqr(),at=it.redSub(st),ut=it.redMul(st),ht=at.redMul(st.redAdd(this.curve.a24.redMul(at)));return this.curve.point(ut,ht)},tt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.diffAdd=function(nt,it){var ot=this.x.redAdd(this.z),st=this.x.redSub(this.z),at=nt.x.redAdd(nt.z),ut=nt.x.redSub(nt.z),ht=ut.redMul(ot),bt=at.redMul(st),Et=it.z.redMul(ht.redAdd(bt).redSqr()),Ct=it.x.redMul(ht.redISub(bt).redSqr());return this.curve.point(Et,Ct)},tt.prototype.mul=function(nt){for(var it=nt.clone(),ot=this,st=this.curve.point(null,null),at=this,ut=[];it.cmpn(0)!==0;it.iushrn(1))ut.push(it.andln(1));for(var ht=ut.length-1;ht>=0;ht--)ut[ht]===0?(ot=ot.diffAdd(st,at),st=st.dbl()):(st=ot.diffAdd(st,at),ot=ot.dbl());return st},tt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.eq=function(nt){return this.getX().cmp(nt.getX())===0},tt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},tt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont$3}var edwards$3,hasRequiredEdwards$1;function requireEdwards$1(){if(hasRequiredEdwards$1)return edwards$3;hasRequiredEdwards$1=1;var _=requireUtils$1(),a=requireBn$1(),$=inherits_browserExports,j=requireBase$2(),et=_.assert;function tt(nt){this.twisted=(nt.a|0)!==1,this.mOneA=this.twisted&&(nt.a|0)===-1,this.extended=this.mOneA,j.call(this,"edwards",nt),this.a=new a(nt.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(nt.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(nt.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),et(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(nt.c|0)===1}$(tt,j),edwards$3=tt,tt.prototype._mulA=function(it){return this.mOneA?it.redNeg():this.a.redMul(it)},tt.prototype._mulC=function(it){return this.oneC?it:this.c.redMul(it)},tt.prototype.jpoint=function(it,ot,st,at){return this.point(it,ot,st,at)},tt.prototype.pointFromX=function(it,ot){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),at=this.c2.redSub(this.a.redMul(st)),ut=this.one.redSub(this.c2.redMul(this.d).redMul(st)),ht=at.redMul(ut.redInvm()),bt=ht.redSqrt();if(bt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");var Et=bt.fromRed().isOdd();return(ot&&!Et||!ot&&Et)&&(bt=bt.redNeg()),this.point(it,bt)},tt.prototype.pointFromY=function(it,ot){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),at=st.redSub(this.c2),ut=st.redMul(this.d).redMul(this.c2).redSub(this.a),ht=at.redMul(ut.redInvm());if(ht.cmp(this.zero)===0){if(ot)throw new Error("invalid point");return this.point(this.zero,it)}var bt=ht.redSqrt();if(bt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");return bt.fromRed().isOdd()!==ot&&(bt=bt.redNeg()),this.point(bt,it)},tt.prototype.validate=function(it){if(it.isInfinity())return!0;it.normalize();var ot=it.x.redSqr(),st=it.y.redSqr(),at=ot.redMul(this.a).redAdd(st),ut=this.c2.redMul(this.one.redAdd(this.d.redMul(ot).redMul(st)));return at.cmp(ut)===0};function rt(nt,it,ot,st,at){j.BasePoint.call(this,nt,"projective"),it===null&&ot===null&&st===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new a(it,16),this.y=new a(ot,16),this.z=st?new a(st,16):this.curve.one,this.t=at&&new a(at,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return $(rt,j.BasePoint),tt.prototype.pointFromJSON=function(it){return rt.fromJSON(this,it)},tt.prototype.point=function(it,ot,st,at){return new rt(this,it,ot,st,at)},rt.fromJSON=function(it,ot){return new rt(it,ot[0],ot[1],ot[2])},rt.prototype.inspect=function(){return this.isInfinity()?"":""},rt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},rt.prototype._extDbl=function(){var it=this.x.redSqr(),ot=this.y.redSqr(),st=this.z.redSqr();st=st.redIAdd(st);var at=this.curve._mulA(it),ut=this.x.redAdd(this.y).redSqr().redISub(it).redISub(ot),ht=at.redAdd(ot),bt=ht.redSub(st),Et=at.redSub(ot),Ct=ut.redMul(bt),Pt=ht.redMul(Et),Tt=ut.redMul(Et),It=bt.redMul(ht);return this.curve.point(Ct,Pt,It,Tt)},rt.prototype._projDbl=function(){var it=this.x.redAdd(this.y).redSqr(),ot=this.x.redSqr(),st=this.y.redSqr(),at,ut,ht,bt,Et,Ct;if(this.curve.twisted){bt=this.curve._mulA(ot);var Pt=bt.redAdd(st);this.zOne?(at=it.redSub(ot).redSub(st).redMul(Pt.redSub(this.curve.two)),ut=Pt.redMul(bt.redSub(st)),ht=Pt.redSqr().redSub(Pt).redSub(Pt)):(Et=this.z.redSqr(),Ct=Pt.redSub(Et).redISub(Et),at=it.redSub(ot).redISub(st).redMul(Ct),ut=Pt.redMul(bt.redSub(st)),ht=Pt.redMul(Ct))}else bt=ot.redAdd(st),Et=this.curve._mulC(this.z).redSqr(),Ct=bt.redSub(Et).redSub(Et),at=this.curve._mulC(it.redISub(bt)).redMul(Ct),ut=this.curve._mulC(bt).redMul(ot.redISub(st)),ht=bt.redMul(Ct);return this.curve.point(at,ut,ht)},rt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},rt.prototype._extAdd=function(it){var ot=this.y.redSub(this.x).redMul(it.y.redSub(it.x)),st=this.y.redAdd(this.x).redMul(it.y.redAdd(it.x)),at=this.t.redMul(this.curve.dd).redMul(it.t),ut=this.z.redMul(it.z.redAdd(it.z)),ht=st.redSub(ot),bt=ut.redSub(at),Et=ut.redAdd(at),Ct=st.redAdd(ot),Pt=ht.redMul(bt),Tt=Et.redMul(Ct),It=ht.redMul(Ct),Lt=bt.redMul(Et);return this.curve.point(Pt,Tt,Lt,It)},rt.prototype._projAdd=function(it){var ot=this.z.redMul(it.z),st=ot.redSqr(),at=this.x.redMul(it.x),ut=this.y.redMul(it.y),ht=this.curve.d.redMul(at).redMul(ut),bt=st.redSub(ht),Et=st.redAdd(ht),Ct=this.x.redAdd(this.y).redMul(it.x.redAdd(it.y)).redISub(at).redISub(ut),Pt=ot.redMul(bt).redMul(Ct),Tt,It;return this.curve.twisted?(Tt=ot.redMul(Et).redMul(ut.redSub(this.curve._mulA(at))),It=bt.redMul(Et)):(Tt=ot.redMul(Et).redMul(ut.redSub(at)),It=this.curve._mulC(bt).redMul(Et)),this.curve.point(Pt,Tt,It)},rt.prototype.add=function(it){return this.isInfinity()?it:it.isInfinity()?this:this.curve.extended?this._extAdd(it):this._projAdd(it)},rt.prototype.mul=function(it){return this._hasDoubles(it)?this.curve._fixedNafMul(this,it):this.curve._wnafMul(this,it)},rt.prototype.mulAdd=function(it,ot,st){return this.curve._wnafMulAdd(1,[this,ot],[it,st],2,!1)},rt.prototype.jmulAdd=function(it,ot,st){return this.curve._wnafMulAdd(1,[this,ot],[it,st],2,!0)},rt.prototype.normalize=function(){if(this.zOne)return this;var it=this.z.redInvm();return this.x=this.x.redMul(it),this.y=this.y.redMul(it),this.t&&(this.t=this.t.redMul(it)),this.z=this.curve.one,this.zOne=!0,this},rt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},rt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},rt.prototype.getY=function(){return this.normalize(),this.y.fromRed()},rt.prototype.eq=function(it){return this===it||this.getX().cmp(it.getX())===0&&this.getY().cmp(it.getY())===0},rt.prototype.eqXToP=function(it){var ot=it.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(ot)===0)return!0;for(var st=it.clone(),at=this.curve.redN.redMul(this.z);;){if(st.iadd(this.curve.n),st.cmp(this.curve.p)>=0)return!1;if(ot.redIAdd(at),this.x.cmp(ot)===0)return!0}},rt.prototype.toP=rt.prototype.normalize,rt.prototype.mixedAdd=rt.prototype.add,edwards$3}var hasRequiredCurve$1;function requireCurve$1(){return hasRequiredCurve$1||(hasRequiredCurve$1=1,function(_){var a=_;a.base=requireBase$2(),a.short=requireShort$1(),a.mont=requireMont$1(),a.edwards=requireEdwards$1()}(curve$3)),curve$3}var curves$7={},hash$7={},utils$F={},assert$r=minimalisticAssert,inherits$8=inherits_browserExports;utils$F.inherits=inherits$8;function isSurrogatePair(_,a){return(_.charCodeAt(a)&64512)!==55296||a<0||a+1>=_.length?!1:(_.charCodeAt(a+1)&64512)===56320}function toArray$3(_,a){if(Array.isArray(_))return _.slice();if(!_)return[];var $=[];if(typeof _=="string")if(a){if(a==="hex")for(_=_.replace(/[^a-z0-9]+/ig,""),_.length%2!==0&&(_="0"+_),et=0;et<_.length;et+=2)$.push(parseInt(_[et]+_[et+1],16))}else for(var j=0,et=0;et<_.length;et++){var tt=_.charCodeAt(et);tt<128?$[j++]=tt:tt<2048?($[j++]=tt>>6|192,$[j++]=tt&63|128):isSurrogatePair(_,et)?(tt=65536+((tt&1023)<<10)+(_.charCodeAt(++et)&1023),$[j++]=tt>>18|240,$[j++]=tt>>12&63|128,$[j++]=tt>>6&63|128,$[j++]=tt&63|128):($[j++]=tt>>12|224,$[j++]=tt>>6&63|128,$[j++]=tt&63|128)}else for(et=0;et<_.length;et++)$[et]=_[et]|0;return $}utils$F.toArray=toArray$3;function toHex$2(_){for(var a="",$=0;$<_.length;$++)a+=zero2(_[$].toString(16));return a}utils$F.toHex=toHex$2;function htonl(_){var a=_>>>24|_>>>8&65280|_<<8&16711680|(_&255)<<24;return a>>>0}utils$F.htonl=htonl;function toHex32(_,a){for(var $="",j=0;j<_.length;j++){var et=_[j];a==="little"&&(et=htonl(et)),$+=zero8(et.toString(16))}return $}utils$F.toHex32=toHex32;function zero2(_){return _.length===1?"0"+_:_}utils$F.zero2=zero2;function zero8(_){return _.length===7?"0"+_:_.length===6?"00"+_:_.length===5?"000"+_:_.length===4?"0000"+_:_.length===3?"00000"+_:_.length===2?"000000"+_:_.length===1?"0000000"+_:_}utils$F.zero8=zero8;function join32(_,a,$,j){var et=$-a;assert$r(et%4===0);for(var tt=new Array(et/4),rt=0,nt=a;rt>>0}return tt}utils$F.join32=join32;function split32(_,a){for(var $=new Array(_.length*4),j=0,et=0;j<_.length;j++,et+=4){var tt=_[j];a==="big"?($[et]=tt>>>24,$[et+1]=tt>>>16&255,$[et+2]=tt>>>8&255,$[et+3]=tt&255):($[et+3]=tt>>>24,$[et+2]=tt>>>16&255,$[et+1]=tt>>>8&255,$[et]=tt&255)}return $}utils$F.split32=split32;function rotr32$1(_,a){return _>>>a|_<<32-a}utils$F.rotr32=rotr32$1;function rotl32$2(_,a){return _<>>32-a}utils$F.rotl32=rotl32$2;function sum32$3(_,a){return _+a>>>0}utils$F.sum32=sum32$3;function sum32_3$1(_,a,$){return _+a+$>>>0}utils$F.sum32_3=sum32_3$1;function sum32_4$2(_,a,$,j){return _+a+$+j>>>0}utils$F.sum32_4=sum32_4$2;function sum32_5$2(_,a,$,j,et){return _+a+$+j+et>>>0}utils$F.sum32_5=sum32_5$2;function sum64$1(_,a,$,j){var et=_[a],tt=_[a+1],rt=j+tt>>>0,nt=(rt>>0,_[a+1]=rt}utils$F.sum64=sum64$1;function sum64_hi$1(_,a,$,j){var et=a+j>>>0,tt=(et>>0}utils$F.sum64_hi=sum64_hi$1;function sum64_lo$1(_,a,$,j){var et=a+j;return et>>>0}utils$F.sum64_lo=sum64_lo$1;function sum64_4_hi$1(_,a,$,j,et,tt,rt,nt){var it=0,ot=a;ot=ot+j>>>0,it+=ot>>0,it+=ot>>0,it+=ot>>0}utils$F.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(_,a,$,j,et,tt,rt,nt){var it=a+j+tt+nt;return it>>>0}utils$F.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(_,a,$,j,et,tt,rt,nt,it,ot){var st=0,at=a;at=at+j>>>0,st+=at>>0,st+=at>>0,st+=at>>0,st+=at>>0}utils$F.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(_,a,$,j,et,tt,rt,nt,it,ot){var st=a+j+tt+nt+ot;return st>>>0}utils$F.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(_,a,$){var j=a<<32-$|_>>>$;return j>>>0}utils$F.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(_,a,$){var j=_<<32-$|a>>>$;return j>>>0}utils$F.rotr64_lo=rotr64_lo$1;function shr64_hi$1(_,a,$){return _>>>$}utils$F.shr64_hi=shr64_hi$1;function shr64_lo$1(_,a,$){var j=_<<32-$|a>>>$;return j>>>0}utils$F.shr64_lo=shr64_lo$1;var common$5={},utils$E=utils$F,assert$q=minimalisticAssert;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$5.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(a,$){if(a=utils$E.toArray(a,$),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;var j=a.length%this._delta8;this.pending=a.slice(a.length-j,a.length),this.pending.length===0&&(this.pending=null),a=utils$E.join32(a,0,a.length-j,this.endian);for(var et=0;et>>24&255,et[tt++]=a>>>16&255,et[tt++]=a>>>8&255,et[tt++]=a&255}else for(et[tt++]=a&255,et[tt++]=a>>>8&255,et[tt++]=a>>>16&255,et[tt++]=a>>>24&255,et[tt++]=0,et[tt++]=0,et[tt++]=0,et[tt++]=0,rt=8;rt>>3}common$4.g0_256=g0_256$1;function g1_256$1(_){return rotr32(_,17)^rotr32(_,19)^_>>>10}common$4.g1_256=g1_256$1;var utils$C=utils$F,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$C.rotl32,sum32$2=utils$C.sum32,sum32_5$1=utils$C.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$C.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(a,$){for(var j=this.W,et=0;et<16;et++)j[et]=a[$+et];for(;etthis.blockSize&&(a=new this.Hash().update(a).digest()),assert$n(a.length<=this.blockSize);for(var $=a.length;$=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,$,j)}var hmacDrbg=HmacDRBG$2;HmacDRBG$2.prototype._init=function(a,$,j){var et=a.concat($).concat(j);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var tt=0;tt=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(j||[])),this._reseed=1};HmacDRBG$2.prototype.generate=function(a,$,j,et){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof $!="string"&&(et=j,j=$,$=null),j&&(j=utils$v.toArray(j,et||"hex"),this._update(j));for(var tt=[];tt.length"},key$7}var signature$7,hasRequiredSignature$3;function requireSignature$3(){if(hasRequiredSignature$3)return signature$7;hasRequiredSignature$3=1;var _=requireBn$1(),a=requireUtils$1(),$=a.assert;function j(it,ot){if(it instanceof j)return it;this._importDER(it,ot)||($(it.r&&it.s,"Signature without r or s"),this.r=new _(it.r,16),this.s=new _(it.s,16),it.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=it.recoveryParam)}signature$7=j;function et(){this.place=0}function tt(it,ot){var st=it[ot.place++];if(!(st&128))return st;var at=st&15;if(at===0||at>4)return!1;for(var ut=0,ht=0,bt=ot.place;ht>>=0;return ut<=127?!1:(ot.place=bt,ut)}function rt(it){for(var ot=0,st=it.length-1;!it[ot]&&!(it[ot+1]&128)&&ot>>3);for(it.push(st|128);--st;)it.push(ot>>>(st<<3)&255);it.push(ot)}return j.prototype.toDER=function(ot){var st=this.r.toArray(),at=this.s.toArray();for(st[0]&128&&(st=[0].concat(st)),at[0]&128&&(at=[0].concat(at)),st=rt(st),at=rt(at);!at[0]&&!(at[1]&128);)at=at.slice(1);var ut=[2];nt(ut,st.length),ut=ut.concat(st),ut.push(2),nt(ut,at.length);var ht=ut.concat(at),bt=[48];return nt(bt,ht.length),bt=bt.concat(ht),a.encode(bt,ot)},signature$7}var ec$5,hasRequiredEc$1;function requireEc$1(){if(hasRequiredEc$1)return ec$5;hasRequiredEc$1=1;var _=requireBn$1(),a=hmacDrbg,$=requireUtils$1(),j=requireCurves$1(),et=requireBrorand(),tt=$.assert,rt=requireKey$3(),nt=requireSignature$3();function it(ot){if(!(this instanceof it))return new it(ot);typeof ot=="string"&&(tt(Object.prototype.hasOwnProperty.call(j,ot),"Unknown curve "+ot),ot=j[ot]),ot instanceof j.PresetCurve&&(ot={curve:ot}),this.curve=ot.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=ot.curve.g,this.g.precompute(ot.curve.n.bitLength()+1),this.hash=ot.hash||ot.curve.hash}return ec$5=it,it.prototype.keyPair=function(st){return new rt(this,st)},it.prototype.keyFromPrivate=function(st,at){return rt.fromPrivate(this,st,at)},it.prototype.keyFromPublic=function(st,at){return rt.fromPublic(this,st,at)},it.prototype.genKeyPair=function(st){st||(st={});for(var at=new a({hash:this.hash,pers:st.pers,persEnc:st.persEnc||"utf8",entropy:st.entropy||et(this.hash.hmacStrength),entropyEnc:st.entropy&&st.entropyEnc||"utf8",nonce:this.n.toArray()}),ut=this.n.byteLength(),ht=this.n.sub(new _(2));;){var bt=new _(at.generate(ut));if(!(bt.cmp(ht)>0))return bt.iaddn(1),this.keyFromPrivate(bt)}},it.prototype._truncateToN=function(st,at){var ut=st.byteLength()*8-this.n.bitLength();return ut>0&&(st=st.ushrn(ut)),!at&&st.cmp(this.n)>=0?st.sub(this.n):st},it.prototype.sign=function(st,at,ut,ht){typeof ut=="object"&&(ht=ut,ut=null),ht||(ht={}),at=this.keyFromPrivate(at,ut),st=this._truncateToN(new _(st,16));for(var bt=this.n.byteLength(),Et=at.getPrivate().toArray("be",bt),Ct=st.toArray("be",bt),Pt=new a({hash:this.hash,entropy:Et,nonce:Ct,pers:ht.pers,persEnc:ht.persEnc||"utf8"}),Tt=this.n.sub(new _(1)),It=0;;It++){var Lt=ht.k?ht.k(It):new _(Pt.generate(this.n.byteLength()));if(Lt=this._truncateToN(Lt,!0),!(Lt.cmpn(1)<=0||Lt.cmp(Tt)>=0)){var Nt=this.g.mul(Lt);if(!Nt.isInfinity()){var Ut=Nt.getX(),jt=Ut.umod(this.n);if(jt.cmpn(0)!==0){var Mt=Lt.invm(this.n).mul(jt.mul(at.getPrivate()).iadd(st));if(Mt=Mt.umod(this.n),Mt.cmpn(0)!==0){var Dt=(Nt.getY().isOdd()?1:0)|(Ut.cmp(jt)!==0?2:0);return ht.canonical&&Mt.cmp(this.nh)>0&&(Mt=this.n.sub(Mt),Dt^=1),new nt({r:jt,s:Mt,recoveryParam:Dt})}}}}}},it.prototype.verify=function(st,at,ut,ht){st=this._truncateToN(new _(st,16)),ut=this.keyFromPublic(ut,ht),at=new nt(at,"hex");var bt=at.r,Et=at.s;if(bt.cmpn(1)<0||bt.cmp(this.n)>=0||Et.cmpn(1)<0||Et.cmp(this.n)>=0)return!1;var Ct=Et.invm(this.n),Pt=Ct.mul(st).umod(this.n),Tt=Ct.mul(bt).umod(this.n),It;return this.curve._maxwellTrick?(It=this.g.jmulAdd(Pt,ut.getPublic(),Tt),It.isInfinity()?!1:It.eqXToP(bt)):(It=this.g.mulAdd(Pt,ut.getPublic(),Tt),It.isInfinity()?!1:It.getX().umod(this.n).cmp(bt)===0)},it.prototype.recoverPubKey=function(ot,st,at,ut){tt((3&at)===at,"The recovery param is more than two bits"),st=new nt(st,ut);var ht=this.n,bt=new _(ot),Et=st.r,Ct=st.s,Pt=at&1,Tt=at>>1;if(Et.cmp(this.curve.p.umod(this.curve.n))>=0&&Tt)throw new Error("Unable to find sencond key candinate");Tt?Et=this.curve.pointFromX(Et.add(this.curve.n),Pt):Et=this.curve.pointFromX(Et,Pt);var It=st.r.invm(ht),Lt=ht.sub(bt).mul(It).umod(ht),Nt=Ct.mul(It).umod(ht);return this.g.mulAdd(Lt,Et,Nt)},it.prototype.getKeyRecoveryParam=function(ot,st,at,ut){if(st=new nt(st,ut),st.recoveryParam!==null)return st.recoveryParam;for(var ht=0;ht<4;ht++){var bt;try{bt=this.recoverPubKey(ot,st,ht)}catch{continue}if(bt.eq(at))return ht}throw new Error("Unable to find valid recovery factor")},ec$5}var key$6,hasRequiredKey$2;function requireKey$2(){if(hasRequiredKey$2)return key$6;hasRequiredKey$2=1;var _=requireUtils$1(),a=_.assert,$=_.parseBytes,j=_.cachedProperty;function et(tt,rt){this.eddsa=tt,this._secret=$(rt.secret),tt.isPoint(rt.pub)?this._pub=rt.pub:this._pubBytes=$(rt.pub)}return et.fromPublic=function(rt,nt){return nt instanceof et?nt:new et(rt,{pub:nt})},et.fromSecret=function(rt,nt){return nt instanceof et?nt:new et(rt,{secret:nt})},et.prototype.secret=function(){return this._secret},j(et,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),j(et,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),j(et,"privBytes",function(){var rt=this.eddsa,nt=this.hash(),it=rt.encodingLength-1,ot=nt.slice(0,rt.encodingLength);return ot[0]&=248,ot[it]&=127,ot[it]|=64,ot}),j(et,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),j(et,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),j(et,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),et.prototype.sign=function(rt){return a(this._secret,"KeyPair can only verify"),this.eddsa.sign(rt,this)},et.prototype.verify=function(rt,nt){return this.eddsa.verify(rt,nt,this)},et.prototype.getSecret=function(rt){return a(this._secret,"KeyPair is public only"),_.encode(this.secret(),rt)},et.prototype.getPublic=function(rt){return _.encode(this.pubBytes(),rt)},key$6=et,key$6}var signature$6,hasRequiredSignature$2;function requireSignature$2(){if(hasRequiredSignature$2)return signature$6;hasRequiredSignature$2=1;var _=requireBn$1(),a=requireUtils$1(),$=a.assert,j=a.cachedProperty,et=a.parseBytes;function tt(rt,nt){this.eddsa=rt,typeof nt!="object"&&(nt=et(nt)),Array.isArray(nt)&&(nt={R:nt.slice(0,rt.encodingLength),S:nt.slice(rt.encodingLength)}),$(nt.R&&nt.S,"Signature without R or S"),rt.isPoint(nt.R)&&(this._R=nt.R),nt.S instanceof _&&(this._S=nt.S),this._Rencoded=Array.isArray(nt.R)?nt.R:nt.Rencoded,this._Sencoded=Array.isArray(nt.S)?nt.S:nt.Sencoded}return j(tt,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),j(tt,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),j(tt,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),j(tt,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),tt.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},tt.prototype.toHex=function(){return a.encode(this.toBytes(),"hex").toUpperCase()},signature$6=tt,signature$6}var eddsa$3,hasRequiredEddsa$1;function requireEddsa$1(){if(hasRequiredEddsa$1)return eddsa$3;hasRequiredEddsa$1=1;var _=hash$7,a=requireCurves$1(),$=requireUtils$1(),j=$.assert,et=$.parseBytes,tt=requireKey$2(),rt=requireSignature$2();function nt(it){if(j(it==="ed25519","only tested with ed25519 so far"),!(this instanceof nt))return new nt(it);it=a[it].curve,this.curve=it,this.g=it.g,this.g.precompute(it.n.bitLength()+1),this.pointClass=it.point().constructor,this.encodingLength=Math.ceil(it.n.bitLength()/8),this.hash=_.sha512}return eddsa$3=nt,nt.prototype.sign=function(ot,st){ot=et(ot);var at=this.keyFromSecret(st),ut=this.hashInt(at.messagePrefix(),ot),ht=this.g.mul(ut),bt=this.encodePoint(ht),Et=this.hashInt(bt,at.pubBytes(),ot).mul(at.priv()),Ct=ut.add(Et).umod(this.curve.n);return this.makeSignature({R:ht,S:Ct,Rencoded:bt})},nt.prototype.verify=function(ot,st,at){ot=et(ot),st=this.makeSignature(st);var ut=this.keyFromPublic(at),ht=this.hashInt(st.Rencoded(),ut.pubBytes(),ot),bt=this.g.mul(st.S()),Et=st.R().add(ut.pub().mul(ht));return Et.eq(bt)},nt.prototype.hashInt=function(){for(var ot=this.hash(),st=0;st0?ct:dt},tt.min=function(ct,dt){return ct.cmp(dt)<0?ct:dt},tt.prototype._init=function(ct,dt,vt){if(typeof ct=="number")return this._initNumber(ct,dt,vt);if(typeof ct=="object")return this._initArray(ct,dt,vt);dt==="hex"&&(dt=16),j(dt===(dt|0)&&dt>=2&&dt<=36),ct=ct.toString().replace(/\s+/g,"");var St=0;ct[0]==="-"&&(St++,this.negative=1),St=0;St-=3)$t=ct[St]|ct[St-1]<<8|ct[St-2]<<16,this.words[Rt]|=$t<>>26-xt&67108863,xt+=24,xt>=26&&(xt-=26,Rt++);else if(vt==="le")for(St=0,Rt=0;St>>26-xt&67108863,xt+=24,xt>=26&&(xt-=26,Rt++);return this._strip()};function nt(mt,ct){var dt=mt.charCodeAt(ct);if(dt>=48&&dt<=57)return dt-48;if(dt>=65&&dt<=70)return dt-55;if(dt>=97&&dt<=102)return dt-87;j(!1,"Invalid character in "+mt)}function it(mt,ct,dt){var vt=nt(mt,dt);return dt-1>=ct&&(vt|=nt(mt,dt-1)<<4),vt}tt.prototype._parseHex=function(ct,dt,vt){this.length=Math.ceil((ct.length-dt)/6),this.words=new Array(this.length);for(var St=0;St=dt;St-=2)xt=it(ct,dt,St)<=18?(Rt-=18,$t+=1,this.words[$t]|=xt>>>26):Rt+=8;else{var At=ct.length-dt;for(St=At%2===0?dt+1:dt;St=18?(Rt-=18,$t+=1,this.words[$t]|=xt>>>26):Rt+=8}this._strip()};function ot(mt,ct,dt,vt){for(var St=0,Rt=0,$t=Math.min(mt.length,dt),xt=ct;xt<$t;xt++){var At=mt.charCodeAt(xt)-48;St*=vt,At>=49?Rt=At-49+10:At>=17?Rt=At-17+10:Rt=At,j(At>=0&&Rt1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=at}catch{tt.prototype.inspect=at}else tt.prototype.inspect=at;function at(){return(this.red?""}var ut=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ht=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],bt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(ct,dt){ct=ct||10,dt=dt|0||1;var vt;if(ct===16||ct==="hex"){vt="";for(var St=0,Rt=0,$t=0;$t>>24-St&16777215,St+=2,St>=26&&(St-=26,$t--),Rt!==0||$t!==this.length-1?vt=ut[6-At.length]+At+vt:vt=At+vt}for(Rt!==0&&(vt=Rt.toString(16)+vt);vt.length%dt!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}if(ct===(ct|0)&&ct>=2&&ct<=36){var wt=ht[ct],Ot=bt[ct];vt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var nr=tr.modrn(Ot).toString(ct);tr=tr.idivn(Ot),tr.isZero()?vt=nr+vt:vt=ut[wt-nr.length]+nr+vt}for(this.isZero()&&(vt="0"+vt);vt.length%dt!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var ct=this.words[0];return this.length===2?ct+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ct+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-ct:ct},tt.prototype.toJSON=function(){return this.toString(16,2)},rt&&(tt.prototype.toBuffer=function(ct,dt){return this.toArrayLike(rt,ct,dt)}),tt.prototype.toArray=function(ct,dt){return this.toArrayLike(Array,ct,dt)};var Et=function(ct,dt){return ct.allocUnsafe?ct.allocUnsafe(dt):new ct(dt)};tt.prototype.toArrayLike=function(ct,dt,vt){this._strip();var St=this.byteLength(),Rt=vt||Math.max(1,St);j(St<=Rt,"byte array longer than desired length"),j(Rt>0,"Requested array length <= 0");var $t=Et(ct,Rt),xt=dt==="le"?"LE":"BE";return this["_toArrayLike"+xt]($t,St),$t},tt.prototype._toArrayLikeLE=function(ct,dt){for(var vt=0,St=0,Rt=0,$t=0;Rt>8&255),vt>16&255),$t===6?(vt>24&255),St=0,$t=0):(St=xt>>>24,$t+=2)}if(vt=0&&(ct[vt--]=xt>>8&255),vt>=0&&(ct[vt--]=xt>>16&255),$t===6?(vt>=0&&(ct[vt--]=xt>>24&255),St=0,$t=0):(St=xt>>>24,$t+=2)}if(vt>=0)for(ct[vt--]=St;vt>=0;)ct[vt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var dt=ct,vt=0;return dt>=4096&&(vt+=13,dt>>>=13),dt>=64&&(vt+=7,dt>>>=7),dt>=8&&(vt+=4,dt>>>=4),dt>=2&&(vt+=2,dt>>>=2),vt+dt},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var dt=ct,vt=0;return dt&8191||(vt+=13,dt>>>=13),dt&127||(vt+=7,dt>>>=7),dt&15||(vt+=4,dt>>>=4),dt&3||(vt+=2,dt>>>=2),dt&1||vt++,vt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],dt=this._countBits(ct);return(this.length-1)*26+dt};function Ct(mt){for(var ct=new Array(mt.bitLength()),dt=0;dt>>St&1}return ct}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var ct=0,dt=0;dtct.length?this.clone().ior(ct):ct.clone().ior(this)},tt.prototype.uor=function(ct){return this.length>ct.length?this.clone().iuor(ct):ct.clone().iuor(this)},tt.prototype.iuand=function(ct){var dt;this.length>ct.length?dt=ct:dt=this;for(var vt=0;vtct.length?this.clone().iand(ct):ct.clone().iand(this)},tt.prototype.uand=function(ct){return this.length>ct.length?this.clone().iuand(ct):ct.clone().iuand(this)},tt.prototype.iuxor=function(ct){var dt,vt;this.length>ct.length?(dt=this,vt=ct):(dt=ct,vt=this);for(var St=0;Stct.length?this.clone().ixor(ct):ct.clone().ixor(this)},tt.prototype.uxor=function(ct){return this.length>ct.length?this.clone().iuxor(ct):ct.clone().iuxor(this)},tt.prototype.inotn=function(ct){j(typeof ct=="number"&&ct>=0);var dt=Math.ceil(ct/26)|0,vt=ct%26;this._expand(dt),vt>0&&dt--;for(var St=0;St0&&(this.words[St]=~this.words[St]&67108863>>26-vt),this._strip()},tt.prototype.notn=function(ct){return this.clone().inotn(ct)},tt.prototype.setn=function(ct,dt){j(typeof ct=="number"&&ct>=0);var vt=ct/26|0,St=ct%26;return this._expand(vt+1),dt?this.words[vt]=this.words[vt]|1<ct.length?(vt=this,St=ct):(vt=ct,St=this);for(var Rt=0,$t=0;$t>>26;for(;Rt!==0&&$t>>26;if(this.length=vt.length,Rt!==0)this.words[this.length]=Rt,this.length++;else if(vt!==this)for(;$tct.length?this.clone().iadd(ct):ct.clone().iadd(this)},tt.prototype.isub=function(ct){if(ct.negative!==0){ct.negative=0;var dt=this.iadd(ct);return ct.negative=1,dt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(ct),this.negative=1,this._normSign();var vt=this.cmp(ct);if(vt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Rt;vt>0?(St=this,Rt=ct):(St=ct,Rt=this);for(var $t=0,xt=0;xt>26,this.words[xt]=dt&67108863;for(;$t!==0&&xt>26,this.words[xt]=dt&67108863;if($t===0&&xt>>26,tr=At&67108863,nr=Math.min(wt,ct.length-1),ir=Math.max(0,wt-mt.length+1);ir<=nr;ir++){var Wt=wt-ir|0;St=mt.words[Wt]|0,Rt=ct.words[ir]|0,$t=St*Rt+tr,Ot+=$t/67108864|0,tr=$t&67108863}dt.words[wt]=tr|0,At=Ot|0}return At!==0?dt.words[wt]=At|0:dt.length--,dt._strip()}var Tt=function(ct,dt,vt){var St=ct.words,Rt=dt.words,$t=vt.words,xt=0,At,wt,Ot,tr=St[0]|0,nr=tr&8191,ir=tr>>>13,Wt=St[1]|0,Kt=Wt&8191,Jt=Wt>>>13,Ht=St[2]|0,qt=Ht&8191,Qt=Ht>>>13,dr=St[3]|0,xr=dr&8191,pr=dr>>>13,kr=St[4]|0,Ir=kr&8191,lr=kr>>>13,fr=St[5]|0,Er=fr&8191,$r=fr>>>13,Pr=St[6]|0,Rr=Pr&8191,Ar=Pr>>>13,Or=St[7]|0,Lr=Or&8191,or=Or>>>13,Yt=St[8]|0,er=Yt&8191,Zt=Yt>>>13,Vt=St[9]|0,Gt=Vt&8191,ar=Vt>>>13,br=Rt[0]|0,wr=br&8191,Sr=br>>>13,Wr=Rt[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=Rt[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=Rt[3]|0,ln=mn&8191,qr=mn>>>13,wn=Rt[4]|0,un=wn&8191,Vr=wn>>>13,hn=Rt[5]|0,fn=hn&8191,Kr=hn>>>13,$n=Rt[6]|0,dn=$n&8191,Gr=$n>>>13,gn=Rt[7]|0,an=gn&8191,Zr=gn>>>13,Rn=Rt[8]|0,Sn=Rn&8191,nn=Rn>>>13,Tn=Rt[9]|0,yn=Tn&8191,En=Tn>>>13;vt.negative=ct.negative^dt.negative,vt.length=19,At=Math.imul(nr,wr),wt=Math.imul(nr,Sr),wt=wt+Math.imul(ir,wr)|0,Ot=Math.imul(ir,Sr);var ds=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ds>>>26)|0,ds&=67108863,At=Math.imul(Kt,wr),wt=Math.imul(Kt,Sr),wt=wt+Math.imul(Jt,wr)|0,Ot=Math.imul(Jt,Sr),At=At+Math.imul(nr,Hr)|0,wt=wt+Math.imul(nr,Fr)|0,wt=wt+Math.imul(ir,Hr)|0,Ot=Ot+Math.imul(ir,Fr)|0;var fs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(fs>>>26)|0,fs&=67108863,At=Math.imul(qt,wr),wt=Math.imul(qt,Sr),wt=wt+Math.imul(Qt,wr)|0,Ot=Math.imul(Qt,Sr),At=At+Math.imul(Kt,Hr)|0,wt=wt+Math.imul(Kt,Fr)|0,wt=wt+Math.imul(Jt,Hr)|0,Ot=Ot+Math.imul(Jt,Fr)|0,At=At+Math.imul(nr,Jr)|0,wt=wt+Math.imul(nr,Qr)|0,wt=wt+Math.imul(ir,Jr)|0,Ot=Ot+Math.imul(ir,Qr)|0;var hs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(hs>>>26)|0,hs&=67108863,At=Math.imul(xr,wr),wt=Math.imul(xr,Sr),wt=wt+Math.imul(pr,wr)|0,Ot=Math.imul(pr,Sr),At=At+Math.imul(qt,Hr)|0,wt=wt+Math.imul(qt,Fr)|0,wt=wt+Math.imul(Qt,Hr)|0,Ot=Ot+Math.imul(Qt,Fr)|0,At=At+Math.imul(Kt,Jr)|0,wt=wt+Math.imul(Kt,Qr)|0,wt=wt+Math.imul(Jt,Jr)|0,Ot=Ot+Math.imul(Jt,Qr)|0,At=At+Math.imul(nr,ln)|0,wt=wt+Math.imul(nr,qr)|0,wt=wt+Math.imul(ir,ln)|0,Ot=Ot+Math.imul(ir,qr)|0;var ps=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ps>>>26)|0,ps&=67108863,At=Math.imul(Ir,wr),wt=Math.imul(Ir,Sr),wt=wt+Math.imul(lr,wr)|0,Ot=Math.imul(lr,Sr),At=At+Math.imul(xr,Hr)|0,wt=wt+Math.imul(xr,Fr)|0,wt=wt+Math.imul(pr,Hr)|0,Ot=Ot+Math.imul(pr,Fr)|0,At=At+Math.imul(qt,Jr)|0,wt=wt+Math.imul(qt,Qr)|0,wt=wt+Math.imul(Qt,Jr)|0,Ot=Ot+Math.imul(Qt,Qr)|0,At=At+Math.imul(Kt,ln)|0,wt=wt+Math.imul(Kt,qr)|0,wt=wt+Math.imul(Jt,ln)|0,Ot=Ot+Math.imul(Jt,qr)|0,At=At+Math.imul(nr,un)|0,wt=wt+Math.imul(nr,Vr)|0,wt=wt+Math.imul(ir,un)|0,Ot=Ot+Math.imul(ir,Vr)|0;var Vn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,At=Math.imul(Er,wr),wt=Math.imul(Er,Sr),wt=wt+Math.imul($r,wr)|0,Ot=Math.imul($r,Sr),At=At+Math.imul(Ir,Hr)|0,wt=wt+Math.imul(Ir,Fr)|0,wt=wt+Math.imul(lr,Hr)|0,Ot=Ot+Math.imul(lr,Fr)|0,At=At+Math.imul(xr,Jr)|0,wt=wt+Math.imul(xr,Qr)|0,wt=wt+Math.imul(pr,Jr)|0,Ot=Ot+Math.imul(pr,Qr)|0,At=At+Math.imul(qt,ln)|0,wt=wt+Math.imul(qt,qr)|0,wt=wt+Math.imul(Qt,ln)|0,Ot=Ot+Math.imul(Qt,qr)|0,At=At+Math.imul(Kt,un)|0,wt=wt+Math.imul(Kt,Vr)|0,wt=wt+Math.imul(Jt,un)|0,Ot=Ot+Math.imul(Jt,Vr)|0,At=At+Math.imul(nr,fn)|0,wt=wt+Math.imul(nr,Kr)|0,wt=wt+Math.imul(ir,fn)|0,Ot=Ot+Math.imul(ir,Kr)|0;var ss=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ss>>>26)|0,ss&=67108863,At=Math.imul(Rr,wr),wt=Math.imul(Rr,Sr),wt=wt+Math.imul(Ar,wr)|0,Ot=Math.imul(Ar,Sr),At=At+Math.imul(Er,Hr)|0,wt=wt+Math.imul(Er,Fr)|0,wt=wt+Math.imul($r,Hr)|0,Ot=Ot+Math.imul($r,Fr)|0,At=At+Math.imul(Ir,Jr)|0,wt=wt+Math.imul(Ir,Qr)|0,wt=wt+Math.imul(lr,Jr)|0,Ot=Ot+Math.imul(lr,Qr)|0,At=At+Math.imul(xr,ln)|0,wt=wt+Math.imul(xr,qr)|0,wt=wt+Math.imul(pr,ln)|0,Ot=Ot+Math.imul(pr,qr)|0,At=At+Math.imul(qt,un)|0,wt=wt+Math.imul(qt,Vr)|0,wt=wt+Math.imul(Qt,un)|0,Ot=Ot+Math.imul(Qt,Vr)|0,At=At+Math.imul(Kt,fn)|0,wt=wt+Math.imul(Kt,Kr)|0,wt=wt+Math.imul(Jt,fn)|0,Ot=Ot+Math.imul(Jt,Kr)|0,At=At+Math.imul(nr,dn)|0,wt=wt+Math.imul(nr,Gr)|0,wt=wt+Math.imul(ir,dn)|0,Ot=Ot+Math.imul(ir,Gr)|0;var Jn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,At=Math.imul(Lr,wr),wt=Math.imul(Lr,Sr),wt=wt+Math.imul(or,wr)|0,Ot=Math.imul(or,Sr),At=At+Math.imul(Rr,Hr)|0,wt=wt+Math.imul(Rr,Fr)|0,wt=wt+Math.imul(Ar,Hr)|0,Ot=Ot+Math.imul(Ar,Fr)|0,At=At+Math.imul(Er,Jr)|0,wt=wt+Math.imul(Er,Qr)|0,wt=wt+Math.imul($r,Jr)|0,Ot=Ot+Math.imul($r,Qr)|0,At=At+Math.imul(Ir,ln)|0,wt=wt+Math.imul(Ir,qr)|0,wt=wt+Math.imul(lr,ln)|0,Ot=Ot+Math.imul(lr,qr)|0,At=At+Math.imul(xr,un)|0,wt=wt+Math.imul(xr,Vr)|0,wt=wt+Math.imul(pr,un)|0,Ot=Ot+Math.imul(pr,Vr)|0,At=At+Math.imul(qt,fn)|0,wt=wt+Math.imul(qt,Kr)|0,wt=wt+Math.imul(Qt,fn)|0,Ot=Ot+Math.imul(Qt,Kr)|0,At=At+Math.imul(Kt,dn)|0,wt=wt+Math.imul(Kt,Gr)|0,wt=wt+Math.imul(Jt,dn)|0,Ot=Ot+Math.imul(Jt,Gr)|0,At=At+Math.imul(nr,an)|0,wt=wt+Math.imul(nr,Zr)|0,wt=wt+Math.imul(ir,an)|0,Ot=Ot+Math.imul(ir,Zr)|0;var Yn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,At=Math.imul(er,wr),wt=Math.imul(er,Sr),wt=wt+Math.imul(Zt,wr)|0,Ot=Math.imul(Zt,Sr),At=At+Math.imul(Lr,Hr)|0,wt=wt+Math.imul(Lr,Fr)|0,wt=wt+Math.imul(or,Hr)|0,Ot=Ot+Math.imul(or,Fr)|0,At=At+Math.imul(Rr,Jr)|0,wt=wt+Math.imul(Rr,Qr)|0,wt=wt+Math.imul(Ar,Jr)|0,Ot=Ot+Math.imul(Ar,Qr)|0,At=At+Math.imul(Er,ln)|0,wt=wt+Math.imul(Er,qr)|0,wt=wt+Math.imul($r,ln)|0,Ot=Ot+Math.imul($r,qr)|0,At=At+Math.imul(Ir,un)|0,wt=wt+Math.imul(Ir,Vr)|0,wt=wt+Math.imul(lr,un)|0,Ot=Ot+Math.imul(lr,Vr)|0,At=At+Math.imul(xr,fn)|0,wt=wt+Math.imul(xr,Kr)|0,wt=wt+Math.imul(pr,fn)|0,Ot=Ot+Math.imul(pr,Kr)|0,At=At+Math.imul(qt,dn)|0,wt=wt+Math.imul(qt,Gr)|0,wt=wt+Math.imul(Qt,dn)|0,Ot=Ot+Math.imul(Qt,Gr)|0,At=At+Math.imul(Kt,an)|0,wt=wt+Math.imul(Kt,Zr)|0,wt=wt+Math.imul(Jt,an)|0,Ot=Ot+Math.imul(Jt,Zr)|0,At=At+Math.imul(nr,Sn)|0,wt=wt+Math.imul(nr,nn)|0,wt=wt+Math.imul(ir,Sn)|0,Ot=Ot+Math.imul(ir,nn)|0;var ms=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ms>>>26)|0,ms&=67108863,At=Math.imul(Gt,wr),wt=Math.imul(Gt,Sr),wt=wt+Math.imul(ar,wr)|0,Ot=Math.imul(ar,Sr),At=At+Math.imul(er,Hr)|0,wt=wt+Math.imul(er,Fr)|0,wt=wt+Math.imul(Zt,Hr)|0,Ot=Ot+Math.imul(Zt,Fr)|0,At=At+Math.imul(Lr,Jr)|0,wt=wt+Math.imul(Lr,Qr)|0,wt=wt+Math.imul(or,Jr)|0,Ot=Ot+Math.imul(or,Qr)|0,At=At+Math.imul(Rr,ln)|0,wt=wt+Math.imul(Rr,qr)|0,wt=wt+Math.imul(Ar,ln)|0,Ot=Ot+Math.imul(Ar,qr)|0,At=At+Math.imul(Er,un)|0,wt=wt+Math.imul(Er,Vr)|0,wt=wt+Math.imul($r,un)|0,Ot=Ot+Math.imul($r,Vr)|0,At=At+Math.imul(Ir,fn)|0,wt=wt+Math.imul(Ir,Kr)|0,wt=wt+Math.imul(lr,fn)|0,Ot=Ot+Math.imul(lr,Kr)|0,At=At+Math.imul(xr,dn)|0,wt=wt+Math.imul(xr,Gr)|0,wt=wt+Math.imul(pr,dn)|0,Ot=Ot+Math.imul(pr,Gr)|0,At=At+Math.imul(qt,an)|0,wt=wt+Math.imul(qt,Zr)|0,wt=wt+Math.imul(Qt,an)|0,Ot=Ot+Math.imul(Qt,Zr)|0,At=At+Math.imul(Kt,Sn)|0,wt=wt+Math.imul(Kt,nn)|0,wt=wt+Math.imul(Jt,Sn)|0,Ot=Ot+Math.imul(Jt,nn)|0,At=At+Math.imul(nr,yn)|0,wt=wt+Math.imul(nr,En)|0,wt=wt+Math.imul(ir,yn)|0,Ot=Ot+Math.imul(ir,En)|0;var Qn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,At=Math.imul(Gt,Hr),wt=Math.imul(Gt,Fr),wt=wt+Math.imul(ar,Hr)|0,Ot=Math.imul(ar,Fr),At=At+Math.imul(er,Jr)|0,wt=wt+Math.imul(er,Qr)|0,wt=wt+Math.imul(Zt,Jr)|0,Ot=Ot+Math.imul(Zt,Qr)|0,At=At+Math.imul(Lr,ln)|0,wt=wt+Math.imul(Lr,qr)|0,wt=wt+Math.imul(or,ln)|0,Ot=Ot+Math.imul(or,qr)|0,At=At+Math.imul(Rr,un)|0,wt=wt+Math.imul(Rr,Vr)|0,wt=wt+Math.imul(Ar,un)|0,Ot=Ot+Math.imul(Ar,Vr)|0,At=At+Math.imul(Er,fn)|0,wt=wt+Math.imul(Er,Kr)|0,wt=wt+Math.imul($r,fn)|0,Ot=Ot+Math.imul($r,Kr)|0,At=At+Math.imul(Ir,dn)|0,wt=wt+Math.imul(Ir,Gr)|0,wt=wt+Math.imul(lr,dn)|0,Ot=Ot+Math.imul(lr,Gr)|0,At=At+Math.imul(xr,an)|0,wt=wt+Math.imul(xr,Zr)|0,wt=wt+Math.imul(pr,an)|0,Ot=Ot+Math.imul(pr,Zr)|0,At=At+Math.imul(qt,Sn)|0,wt=wt+Math.imul(qt,nn)|0,wt=wt+Math.imul(Qt,Sn)|0,Ot=Ot+Math.imul(Qt,nn)|0,At=At+Math.imul(Kt,yn)|0,wt=wt+Math.imul(Kt,En)|0,wt=wt+Math.imul(Jt,yn)|0,Ot=Ot+Math.imul(Jt,En)|0;var es=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(es>>>26)|0,es&=67108863,At=Math.imul(Gt,Jr),wt=Math.imul(Gt,Qr),wt=wt+Math.imul(ar,Jr)|0,Ot=Math.imul(ar,Qr),At=At+Math.imul(er,ln)|0,wt=wt+Math.imul(er,qr)|0,wt=wt+Math.imul(Zt,ln)|0,Ot=Ot+Math.imul(Zt,qr)|0,At=At+Math.imul(Lr,un)|0,wt=wt+Math.imul(Lr,Vr)|0,wt=wt+Math.imul(or,un)|0,Ot=Ot+Math.imul(or,Vr)|0,At=At+Math.imul(Rr,fn)|0,wt=wt+Math.imul(Rr,Kr)|0,wt=wt+Math.imul(Ar,fn)|0,Ot=Ot+Math.imul(Ar,Kr)|0,At=At+Math.imul(Er,dn)|0,wt=wt+Math.imul(Er,Gr)|0,wt=wt+Math.imul($r,dn)|0,Ot=Ot+Math.imul($r,Gr)|0,At=At+Math.imul(Ir,an)|0,wt=wt+Math.imul(Ir,Zr)|0,wt=wt+Math.imul(lr,an)|0,Ot=Ot+Math.imul(lr,Zr)|0,At=At+Math.imul(xr,Sn)|0,wt=wt+Math.imul(xr,nn)|0,wt=wt+Math.imul(pr,Sn)|0,Ot=Ot+Math.imul(pr,nn)|0,At=At+Math.imul(qt,yn)|0,wt=wt+Math.imul(qt,En)|0,wt=wt+Math.imul(Qt,yn)|0,Ot=Ot+Math.imul(Qt,En)|0;var ls=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ls>>>26)|0,ls&=67108863,At=Math.imul(Gt,ln),wt=Math.imul(Gt,qr),wt=wt+Math.imul(ar,ln)|0,Ot=Math.imul(ar,qr),At=At+Math.imul(er,un)|0,wt=wt+Math.imul(er,Vr)|0,wt=wt+Math.imul(Zt,un)|0,Ot=Ot+Math.imul(Zt,Vr)|0,At=At+Math.imul(Lr,fn)|0,wt=wt+Math.imul(Lr,Kr)|0,wt=wt+Math.imul(or,fn)|0,Ot=Ot+Math.imul(or,Kr)|0,At=At+Math.imul(Rr,dn)|0,wt=wt+Math.imul(Rr,Gr)|0,wt=wt+Math.imul(Ar,dn)|0,Ot=Ot+Math.imul(Ar,Gr)|0,At=At+Math.imul(Er,an)|0,wt=wt+Math.imul(Er,Zr)|0,wt=wt+Math.imul($r,an)|0,Ot=Ot+Math.imul($r,Zr)|0,At=At+Math.imul(Ir,Sn)|0,wt=wt+Math.imul(Ir,nn)|0,wt=wt+Math.imul(lr,Sn)|0,Ot=Ot+Math.imul(lr,nn)|0,At=At+Math.imul(xr,yn)|0,wt=wt+Math.imul(xr,En)|0,wt=wt+Math.imul(pr,yn)|0,Ot=Ot+Math.imul(pr,En)|0;var us=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(us>>>26)|0,us&=67108863,At=Math.imul(Gt,un),wt=Math.imul(Gt,Vr),wt=wt+Math.imul(ar,un)|0,Ot=Math.imul(ar,Vr),At=At+Math.imul(er,fn)|0,wt=wt+Math.imul(er,Kr)|0,wt=wt+Math.imul(Zt,fn)|0,Ot=Ot+Math.imul(Zt,Kr)|0,At=At+Math.imul(Lr,dn)|0,wt=wt+Math.imul(Lr,Gr)|0,wt=wt+Math.imul(or,dn)|0,Ot=Ot+Math.imul(or,Gr)|0,At=At+Math.imul(Rr,an)|0,wt=wt+Math.imul(Rr,Zr)|0,wt=wt+Math.imul(Ar,an)|0,Ot=Ot+Math.imul(Ar,Zr)|0,At=At+Math.imul(Er,Sn)|0,wt=wt+Math.imul(Er,nn)|0,wt=wt+Math.imul($r,Sn)|0,Ot=Ot+Math.imul($r,nn)|0,At=At+Math.imul(Ir,yn)|0,wt=wt+Math.imul(Ir,En)|0,wt=wt+Math.imul(lr,yn)|0,Ot=Ot+Math.imul(lr,En)|0;var Wn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,At=Math.imul(Gt,fn),wt=Math.imul(Gt,Kr),wt=wt+Math.imul(ar,fn)|0,Ot=Math.imul(ar,Kr),At=At+Math.imul(er,dn)|0,wt=wt+Math.imul(er,Gr)|0,wt=wt+Math.imul(Zt,dn)|0,Ot=Ot+Math.imul(Zt,Gr)|0,At=At+Math.imul(Lr,an)|0,wt=wt+Math.imul(Lr,Zr)|0,wt=wt+Math.imul(or,an)|0,Ot=Ot+Math.imul(or,Zr)|0,At=At+Math.imul(Rr,Sn)|0,wt=wt+Math.imul(Rr,nn)|0,wt=wt+Math.imul(Ar,Sn)|0,Ot=Ot+Math.imul(Ar,nn)|0,At=At+Math.imul(Er,yn)|0,wt=wt+Math.imul(Er,En)|0,wt=wt+Math.imul($r,yn)|0,Ot=Ot+Math.imul($r,En)|0;var as=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(as>>>26)|0,as&=67108863,At=Math.imul(Gt,dn),wt=Math.imul(Gt,Gr),wt=wt+Math.imul(ar,dn)|0,Ot=Math.imul(ar,Gr),At=At+Math.imul(er,an)|0,wt=wt+Math.imul(er,Zr)|0,wt=wt+Math.imul(Zt,an)|0,Ot=Ot+Math.imul(Zt,Zr)|0,At=At+Math.imul(Lr,Sn)|0,wt=wt+Math.imul(Lr,nn)|0,wt=wt+Math.imul(or,Sn)|0,Ot=Ot+Math.imul(or,nn)|0,At=At+Math.imul(Rr,yn)|0,wt=wt+Math.imul(Rr,En)|0,wt=wt+Math.imul(Ar,yn)|0,Ot=Ot+Math.imul(Ar,En)|0;var gs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(gs>>>26)|0,gs&=67108863,At=Math.imul(Gt,an),wt=Math.imul(Gt,Zr),wt=wt+Math.imul(ar,an)|0,Ot=Math.imul(ar,Zr),At=At+Math.imul(er,Sn)|0,wt=wt+Math.imul(er,nn)|0,wt=wt+Math.imul(Zt,Sn)|0,Ot=Ot+Math.imul(Zt,nn)|0,At=At+Math.imul(Lr,yn)|0,wt=wt+Math.imul(Lr,En)|0,wt=wt+Math.imul(or,yn)|0,Ot=Ot+Math.imul(or,En)|0;var vs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(vs>>>26)|0,vs&=67108863,At=Math.imul(Gt,Sn),wt=Math.imul(Gt,nn),wt=wt+Math.imul(ar,Sn)|0,Ot=Math.imul(ar,nn),At=At+Math.imul(er,yn)|0,wt=wt+Math.imul(er,En)|0,wt=wt+Math.imul(Zt,yn)|0,Ot=Ot+Math.imul(Zt,En)|0;var Ps=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,At=Math.imul(Gt,yn),wt=Math.imul(Gt,En),wt=wt+Math.imul(ar,yn)|0,Ot=Math.imul(ar,En);var As=(xt+At|0)+((wt&8191)<<13)|0;return xt=(Ot+(wt>>>13)|0)+(As>>>26)|0,As&=67108863,$t[0]=ds,$t[1]=fs,$t[2]=hs,$t[3]=ps,$t[4]=Vn,$t[5]=ss,$t[6]=Jn,$t[7]=Yn,$t[8]=ms,$t[9]=Qn,$t[10]=es,$t[11]=ls,$t[12]=us,$t[13]=Wn,$t[14]=as,$t[15]=gs,$t[16]=vs,$t[17]=Ps,$t[18]=As,xt!==0&&($t[19]=xt,vt.length++),vt};Math.imul||(Tt=Pt);function It(mt,ct,dt){dt.negative=ct.negative^mt.negative,dt.length=mt.length+ct.length;for(var vt=0,St=0,Rt=0;Rt>>26)|0,St+=$t>>>26,$t&=67108863}dt.words[Rt]=xt,vt=$t,$t=St}return vt!==0?dt.words[Rt]=vt:dt.length--,dt._strip()}function Lt(mt,ct,dt){return It(mt,ct,dt)}tt.prototype.mulTo=function(ct,dt){var vt,St=this.length+ct.length;return this.length===10&&ct.length===10?vt=Tt(this,ct,dt):St<63?vt=Pt(this,ct,dt):St<1024?vt=It(this,ct,dt):vt=Lt(this,ct,dt),vt},tt.prototype.mul=function(ct){var dt=new tt(null);return dt.words=new Array(this.length+ct.length),this.mulTo(ct,dt)},tt.prototype.mulf=function(ct){var dt=new tt(null);return dt.words=new Array(this.length+ct.length),Lt(this,ct,dt)},tt.prototype.imul=function(ct){return this.clone().mulTo(ct,this)},tt.prototype.imuln=function(ct){var dt=ct<0;dt&&(ct=-ct),j(typeof ct=="number"),j(ct<67108864);for(var vt=0,St=0;St>=26,vt+=Rt/67108864|0,vt+=$t>>>26,this.words[St]=$t&67108863}return vt!==0&&(this.words[St]=vt,this.length++),dt?this.ineg():this},tt.prototype.muln=function(ct){return this.clone().imuln(ct)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(ct){var dt=Ct(ct);if(dt.length===0)return new tt(1);for(var vt=this,St=0;St=0);var dt=ct%26,vt=(ct-dt)/26,St=67108863>>>26-dt<<26-dt,Rt;if(dt!==0){var $t=0;for(Rt=0;Rt>>26-dt}$t&&(this.words[Rt]=$t,this.length++)}if(vt!==0){for(Rt=this.length-1;Rt>=0;Rt--)this.words[Rt+vt]=this.words[Rt];for(Rt=0;Rt=0);var St;dt?St=(dt-dt%26)/26:St=0;var Rt=ct%26,$t=Math.min((ct-Rt)/26,this.length),xt=67108863^67108863>>>Rt<$t)for(this.length-=$t,wt=0;wt=0&&(Ot!==0||wt>=St);wt--){var tr=this.words[wt]|0;this.words[wt]=Ot<<26-Rt|tr>>>Rt,Ot=tr&xt}return At&&Ot!==0&&(At.words[At.length++]=Ot),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,dt,vt){return j(this.negative===0),this.iushrn(ct,dt,vt)},tt.prototype.shln=function(ct){return this.clone().ishln(ct)},tt.prototype.ushln=function(ct){return this.clone().iushln(ct)},tt.prototype.shrn=function(ct){return this.clone().ishrn(ct)},tt.prototype.ushrn=function(ct){return this.clone().iushrn(ct)},tt.prototype.testn=function(ct){j(typeof ct=="number"&&ct>=0);var dt=ct%26,vt=(ct-dt)/26,St=1<=0);var dt=ct%26,vt=(ct-dt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=vt)return this;if(dt!==0&&vt++,this.length=Math.min(vt,this.length),dt!==0){var St=67108863^67108863>>>dt<=67108864;dt++)this.words[dt]-=67108864,dt===this.length-1?this.words[dt+1]=1:this.words[dt+1]++;return this.length=Math.max(this.length,dt+1),this},tt.prototype.isubn=function(ct){if(j(typeof ct=="number"),j(ct<67108864),ct<0)return this.iaddn(-ct);if(this.negative!==0)return this.negative=0,this.iaddn(ct),this.negative=1,this;if(this.words[0]-=ct,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var dt=0;dt>26)-(At/67108864|0),this.words[Rt+vt]=$t&67108863}for(;Rt>26,this.words[Rt+vt]=$t&67108863;if(xt===0)return this._strip();for(j(xt===-1),xt=0,Rt=0;Rt>26,this.words[Rt]=$t&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,dt){var vt=this.length-ct.length,St=this.clone(),Rt=ct,$t=Rt.words[Rt.length-1]|0,xt=this._countBits($t);vt=26-xt,vt!==0&&(Rt=Rt.ushln(vt),St.iushln(vt),$t=Rt.words[Rt.length-1]|0);var At=St.length-Rt.length,wt;if(dt!=="mod"){wt=new tt(null),wt.length=At+1,wt.words=new Array(wt.length);for(var Ot=0;Ot=0;nr--){var ir=(St.words[Rt.length+nr]|0)*67108864+(St.words[Rt.length+nr-1]|0);for(ir=Math.min(ir/$t|0,67108863),St._ishlnsubmul(Rt,ir,nr);St.negative!==0;)ir--,St.negative=0,St._ishlnsubmul(Rt,1,nr),St.isZero()||(St.negative^=1);wt&&(wt.words[nr]=ir)}return wt&&wt._strip(),St._strip(),dt!=="div"&&vt!==0&&St.iushrn(vt),{div:wt||null,mod:St}},tt.prototype.divmod=function(ct,dt,vt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var St,Rt,$t;return this.negative!==0&&ct.negative===0?($t=this.neg().divmod(ct,dt),dt!=="mod"&&(St=$t.div.neg()),dt!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.iadd(ct)),{div:St,mod:Rt}):this.negative===0&&ct.negative!==0?($t=this.divmod(ct.neg(),dt),dt!=="mod"&&(St=$t.div.neg()),{div:St,mod:$t.mod}):this.negative&ct.negative?($t=this.neg().divmod(ct.neg(),dt),dt!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.isub(ct)),{div:$t.div,mod:Rt}):ct.length>this.length||this.cmp(ct)<0?{div:new tt(0),mod:this}:ct.length===1?dt==="div"?{div:this.divn(ct.words[0]),mod:null}:dt==="mod"?{div:null,mod:new tt(this.modrn(ct.words[0]))}:{div:this.divn(ct.words[0]),mod:new tt(this.modrn(ct.words[0]))}:this._wordDiv(ct,dt)},tt.prototype.div=function(ct){return this.divmod(ct,"div",!1).div},tt.prototype.mod=function(ct){return this.divmod(ct,"mod",!1).mod},tt.prototype.umod=function(ct){return this.divmod(ct,"mod",!0).mod},tt.prototype.divRound=function(ct){var dt=this.divmod(ct);if(dt.mod.isZero())return dt.div;var vt=dt.div.negative!==0?dt.mod.isub(ct):dt.mod,St=ct.ushrn(1),Rt=ct.andln(1),$t=vt.cmp(St);return $t<0||Rt===1&&$t===0?dt.div:dt.div.negative!==0?dt.div.isubn(1):dt.div.iaddn(1)},tt.prototype.modrn=function(ct){var dt=ct<0;dt&&(ct=-ct),j(ct<=67108863);for(var vt=(1<<26)%ct,St=0,Rt=this.length-1;Rt>=0;Rt--)St=(vt*St+(this.words[Rt]|0))%ct;return dt?-St:St},tt.prototype.modn=function(ct){return this.modrn(ct)},tt.prototype.idivn=function(ct){var dt=ct<0;dt&&(ct=-ct),j(ct<=67108863);for(var vt=0,St=this.length-1;St>=0;St--){var Rt=(this.words[St]|0)+vt*67108864;this.words[St]=Rt/ct|0,vt=Rt%ct}return this._strip(),dt?this.ineg():this},tt.prototype.divn=function(ct){return this.clone().idivn(ct)},tt.prototype.egcd=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,vt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var St=new tt(1),Rt=new tt(0),$t=new tt(0),xt=new tt(1),At=0;dt.isEven()&&vt.isEven();)dt.iushrn(1),vt.iushrn(1),++At;for(var wt=vt.clone(),Ot=dt.clone();!dt.isZero();){for(var tr=0,nr=1;!(dt.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(dt.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(wt),Rt.isub(Ot)),St.iushrn(1),Rt.iushrn(1);for(var ir=0,Wt=1;!(vt.words[0]&Wt)&&ir<26;++ir,Wt<<=1);if(ir>0)for(vt.iushrn(ir);ir-- >0;)($t.isOdd()||xt.isOdd())&&($t.iadd(wt),xt.isub(Ot)),$t.iushrn(1),xt.iushrn(1);dt.cmp(vt)>=0?(dt.isub(vt),St.isub($t),Rt.isub(xt)):(vt.isub(dt),$t.isub(St),xt.isub(Rt))}return{a:$t,b:xt,gcd:vt.iushln(At)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,vt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var St=new tt(1),Rt=new tt(0),$t=vt.clone();dt.cmpn(1)>0&&vt.cmpn(1)>0;){for(var xt=0,At=1;!(dt.words[0]&At)&&xt<26;++xt,At<<=1);if(xt>0)for(dt.iushrn(xt);xt-- >0;)St.isOdd()&&St.iadd($t),St.iushrn(1);for(var wt=0,Ot=1;!(vt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(vt.iushrn(wt);wt-- >0;)Rt.isOdd()&&Rt.iadd($t),Rt.iushrn(1);dt.cmp(vt)>=0?(dt.isub(vt),St.isub(Rt)):(vt.isub(dt),Rt.isub(St))}var tr;return dt.cmpn(1)===0?tr=St:tr=Rt,tr.cmpn(0)<0&&tr.iadd(ct),tr},tt.prototype.gcd=function(ct){if(this.isZero())return ct.abs();if(ct.isZero())return this.abs();var dt=this.clone(),vt=ct.clone();dt.negative=0,vt.negative=0;for(var St=0;dt.isEven()&&vt.isEven();St++)dt.iushrn(1),vt.iushrn(1);do{for(;dt.isEven();)dt.iushrn(1);for(;vt.isEven();)vt.iushrn(1);var Rt=dt.cmp(vt);if(Rt<0){var $t=dt;dt=vt,vt=$t}else if(Rt===0||vt.cmpn(1)===0)break;dt.isub(vt)}while(!0);return vt.iushln(St)},tt.prototype.invm=function(ct){return this.egcd(ct).a.umod(ct)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(ct){return this.words[0]&ct},tt.prototype.bincn=function(ct){j(typeof ct=="number");var dt=ct%26,vt=(ct-dt)/26,St=1<>>26,xt&=67108863,this.words[$t]=xt}return Rt!==0&&(this.words[$t]=Rt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(ct){var dt=ct<0;if(this.negative!==0&&!dt)return-1;if(this.negative===0&&dt)return 1;this._strip();var vt;if(this.length>1)vt=1;else{dt&&(ct=-ct),j(ct<=67108863,"Number is too big");var St=this.words[0]|0;vt=St===ct?0:Stct.length)return 1;if(this.length=0;vt--){var St=this.words[vt]|0,Rt=ct.words[vt]|0;if(St!==Rt){StRt&&(dt=1);break}}return dt},tt.prototype.gtn=function(ct){return this.cmpn(ct)===1},tt.prototype.gt=function(ct){return this.cmp(ct)===1},tt.prototype.gten=function(ct){return this.cmpn(ct)>=0},tt.prototype.gte=function(ct){return this.cmp(ct)>=0},tt.prototype.ltn=function(ct){return this.cmpn(ct)===-1},tt.prototype.lt=function(ct){return this.cmp(ct)===-1},tt.prototype.lten=function(ct){return this.cmpn(ct)<=0},tt.prototype.lte=function(ct){return this.cmp(ct)<=0},tt.prototype.eqn=function(ct){return this.cmpn(ct)===0},tt.prototype.eq=function(ct){return this.cmp(ct)===0},tt.red=function(ct){return new Bt(ct)},tt.prototype.toRed=function(ct){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),ct.convertTo(this)._forceRed(ct)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(ct){return this.red=ct,this},tt.prototype.forceRed=function(ct){return j(!this.red,"Already a number in reduction context"),this._forceRed(ct)},tt.prototype.redAdd=function(ct){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,ct)},tt.prototype.redIAdd=function(ct){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,ct)},tt.prototype.redSub=function(ct){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,ct)},tt.prototype.redISub=function(ct){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,ct)},tt.prototype.redShl=function(ct){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,ct)},tt.prototype.redMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.mul(this,ct)},tt.prototype.redIMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.imul(this,ct)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(ct){return j(this.red&&!ct.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,ct)};var Nt={k256:null,p224:null,p192:null,p25519:null};function Ut(mt,ct){this.name=mt,this.p=new tt(ct,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Ut.prototype._tmp=function(){var ct=new tt(null);return ct.words=new Array(Math.ceil(this.n/13)),ct},Ut.prototype.ireduce=function(ct){var dt=ct,vt;do this.split(dt,this.tmp),dt=this.imulK(dt),dt=dt.iadd(this.tmp),vt=dt.bitLength();while(vt>this.n);var St=vt0?dt.isub(this.p):dt.strip!==void 0?dt.strip():dt._strip(),dt},Ut.prototype.split=function(ct,dt){ct.iushrn(this.n,0,dt)},Ut.prototype.imulK=function(ct){return ct.imul(this.k)};function jt(){Ut.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(jt,Ut),jt.prototype.split=function(ct,dt){for(var vt=4194303,St=Math.min(ct.length,9),Rt=0;Rt>>22,$t=xt}$t>>>=22,ct.words[Rt-10]=$t,$t===0&&ct.length>10?ct.length-=10:ct.length-=9},jt.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var dt=0,vt=0;vt>>=26,ct.words[vt]=Rt,dt=St}return dt!==0&&(ct.words[ct.length++]=dt),ct},tt._prime=function(ct){if(Nt[ct])return Nt[ct];var dt;if(ct==="k256")dt=new jt;else if(ct==="p224")dt=new Mt;else if(ct==="p192")dt=new Dt;else if(ct==="p25519")dt=new Ft;else throw new Error("Unknown prime "+ct);return Nt[ct]=dt,dt};function Bt(mt){if(typeof mt=="string"){var ct=tt._prime(mt);this.m=ct.p,this.prime=ct}else j(mt.gtn(1),"modulus must be greater than 1"),this.m=mt,this.prime=null}Bt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},Bt.prototype._verify2=function(ct,dt){j((ct.negative|dt.negative)===0,"red works only with positives"),j(ct.red&&ct.red===dt.red,"red works only with red numbers")},Bt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(st(ct,ct.umod(this.m)._forceRed(this)),ct)},Bt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},Bt.prototype.add=function(ct,dt){this._verify2(ct,dt);var vt=ct.add(dt);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt._forceRed(this)},Bt.prototype.iadd=function(ct,dt){this._verify2(ct,dt);var vt=ct.iadd(dt);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt},Bt.prototype.sub=function(ct,dt){this._verify2(ct,dt);var vt=ct.sub(dt);return vt.cmpn(0)<0&&vt.iadd(this.m),vt._forceRed(this)},Bt.prototype.isub=function(ct,dt){this._verify2(ct,dt);var vt=ct.isub(dt);return vt.cmpn(0)<0&&vt.iadd(this.m),vt},Bt.prototype.shl=function(ct,dt){return this._verify1(ct),this.imod(ct.ushln(dt))},Bt.prototype.imul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.imul(dt))},Bt.prototype.mul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.mul(dt))},Bt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},Bt.prototype.sqr=function(ct){return this.mul(ct,ct)},Bt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var dt=this.m.andln(3);if(j(dt%2===1),dt===3){var vt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,vt)}for(var St=this.m.subn(1),Rt=0;!St.isZero()&&St.andln(1)===0;)Rt++,St.iushrn(1);j(!St.isZero());var $t=new tt(1).toRed(this),xt=$t.redNeg(),At=this.m.subn(1).iushrn(1),wt=this.m.bitLength();for(wt=new tt(2*wt*wt).toRed(this);this.pow(wt,At).cmp(xt)!==0;)wt.redIAdd(xt);for(var Ot=this.pow(wt,St),tr=this.pow(ct,St.addn(1).iushrn(1)),nr=this.pow(ct,St),ir=Rt;nr.cmp($t)!==0;){for(var Wt=nr,Kt=0;Wt.cmp($t)!==0;Kt++)Wt=Wt.redSqr();j(Kt=0;Rt--){for(var Ot=dt.words[Rt],tr=wt-1;tr>=0;tr--){var nr=Ot>>tr&1;if($t!==St[0]&&($t=this.sqr($t)),nr===0&&xt===0){At=0;continue}xt<<=1,xt|=nr,At++,!(At!==vt&&(Rt!==0||tr!==0))&&($t=this.mul($t,St[xt]),At=0,xt=0)}wt=26}return $t},Bt.prototype.convertTo=function(ct){var dt=ct.umod(this.m);return dt===ct?dt.clone():dt},Bt.prototype.convertFrom=function(ct){var dt=ct.clone();return dt.red=null,dt},tt.mont=function(ct){return new yt(ct)};function yt(mt){Bt.call(this,mt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(yt,Bt),yt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},yt.prototype.convertFrom=function(ct){var dt=this.imod(ct.mul(this.rinv));return dt.red=null,dt},yt.prototype.imul=function(ct,dt){if(ct.isZero()||dt.isZero())return ct.words[0]=0,ct.length=1,ct;var vt=ct.imul(dt),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.mul=function(ct,dt){if(ct.isZero()||dt.isZero())return new tt(0)._forceRed(this);var vt=ct.mul(dt),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.invm=function(ct){var dt=this.imod(ct._invmp(this.m).mul(this.r2));return dt._forceRed(this)}})(_,commonjsGlobal)}(bn$1)),bn$1.exports}var asn1$1={},asn1={},api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(_,a){if(_.indexOf)return _.indexOf(a);for(var $=0;$<_.length;$++)if(_[$]===a)return $;return-1},Object_keys=function(_){if(Object.keys)return Object.keys(_);var a=[];for(var $ in _)a.push($);return a},forEach=function(_,a){if(_.forEach)return _.forEach(a);for(var $=0;$<_.length;$++)a(_[$],$,_)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(_,a,$){Object.defineProperty(_,a,{writable:!0,enumerable:!1,configurable:!0,value:$})}}catch{return function(a,$,j){a[$]=j}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(a){if(!(this instanceof Script))return new Script(a);this.code=a};Script.prototype.runInContext=function(_){if(!(_ instanceof Context))throw new TypeError("needs a 'context' argument.");var a=document.createElement("iframe");a.style||(a.style={}),a.style.display="none",document.body.appendChild(a);var $=a.contentWindow,j=$.eval,et=$.execScript;!j&&et&&(et.call($,"null"),j=$.eval),forEach(Object_keys(_),function(nt){$[nt]=_[nt]}),forEach(globals,function(nt){_[nt]&&($[nt]=_[nt])});var tt=Object_keys($),rt=j.call($,this.code);return forEach(Object_keys($),function(nt){(nt in _||indexOf(tt,nt)===-1)&&(_[nt]=$[nt])}),forEach(globals,function(nt){nt in _||defineProp(_,nt,$[nt])}),document.body.removeChild(a),rt},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(_){var a=Script.createContext(_),$=this.runInContext(a);return _&&forEach(Object_keys(a),function(j){_[j]=a[j]}),$},forEach(Object_keys(Script.prototype),function(_){exports[_]=Script[_]=function(a){var $=Script(a);return $[_].apply($,[].slice.call(arguments,1))}}),exports.isContext=function(_){return _ instanceof Context},exports.createScript=function(_){return exports.Script(_)},exports.createContext=Script.createContext=function(_){var a=new Context;return typeof _=="object"&&forEach(Object_keys(_),function($){a[$]=_[$]}),a}}(vmBrowserify)),vmBrowserify}var hasRequiredApi;function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(_){var a=requireAsn1$1(),$=inherits_browserExports,j=_;j.define=function(rt,nt){return new et(rt,nt)};function et(tt,rt){this.name=tt,this.body=rt,this.decoders={},this.encoders={}}et.prototype._createNamed=function(rt){var nt;try{nt=requireVmBrowserify().runInThisContext("(function "+this.name+`(entity) { + `)+" "+nr[1]:nr[0]+tr+" "+Ot.join(", ")+" "+nr[1]}_.types=types$1;function Pt(Ot){return Array.isArray(Ot)}_.isArray=Pt;function Tt(Ot){return typeof Ot=="boolean"}_.isBoolean=Tt;function kt(Ot){return Ot===null}_.isNull=kt;function Lt(Ot){return Ot==null}_.isNullOrUndefined=Lt;function Nt(Ot){return typeof Ot=="number"}_.isNumber=Nt;function zt(Ot){return typeof Ot=="string"}_.isString=zt;function jt(Ot){return typeof Ot=="symbol"}_.isSymbol=jt;function Mt(Ot){return Ot===void 0}_.isUndefined=Mt;function Dt(Ot){return Ft(Ot)&&ht(Ot)==="[object RegExp]"}_.isRegExp=Dt,_.types.isRegExp=Dt;function Ft(Ot){return typeof Ot=="object"&&Ot!==null}_.isObject=Ft;function Bt(Ot){return Ft(Ot)&&ht(Ot)==="[object Date]"}_.isDate=Bt,_.types.isDate=Bt;function yt(Ot){return Ft(Ot)&&(ht(Ot)==="[object Error]"||Ot instanceof Error)}_.isError=yt,_.types.isNativeError=yt;function bt(Ot){return typeof Ot=="function"}_.isFunction=bt;function ct(Ot){return Ot===null||typeof Ot=="boolean"||typeof Ot=="number"||typeof Ot=="string"||typeof Ot=="symbol"||typeof Ot>"u"}_.isPrimitive=ct,_.isBuffer=isBufferBrowser;function ht(Ot){return Object.prototype.toString.call(Ot)}function vt(Ot){return Ot<10?"0"+Ot.toString(10):Ot.toString(10)}var St=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Rt(){var Ot=new Date,tr=[vt(Ot.getHours()),vt(Ot.getMinutes()),vt(Ot.getSeconds())].join(":");return[Ot.getDate(),St[Ot.getMonth()],tr].join(" ")}_.log=function(){console.log("%s - %s",Rt(),_.format.apply(_,arguments))},_.inherits=inherits_browserExports,_._extend=function(Ot,tr){if(!tr||!Ft(tr))return Ot;for(var nr=Object.keys(tr),ir=nr.length;ir--;)Ot[nr[ir]]=tr[nr[ir]];return Ot};function $t(Ot,tr){return Object.prototype.hasOwnProperty.call(Ot,tr)}var Et=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;_.promisify=function(tr){if(typeof tr!="function")throw new TypeError('The "original" argument must be of type Function');if(Et&&tr[Et]){var nr=tr[Et];if(typeof nr!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(nr,Et,{value:nr,enumerable:!1,writable:!1,configurable:!0}),nr}function nr(){for(var ir,Wt,Kt=new Promise(function(Vt,Qt){ir=Vt,Wt=Qt}),Jt=[],Ht=0;Ht0?this.tail.next=Pt:this.head=Pt,this.tail=Pt,++this.length}},{key:"unshift",value:function(Ct){var Pt={data:Ct,next:this.head};this.length===0&&(this.tail=Pt),this.head=Pt,++this.length}},{key:"shift",value:function(){if(this.length!==0){var Ct=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Ct}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(Ct){if(this.length===0)return"";for(var Pt=this.head,Tt=""+Pt.data;Pt=Pt.next;)Tt+=Ct+Pt.data;return Tt}},{key:"concat",value:function(Ct){if(this.length===0)return at.alloc(0);for(var Pt=at.allocUnsafe(Ct>>>0),Tt=this.head,kt=0;Tt;)dt(Tt.data,Pt,kt),kt+=Tt.data.length,Tt=Tt.next;return Pt}},{key:"consume",value:function(Ct,Pt){var Tt;return CtLt.length?Lt.length:Ct;if(Nt===Lt.length?kt+=Lt:kt+=Lt.slice(0,Ct),Ct-=Nt,Ct===0){Nt===Lt.length?(++Tt,Pt.next?this.head=Pt.next:this.head=this.tail=null):(this.head=Pt,Pt.data=Lt.slice(Nt));break}++Tt}return this.length-=Tt,kt}},{key:"_getBuffer",value:function(Ct){var Pt=at.allocUnsafe(Ct),Tt=this.head,kt=1;for(Tt.data.copy(Pt),Ct-=Tt.data.length;Tt=Tt.next;){var Lt=Tt.data,Nt=Ct>Lt.length?Lt.length:Ct;if(Lt.copy(Pt,Pt.length-Ct,0,Nt),Ct-=Nt,Ct===0){Nt===Lt.length?(++kt,Tt.next?this.head=Tt.next:this.head=this.tail=null):(this.head=Tt,Tt.data=Lt.slice(Nt));break}++kt}return this.length-=kt,Pt}},{key:ut,value:function(Ct,Pt){return ot(this,a(a({},Pt),{},{depth:0,customInspect:!1}))}}]),mt}(),buffer_list}function destroy(_,a){var $=this,j=this._readableState&&this._readableState.destroyed,et=this._writableState&&this._writableState.destroyed;return j||et?(a?a(_):_&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(emitErrorNT,this,_)):process$1$1.nextTick(emitErrorNT,this,_)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(_||null,function(tt){!a&&tt?$._writableState?$._writableState.errorEmitted?process$1$1.nextTick(emitCloseNT,$):($._writableState.errorEmitted=!0,process$1$1.nextTick(emitErrorAndCloseNT,$,tt)):process$1$1.nextTick(emitErrorAndCloseNT,$,tt):a?(process$1$1.nextTick(emitCloseNT,$),a(tt)):process$1$1.nextTick(emitCloseNT,$)}),this)}function emitErrorAndCloseNT(_,a){emitErrorNT(_,a),emitCloseNT(_)}function emitCloseNT(_){_._writableState&&!_._writableState.emitClose||_._readableState&&!_._readableState.emitClose||_.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(_,a){_.emit("error",a)}function errorOrDestroy(_,a){var $=_._readableState,j=_._writableState;$&&$.autoDestroy||j&&j.autoDestroy?_.destroy(a):_.emit("error",a)}var destroy_1$1={destroy,undestroy,errorOrDestroy},errorsBrowser={};function _inheritsLoose(_,a){_.prototype=Object.create(a.prototype),_.prototype.constructor=_,_.__proto__=a}var codes={};function createErrorType(_,a,$){$||($=Error);function j(tt,rt,nt){return typeof a=="string"?a:a(tt,rt,nt)}var et=function(tt){_inheritsLoose(rt,tt);function rt(nt,it,at){return tt.call(this,j(nt,it,at))||this}return rt}($);et.prototype.name=$.name,et.prototype.code=_,codes[_]=et}function oneOf(_,a){if(Array.isArray(_)){var $=_.length;return _=_.map(function(j){return String(j)}),$>2?"one of ".concat(a," ").concat(_.slice(0,$-1).join(", "),", or ")+_[$-1]:$===2?"one of ".concat(a," ").concat(_[0]," or ").concat(_[1]):"of ".concat(a," ").concat(_[0])}else return"of ".concat(a," ").concat(String(_))}function startsWith(_,a,$){return _.substr(0,a.length)===a}function endsWith$2(_,a,$){return($===void 0||$>_.length)&&($=_.length),_.substring($-a.length,$)===a}function includes(_,a,$){return typeof $!="number"&&($=0),$+a.length>_.length?!1:_.indexOf(a,$)!==-1}createErrorType("ERR_INVALID_OPT_VALUE",function(_,a){return'The value "'+a+'" is invalid for option "'+_+'"'},TypeError);createErrorType("ERR_INVALID_ARG_TYPE",function(_,a,$){var j;typeof a=="string"&&startsWith(a,"not ")?(j="must not be",a=a.replace(/^not /,"")):j="must be";var et;if(endsWith$2(_," argument"))et="The ".concat(_," ").concat(j," ").concat(oneOf(a,"type"));else{var tt=includes(_,".")?"property":"argument";et='The "'.concat(_,'" ').concat(tt," ").concat(j," ").concat(oneOf(a,"type"))}return et+=". Received type ".concat(typeof $),et},TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(_){return"The "+_+" method is not implemented"});createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",function(_){return"Cannot call "+_+" after a stream was destroyed"});createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",function(_){return"Unknown encoding: "+_},TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");errorsBrowser.codes=codes;var ERR_INVALID_OPT_VALUE=errorsBrowser.codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(_,a,$){return _.highWaterMark!=null?_.highWaterMark:a?_[$]:null}function getHighWaterMark(_,a,$,j){var et=highWaterMarkFrom(a,j,$);if(et!=null){if(!(isFinite(et)&&Math.floor(et)===et)||et<0){var tt=j?$:"highWaterMark";throw new ERR_INVALID_OPT_VALUE(tt,et)}return Math.floor(et)}return _.objectMode?16:16*1024}var state={getHighWaterMark},browser$c=deprecate;function deprecate(_,a){if(config$3("noDeprecation"))return _;var $=!1;function j(){if(!$){if(config$3("throwDeprecation"))throw new Error(a);config$3("traceDeprecation")?console.trace(a):console.warn(a),$=!0}return _.apply(this,arguments)}return j}function config$3(_){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var a=commonjsGlobal.localStorage[_];return a==null?!1:String(a).toLowerCase()==="true"}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=Mt;function _(ir){var Wt=this;this.next=null,this.entry=null,this.finish=function(){nr(Wt,ir)}}var a;Mt.WritableState=zt;var $={deprecate:browser$c},j=streamBrowser$1,et=buffer$1.Buffer,tt=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function rt(ir){return et.from(ir)}function nt(ir){return et.isBuffer(ir)||ir instanceof tt}var it=destroy_1$1,at=state,st=at.getHighWaterMark,ot=errorsBrowser.codes,ut=ot.ERR_INVALID_ARG_TYPE,dt=ot.ERR_METHOD_NOT_IMPLEMENTED,mt=ot.ERR_MULTIPLE_CALLBACK,xt=ot.ERR_STREAM_CANNOT_PIPE,Ct=ot.ERR_STREAM_DESTROYED,Pt=ot.ERR_STREAM_NULL_VALUES,Tt=ot.ERR_STREAM_WRITE_AFTER_END,kt=ot.ERR_UNKNOWN_ENCODING,Lt=it.errorOrDestroy;inherits_browserExports(Mt,j);function Nt(){}function zt(ir,Wt,Kt){a=a||require_stream_duplex$1(),ir=ir||{},typeof Kt!="boolean"&&(Kt=Wt instanceof a),this.objectMode=!!ir.objectMode,Kt&&(this.objectMode=this.objectMode||!!ir.writableObjectMode),this.highWaterMark=st(this,ir,"writableHighWaterMark",Kt),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Jt=ir.decodeStrings===!1;this.decodeStrings=!Jt,this.defaultEncoding=ir.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ht){vt(Wt,Ht)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=ir.emitClose!==!1,this.autoDestroy=!!ir.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new _(this)}zt.prototype.getBuffer=function(){for(var Wt=this.bufferedRequest,Kt=[];Wt;)Kt.push(Wt),Wt=Wt.next;return Kt},function(){try{Object.defineProperty(zt.prototype,"buffer",{get:$.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var jt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(jt=Function.prototype[Symbol.hasInstance],Object.defineProperty(Mt,Symbol.hasInstance,{value:function(Wt){return jt.call(this,Wt)?!0:this!==Mt?!1:Wt&&Wt._writableState instanceof zt}})):jt=function(Wt){return Wt instanceof this};function Mt(ir){a=a||require_stream_duplex$1();var Wt=this instanceof a;if(!Wt&&!jt.call(Mt,this))return new Mt(ir);this._writableState=new zt(ir,this,Wt),this.writable=!0,ir&&(typeof ir.write=="function"&&(this._write=ir.write),typeof ir.writev=="function"&&(this._writev=ir.writev),typeof ir.destroy=="function"&&(this._destroy=ir.destroy),typeof ir.final=="function"&&(this._final=ir.final)),j.call(this)}Mt.prototype.pipe=function(){Lt(this,new xt)};function Dt(ir,Wt){var Kt=new Tt;Lt(ir,Kt),process$1$1.nextTick(Wt,Kt)}function Ft(ir,Wt,Kt,Jt){var Ht;return Kt===null?Ht=new Pt:typeof Kt!="string"&&!Wt.objectMode&&(Ht=new ut("chunk",["string","Buffer"],Kt)),Ht?(Lt(ir,Ht),process$1$1.nextTick(Jt,Ht),!1):!0}Mt.prototype.write=function(ir,Wt,Kt){var Jt=this._writableState,Ht=!1,Vt=!Jt.objectMode&&nt(ir);return Vt&&!et.isBuffer(ir)&&(ir=rt(ir)),typeof Wt=="function"&&(Kt=Wt,Wt=null),Vt?Wt="buffer":Wt||(Wt=Jt.defaultEncoding),typeof Kt!="function"&&(Kt=Nt),Jt.ending?Dt(this,Kt):(Vt||Ft(this,Jt,ir,Kt))&&(Jt.pendingcb++,Ht=yt(this,Jt,Vt,ir,Wt,Kt)),Ht},Mt.prototype.cork=function(){this._writableState.corked++},Mt.prototype.uncork=function(){var ir=this._writableState;ir.corked&&(ir.corked--,!ir.writing&&!ir.corked&&!ir.bufferProcessing&&ir.bufferedRequest&&$t(this,ir))},Mt.prototype.setDefaultEncoding=function(Wt){if(typeof Wt=="string"&&(Wt=Wt.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Wt+"").toLowerCase())>-1))throw new kt(Wt);return this._writableState.defaultEncoding=Wt,this},Object.defineProperty(Mt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Bt(ir,Wt,Kt){return!ir.objectMode&&ir.decodeStrings!==!1&&typeof Wt=="string"&&(Wt=et.from(Wt,Kt)),Wt}Object.defineProperty(Mt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function yt(ir,Wt,Kt,Jt,Ht,Vt){if(!Kt){var Qt=Bt(Wt,Jt,Ht);Jt!==Qt&&(Kt=!0,Ht="buffer",Jt=Qt)}var dr=Wt.objectMode?1:Jt.length;Wt.length+=dr;var xr=Wt.length>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function utf8CheckIncomplete(_,a,$){var j=a.length-1;if(j<$)return 0;var et=utf8CheckByte(a[j]);return et>=0?(et>0&&(_.lastNeed=et-1),et):--j<$||et===-2?0:(et=utf8CheckByte(a[j]),et>=0?(et>0&&(_.lastNeed=et-2),et):--j<$||et===-2?0:(et=utf8CheckByte(a[j]),et>=0?(et>0&&(et===2?et=0:_.lastNeed=et-3),et):0))}function utf8CheckExtraBytes(_,a,$){if((a[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&a.length>1){if((a[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&a.length>2&&(a[2]&192)!==128)return _.lastNeed=2,"�"}}function utf8FillLast(_){var a=this.lastTotal-this.lastNeed,$=utf8CheckExtraBytes(this,_);if($!==void 0)return $;if(this.lastNeed<=_.length)return _.copy(this.lastChar,a,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,a,0,_.length),this.lastNeed-=_.length}function utf8Text(_,a){var $=utf8CheckIncomplete(this,_,a);if(!this.lastNeed)return _.toString("utf8",a);this.lastTotal=$;var j=_.length-($-this.lastNeed);return _.copy(this.lastChar,0,j),_.toString("utf8",a,j)}function utf8End(_){var a=_&&_.length?this.write(_):"";return this.lastNeed?a+"�":a}function utf16Text(_,a){if((_.length-a)%2===0){var $=_.toString("utf16le",a);if($){var j=$.charCodeAt($.length-1);if(j>=55296&&j<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],$.slice(0,-1)}return $}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",a,_.length-1)}function utf16End(_){var a=_&&_.length?this.write(_):"";if(this.lastNeed){var $=this.lastTotal-this.lastNeed;return a+this.lastChar.toString("utf16le",0,$)}return a}function base64Text(_,a){var $=(_.length-a)%3;return $===0?_.toString("base64",a):(this.lastNeed=3-$,this.lastTotal=3,$===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",a,_.length-$))}function base64End(_){var a=_&&_.length?this.write(_):"";return this.lastNeed?a+this.lastChar.toString("base64",0,3-this.lastNeed):a}function simpleWrite(_){return _.toString(this.encoding)}function simpleEnd(_){return _&&_.length?this.write(_):""}var ERR_STREAM_PREMATURE_CLOSE=errorsBrowser.codes.ERR_STREAM_PREMATURE_CLOSE;function once$1(_){var a=!1;return function(){if(!a){a=!0;for(var $=arguments.length,j=new Array($),et=0;et<$;et++)j[et]=arguments[et];_.apply(this,j)}}}function noop$9(){}function isRequest$2(_){return _.setHeader&&typeof _.abort=="function"}function eos$1(_,a,$){if(typeof a=="function")return eos$1(_,null,a);a||(a={}),$=once$1($||noop$9);var j=a.readable||a.readable!==!1&&_.readable,et=a.writable||a.writable!==!1&&_.writable,tt=function(){_.writable||nt()},rt=_._writableState&&_._writableState.finished,nt=function(){et=!1,rt=!0,j||$.call(_)},it=_._readableState&&_._readableState.endEmitted,at=function(){j=!1,it=!0,et||$.call(_)},st=function(mt){$.call(_,mt)},ot=function(){var mt;if(j&&!it)return(!_._readableState||!_._readableState.ended)&&(mt=new ERR_STREAM_PREMATURE_CLOSE),$.call(_,mt);if(et&&!rt)return(!_._writableState||!_._writableState.ended)&&(mt=new ERR_STREAM_PREMATURE_CLOSE),$.call(_,mt)},ut=function(){_.req.on("finish",nt)};return isRequest$2(_)?(_.on("complete",nt),_.on("abort",ot),_.req?ut():_.on("request",ut)):et&&!_._writableState&&(_.on("end",tt),_.on("close",tt)),_.on("end",at),_.on("finish",nt),a.error!==!1&&_.on("error",st),_.on("close",ot),function(){_.removeListener("complete",nt),_.removeListener("abort",ot),_.removeListener("request",ut),_.req&&_.req.removeListener("finish",nt),_.removeListener("end",tt),_.removeListener("close",tt),_.removeListener("finish",nt),_.removeListener("end",at),_.removeListener("error",st),_.removeListener("close",ot)}}var endOfStream=eos$1,async_iterator,hasRequiredAsync_iterator;function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;hasRequiredAsync_iterator=1;var _;function a(kt,Lt,Nt){return Lt=$(Lt),Lt in kt?Object.defineProperty(kt,Lt,{value:Nt,enumerable:!0,configurable:!0,writable:!0}):kt[Lt]=Nt,kt}function $(kt){var Lt=j(kt,"string");return typeof Lt=="symbol"?Lt:String(Lt)}function j(kt,Lt){if(typeof kt!="object"||kt===null)return kt;var Nt=kt[Symbol.toPrimitive];if(Nt!==void 0){var zt=Nt.call(kt,Lt||"default");if(typeof zt!="object")return zt;throw new TypeError("@@toPrimitive must return a primitive value.")}return(Lt==="string"?String:Number)(kt)}var et=endOfStream,tt=Symbol("lastResolve"),rt=Symbol("lastReject"),nt=Symbol("error"),it=Symbol("ended"),at=Symbol("lastPromise"),st=Symbol("handlePromise"),ot=Symbol("stream");function ut(kt,Lt){return{value:kt,done:Lt}}function dt(kt){var Lt=kt[tt];if(Lt!==null){var Nt=kt[ot].read();Nt!==null&&(kt[at]=null,kt[tt]=null,kt[rt]=null,Lt(ut(Nt,!1)))}}function mt(kt){process$1$1.nextTick(dt,kt)}function xt(kt,Lt){return function(Nt,zt){kt.then(function(){if(Lt[it]){Nt(ut(void 0,!0));return}Lt[st](Nt,zt)},zt)}}var Ct=Object.getPrototypeOf(function(){}),Pt=Object.setPrototypeOf((_={get stream(){return this[ot]},next:function(){var Lt=this,Nt=this[nt];if(Nt!==null)return Promise.reject(Nt);if(this[it])return Promise.resolve(ut(void 0,!0));if(this[ot].destroyed)return new Promise(function(Dt,Ft){process$1$1.nextTick(function(){Lt[nt]?Ft(Lt[nt]):Dt(ut(void 0,!0))})});var zt=this[at],jt;if(zt)jt=new Promise(xt(zt,this));else{var Mt=this[ot].read();if(Mt!==null)return Promise.resolve(ut(Mt,!1));jt=new Promise(this[st])}return this[at]=jt,jt}},a(_,Symbol.asyncIterator,function(){return this}),a(_,"return",function(){var Lt=this;return new Promise(function(Nt,zt){Lt[ot].destroy(null,function(jt){if(jt){zt(jt);return}Nt(ut(void 0,!0))})})}),_),Ct),Tt=function(Lt){var Nt,zt=Object.create(Pt,(Nt={},a(Nt,ot,{value:Lt,writable:!0}),a(Nt,tt,{value:null,writable:!0}),a(Nt,rt,{value:null,writable:!0}),a(Nt,nt,{value:null,writable:!0}),a(Nt,it,{value:Lt._readableState.endEmitted,writable:!0}),a(Nt,st,{value:function(Mt,Dt){var Ft=zt[ot].read();Ft?(zt[at]=null,zt[tt]=null,zt[rt]=null,Mt(ut(Ft,!1))):(zt[tt]=Mt,zt[rt]=Dt)},writable:!0}),Nt));return zt[at]=null,et(Lt,function(jt){if(jt&&jt.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Mt=zt[rt];Mt!==null&&(zt[at]=null,zt[tt]=null,zt[rt]=null,Mt(jt)),zt[nt]=jt;return}var Dt=zt[tt];Dt!==null&&(zt[at]=null,zt[tt]=null,zt[rt]=null,Dt(ut(void 0,!0))),zt[it]=!0}),Lt.on("readable",mt.bind(null,zt)),zt};return async_iterator=Tt,async_iterator}var fromBrowser,hasRequiredFromBrowser;function requireFromBrowser(){return hasRequiredFromBrowser||(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")}),fromBrowser}var _stream_readable$1,hasRequired_stream_readable$1;function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;hasRequired_stream_readable$1=1,_stream_readable$1=Dt;var _;Dt.ReadableState=Mt,eventsExports.EventEmitter;var a=function(Qt,dr){return Qt.listeners(dr).length},$=streamBrowser$1,j=buffer$1.Buffer,et=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function tt(Vt){return j.from(Vt)}function rt(Vt){return j.isBuffer(Vt)||Vt instanceof et}var nt=util$5,it;nt&&nt.debuglog?it=nt.debuglog("stream"):it=function(){};var at=requireBuffer_list(),st=destroy_1$1,ot=state,ut=ot.getHighWaterMark,dt=errorsBrowser.codes,mt=dt.ERR_INVALID_ARG_TYPE,xt=dt.ERR_STREAM_PUSH_AFTER_EOF,Ct=dt.ERR_METHOD_NOT_IMPLEMENTED,Pt=dt.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Tt,kt,Lt;inherits_browserExports(Dt,$);var Nt=st.errorOrDestroy,zt=["error","close","destroy","pause","resume"];function jt(Vt,Qt,dr){if(typeof Vt.prependListener=="function")return Vt.prependListener(Qt,dr);!Vt._events||!Vt._events[Qt]?Vt.on(Qt,dr):Array.isArray(Vt._events[Qt])?Vt._events[Qt].unshift(dr):Vt._events[Qt]=[dr,Vt._events[Qt]]}function Mt(Vt,Qt,dr){_=_||require_stream_duplex$1(),Vt=Vt||{},typeof dr!="boolean"&&(dr=Qt instanceof _),this.objectMode=!!Vt.objectMode,dr&&(this.objectMode=this.objectMode||!!Vt.readableObjectMode),this.highWaterMark=ut(this,Vt,"readableHighWaterMark",dr),this.buffer=new at,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=Vt.emitClose!==!1,this.autoDestroy=!!Vt.autoDestroy,this.destroyed=!1,this.defaultEncoding=Vt.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Vt.encoding&&(Tt||(Tt=string_decoder$1.StringDecoder),this.decoder=new Tt(Vt.encoding),this.encoding=Vt.encoding)}function Dt(Vt){if(_=_||require_stream_duplex$1(),!(this instanceof Dt))return new Dt(Vt);var Qt=this instanceof _;this._readableState=new Mt(Vt,this,Qt),this.readable=!0,Vt&&(typeof Vt.read=="function"&&(this._read=Vt.read),typeof Vt.destroy=="function"&&(this._destroy=Vt.destroy)),$.call(this)}Object.defineProperty(Dt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Qt){this._readableState&&(this._readableState.destroyed=Qt)}}),Dt.prototype.destroy=st.destroy,Dt.prototype._undestroy=st.undestroy,Dt.prototype._destroy=function(Vt,Qt){Qt(Vt)},Dt.prototype.push=function(Vt,Qt){var dr=this._readableState,xr;return dr.objectMode?xr=!0:typeof Vt=="string"&&(Qt=Qt||dr.defaultEncoding,Qt!==dr.encoding&&(Vt=j.from(Vt,Qt),Qt=""),xr=!0),Ft(this,Vt,Qt,!1,xr)},Dt.prototype.unshift=function(Vt){return Ft(this,Vt,null,!0,!1)};function Ft(Vt,Qt,dr,xr,pr){it("readableAddChunk",Qt);var Ir=Vt._readableState;if(Qt===null)Ir.reading=!1,vt(Vt,Ir);else{var kr;if(pr||(kr=yt(Ir,Qt)),kr)Nt(Vt,kr);else if(Ir.objectMode||Qt&&Qt.length>0)if(typeof Qt!="string"&&!Ir.objectMode&&Object.getPrototypeOf(Qt)!==j.prototype&&(Qt=tt(Qt)),xr)Ir.endEmitted?Nt(Vt,new Pt):Bt(Vt,Ir,Qt,!0);else if(Ir.ended)Nt(Vt,new xt);else{if(Ir.destroyed)return!1;Ir.reading=!1,Ir.decoder&&!dr?(Qt=Ir.decoder.write(Qt),Ir.objectMode||Qt.length!==0?Bt(Vt,Ir,Qt,!1):$t(Vt,Ir)):Bt(Vt,Ir,Qt,!1)}else xr||(Ir.reading=!1,$t(Vt,Ir))}return!Ir.ended&&(Ir.length=bt?Vt=bt:(Vt--,Vt|=Vt>>>1,Vt|=Vt>>>2,Vt|=Vt>>>4,Vt|=Vt>>>8,Vt|=Vt>>>16,Vt++),Vt}function ht(Vt,Qt){return Vt<=0||Qt.length===0&&Qt.ended?0:Qt.objectMode?1:Vt!==Vt?Qt.flowing&&Qt.length?Qt.buffer.head.data.length:Qt.length:(Vt>Qt.highWaterMark&&(Qt.highWaterMark=ct(Vt)),Vt<=Qt.length?Vt:Qt.ended?Qt.length:(Qt.needReadable=!0,0))}Dt.prototype.read=function(Vt){it("read",Vt),Vt=parseInt(Vt,10);var Qt=this._readableState,dr=Vt;if(Vt!==0&&(Qt.emittedReadable=!1),Vt===0&&Qt.needReadable&&((Qt.highWaterMark!==0?Qt.length>=Qt.highWaterMark:Qt.length>0)||Qt.ended))return it("read: emitReadable",Qt.length,Qt.ended),Qt.length===0&&Qt.ended?Kt(this):St(this),null;if(Vt=ht(Vt,Qt),Vt===0&&Qt.ended)return Qt.length===0&&Kt(this),null;var xr=Qt.needReadable;it("need readable",xr),(Qt.length===0||Qt.length-Vt0?pr=Wt(Vt,Qt):pr=null,pr===null?(Qt.needReadable=Qt.length<=Qt.highWaterMark,Vt=0):(Qt.length-=Vt,Qt.awaitDrain=0),Qt.length===0&&(Qt.ended||(Qt.needReadable=!0),dr!==Vt&&Qt.ended&&Kt(this)),pr!==null&&this.emit("data",pr),pr};function vt(Vt,Qt){if(it("onEofChunk"),!Qt.ended){if(Qt.decoder){var dr=Qt.decoder.end();dr&&dr.length&&(Qt.buffer.push(dr),Qt.length+=Qt.objectMode?1:dr.length)}Qt.ended=!0,Qt.sync?St(Vt):(Qt.needReadable=!1,Qt.emittedReadable||(Qt.emittedReadable=!0,Rt(Vt)))}}function St(Vt){var Qt=Vt._readableState;it("emitReadable",Qt.needReadable,Qt.emittedReadable),Qt.needReadable=!1,Qt.emittedReadable||(it("emitReadable",Qt.flowing),Qt.emittedReadable=!0,process$1$1.nextTick(Rt,Vt))}function Rt(Vt){var Qt=Vt._readableState;it("emitReadable_",Qt.destroyed,Qt.length,Qt.ended),!Qt.destroyed&&(Qt.length||Qt.ended)&&(Vt.emit("readable"),Qt.emittedReadable=!1),Qt.needReadable=!Qt.flowing&&!Qt.ended&&Qt.length<=Qt.highWaterMark,ir(Vt)}function $t(Vt,Qt){Qt.readingMore||(Qt.readingMore=!0,process$1$1.nextTick(Et,Vt,Qt))}function Et(Vt,Qt){for(;!Qt.reading&&!Qt.ended&&(Qt.length1&&Ht(xr.pipes,Vt)!==-1)&&!Er&&(it("false write response, pause",xr.awaitDrain),xr.awaitDrain++),dr.pause())}function Rr(ar){it("onerror",ar),Lr(),Vt.removeListener("error",Rr),a(Vt,"error")===0&&Nt(Vt,ar)}jt(Vt,"error",Rr);function Ar(){Vt.removeListener("finish",Or),Lr()}Vt.once("close",Ar);function Or(){it("onfinish"),Vt.removeListener("close",Ar),Lr()}Vt.once("finish",Or);function Lr(){it("unpipe"),dr.unpipe(Vt)}return Vt.emit("pipe",dr),xr.flowing||(it("pipe resume"),dr.resume()),Vt};function At(Vt){return function(){var dr=Vt._readableState;it("pipeOnDrain",dr.awaitDrain),dr.awaitDrain&&dr.awaitDrain--,dr.awaitDrain===0&&a(Vt,"data")&&(dr.flowing=!0,ir(Vt))}}Dt.prototype.unpipe=function(Vt){var Qt=this._readableState,dr={hasUnpiped:!1};if(Qt.pipesCount===0)return this;if(Qt.pipesCount===1)return Vt&&Vt!==Qt.pipes?this:(Vt||(Vt=Qt.pipes),Qt.pipes=null,Qt.pipesCount=0,Qt.flowing=!1,Vt&&Vt.emit("unpipe",this,dr),this);if(!Vt){var xr=Qt.pipes,pr=Qt.pipesCount;Qt.pipes=null,Qt.pipesCount=0,Qt.flowing=!1;for(var Ir=0;Ir0,xr.flowing!==!1&&this.resume()):Vt==="readable"&&!xr.endEmitted&&!xr.readableListening&&(xr.readableListening=xr.needReadable=!0,xr.flowing=!1,xr.emittedReadable=!1,it("on readable",xr.length,xr.reading),xr.length?St(this):xr.reading||process$1$1.nextTick(Ot,this)),dr},Dt.prototype.addListener=Dt.prototype.on,Dt.prototype.removeListener=function(Vt,Qt){var dr=$.prototype.removeListener.call(this,Vt,Qt);return Vt==="readable"&&process$1$1.nextTick(wt,this),dr},Dt.prototype.removeAllListeners=function(Vt){var Qt=$.prototype.removeAllListeners.apply(this,arguments);return(Vt==="readable"||Vt===void 0)&&process$1$1.nextTick(wt,this),Qt};function wt(Vt){var Qt=Vt._readableState;Qt.readableListening=Vt.listenerCount("readable")>0,Qt.resumeScheduled&&!Qt.paused?Qt.flowing=!0:Vt.listenerCount("data")>0&&Vt.resume()}function Ot(Vt){it("readable nexttick read 0"),Vt.read(0)}Dt.prototype.resume=function(){var Vt=this._readableState;return Vt.flowing||(it("resume"),Vt.flowing=!Vt.readableListening,tr(this,Vt)),Vt.paused=!1,this};function tr(Vt,Qt){Qt.resumeScheduled||(Qt.resumeScheduled=!0,process$1$1.nextTick(nr,Vt,Qt))}function nr(Vt,Qt){it("resume",Qt.reading),Qt.reading||Vt.read(0),Qt.resumeScheduled=!1,Vt.emit("resume"),ir(Vt),Qt.flowing&&!Qt.reading&&Vt.read(0)}Dt.prototype.pause=function(){return it("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(it("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function ir(Vt){var Qt=Vt._readableState;for(it("flow",Qt.flowing);Qt.flowing&&Vt.read()!==null;);}Dt.prototype.wrap=function(Vt){var Qt=this,dr=this._readableState,xr=!1;Vt.on("end",function(){if(it("wrapped end"),dr.decoder&&!dr.ended){var kr=dr.decoder.end();kr&&kr.length&&Qt.push(kr)}Qt.push(null)}),Vt.on("data",function(kr){if(it("wrapped data"),dr.decoder&&(kr=dr.decoder.write(kr)),!(dr.objectMode&&kr==null)&&!(!dr.objectMode&&(!kr||!kr.length))){var lr=Qt.push(kr);lr||(xr=!0,Vt.pause())}});for(var pr in Vt)this[pr]===void 0&&typeof Vt[pr]=="function"&&(this[pr]=function(lr){return function(){return Vt[lr].apply(Vt,arguments)}}(pr));for(var Ir=0;Ir=Qt.length?(Qt.decoder?dr=Qt.buffer.join(""):Qt.buffer.length===1?dr=Qt.buffer.first():dr=Qt.buffer.concat(Qt.length),Qt.buffer.clear()):dr=Qt.buffer.consume(Vt,Qt.decoder),dr}function Kt(Vt){var Qt=Vt._readableState;it("endReadable",Qt.endEmitted),Qt.endEmitted||(Qt.ended=!0,process$1$1.nextTick(Jt,Qt,Vt))}function Jt(Vt,Qt){if(it("endReadableNT",Vt.endEmitted,Vt.length),!Vt.endEmitted&&Vt.length===0&&(Vt.endEmitted=!0,Qt.readable=!1,Qt.emit("end"),Vt.autoDestroy)){var dr=Qt._writableState;(!dr||dr.autoDestroy&&dr.finished)&&Qt.destroy()}}typeof Symbol=="function"&&(Dt.from=function(Vt,Qt){return Lt===void 0&&(Lt=requireFromBrowser()),Lt(Dt,Vt,Qt)});function Ht(Vt,Qt){for(var dr=0,xr=Vt.length;dr0;return destroyer(rt,it,at,function(st){et||(et=st),st&&tt.forEach(call$1),!it&&(tt.forEach(call$1),j(et))})});return a.reduce(pipe)}var pipeline_1=pipeline;(function(_,a){a=_.exports=require_stream_readable$1(),a.Stream=a,a.Readable=a,a.Writable=require_stream_writable$1(),a.Duplex=require_stream_duplex$1(),a.Transform=_stream_transform$1,a.PassThrough=_stream_passthrough$1,a.finished=endOfStream,a.pipeline=pipeline_1})(readableBrowser$1,readableBrowser$1.exports);var readableBrowserExports=readableBrowser$1.exports,Buffer$e=safeBufferExports.Buffer,Transform$1=readableBrowserExports.Transform,inherits$n=inherits_browserExports;function throwIfNotStringOrBuffer(_,a){if(!Buffer$e.isBuffer(_)&&typeof _!="string")throw new TypeError(a+" must be a string or a buffer")}function HashBase$2(_){Transform$1.call(this),this._block=Buffer$e.allocUnsafe(_),this._blockSize=_,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$n(HashBase$2,Transform$1);HashBase$2.prototype._transform=function(_,a,$){var j=null;try{this.update(_,a)}catch(et){j=et}$(j)};HashBase$2.prototype._flush=function(_){var a=null;try{this.push(this.digest())}catch($){a=$}_(a)};HashBase$2.prototype.update=function(_,a){if(throwIfNotStringOrBuffer(_,"Data"),this._finalized)throw new Error("Digest already called");Buffer$e.isBuffer(_)||(_=Buffer$e.from(_,a));for(var $=this._block,j=0;this._blockOffset+_.length-j>=this._blockSize;){for(var et=this._blockOffset;et0;++tt)this._length[tt]+=rt,rt=this._length[tt]/4294967296|0,rt>0&&(this._length[tt]-=4294967296*rt);return this};HashBase$2.prototype._update=function(){throw new Error("_update is not implemented")};HashBase$2.prototype.digest=function(_){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var a=this._digest();_!==void 0&&(a=a.toString(_)),this._block.fill(0),this._blockOffset=0;for(var $=0;$<4;++$)this._length[$]=0;return a};HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$m=inherits_browserExports,HashBase$1=hashBase,Buffer$d=safeBufferExports.Buffer,ARRAY16$1=new Array(16);function MD5$2(){HashBase$1.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}inherits$m(MD5$2,HashBase$1);MD5$2.prototype._update=function(){for(var _=ARRAY16$1,a=0;a<16;++a)_[a]=this._block.readInt32LE(a*4);var $=this._a,j=this._b,et=this._c,tt=this._d;$=fnF($,j,et,tt,_[0],3614090360,7),tt=fnF(tt,$,j,et,_[1],3905402710,12),et=fnF(et,tt,$,j,_[2],606105819,17),j=fnF(j,et,tt,$,_[3],3250441966,22),$=fnF($,j,et,tt,_[4],4118548399,7),tt=fnF(tt,$,j,et,_[5],1200080426,12),et=fnF(et,tt,$,j,_[6],2821735955,17),j=fnF(j,et,tt,$,_[7],4249261313,22),$=fnF($,j,et,tt,_[8],1770035416,7),tt=fnF(tt,$,j,et,_[9],2336552879,12),et=fnF(et,tt,$,j,_[10],4294925233,17),j=fnF(j,et,tt,$,_[11],2304563134,22),$=fnF($,j,et,tt,_[12],1804603682,7),tt=fnF(tt,$,j,et,_[13],4254626195,12),et=fnF(et,tt,$,j,_[14],2792965006,17),j=fnF(j,et,tt,$,_[15],1236535329,22),$=fnG($,j,et,tt,_[1],4129170786,5),tt=fnG(tt,$,j,et,_[6],3225465664,9),et=fnG(et,tt,$,j,_[11],643717713,14),j=fnG(j,et,tt,$,_[0],3921069994,20),$=fnG($,j,et,tt,_[5],3593408605,5),tt=fnG(tt,$,j,et,_[10],38016083,9),et=fnG(et,tt,$,j,_[15],3634488961,14),j=fnG(j,et,tt,$,_[4],3889429448,20),$=fnG($,j,et,tt,_[9],568446438,5),tt=fnG(tt,$,j,et,_[14],3275163606,9),et=fnG(et,tt,$,j,_[3],4107603335,14),j=fnG(j,et,tt,$,_[8],1163531501,20),$=fnG($,j,et,tt,_[13],2850285829,5),tt=fnG(tt,$,j,et,_[2],4243563512,9),et=fnG(et,tt,$,j,_[7],1735328473,14),j=fnG(j,et,tt,$,_[12],2368359562,20),$=fnH($,j,et,tt,_[5],4294588738,4),tt=fnH(tt,$,j,et,_[8],2272392833,11),et=fnH(et,tt,$,j,_[11],1839030562,16),j=fnH(j,et,tt,$,_[14],4259657740,23),$=fnH($,j,et,tt,_[1],2763975236,4),tt=fnH(tt,$,j,et,_[4],1272893353,11),et=fnH(et,tt,$,j,_[7],4139469664,16),j=fnH(j,et,tt,$,_[10],3200236656,23),$=fnH($,j,et,tt,_[13],681279174,4),tt=fnH(tt,$,j,et,_[0],3936430074,11),et=fnH(et,tt,$,j,_[3],3572445317,16),j=fnH(j,et,tt,$,_[6],76029189,23),$=fnH($,j,et,tt,_[9],3654602809,4),tt=fnH(tt,$,j,et,_[12],3873151461,11),et=fnH(et,tt,$,j,_[15],530742520,16),j=fnH(j,et,tt,$,_[2],3299628645,23),$=fnI($,j,et,tt,_[0],4096336452,6),tt=fnI(tt,$,j,et,_[7],1126891415,10),et=fnI(et,tt,$,j,_[14],2878612391,15),j=fnI(j,et,tt,$,_[5],4237533241,21),$=fnI($,j,et,tt,_[12],1700485571,6),tt=fnI(tt,$,j,et,_[3],2399980690,10),et=fnI(et,tt,$,j,_[10],4293915773,15),j=fnI(j,et,tt,$,_[1],2240044497,21),$=fnI($,j,et,tt,_[8],1873313359,6),tt=fnI(tt,$,j,et,_[15],4264355552,10),et=fnI(et,tt,$,j,_[6],2734768916,15),j=fnI(j,et,tt,$,_[13],1309151649,21),$=fnI($,j,et,tt,_[4],4149444226,6),tt=fnI(tt,$,j,et,_[11],3174756917,10),et=fnI(et,tt,$,j,_[2],718787259,15),j=fnI(j,et,tt,$,_[9],3951481745,21),this._a=this._a+$|0,this._b=this._b+j|0,this._c=this._c+et|0,this._d=this._d+tt|0};MD5$2.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var _=Buffer$d.allocUnsafe(16);return _.writeInt32LE(this._a,0),_.writeInt32LE(this._b,4),_.writeInt32LE(this._c,8),_.writeInt32LE(this._d,12),_};function rotl$1(_,a){return _<>>32-a}function fnF(_,a,$,j,et,tt,rt){return rotl$1(_+(a&$|~a&j)+et+tt|0,rt)+a|0}function fnG(_,a,$,j,et,tt,rt){return rotl$1(_+(a&j|$&~j)+et+tt|0,rt)+a|0}function fnH(_,a,$,j,et,tt,rt){return rotl$1(_+(a^$^j)+et+tt|0,rt)+a|0}function fnI(_,a,$,j,et,tt,rt){return rotl$1(_+($^(a|~j))+et+tt|0,rt)+a|0}var md5_js=MD5$2,Buffer$c=buffer$1.Buffer,inherits$l=inherits_browserExports,HashBase=hashBase,ARRAY16=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160$3(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}inherits$l(RIPEMD160$3,HashBase);RIPEMD160$3.prototype._update=function(){for(var _=ARRAY16,a=0;a<16;++a)_[a]=this._block.readInt32LE(a*4);for(var $=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=this._a|0,it=this._b|0,at=this._c|0,st=this._d|0,ot=this._e|0,ut=0;ut<80;ut+=1){var dt,mt;ut<16?(dt=fn1($,j,et,tt,rt,_[zl[ut]],hl[0],sl[ut]),mt=fn5(nt,it,at,st,ot,_[zr[ut]],hr[0],sr[ut])):ut<32?(dt=fn2($,j,et,tt,rt,_[zl[ut]],hl[1],sl[ut]),mt=fn4(nt,it,at,st,ot,_[zr[ut]],hr[1],sr[ut])):ut<48?(dt=fn3($,j,et,tt,rt,_[zl[ut]],hl[2],sl[ut]),mt=fn3(nt,it,at,st,ot,_[zr[ut]],hr[2],sr[ut])):ut<64?(dt=fn4($,j,et,tt,rt,_[zl[ut]],hl[3],sl[ut]),mt=fn2(nt,it,at,st,ot,_[zr[ut]],hr[3],sr[ut])):(dt=fn5($,j,et,tt,rt,_[zl[ut]],hl[4],sl[ut]),mt=fn1(nt,it,at,st,ot,_[zr[ut]],hr[4],sr[ut])),$=rt,rt=tt,tt=rotl(et,10),et=j,j=dt,nt=ot,ot=st,st=rotl(at,10),at=it,it=mt}var xt=this._b+et+st|0;this._b=this._c+tt+ot|0,this._c=this._d+rt+nt|0,this._d=this._e+$+it|0,this._e=this._a+j+at|0,this._a=xt};RIPEMD160$3.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var _=Buffer$c.alloc?Buffer$c.alloc(20):new Buffer$c(20);return _.writeInt32LE(this._a,0),_.writeInt32LE(this._b,4),_.writeInt32LE(this._c,8),_.writeInt32LE(this._d,12),_.writeInt32LE(this._e,16),_};function rotl(_,a){return _<>>32-a}function fn1(_,a,$,j,et,tt,rt,nt){return rotl(_+(a^$^j)+tt+rt|0,nt)+et|0}function fn2(_,a,$,j,et,tt,rt,nt){return rotl(_+(a&$|~a&j)+tt+rt|0,nt)+et|0}function fn3(_,a,$,j,et,tt,rt,nt){return rotl(_+((a|~$)^j)+tt+rt|0,nt)+et|0}function fn4(_,a,$,j,et,tt,rt,nt){return rotl(_+(a&j|$&~j)+tt+rt|0,nt)+et|0}function fn5(_,a,$,j,et,tt,rt,nt){return rotl(_+(a^($|~j))+tt+rt|0,nt)+et|0}var ripemd160=RIPEMD160$3,sha_js={exports:{}},Buffer$b=safeBufferExports.Buffer;function Hash$8(_,a){this._block=Buffer$b.alloc(_),this._finalSize=a,this._blockSize=_,this._len=0}Hash$8.prototype.update=function(_,a){typeof _=="string"&&(a=a||"utf8",_=Buffer$b.from(_,a));for(var $=this._block,j=this._blockSize,et=_.length,tt=this._len,rt=0;rt=this._finalSize&&(this._update(this._block),this._block.fill(0));var $=this._len*8;if($<=4294967295)this._block.writeUInt32BE($,this._blockSize-4);else{var j=($&4294967295)>>>0,et=($-j)/4294967296;this._block.writeUInt32BE(et,this._blockSize-8),this._block.writeUInt32BE(j,this._blockSize-4)}this._update(this._block);var tt=this._hash();return _?tt.toString(_):tt};Hash$8.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$9=Hash$8,inherits$k=inherits_browserExports,Hash$7=hash$9,Buffer$a=safeBufferExports.Buffer,K$5=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$7.call(this,64,56)}inherits$k(Sha,Hash$7);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(_){return _<<5|_>>>27}function rotl30$1(_){return _<<30|_>>>2}function ft$1(_,a,$,j){return _===0?a&$|~a&j:_===2?a&$|a&j|$&j:a^$^j}Sha.prototype._update=function(_){for(var a=this._w,$=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=0;nt<16;++nt)a[nt]=_.readInt32BE(nt*4);for(;nt<80;++nt)a[nt]=a[nt-3]^a[nt-8]^a[nt-14]^a[nt-16];for(var it=0;it<80;++it){var at=~~(it/20),st=rotl5$1($)+ft$1(at,j,et,tt)+rt+a[it]+K$5[at]|0;rt=tt,tt=et,et=rotl30$1(j),j=$,$=st}this._a=$+this._a|0,this._b=j+this._b|0,this._c=et+this._c|0,this._d=tt+this._d|0,this._e=rt+this._e|0};Sha.prototype._hash=function(){var _=Buffer$a.allocUnsafe(20);return _.writeInt32BE(this._a|0,0),_.writeInt32BE(this._b|0,4),_.writeInt32BE(this._c|0,8),_.writeInt32BE(this._d|0,12),_.writeInt32BE(this._e|0,16),_};var sha$3=Sha,inherits$j=inherits_browserExports,Hash$6=hash$9,Buffer$9=safeBufferExports.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$6.call(this,64,56)}inherits$j(Sha1,Hash$6);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(_){return _<<1|_>>>31}function rotl5(_){return _<<5|_>>>27}function rotl30(_){return _<<30|_>>>2}function ft(_,a,$,j){return _===0?a&$|~a&j:_===2?a&$|a&j|$&j:a^$^j}Sha1.prototype._update=function(_){for(var a=this._w,$=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=0;nt<16;++nt)a[nt]=_.readInt32BE(nt*4);for(;nt<80;++nt)a[nt]=rotl1(a[nt-3]^a[nt-8]^a[nt-14]^a[nt-16]);for(var it=0;it<80;++it){var at=~~(it/20),st=rotl5($)+ft(at,j,et,tt)+rt+a[it]+K$4[at]|0;rt=tt,tt=et,et=rotl30(j),j=$,$=st}this._a=$+this._a|0,this._b=j+this._b|0,this._c=et+this._c|0,this._d=tt+this._d|0,this._e=rt+this._e|0};Sha1.prototype._hash=function(){var _=Buffer$9.allocUnsafe(20);return _.writeInt32BE(this._a|0,0),_.writeInt32BE(this._b|0,4),_.writeInt32BE(this._c|0,8),_.writeInt32BE(this._d|0,12),_.writeInt32BE(this._e|0,16),_};var sha1=Sha1,inherits$i=inherits_browserExports,Hash$5=hash$9,Buffer$8=safeBufferExports.Buffer,K$3=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],W$3=new Array(64);function Sha256$1(){this.init(),this._w=W$3,Hash$5.call(this,64,56)}inherits$i(Sha256$1,Hash$5);Sha256$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ch(_,a,$){return $^_&(a^$)}function maj$1(_,a,$){return _&a|$&(_|a)}function sigma0$1(_){return(_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10)}function sigma1$1(_){return(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7)}function gamma0(_){return(_>>>7|_<<25)^(_>>>18|_<<14)^_>>>3}function gamma1(_){return(_>>>17|_<<15)^(_>>>19|_<<13)^_>>>10}Sha256$1.prototype._update=function(_){for(var a=this._w,$=this._a|0,j=this._b|0,et=this._c|0,tt=this._d|0,rt=this._e|0,nt=this._f|0,it=this._g|0,at=this._h|0,st=0;st<16;++st)a[st]=_.readInt32BE(st*4);for(;st<64;++st)a[st]=gamma1(a[st-2])+a[st-7]+gamma0(a[st-15])+a[st-16]|0;for(var ot=0;ot<64;++ot){var ut=at+sigma1$1(rt)+ch(rt,nt,it)+K$3[ot]+a[ot]|0,dt=sigma0$1($)+maj$1($,j,et)|0;at=it,it=nt,nt=rt,rt=tt+ut|0,tt=et,et=j,j=$,$=ut+dt|0}this._a=$+this._a|0,this._b=j+this._b|0,this._c=et+this._c|0,this._d=tt+this._d|0,this._e=rt+this._e|0,this._f=nt+this._f|0,this._g=it+this._g|0,this._h=at+this._h|0};Sha256$1.prototype._hash=function(){var _=Buffer$8.allocUnsafe(32);return _.writeInt32BE(this._a,0),_.writeInt32BE(this._b,4),_.writeInt32BE(this._c,8),_.writeInt32BE(this._d,12),_.writeInt32BE(this._e,16),_.writeInt32BE(this._f,20),_.writeInt32BE(this._g,24),_.writeInt32BE(this._h,28),_};var sha256$5=Sha256$1,inherits$h=inherits_browserExports,Sha256=sha256$5,Hash$4=hash$9,Buffer$7=safeBufferExports.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$4.call(this,64,56)}inherits$h(Sha224,Sha256);Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Sha224.prototype._hash=function(){var _=Buffer$7.allocUnsafe(28);return _.writeInt32BE(this._a,0),_.writeInt32BE(this._b,4),_.writeInt32BE(this._c,8),_.writeInt32BE(this._d,12),_.writeInt32BE(this._e,16),_.writeInt32BE(this._f,20),_.writeInt32BE(this._g,24),_};var sha224$1=Sha224,inherits$g=inherits_browserExports,Hash$3=hash$9,Buffer$6=safeBufferExports.Buffer,K$2=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W$1=new Array(160);function Sha512(){this.init(),this._w=W$1,Hash$3.call(this,128,112)}inherits$g(Sha512,Hash$3);Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ch(_,a,$){return $^_&(a^$)}function maj(_,a,$){return _&a|$&(_|a)}function sigma0(_,a){return(_>>>28|a<<4)^(a>>>2|_<<30)^(a>>>7|_<<25)}function sigma1(_,a){return(_>>>14|a<<18)^(_>>>18|a<<14)^(a>>>9|_<<23)}function Gamma0(_,a){return(_>>>1|a<<31)^(_>>>8|a<<24)^_>>>7}function Gamma0l(_,a){return(_>>>1|a<<31)^(_>>>8|a<<24)^(_>>>7|a<<25)}function Gamma1(_,a){return(_>>>19|a<<13)^(a>>>29|_<<3)^_>>>6}function Gamma1l(_,a){return(_>>>19|a<<13)^(a>>>29|_<<3)^(_>>>6|a<<26)}function getCarry(_,a){return _>>>0>>0?1:0}Sha512.prototype._update=function(_){for(var a=this._w,$=this._ah|0,j=this._bh|0,et=this._ch|0,tt=this._dh|0,rt=this._eh|0,nt=this._fh|0,it=this._gh|0,at=this._hh|0,st=this._al|0,ot=this._bl|0,ut=this._cl|0,dt=this._dl|0,mt=this._el|0,xt=this._fl|0,Ct=this._gl|0,Pt=this._hl|0,Tt=0;Tt<32;Tt+=2)a[Tt]=_.readInt32BE(Tt*4),a[Tt+1]=_.readInt32BE(Tt*4+4);for(;Tt<160;Tt+=2){var kt=a[Tt-30],Lt=a[Tt-15*2+1],Nt=Gamma0(kt,Lt),zt=Gamma0l(Lt,kt);kt=a[Tt-2*2],Lt=a[Tt-2*2+1];var jt=Gamma1(kt,Lt),Mt=Gamma1l(Lt,kt),Dt=a[Tt-7*2],Ft=a[Tt-7*2+1],Bt=a[Tt-16*2],yt=a[Tt-16*2+1],bt=zt+Ft|0,ct=Nt+Dt+getCarry(bt,zt)|0;bt=bt+Mt|0,ct=ct+jt+getCarry(bt,Mt)|0,bt=bt+yt|0,ct=ct+Bt+getCarry(bt,yt)|0,a[Tt]=ct,a[Tt+1]=bt}for(var ht=0;ht<160;ht+=2){ct=a[ht],bt=a[ht+1];var vt=maj($,j,et),St=maj(st,ot,ut),Rt=sigma0($,st),$t=sigma0(st,$),Et=sigma1(rt,mt),At=sigma1(mt,rt),wt=K$2[ht],Ot=K$2[ht+1],tr=Ch(rt,nt,it),nr=Ch(mt,xt,Ct),ir=Pt+At|0,Wt=at+Et+getCarry(ir,Pt)|0;ir=ir+nr|0,Wt=Wt+tr+getCarry(ir,nr)|0,ir=ir+Ot|0,Wt=Wt+wt+getCarry(ir,Ot)|0,ir=ir+bt|0,Wt=Wt+ct+getCarry(ir,bt)|0;var Kt=$t+St|0,Jt=Rt+vt+getCarry(Kt,$t)|0;at=it,Pt=Ct,it=nt,Ct=xt,nt=rt,xt=mt,mt=dt+ir|0,rt=tt+Wt+getCarry(mt,dt)|0,tt=et,dt=ut,et=j,ut=ot,j=$,ot=st,st=ir+Kt|0,$=Wt+Jt+getCarry(st,ir)|0}this._al=this._al+st|0,this._bl=this._bl+ot|0,this._cl=this._cl+ut|0,this._dl=this._dl+dt|0,this._el=this._el+mt|0,this._fl=this._fl+xt|0,this._gl=this._gl+Ct|0,this._hl=this._hl+Pt|0,this._ah=this._ah+$+getCarry(this._al,st)|0,this._bh=this._bh+j+getCarry(this._bl,ot)|0,this._ch=this._ch+et+getCarry(this._cl,ut)|0,this._dh=this._dh+tt+getCarry(this._dl,dt)|0,this._eh=this._eh+rt+getCarry(this._el,mt)|0,this._fh=this._fh+nt+getCarry(this._fl,xt)|0,this._gh=this._gh+it+getCarry(this._gl,Ct)|0,this._hh=this._hh+at+getCarry(this._hl,Pt)|0};Sha512.prototype._hash=function(){var _=Buffer$6.allocUnsafe(64);function a($,j,et){_.writeInt32BE($,et),_.writeInt32BE(j,et+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),a(this._gh,this._gl,48),a(this._hh,this._hl,56),_};var sha512$4=Sha512,inherits$f=inherits_browserExports,SHA512$3=sha512$4,Hash$2=hash$9,Buffer$5=safeBufferExports.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$2.call(this,128,112)}inherits$f(Sha384,SHA512$3);Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Sha384.prototype._hash=function(){var _=Buffer$5.allocUnsafe(48);function a($,j,et){_.writeInt32BE($,et),_.writeInt32BE(j,et+4)}return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),_};var sha384$1=Sha384,exports=sha_js.exports=function(a){a=a.toLowerCase();var $=exports[a];if(!$)throw new Error(a+" is not supported (we accept pull requests)");return new $};exports.sha=sha$3;exports.sha1=sha1;exports.sha224=sha224$1;exports.sha256=sha256$5;exports.sha384=sha384$1;exports.sha512=sha512$4;var sha_jsExports=sha_js.exports,streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$e=inherits_browserExports;inherits$e(Stream,EE);Stream.Readable=require_stream_readable$1();Stream.Writable=require_stream_writable$1();Stream.Duplex=require_stream_duplex$1();Stream.Transform=_stream_transform$1;Stream.PassThrough=_stream_passthrough$1;Stream.finished=endOfStream;Stream.pipeline=pipeline_1;Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(_,a){var $=this;function j(st){_.writable&&_.write(st)===!1&&$.pause&&$.pause()}$.on("data",j);function et(){$.readable&&$.resume&&$.resume()}_.on("drain",et),!_._isStdio&&(!a||a.end!==!1)&&($.on("end",rt),$.on("close",nt));var tt=!1;function rt(){tt||(tt=!0,_.end())}function nt(){tt||(tt=!0,typeof _.destroy=="function"&&_.destroy())}function it(st){if(at(),EE.listenerCount(this,"error")===0)throw st}$.on("error",it),_.on("error",it);function at(){$.removeListener("data",j),_.removeListener("drain",et),$.removeListener("end",rt),$.removeListener("close",nt),$.removeListener("error",it),_.removeListener("error",it),$.removeListener("end",at),$.removeListener("close",at),_.removeListener("close",at)}return $.on("end",at),$.on("close",at),_.on("close",at),_.emit("pipe",$),_};var Buffer$4=safeBufferExports.Buffer,Transform=streamBrowserify.Transform,StringDecoder=string_decoder$1.StringDecoder,inherits$d=inherits_browserExports;function CipherBase(_){Transform.call(this),this.hashMode=typeof _=="string",this.hashMode?this[_]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$d(CipherBase,Transform);CipherBase.prototype.update=function(_,a,$){typeof _=="string"&&(_=Buffer$4.from(_,a));var j=this._update(_);return this.hashMode?this:($&&(j=this._toString(j,$)),j)};CipherBase.prototype.setAutoPadding=function(){};CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase.prototype._transform=function(_,a,$){var j;try{this.hashMode?this._update(_):this.push(this._update(_))}catch(et){j=et}finally{$(j)}};CipherBase.prototype._flush=function(_){var a;try{this.push(this.__final())}catch($){a=$}_(a)};CipherBase.prototype._finalOrDigest=function(_){var a=this.__final()||Buffer$4.alloc(0);return _&&(a=this._toString(a,_,!0)),a};CipherBase.prototype._toString=function(_,a,$){if(this._decoder||(this._decoder=new StringDecoder(a),this._encoding=a),this._encoding!==a)throw new Error("can't switch encodings");var j=this._decoder.write(_);return $&&(j+=this._decoder.end()),j};var cipherBase=CipherBase,inherits$c=inherits_browserExports,MD5$1=md5_js,RIPEMD160$2=ripemd160,sha$2=sha_jsExports,Base$9=cipherBase;function Hash$1(_){Base$9.call(this,"digest"),this._hash=_}inherits$c(Hash$1,Base$9);Hash$1.prototype._update=function(_){this._hash.update(_)};Hash$1.prototype._final=function(){return this._hash.digest()};var browser$b=function(a){return a=a.toLowerCase(),a==="md5"?new MD5$1:a==="rmd160"||a==="ripemd160"?new RIPEMD160$2:new Hash$1(sha$2(a))},_Buffer=safeBufferExports.Buffer;function base$9(_){if(_.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),$=0;$>>0,kt=new Uint8Array(Tt);Ct!==Pt;){for(var Lt=dt[Ct],Nt=0,zt=Tt-1;(Lt!==0||Nt>>0,kt[zt]=Lt%rt>>>0,Lt=Lt/rt>>>0;if(Lt!==0)throw new Error("Non-zero carry");xt=Nt,Ct++}for(var jt=Tt-xt;jt!==Tt&&kt[jt]===0;)jt++;for(var Mt=nt.repeat(mt);jt>>0,Tt=new Uint8Array(Pt);dt[mt];){var kt=a[dt.charCodeAt(mt)];if(kt===255)return;for(var Lt=0,Nt=Pt-1;(kt!==0||Lt>>0,Tt[Nt]=kt%256>>>0,kt=kt/256>>>0;if(kt!==0)throw new Error("Non-zero carry");Ct=Lt,mt++}for(var zt=Pt-Ct;zt!==Pt&&Tt[zt]===0;)zt++;var jt=_Buffer.allocUnsafe(xt+(Pt-zt));jt.fill(0,0,xt);for(var Mt=xt;zt!==Pt;)jt[Mt++]=Tt[zt++];return jt}function ut(dt){var mt=ot(dt);if(mt)return mt;throw new Error("Non-base"+rt+" character")}return{encode:st,decodeUnsafe:ot,decode:ut}}var src$2=base$9,basex$1=src$2,ALPHABET$3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$1=basex$1(ALPHABET$3),base58$1=bs58$1,Buffer$3=safeBufferExports.Buffer,base$8=function(_){function a(tt){var rt=_(tt);return base58$1.encode(Buffer$3.concat([tt,rt],tt.length+4))}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=_(rt);if(!(nt[0]^it[0]|nt[1]^it[1]|nt[2]^it[2]|nt[3]^it[3]))return rt}function j(tt){var rt=base58$1.decodeUnsafe(tt);if(rt)return $(rt)}function et(tt){var rt=base58$1.decode(tt),nt=$(rt);if(!nt)throw new Error("Invalid checksum");return nt}return{encode:a,decode:et,decodeUnsafe:j}},createHash=browser$b,bs58checkBase$1=base$8;function sha256x2$1(_){var a=createHash("sha256").update(_).digest();return createHash("sha256").update(a).digest()}var bs58check$2=bs58checkBase$1(sha256x2$1),nacl={},box={},x25519={},random={},system={},browser$a={};Object.defineProperty(browser$a,"__esModule",{value:!0});browser$a.BrowserRandomSource=void 0;const QUOTA=65536;class BrowserRandomSource{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const a=typeof self<"u"?self.crypto||self.msCrypto:null;a&&a.getRandomValues!==void 0&&(this._crypto=a,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(a){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const $=new Uint8Array(a);for(let j=0;j<$.length;j+=QUOTA)this._crypto.getRandomValues($.subarray(j,j+Math.min($.length-j,QUOTA)));return $}}browser$a.BrowserRandomSource=BrowserRandomSource;function commonjsRequire(_){throw new Error('Could not dynamically require "'+_+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var node$2={},wipe$1={};Object.defineProperty(wipe$1,"__esModule",{value:!0});function wipe(_){for(var a=0;a<_.length;a++)_[a]=0;return _}wipe$1.wipe=wipe;var cryptoBrowserify={},browser$9={exports:{}},hasRequiredBrowser$8;function requireBrowser$8(){if(hasRequiredBrowser$8)return browser$9.exports;hasRequiredBrowser$8=1;var _=65536,a=4294967295;function $(){throw new Error(`Secure random number generation is not supported by this browser. +Use Chrome, Firefox or Internet Explorer 11`)}var j=safeBufferExports.Buffer,et=commonjsGlobal.crypto||commonjsGlobal.msCrypto;et&&et.getRandomValues?browser$9.exports=tt:browser$9.exports=$;function tt(rt,nt){if(rt>a)throw new RangeError("requested too many random bytes");var it=j.allocUnsafe(rt);if(rt>0)if(rt>_)for(var at=0;atet?nt=rt(nt):nt.lengthot){var ut=at==="rmd160"?new tt:rt(at);st=ut.update(st).digest()}else st.lengthMAX_ALLOC||a!==a)throw new TypeError("Bad key length")},defaultEncoding$2;if(commonjsGlobal.process&&commonjsGlobal.process.browser)defaultEncoding$2="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var pVersionMajor=parseInt(process$1$1.version.split(".")[0].slice(1),10);defaultEncoding$2=pVersionMajor>=6?"utf-8":"binary"}else defaultEncoding$2="utf-8";var defaultEncoding_1=defaultEncoding$2,Buffer$2=safeBufferExports.Buffer,toBuffer$4=function(_,a,$){if(Buffer$2.isBuffer(_))return _;if(typeof _=="string")return Buffer$2.from(_,a);if(ArrayBuffer.isView(_))return Buffer$2.from(_.buffer);throw new TypeError($+" must be a string, a Buffer, a typed array or a DataView")},md5$2=md5$3,RIPEMD160$1=ripemd160,sha$1=sha_jsExports,Buffer$1=safeBufferExports.Buffer,checkParameters$1=precondition,defaultEncoding$1=defaultEncoding_1,toBuffer$3=toBuffer$4,ZEROS=Buffer$1.alloc(128),sizes$1={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac$1(_,a,$){var j=getDigest(_),et=_==="sha512"||_==="sha384"?128:64;a.length>et?a=j(a):a.length>>0},utils$T.writeUInt32BE=function(et,tt,rt){et[0+rt]=tt>>>24,et[1+rt]=tt>>>16&255,et[2+rt]=tt>>>8&255,et[3+rt]=tt&255},utils$T.ip=function(et,tt,rt,nt){for(var it=0,at=0,st=6;st>=0;st-=2){for(var ot=0;ot<=24;ot+=8)it<<=1,it|=tt>>>ot+st&1;for(var ot=0;ot<=24;ot+=8)it<<=1,it|=et>>>ot+st&1}for(var st=6;st>=0;st-=2){for(var ot=1;ot<=25;ot+=8)at<<=1,at|=tt>>>ot+st&1;for(var ot=1;ot<=25;ot+=8)at<<=1,at|=et>>>ot+st&1}rt[nt+0]=it>>>0,rt[nt+1]=at>>>0},utils$T.rip=function(et,tt,rt,nt){for(var it=0,at=0,st=0;st<4;st++)for(var ot=24;ot>=0;ot-=8)it<<=1,it|=tt>>>ot+st&1,it<<=1,it|=et>>>ot+st&1;for(var st=4;st<8;st++)for(var ot=24;ot>=0;ot-=8)at<<=1,at|=tt>>>ot+st&1,at<<=1,at|=et>>>ot+st&1;rt[nt+0]=it>>>0,rt[nt+1]=at>>>0},utils$T.pc1=function(et,tt,rt,nt){for(var it=0,at=0,st=7;st>=5;st--){for(var ot=0;ot<=24;ot+=8)it<<=1,it|=tt>>ot+st&1;for(var ot=0;ot<=24;ot+=8)it<<=1,it|=et>>ot+st&1}for(var ot=0;ot<=24;ot+=8)it<<=1,it|=tt>>ot+st&1;for(var st=1;st<=3;st++){for(var ot=0;ot<=24;ot+=8)at<<=1,at|=tt>>ot+st&1;for(var ot=0;ot<=24;ot+=8)at<<=1,at|=et>>ot+st&1}for(var ot=0;ot<=24;ot+=8)at<<=1,at|=et>>ot+st&1;rt[nt+0]=it>>>0,rt[nt+1]=at>>>0},utils$T.r28shl=function(et,tt){return et<>>28-tt};var _=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$T.pc2=function(et,tt,rt,nt){for(var it=0,at=0,st=_.length>>>1,ot=0;ot>>_[ot]&1;for(var ot=st;ot<_.length;ot++)at<<=1,at|=tt>>>_[ot]&1;rt[nt+0]=it>>>0,rt[nt+1]=at>>>0},utils$T.expand=function(et,tt,rt){var nt=0,it=0;nt=(et&1)<<5|et>>>27;for(var at=23;at>=15;at-=4)nt<<=6,nt|=et>>>at&63;for(var at=11;at>=3;at-=4)it|=et>>>at&63,it<<=6;it|=(et&31)<<1|et>>>31,tt[rt+0]=nt>>>0,tt[rt+1]=it>>>0};var a=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$T.substitute=function(et,tt){for(var rt=0,nt=0;nt<4;nt++){var it=et>>>18-nt*6&63,at=a[nt*64+it];rt<<=4,rt|=at}for(var nt=0;nt<4;nt++){var it=tt>>>18-nt*6&63,at=a[4*64+nt*64+it];rt<<=4,rt|=at}return rt>>>0};var $=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$T.permute=function(et){for(var tt=0,rt=0;rt<$.length;rt++)tt<<=1,tt|=et>>>$[rt]&1;return tt>>>0},utils$T.padSplit=function(et,tt,rt){for(var nt=et.toString(2);nt.length0;rt--)et+=this._buffer(j,et),tt+=this._flushBuffer(nt,tt);return et+=this._buffer(j,et),nt},a.prototype.final=function(j){var et;j&&(et=this.update(j));var tt;return this.type==="encrypt"?tt=this._finalEncrypt():tt=this._finalDecrypt(),et?et.concat(tt):tt},a.prototype._pad=function(j,et){if(et===0)return!1;for(;et>>1];st=$.r28shl(st,dt),ot=$.r28shl(ot,dt),$.pc2(st,ot,it.keys,ut)}},tt.prototype._update=function(it,at,st,ot){var ut=this._desState,dt=$.readUInt32BE(it,at),mt=$.readUInt32BE(it,at+4);$.ip(dt,mt,ut.tmp,0),dt=ut.tmp[0],mt=ut.tmp[1],this.type==="encrypt"?this._encrypt(ut,dt,mt,ut.tmp,0):this._decrypt(ut,dt,mt,ut.tmp,0),dt=ut.tmp[0],mt=ut.tmp[1],$.writeUInt32BE(st,dt,ot),$.writeUInt32BE(st,mt,ot+4)},tt.prototype._pad=function(it,at){if(this.padding===!1)return!1;for(var st=it.length-at,ot=at;ot>>0,dt=Lt}$.rip(mt,dt,ot,ut)},tt.prototype._decrypt=function(it,at,st,ot,ut){for(var dt=st,mt=at,xt=it.keys.length-2;xt>=0;xt-=2){var Ct=it.keys[xt],Pt=it.keys[xt+1];$.expand(dt,it.tmp,0),Ct^=it.tmp[0],Pt^=it.tmp[1];var Tt=$.substitute(Ct,Pt),kt=$.permute(Tt),Lt=dt;dt=(mt^kt)>>>0,mt=Lt}$.rip(dt,mt,ot,ut)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var _=minimalisticAssert,a=inherits_browserExports,$={};function j(tt){_.equal(tt.length,8,"Invalid IV length"),this.iv=new Array(8);for(var rt=0;rt>nt%8,j._prev=$(j._prev,tt?st:ot);return at}function $(j,et){var tt=j.length,rt=-1,nt=_.allocUnsafe(j.length);for(j=_.concat([j,_.from([et])]);++rt>7;return nt}return cfb1.encrypt=function(j,et,tt){for(var rt=et.length,nt=_.allocUnsafe(rt),it=-1;++it>>24]^dt[Pt>>>16&255]^mt[Tt>>>8&255]^xt[kt&255]^it[Mt++],Nt=ut[Pt>>>24]^dt[Tt>>>16&255]^mt[kt>>>8&255]^xt[Ct&255]^it[Mt++],zt=ut[Tt>>>24]^dt[kt>>>16&255]^mt[Ct>>>8&255]^xt[Pt&255]^it[Mt++],jt=ut[kt>>>24]^dt[Ct>>>16&255]^mt[Pt>>>8&255]^xt[Tt&255]^it[Mt++],Ct=Lt,Pt=Nt,Tt=zt,kt=jt;return Lt=(st[Ct>>>24]<<24|st[Pt>>>16&255]<<16|st[Tt>>>8&255]<<8|st[kt&255])^it[Mt++],Nt=(st[Pt>>>24]<<24|st[Tt>>>16&255]<<16|st[kt>>>8&255]<<8|st[Ct&255])^it[Mt++],zt=(st[Tt>>>24]<<24|st[kt>>>16&255]<<16|st[Ct>>>8&255]<<8|st[Pt&255])^it[Mt++],jt=(st[kt>>>24]<<24|st[Ct>>>16&255]<<16|st[Pt>>>8&255]<<8|st[Tt&255])^it[Mt++],Lt=Lt>>>0,Nt=Nt>>>0,zt=zt>>>0,jt=jt>>>0,[Lt,Nt,zt,jt]}var et=[0,1,2,4,8,16,32,64,128,27,54],tt=function(){for(var nt=new Array(256),it=0;it<256;it++)it<128?nt[it]=it<<1:nt[it]=it<<1^283;for(var at=[],st=[],ot=[[],[],[],[]],ut=[[],[],[],[]],dt=0,mt=0,xt=0;xt<256;++xt){var Ct=mt^mt<<1^mt<<2^mt<<3^mt<<4;Ct=Ct>>>8^Ct&255^99,at[dt]=Ct,st[Ct]=dt;var Pt=nt[dt],Tt=nt[Pt],kt=nt[Tt],Lt=nt[Ct]*257^Ct*16843008;ot[0][dt]=Lt<<24|Lt>>>8,ot[1][dt]=Lt<<16|Lt>>>16,ot[2][dt]=Lt<<8|Lt>>>24,ot[3][dt]=Lt,Lt=kt*16843009^Tt*65537^Pt*257^dt*16843008,ut[0][Ct]=Lt<<24|Lt>>>8,ut[1][Ct]=Lt<<16|Lt>>>16,ut[2][Ct]=Lt<<8|Lt>>>24,ut[3][Ct]=Lt,dt===0?dt=mt=1:(dt=Pt^nt[nt[nt[kt^Pt]]],mt^=nt[nt[mt]])}return{SBOX:at,INV_SBOX:st,SUB_MIX:ot,INV_SUB_MIX:ut}}();function rt(nt){this._key=a(nt),this._reset()}return rt.blockSize=4*4,rt.keySize=256/8,rt.prototype.blockSize=rt.blockSize,rt.prototype.keySize=rt.keySize,rt.prototype._reset=function(){for(var nt=this._key,it=nt.length,at=it+6,st=(at+1)*4,ot=[],ut=0;ut>>24,dt=tt.SBOX[dt>>>24]<<24|tt.SBOX[dt>>>16&255]<<16|tt.SBOX[dt>>>8&255]<<8|tt.SBOX[dt&255],dt^=et[ut/it|0]<<24):it>6&&ut%it===4&&(dt=tt.SBOX[dt>>>24]<<24|tt.SBOX[dt>>>16&255]<<16|tt.SBOX[dt>>>8&255]<<8|tt.SBOX[dt&255]),ot[ut]=ot[ut-it]^dt}for(var mt=[],xt=0;xt>>24]]^tt.INV_SUB_MIX[1][tt.SBOX[Pt>>>16&255]]^tt.INV_SUB_MIX[2][tt.SBOX[Pt>>>8&255]]^tt.INV_SUB_MIX[3][tt.SBOX[Pt&255]]}this._nRounds=at,this._keySchedule=ot,this._invKeySchedule=mt},rt.prototype.encryptBlockRaw=function(nt){return nt=a(nt),j(nt,this._keySchedule,tt.SUB_MIX,tt.SBOX,this._nRounds)},rt.prototype.encryptBlock=function(nt){var it=this.encryptBlockRaw(nt),at=_.allocUnsafe(16);return at.writeUInt32BE(it[0],0),at.writeUInt32BE(it[1],4),at.writeUInt32BE(it[2],8),at.writeUInt32BE(it[3],12),at},rt.prototype.decryptBlock=function(nt){nt=a(nt);var it=nt[1];nt[1]=nt[3],nt[3]=it;var at=j(nt,this._invKeySchedule,tt.INV_SUB_MIX,tt.INV_SBOX,this._nRounds),st=_.allocUnsafe(16);return st.writeUInt32BE(at[0],0),st.writeUInt32BE(at[3],4),st.writeUInt32BE(at[2],8),st.writeUInt32BE(at[1],12),st},rt.prototype.scrub=function(){$(this._keySchedule),$(this._invKeySchedule),$(this._key)},aes.AES=rt,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var _=safeBufferExports.Buffer,a=_.alloc(16,0);function $(tt){return[tt.readUInt32BE(0),tt.readUInt32BE(4),tt.readUInt32BE(8),tt.readUInt32BE(12)]}function j(tt){var rt=_.allocUnsafe(16);return rt.writeUInt32BE(tt[0]>>>0,0),rt.writeUInt32BE(tt[1]>>>0,4),rt.writeUInt32BE(tt[2]>>>0,8),rt.writeUInt32BE(tt[3]>>>0,12),rt}function et(tt){this.h=tt,this.state=_.alloc(16,0),this.cache=_.allocUnsafe(0)}return et.prototype.ghash=function(tt){for(var rt=-1;++rt0;nt--)tt[nt]=tt[nt]>>>1|(tt[nt-1]&1)<<31;tt[0]=tt[0]>>>1,at&&(tt[0]=tt[0]^225<<24)}this.state=j(rt)},et.prototype.update=function(tt){this.cache=_.concat([this.cache,tt]);for(var rt;this.cache.length>=16;)rt=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(rt)},et.prototype.final=function(tt,rt){return this.cache.length&&this.ghash(_.concat([this.cache,a],16)),this.ghash(j([0,tt,0,rt])),this.state},ghash=et,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var _=requireAes(),a=safeBufferExports.Buffer,$=cipherBase,j=inherits_browserExports,et=requireGhash(),tt=requireBufferXor(),rt=requireIncr32();function nt(st,ot){var ut=0;st.length!==ot.length&&ut++;for(var dt=Math.min(st.length,ot.length),mt=0;mt0||rt>0;){var ot=new a;ot.update(st),ot.update(j),et&&ot.update(et),st=ot.digest();var ut=0;if(nt>0){var dt=it.length-nt;ut=Math.min(nt,st.length),st.copy(it,dt,0,ut),nt-=ut}if(ut0){var mt=at.length-rt,xt=Math.min(rt,st.length-ut);st.copy(at,mt,ut,ut+xt),rt-=xt}}return st.fill(0),{key:it,iv:at}}return evp_bytestokey=$,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var _=requireModes$1(),a=requireAuthCipher(),$=safeBufferExports.Buffer,j=requireStreamCipher(),et=cipherBase,tt=requireAes(),rt=requireEvp_bytestokey(),nt=inherits_browserExports;function it(dt,mt,xt){et.call(this),this._cache=new st,this._cipher=new tt.AES(mt),this._prev=$.from(xt),this._mode=dt,this._autopadding=!0}nt(it,et),it.prototype._update=function(dt){this._cache.add(dt);for(var mt,xt,Ct=[];mt=this._cache.get();)xt=this._mode.encrypt(this,mt),Ct.push(xt);return $.concat(Ct)};var at=$.alloc(16,16);it.prototype._final=function(){var dt=this._cache.flush();if(this._autopadding)return dt=this._mode.encrypt(this,dt),this._cipher.scrub(),dt;if(!dt.equals(at))throw this._cipher.scrub(),new Error("data not multiple of block length")},it.prototype.setAutoPadding=function(dt){return this._autopadding=!!dt,this};function st(){this.cache=$.allocUnsafe(0)}st.prototype.add=function(dt){this.cache=$.concat([this.cache,dt])},st.prototype.get=function(){if(this.cache.length>15){var dt=this.cache.slice(0,16);return this.cache=this.cache.slice(16),dt}return null},st.prototype.flush=function(){for(var dt=16-this.cache.length,mt=$.allocUnsafe(dt),xt=-1;++xt16)return mt=this.cache.slice(0,16),this.cache=this.cache.slice(16),mt}else if(this.cache.length>=16)return mt=this.cache.slice(0,16),this.cache=this.cache.slice(16),mt;return null},at.prototype.flush=function(){if(this.cache.length)return this.cache};function st(dt){var mt=dt[15];if(mt<1||mt>16)throw new Error("unable to decrypt data");for(var xt=-1;++xt0?yt:bt},tt.min=function(yt,bt){return yt.cmp(bt)<0?yt:bt},tt.prototype._init=function(yt,bt,ct){if(typeof yt=="number")return this._initNumber(yt,bt,ct);if(typeof yt=="object")return this._initArray(yt,bt,ct);bt==="hex"&&(bt=16),j(bt===(bt|0)&&bt>=2&&bt<=36),yt=yt.toString().replace(/\s+/g,"");var ht=0;yt[0]==="-"&&(ht++,this.negative=1),ht=0;ht-=3)St=yt[ht]|yt[ht-1]<<8|yt[ht-2]<<16,this.words[vt]|=St<>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);else if(ct==="le")for(ht=0,vt=0;ht>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);return this.strip()};function nt(Bt,yt){var bt=Bt.charCodeAt(yt);return bt>=65&&bt<=70?bt-55:bt>=97&&bt<=102?bt-87:bt-48&15}function it(Bt,yt,bt){var ct=nt(Bt,bt);return bt-1>=yt&&(ct|=nt(Bt,bt-1)<<4),ct}tt.prototype._parseHex=function(yt,bt,ct){this.length=Math.ceil((yt.length-bt)/6),this.words=new Array(this.length);for(var ht=0;ht=bt;ht-=2)Rt=it(yt,bt,ht)<=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8;else{var $t=yt.length-bt;for(ht=$t%2===0?bt+1:bt;ht=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8}this.strip()};function at(Bt,yt,bt,ct){for(var ht=0,vt=Math.min(Bt.length,bt),St=yt;St=49?ht+=Rt-49+10:Rt>=17?ht+=Rt-17+10:ht+=Rt}return ht}tt.prototype._parseBase=function(yt,bt,ct){this.words=[0],this.length=1;for(var ht=0,vt=1;vt<=67108863;vt*=bt)ht++;ht--,vt=vt/bt|0;for(var St=yt.length-ct,Rt=St%ht,$t=Math.min(St,St-Rt)+ct,Et=0,At=ct;At<$t;At+=ht)Et=at(yt,At,At+ht,bt),this.imuln(vt),this.words[0]+Et<67108864?this.words[0]+=Et:this._iaddn(Et);if(Rt!==0){var wt=1;for(Et=at(yt,At,yt.length,bt),At=0;At1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},tt.prototype.inspect=function(){return(this.red?""};var st=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ot=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ut=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(yt,bt){yt=yt||10,bt=bt|0||1;var ct;if(yt===16||yt==="hex"){ct="";for(var ht=0,vt=0,St=0;St>>24-ht&16777215,vt!==0||St!==this.length-1?ct=st[6-$t.length]+$t+ct:ct=$t+ct,ht+=2,ht>=26&&(ht-=26,St--)}for(vt!==0&&(ct=vt.toString(16)+ct);ct.length%bt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}if(yt===(yt|0)&&yt>=2&&yt<=36){var Et=ot[yt],At=ut[yt];ct="";var wt=this.clone();for(wt.negative=0;!wt.isZero();){var Ot=wt.modn(At).toString(yt);wt=wt.idivn(At),wt.isZero()?ct=Ot+ct:ct=st[Et-Ot.length]+Ot+ct}for(this.isZero()&&(ct="0"+ct);ct.length%bt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var yt=this.words[0];return this.length===2?yt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?yt+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-yt:yt},tt.prototype.toJSON=function(){return this.toString(16)},tt.prototype.toBuffer=function(yt,bt){return j(typeof rt<"u"),this.toArrayLike(rt,yt,bt)},tt.prototype.toArray=function(yt,bt){return this.toArrayLike(Array,yt,bt)},tt.prototype.toArrayLike=function(yt,bt,ct){var ht=this.byteLength(),vt=ct||Math.max(1,ht);j(ht<=vt,"byte array longer than desired length"),j(vt>0,"Requested array length <= 0"),this.strip();var St=bt==="le",Rt=new yt(vt),$t,Et,At=this.clone();if(St){for(Et=0;!At.isZero();Et++)$t=At.andln(255),At.iushrn(8),Rt[Et]=$t;for(;Et=4096&&(ct+=13,bt>>>=13),bt>=64&&(ct+=7,bt>>>=7),bt>=8&&(ct+=4,bt>>>=4),bt>=2&&(ct+=2,bt>>>=2),ct+bt},tt.prototype._zeroBits=function(yt){if(yt===0)return 26;var bt=yt,ct=0;return bt&8191||(ct+=13,bt>>>=13),bt&127||(ct+=7,bt>>>=7),bt&15||(ct+=4,bt>>>=4),bt&3||(ct+=2,bt>>>=2),bt&1||ct++,ct},tt.prototype.bitLength=function(){var yt=this.words[this.length-1],bt=this._countBits(yt);return(this.length-1)*26+bt};function dt(Bt){for(var yt=new Array(Bt.bitLength()),bt=0;bt>>ht}return yt}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var yt=0,bt=0;btyt.length?this.clone().ior(yt):yt.clone().ior(this)},tt.prototype.uor=function(yt){return this.length>yt.length?this.clone().iuor(yt):yt.clone().iuor(this)},tt.prototype.iuand=function(yt){var bt;this.length>yt.length?bt=yt:bt=this;for(var ct=0;ctyt.length?this.clone().iand(yt):yt.clone().iand(this)},tt.prototype.uand=function(yt){return this.length>yt.length?this.clone().iuand(yt):yt.clone().iuand(this)},tt.prototype.iuxor=function(yt){var bt,ct;this.length>yt.length?(bt=this,ct=yt):(bt=yt,ct=this);for(var ht=0;htyt.length?this.clone().ixor(yt):yt.clone().ixor(this)},tt.prototype.uxor=function(yt){return this.length>yt.length?this.clone().iuxor(yt):yt.clone().iuxor(this)},tt.prototype.inotn=function(yt){j(typeof yt=="number"&&yt>=0);var bt=Math.ceil(yt/26)|0,ct=yt%26;this._expand(bt),ct>0&&bt--;for(var ht=0;ht0&&(this.words[ht]=~this.words[ht]&67108863>>26-ct),this.strip()},tt.prototype.notn=function(yt){return this.clone().inotn(yt)},tt.prototype.setn=function(yt,bt){j(typeof yt=="number"&&yt>=0);var ct=yt/26|0,ht=yt%26;return this._expand(ct+1),bt?this.words[ct]=this.words[ct]|1<yt.length?(ct=this,ht=yt):(ct=yt,ht=this);for(var vt=0,St=0;St>>26;for(;vt!==0&&St>>26;if(this.length=ct.length,vt!==0)this.words[this.length]=vt,this.length++;else if(ct!==this)for(;Styt.length?this.clone().iadd(yt):yt.clone().iadd(this)},tt.prototype.isub=function(yt){if(yt.negative!==0){yt.negative=0;var bt=this.iadd(yt);return yt.negative=1,bt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(yt),this.negative=1,this._normSign();var ct=this.cmp(yt);if(ct===0)return this.negative=0,this.length=1,this.words[0]=0,this;var ht,vt;ct>0?(ht=this,vt=yt):(ht=yt,vt=this);for(var St=0,Rt=0;Rt>26,this.words[Rt]=bt&67108863;for(;St!==0&&Rt>26,this.words[Rt]=bt&67108863;if(St===0&&Rt>>26,wt=$t&67108863,Ot=Math.min(Et,yt.length-1),tr=Math.max(0,Et-Bt.length+1);tr<=Ot;tr++){var nr=Et-tr|0;ht=Bt.words[nr]|0,vt=yt.words[tr]|0,St=ht*vt+wt,At+=St/67108864|0,wt=St&67108863}bt.words[Et]=wt|0,$t=At|0}return $t!==0?bt.words[Et]=$t|0:bt.length--,bt.strip()}var xt=function(yt,bt,ct){var ht=yt.words,vt=bt.words,St=ct.words,Rt=0,$t,Et,At,wt=ht[0]|0,Ot=wt&8191,tr=wt>>>13,nr=ht[1]|0,ir=nr&8191,Wt=nr>>>13,Kt=ht[2]|0,Jt=Kt&8191,Ht=Kt>>>13,Vt=ht[3]|0,Qt=Vt&8191,dr=Vt>>>13,xr=ht[4]|0,pr=xr&8191,Ir=xr>>>13,kr=ht[5]|0,lr=kr&8191,fr=kr>>>13,Er=ht[6]|0,$r=Er&8191,Pr=Er>>>13,Rr=ht[7]|0,Ar=Rr&8191,Or=Rr>>>13,Lr=ht[8]|0,ar=Lr&8191,Yt=Lr>>>13,er=ht[9]|0,Zt=er&8191,qt=er>>>13,Gt=vt[0]|0,or=Gt&8191,vr=Gt>>>13,wr=vt[1]|0,Sr=wr&8191,Wr=wr>>>13,Hr=vt[2]|0,Fr=Hr&8191,pn=Hr>>>13,Jr=vt[3]|0,Qr=Jr&8191,mn=Jr>>>13,ln=vt[4]|0,Vr=ln&8191,wn=ln>>>13,un=vt[5]|0,qr=un&8191,hn=un>>>13,fn=vt[6]|0,Kr=fn&8191,$n=fn>>>13,dn=vt[7]|0,Gr=dn&8191,gn=dn>>>13,an=vt[8]|0,Zr=an&8191,Rn=an>>>13,Sn=vt[9]|0,nn=Sn&8191,Tn=Sn>>>13;ct.negative=yt.negative^bt.negative,ct.length=19,$t=Math.imul(Ot,or),Et=Math.imul(Ot,vr),Et=Et+Math.imul(tr,or)|0,At=Math.imul(tr,vr);var yn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(yn>>>26)|0,yn&=67108863,$t=Math.imul(ir,or),Et=Math.imul(ir,vr),Et=Et+Math.imul(Wt,or)|0,At=Math.imul(Wt,vr),$t=$t+Math.imul(Ot,Sr)|0,Et=Et+Math.imul(Ot,Wr)|0,Et=Et+Math.imul(tr,Sr)|0,At=At+Math.imul(tr,Wr)|0;var En=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(En>>>26)|0,En&=67108863,$t=Math.imul(Jt,or),Et=Math.imul(Jt,vr),Et=Et+Math.imul(Ht,or)|0,At=Math.imul(Ht,vr),$t=$t+Math.imul(ir,Sr)|0,Et=Et+Math.imul(ir,Wr)|0,Et=Et+Math.imul(Wt,Sr)|0,At=At+Math.imul(Wt,Wr)|0,$t=$t+Math.imul(Ot,Fr)|0,Et=Et+Math.imul(Ot,pn)|0,Et=Et+Math.imul(tr,Fr)|0,At=At+Math.imul(tr,pn)|0;var ds=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ds>>>26)|0,ds&=67108863,$t=Math.imul(Qt,or),Et=Math.imul(Qt,vr),Et=Et+Math.imul(dr,or)|0,At=Math.imul(dr,vr),$t=$t+Math.imul(Jt,Sr)|0,Et=Et+Math.imul(Jt,Wr)|0,Et=Et+Math.imul(Ht,Sr)|0,At=At+Math.imul(Ht,Wr)|0,$t=$t+Math.imul(ir,Fr)|0,Et=Et+Math.imul(ir,pn)|0,Et=Et+Math.imul(Wt,Fr)|0,At=At+Math.imul(Wt,pn)|0,$t=$t+Math.imul(Ot,Qr)|0,Et=Et+Math.imul(Ot,mn)|0,Et=Et+Math.imul(tr,Qr)|0,At=At+Math.imul(tr,mn)|0;var fs=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(fs>>>26)|0,fs&=67108863,$t=Math.imul(pr,or),Et=Math.imul(pr,vr),Et=Et+Math.imul(Ir,or)|0,At=Math.imul(Ir,vr),$t=$t+Math.imul(Qt,Sr)|0,Et=Et+Math.imul(Qt,Wr)|0,Et=Et+Math.imul(dr,Sr)|0,At=At+Math.imul(dr,Wr)|0,$t=$t+Math.imul(Jt,Fr)|0,Et=Et+Math.imul(Jt,pn)|0,Et=Et+Math.imul(Ht,Fr)|0,At=At+Math.imul(Ht,pn)|0,$t=$t+Math.imul(ir,Qr)|0,Et=Et+Math.imul(ir,mn)|0,Et=Et+Math.imul(Wt,Qr)|0,At=At+Math.imul(Wt,mn)|0,$t=$t+Math.imul(Ot,Vr)|0,Et=Et+Math.imul(Ot,wn)|0,Et=Et+Math.imul(tr,Vr)|0,At=At+Math.imul(tr,wn)|0;var hs=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(hs>>>26)|0,hs&=67108863,$t=Math.imul(lr,or),Et=Math.imul(lr,vr),Et=Et+Math.imul(fr,or)|0,At=Math.imul(fr,vr),$t=$t+Math.imul(pr,Sr)|0,Et=Et+Math.imul(pr,Wr)|0,Et=Et+Math.imul(Ir,Sr)|0,At=At+Math.imul(Ir,Wr)|0,$t=$t+Math.imul(Qt,Fr)|0,Et=Et+Math.imul(Qt,pn)|0,Et=Et+Math.imul(dr,Fr)|0,At=At+Math.imul(dr,pn)|0,$t=$t+Math.imul(Jt,Qr)|0,Et=Et+Math.imul(Jt,mn)|0,Et=Et+Math.imul(Ht,Qr)|0,At=At+Math.imul(Ht,mn)|0,$t=$t+Math.imul(ir,Vr)|0,Et=Et+Math.imul(ir,wn)|0,Et=Et+Math.imul(Wt,Vr)|0,At=At+Math.imul(Wt,wn)|0,$t=$t+Math.imul(Ot,qr)|0,Et=Et+Math.imul(Ot,hn)|0,Et=Et+Math.imul(tr,qr)|0,At=At+Math.imul(tr,hn)|0;var ps=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ps>>>26)|0,ps&=67108863,$t=Math.imul($r,or),Et=Math.imul($r,vr),Et=Et+Math.imul(Pr,or)|0,At=Math.imul(Pr,vr),$t=$t+Math.imul(lr,Sr)|0,Et=Et+Math.imul(lr,Wr)|0,Et=Et+Math.imul(fr,Sr)|0,At=At+Math.imul(fr,Wr)|0,$t=$t+Math.imul(pr,Fr)|0,Et=Et+Math.imul(pr,pn)|0,Et=Et+Math.imul(Ir,Fr)|0,At=At+Math.imul(Ir,pn)|0,$t=$t+Math.imul(Qt,Qr)|0,Et=Et+Math.imul(Qt,mn)|0,Et=Et+Math.imul(dr,Qr)|0,At=At+Math.imul(dr,mn)|0,$t=$t+Math.imul(Jt,Vr)|0,Et=Et+Math.imul(Jt,wn)|0,Et=Et+Math.imul(Ht,Vr)|0,At=At+Math.imul(Ht,wn)|0,$t=$t+Math.imul(ir,qr)|0,Et=Et+Math.imul(ir,hn)|0,Et=Et+Math.imul(Wt,qr)|0,At=At+Math.imul(Wt,hn)|0,$t=$t+Math.imul(Ot,Kr)|0,Et=Et+Math.imul(Ot,$n)|0,Et=Et+Math.imul(tr,Kr)|0,At=At+Math.imul(tr,$n)|0;var qn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(qn>>>26)|0,qn&=67108863,$t=Math.imul(Ar,or),Et=Math.imul(Ar,vr),Et=Et+Math.imul(Or,or)|0,At=Math.imul(Or,vr),$t=$t+Math.imul($r,Sr)|0,Et=Et+Math.imul($r,Wr)|0,Et=Et+Math.imul(Pr,Sr)|0,At=At+Math.imul(Pr,Wr)|0,$t=$t+Math.imul(lr,Fr)|0,Et=Et+Math.imul(lr,pn)|0,Et=Et+Math.imul(fr,Fr)|0,At=At+Math.imul(fr,pn)|0,$t=$t+Math.imul(pr,Qr)|0,Et=Et+Math.imul(pr,mn)|0,Et=Et+Math.imul(Ir,Qr)|0,At=At+Math.imul(Ir,mn)|0,$t=$t+Math.imul(Qt,Vr)|0,Et=Et+Math.imul(Qt,wn)|0,Et=Et+Math.imul(dr,Vr)|0,At=At+Math.imul(dr,wn)|0,$t=$t+Math.imul(Jt,qr)|0,Et=Et+Math.imul(Jt,hn)|0,Et=Et+Math.imul(Ht,qr)|0,At=At+Math.imul(Ht,hn)|0,$t=$t+Math.imul(ir,Kr)|0,Et=Et+Math.imul(ir,$n)|0,Et=Et+Math.imul(Wt,Kr)|0,At=At+Math.imul(Wt,$n)|0,$t=$t+Math.imul(Ot,Gr)|0,Et=Et+Math.imul(Ot,gn)|0,Et=Et+Math.imul(tr,Gr)|0,At=At+Math.imul(tr,gn)|0;var ss=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ss>>>26)|0,ss&=67108863,$t=Math.imul(ar,or),Et=Math.imul(ar,vr),Et=Et+Math.imul(Yt,or)|0,At=Math.imul(Yt,vr),$t=$t+Math.imul(Ar,Sr)|0,Et=Et+Math.imul(Ar,Wr)|0,Et=Et+Math.imul(Or,Sr)|0,At=At+Math.imul(Or,Wr)|0,$t=$t+Math.imul($r,Fr)|0,Et=Et+Math.imul($r,pn)|0,Et=Et+Math.imul(Pr,Fr)|0,At=At+Math.imul(Pr,pn)|0,$t=$t+Math.imul(lr,Qr)|0,Et=Et+Math.imul(lr,mn)|0,Et=Et+Math.imul(fr,Qr)|0,At=At+Math.imul(fr,mn)|0,$t=$t+Math.imul(pr,Vr)|0,Et=Et+Math.imul(pr,wn)|0,Et=Et+Math.imul(Ir,Vr)|0,At=At+Math.imul(Ir,wn)|0,$t=$t+Math.imul(Qt,qr)|0,Et=Et+Math.imul(Qt,hn)|0,Et=Et+Math.imul(dr,qr)|0,At=At+Math.imul(dr,hn)|0,$t=$t+Math.imul(Jt,Kr)|0,Et=Et+Math.imul(Jt,$n)|0,Et=Et+Math.imul(Ht,Kr)|0,At=At+Math.imul(Ht,$n)|0,$t=$t+Math.imul(ir,Gr)|0,Et=Et+Math.imul(ir,gn)|0,Et=Et+Math.imul(Wt,Gr)|0,At=At+Math.imul(Wt,gn)|0,$t=$t+Math.imul(Ot,Zr)|0,Et=Et+Math.imul(Ot,Rn)|0,Et=Et+Math.imul(tr,Zr)|0,At=At+Math.imul(tr,Rn)|0;var Jn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,$t=Math.imul(Zt,or),Et=Math.imul(Zt,vr),Et=Et+Math.imul(qt,or)|0,At=Math.imul(qt,vr),$t=$t+Math.imul(ar,Sr)|0,Et=Et+Math.imul(ar,Wr)|0,Et=Et+Math.imul(Yt,Sr)|0,At=At+Math.imul(Yt,Wr)|0,$t=$t+Math.imul(Ar,Fr)|0,Et=Et+Math.imul(Ar,pn)|0,Et=Et+Math.imul(Or,Fr)|0,At=At+Math.imul(Or,pn)|0,$t=$t+Math.imul($r,Qr)|0,Et=Et+Math.imul($r,mn)|0,Et=Et+Math.imul(Pr,Qr)|0,At=At+Math.imul(Pr,mn)|0,$t=$t+Math.imul(lr,Vr)|0,Et=Et+Math.imul(lr,wn)|0,Et=Et+Math.imul(fr,Vr)|0,At=At+Math.imul(fr,wn)|0,$t=$t+Math.imul(pr,qr)|0,Et=Et+Math.imul(pr,hn)|0,Et=Et+Math.imul(Ir,qr)|0,At=At+Math.imul(Ir,hn)|0,$t=$t+Math.imul(Qt,Kr)|0,Et=Et+Math.imul(Qt,$n)|0,Et=Et+Math.imul(dr,Kr)|0,At=At+Math.imul(dr,$n)|0,$t=$t+Math.imul(Jt,Gr)|0,Et=Et+Math.imul(Jt,gn)|0,Et=Et+Math.imul(Ht,Gr)|0,At=At+Math.imul(Ht,gn)|0,$t=$t+Math.imul(ir,Zr)|0,Et=Et+Math.imul(ir,Rn)|0,Et=Et+Math.imul(Wt,Zr)|0,At=At+Math.imul(Wt,Rn)|0,$t=$t+Math.imul(Ot,nn)|0,Et=Et+Math.imul(Ot,Tn)|0,Et=Et+Math.imul(tr,nn)|0,At=At+Math.imul(tr,Tn)|0;var Yn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,$t=Math.imul(Zt,Sr),Et=Math.imul(Zt,Wr),Et=Et+Math.imul(qt,Sr)|0,At=Math.imul(qt,Wr),$t=$t+Math.imul(ar,Fr)|0,Et=Et+Math.imul(ar,pn)|0,Et=Et+Math.imul(Yt,Fr)|0,At=At+Math.imul(Yt,pn)|0,$t=$t+Math.imul(Ar,Qr)|0,Et=Et+Math.imul(Ar,mn)|0,Et=Et+Math.imul(Or,Qr)|0,At=At+Math.imul(Or,mn)|0,$t=$t+Math.imul($r,Vr)|0,Et=Et+Math.imul($r,wn)|0,Et=Et+Math.imul(Pr,Vr)|0,At=At+Math.imul(Pr,wn)|0,$t=$t+Math.imul(lr,qr)|0,Et=Et+Math.imul(lr,hn)|0,Et=Et+Math.imul(fr,qr)|0,At=At+Math.imul(fr,hn)|0,$t=$t+Math.imul(pr,Kr)|0,Et=Et+Math.imul(pr,$n)|0,Et=Et+Math.imul(Ir,Kr)|0,At=At+Math.imul(Ir,$n)|0,$t=$t+Math.imul(Qt,Gr)|0,Et=Et+Math.imul(Qt,gn)|0,Et=Et+Math.imul(dr,Gr)|0,At=At+Math.imul(dr,gn)|0,$t=$t+Math.imul(Jt,Zr)|0,Et=Et+Math.imul(Jt,Rn)|0,Et=Et+Math.imul(Ht,Zr)|0,At=At+Math.imul(Ht,Rn)|0,$t=$t+Math.imul(ir,nn)|0,Et=Et+Math.imul(ir,Tn)|0,Et=Et+Math.imul(Wt,nn)|0,At=At+Math.imul(Wt,Tn)|0;var ms=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ms>>>26)|0,ms&=67108863,$t=Math.imul(Zt,Fr),Et=Math.imul(Zt,pn),Et=Et+Math.imul(qt,Fr)|0,At=Math.imul(qt,pn),$t=$t+Math.imul(ar,Qr)|0,Et=Et+Math.imul(ar,mn)|0,Et=Et+Math.imul(Yt,Qr)|0,At=At+Math.imul(Yt,mn)|0,$t=$t+Math.imul(Ar,Vr)|0,Et=Et+Math.imul(Ar,wn)|0,Et=Et+Math.imul(Or,Vr)|0,At=At+Math.imul(Or,wn)|0,$t=$t+Math.imul($r,qr)|0,Et=Et+Math.imul($r,hn)|0,Et=Et+Math.imul(Pr,qr)|0,At=At+Math.imul(Pr,hn)|0,$t=$t+Math.imul(lr,Kr)|0,Et=Et+Math.imul(lr,$n)|0,Et=Et+Math.imul(fr,Kr)|0,At=At+Math.imul(fr,$n)|0,$t=$t+Math.imul(pr,Gr)|0,Et=Et+Math.imul(pr,gn)|0,Et=Et+Math.imul(Ir,Gr)|0,At=At+Math.imul(Ir,gn)|0,$t=$t+Math.imul(Qt,Zr)|0,Et=Et+Math.imul(Qt,Rn)|0,Et=Et+Math.imul(dr,Zr)|0,At=At+Math.imul(dr,Rn)|0,$t=$t+Math.imul(Jt,nn)|0,Et=Et+Math.imul(Jt,Tn)|0,Et=Et+Math.imul(Ht,nn)|0,At=At+Math.imul(Ht,Tn)|0;var Qn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,$t=Math.imul(Zt,Qr),Et=Math.imul(Zt,mn),Et=Et+Math.imul(qt,Qr)|0,At=Math.imul(qt,mn),$t=$t+Math.imul(ar,Vr)|0,Et=Et+Math.imul(ar,wn)|0,Et=Et+Math.imul(Yt,Vr)|0,At=At+Math.imul(Yt,wn)|0,$t=$t+Math.imul(Ar,qr)|0,Et=Et+Math.imul(Ar,hn)|0,Et=Et+Math.imul(Or,qr)|0,At=At+Math.imul(Or,hn)|0,$t=$t+Math.imul($r,Kr)|0,Et=Et+Math.imul($r,$n)|0,Et=Et+Math.imul(Pr,Kr)|0,At=At+Math.imul(Pr,$n)|0,$t=$t+Math.imul(lr,Gr)|0,Et=Et+Math.imul(lr,gn)|0,Et=Et+Math.imul(fr,Gr)|0,At=At+Math.imul(fr,gn)|0,$t=$t+Math.imul(pr,Zr)|0,Et=Et+Math.imul(pr,Rn)|0,Et=Et+Math.imul(Ir,Zr)|0,At=At+Math.imul(Ir,Rn)|0,$t=$t+Math.imul(Qt,nn)|0,Et=Et+Math.imul(Qt,Tn)|0,Et=Et+Math.imul(dr,nn)|0,At=At+Math.imul(dr,Tn)|0;var es=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(es>>>26)|0,es&=67108863,$t=Math.imul(Zt,Vr),Et=Math.imul(Zt,wn),Et=Et+Math.imul(qt,Vr)|0,At=Math.imul(qt,wn),$t=$t+Math.imul(ar,qr)|0,Et=Et+Math.imul(ar,hn)|0,Et=Et+Math.imul(Yt,qr)|0,At=At+Math.imul(Yt,hn)|0,$t=$t+Math.imul(Ar,Kr)|0,Et=Et+Math.imul(Ar,$n)|0,Et=Et+Math.imul(Or,Kr)|0,At=At+Math.imul(Or,$n)|0,$t=$t+Math.imul($r,Gr)|0,Et=Et+Math.imul($r,gn)|0,Et=Et+Math.imul(Pr,Gr)|0,At=At+Math.imul(Pr,gn)|0,$t=$t+Math.imul(lr,Zr)|0,Et=Et+Math.imul(lr,Rn)|0,Et=Et+Math.imul(fr,Zr)|0,At=At+Math.imul(fr,Rn)|0,$t=$t+Math.imul(pr,nn)|0,Et=Et+Math.imul(pr,Tn)|0,Et=Et+Math.imul(Ir,nn)|0,At=At+Math.imul(Ir,Tn)|0;var ls=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ls>>>26)|0,ls&=67108863,$t=Math.imul(Zt,qr),Et=Math.imul(Zt,hn),Et=Et+Math.imul(qt,qr)|0,At=Math.imul(qt,hn),$t=$t+Math.imul(ar,Kr)|0,Et=Et+Math.imul(ar,$n)|0,Et=Et+Math.imul(Yt,Kr)|0,At=At+Math.imul(Yt,$n)|0,$t=$t+Math.imul(Ar,Gr)|0,Et=Et+Math.imul(Ar,gn)|0,Et=Et+Math.imul(Or,Gr)|0,At=At+Math.imul(Or,gn)|0,$t=$t+Math.imul($r,Zr)|0,Et=Et+Math.imul($r,Rn)|0,Et=Et+Math.imul(Pr,Zr)|0,At=At+Math.imul(Pr,Rn)|0,$t=$t+Math.imul(lr,nn)|0,Et=Et+Math.imul(lr,Tn)|0,Et=Et+Math.imul(fr,nn)|0,At=At+Math.imul(fr,Tn)|0;var us=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(us>>>26)|0,us&=67108863,$t=Math.imul(Zt,Kr),Et=Math.imul(Zt,$n),Et=Et+Math.imul(qt,Kr)|0,At=Math.imul(qt,$n),$t=$t+Math.imul(ar,Gr)|0,Et=Et+Math.imul(ar,gn)|0,Et=Et+Math.imul(Yt,Gr)|0,At=At+Math.imul(Yt,gn)|0,$t=$t+Math.imul(Ar,Zr)|0,Et=Et+Math.imul(Ar,Rn)|0,Et=Et+Math.imul(Or,Zr)|0,At=At+Math.imul(Or,Rn)|0,$t=$t+Math.imul($r,nn)|0,Et=Et+Math.imul($r,Tn)|0,Et=Et+Math.imul(Pr,nn)|0,At=At+Math.imul(Pr,Tn)|0;var Wn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,$t=Math.imul(Zt,Gr),Et=Math.imul(Zt,gn),Et=Et+Math.imul(qt,Gr)|0,At=Math.imul(qt,gn),$t=$t+Math.imul(ar,Zr)|0,Et=Et+Math.imul(ar,Rn)|0,Et=Et+Math.imul(Yt,Zr)|0,At=At+Math.imul(Yt,Rn)|0,$t=$t+Math.imul(Ar,nn)|0,Et=Et+Math.imul(Ar,Tn)|0,Et=Et+Math.imul(Or,nn)|0,At=At+Math.imul(Or,Tn)|0;var os=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(os>>>26)|0,os&=67108863,$t=Math.imul(Zt,Zr),Et=Math.imul(Zt,Rn),Et=Et+Math.imul(qt,Zr)|0,At=Math.imul(qt,Rn),$t=$t+Math.imul(ar,nn)|0,Et=Et+Math.imul(ar,Tn)|0,Et=Et+Math.imul(Yt,nn)|0,At=At+Math.imul(Yt,Tn)|0;var gs=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(gs>>>26)|0,gs&=67108863,$t=Math.imul(Zt,nn),Et=Math.imul(Zt,Tn),Et=Et+Math.imul(qt,nn)|0,At=Math.imul(qt,Tn);var bs=(Rt+$t|0)+((Et&8191)<<13)|0;return Rt=(At+(Et>>>13)|0)+(bs>>>26)|0,bs&=67108863,St[0]=yn,St[1]=En,St[2]=ds,St[3]=fs,St[4]=hs,St[5]=ps,St[6]=qn,St[7]=ss,St[8]=Jn,St[9]=Yn,St[10]=ms,St[11]=Qn,St[12]=es,St[13]=ls,St[14]=us,St[15]=Wn,St[16]=os,St[17]=gs,St[18]=bs,Rt!==0&&(St[19]=Rt,ct.length++),ct};Math.imul||(xt=mt);function Ct(Bt,yt,bt){bt.negative=yt.negative^Bt.negative,bt.length=Bt.length+yt.length;for(var ct=0,ht=0,vt=0;vt>>26)|0,ht+=St>>>26,St&=67108863}bt.words[vt]=Rt,ct=St,St=ht}return ct!==0?bt.words[vt]=ct:bt.length--,bt.strip()}function Pt(Bt,yt,bt){var ct=new Tt;return ct.mulp(Bt,yt,bt)}tt.prototype.mulTo=function(yt,bt){var ct,ht=this.length+yt.length;return this.length===10&&yt.length===10?ct=xt(this,yt,bt):ht<63?ct=mt(this,yt,bt):ht<1024?ct=Ct(this,yt,bt):ct=Pt(this,yt,bt),ct};function Tt(Bt,yt){this.x=Bt,this.y=yt}Tt.prototype.makeRBT=function(yt){for(var bt=new Array(yt),ct=tt.prototype._countBits(yt)-1,ht=0;ht>=1;return ht},Tt.prototype.permute=function(yt,bt,ct,ht,vt,St){for(var Rt=0;Rt>>1)vt++;return 1<>>13,ct[2*St+1]=vt&8191,vt=vt>>>13;for(St=2*bt;St>=26,bt+=ht/67108864|0,bt+=vt>>>26,this.words[ct]=vt&67108863}return bt!==0&&(this.words[ct]=bt,this.length++),this},tt.prototype.muln=function(yt){return this.clone().imuln(yt)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(yt){var bt=dt(yt);if(bt.length===0)return new tt(1);for(var ct=this,ht=0;ht=0);var bt=yt%26,ct=(yt-bt)/26,ht=67108863>>>26-bt<<26-bt,vt;if(bt!==0){var St=0;for(vt=0;vt>>26-bt}St&&(this.words[vt]=St,this.length++)}if(ct!==0){for(vt=this.length-1;vt>=0;vt--)this.words[vt+ct]=this.words[vt];for(vt=0;vt=0);var ht;bt?ht=(bt-bt%26)/26:ht=0;var vt=yt%26,St=Math.min((yt-vt)/26,this.length),Rt=67108863^67108863>>>vt<St)for(this.length-=St,Et=0;Et=0&&(At!==0||Et>=ht);Et--){var wt=this.words[Et]|0;this.words[Et]=At<<26-vt|wt>>>vt,At=wt&Rt}return $t&&At!==0&&($t.words[$t.length++]=At),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},tt.prototype.ishrn=function(yt,bt,ct){return j(this.negative===0),this.iushrn(yt,bt,ct)},tt.prototype.shln=function(yt){return this.clone().ishln(yt)},tt.prototype.ushln=function(yt){return this.clone().iushln(yt)},tt.prototype.shrn=function(yt){return this.clone().ishrn(yt)},tt.prototype.ushrn=function(yt){return this.clone().iushrn(yt)},tt.prototype.testn=function(yt){j(typeof yt=="number"&&yt>=0);var bt=yt%26,ct=(yt-bt)/26,ht=1<=0);var bt=yt%26,ct=(yt-bt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=ct)return this;if(bt!==0&&ct++,this.length=Math.min(ct,this.length),bt!==0){var ht=67108863^67108863>>>bt<=67108864;bt++)this.words[bt]-=67108864,bt===this.length-1?this.words[bt+1]=1:this.words[bt+1]++;return this.length=Math.max(this.length,bt+1),this},tt.prototype.isubn=function(yt){if(j(typeof yt=="number"),j(yt<67108864),yt<0)return this.iaddn(-yt);if(this.negative!==0)return this.negative=0,this.iaddn(yt),this.negative=1,this;if(this.words[0]-=yt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var bt=0;bt>26)-($t/67108864|0),this.words[vt+ct]=St&67108863}for(;vt>26,this.words[vt+ct]=St&67108863;if(Rt===0)return this.strip();for(j(Rt===-1),Rt=0,vt=0;vt>26,this.words[vt]=St&67108863;return this.negative=1,this.strip()},tt.prototype._wordDiv=function(yt,bt){var ct=this.length-yt.length,ht=this.clone(),vt=yt,St=vt.words[vt.length-1]|0,Rt=this._countBits(St);ct=26-Rt,ct!==0&&(vt=vt.ushln(ct),ht.iushln(ct),St=vt.words[vt.length-1]|0);var $t=ht.length-vt.length,Et;if(bt!=="mod"){Et=new tt(null),Et.length=$t+1,Et.words=new Array(Et.length);for(var At=0;At=0;Ot--){var tr=(ht.words[vt.length+Ot]|0)*67108864+(ht.words[vt.length+Ot-1]|0);for(tr=Math.min(tr/St|0,67108863),ht._ishlnsubmul(vt,tr,Ot);ht.negative!==0;)tr--,ht.negative=0,ht._ishlnsubmul(vt,1,Ot),ht.isZero()||(ht.negative^=1);Et&&(Et.words[Ot]=tr)}return Et&&Et.strip(),ht.strip(),bt!=="div"&&ct!==0&&ht.iushrn(ct),{div:Et||null,mod:ht}},tt.prototype.divmod=function(yt,bt,ct){if(j(!yt.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var ht,vt,St;return this.negative!==0&&yt.negative===0?(St=this.neg().divmod(yt,bt),bt!=="mod"&&(ht=St.div.neg()),bt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.iadd(yt)),{div:ht,mod:vt}):this.negative===0&&yt.negative!==0?(St=this.divmod(yt.neg(),bt),bt!=="mod"&&(ht=St.div.neg()),{div:ht,mod:St.mod}):this.negative&yt.negative?(St=this.neg().divmod(yt.neg(),bt),bt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.isub(yt)),{div:St.div,mod:vt}):yt.length>this.length||this.cmp(yt)<0?{div:new tt(0),mod:this}:yt.length===1?bt==="div"?{div:this.divn(yt.words[0]),mod:null}:bt==="mod"?{div:null,mod:new tt(this.modn(yt.words[0]))}:{div:this.divn(yt.words[0]),mod:new tt(this.modn(yt.words[0]))}:this._wordDiv(yt,bt)},tt.prototype.div=function(yt){return this.divmod(yt,"div",!1).div},tt.prototype.mod=function(yt){return this.divmod(yt,"mod",!1).mod},tt.prototype.umod=function(yt){return this.divmod(yt,"mod",!0).mod},tt.prototype.divRound=function(yt){var bt=this.divmod(yt);if(bt.mod.isZero())return bt.div;var ct=bt.div.negative!==0?bt.mod.isub(yt):bt.mod,ht=yt.ushrn(1),vt=yt.andln(1),St=ct.cmp(ht);return St<0||vt===1&&St===0?bt.div:bt.div.negative!==0?bt.div.isubn(1):bt.div.iaddn(1)},tt.prototype.modn=function(yt){j(yt<=67108863);for(var bt=(1<<26)%yt,ct=0,ht=this.length-1;ht>=0;ht--)ct=(bt*ct+(this.words[ht]|0))%yt;return ct},tt.prototype.idivn=function(yt){j(yt<=67108863);for(var bt=0,ct=this.length-1;ct>=0;ct--){var ht=(this.words[ct]|0)+bt*67108864;this.words[ct]=ht/yt|0,bt=ht%yt}return this.strip()},tt.prototype.divn=function(yt){return this.clone().idivn(yt)},tt.prototype.egcd=function(yt){j(yt.negative===0),j(!yt.isZero());var bt=this,ct=yt.clone();bt.negative!==0?bt=bt.umod(yt):bt=bt.clone();for(var ht=new tt(1),vt=new tt(0),St=new tt(0),Rt=new tt(1),$t=0;bt.isEven()&&ct.isEven();)bt.iushrn(1),ct.iushrn(1),++$t;for(var Et=ct.clone(),At=bt.clone();!bt.isZero();){for(var wt=0,Ot=1;!(bt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(bt.iushrn(wt);wt-- >0;)(ht.isOdd()||vt.isOdd())&&(ht.iadd(Et),vt.isub(At)),ht.iushrn(1),vt.iushrn(1);for(var tr=0,nr=1;!(ct.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ct.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(Et),Rt.isub(At)),St.iushrn(1),Rt.iushrn(1);bt.cmp(ct)>=0?(bt.isub(ct),ht.isub(St),vt.isub(Rt)):(ct.isub(bt),St.isub(ht),Rt.isub(vt))}return{a:St,b:Rt,gcd:ct.iushln($t)}},tt.prototype._invmp=function(yt){j(yt.negative===0),j(!yt.isZero());var bt=this,ct=yt.clone();bt.negative!==0?bt=bt.umod(yt):bt=bt.clone();for(var ht=new tt(1),vt=new tt(0),St=ct.clone();bt.cmpn(1)>0&&ct.cmpn(1)>0;){for(var Rt=0,$t=1;!(bt.words[0]&$t)&&Rt<26;++Rt,$t<<=1);if(Rt>0)for(bt.iushrn(Rt);Rt-- >0;)ht.isOdd()&&ht.iadd(St),ht.iushrn(1);for(var Et=0,At=1;!(ct.words[0]&At)&&Et<26;++Et,At<<=1);if(Et>0)for(ct.iushrn(Et);Et-- >0;)vt.isOdd()&&vt.iadd(St),vt.iushrn(1);bt.cmp(ct)>=0?(bt.isub(ct),ht.isub(vt)):(ct.isub(bt),vt.isub(ht))}var wt;return bt.cmpn(1)===0?wt=ht:wt=vt,wt.cmpn(0)<0&&wt.iadd(yt),wt},tt.prototype.gcd=function(yt){if(this.isZero())return yt.abs();if(yt.isZero())return this.abs();var bt=this.clone(),ct=yt.clone();bt.negative=0,ct.negative=0;for(var ht=0;bt.isEven()&&ct.isEven();ht++)bt.iushrn(1),ct.iushrn(1);do{for(;bt.isEven();)bt.iushrn(1);for(;ct.isEven();)ct.iushrn(1);var vt=bt.cmp(ct);if(vt<0){var St=bt;bt=ct,ct=St}else if(vt===0||ct.cmpn(1)===0)break;bt.isub(ct)}while(!0);return ct.iushln(ht)},tt.prototype.invm=function(yt){return this.egcd(yt).a.umod(yt)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(yt){return this.words[0]&yt},tt.prototype.bincn=function(yt){j(typeof yt=="number");var bt=yt%26,ct=(yt-bt)/26,ht=1<>>26,Rt&=67108863,this.words[St]=Rt}return vt!==0&&(this.words[St]=vt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(yt){var bt=yt<0;if(this.negative!==0&&!bt)return-1;if(this.negative===0&&bt)return 1;this.strip();var ct;if(this.length>1)ct=1;else{bt&&(yt=-yt),j(yt<=67108863,"Number is too big");var ht=this.words[0]|0;ct=ht===yt?0:htyt.length)return 1;if(this.length=0;ct--){var ht=this.words[ct]|0,vt=yt.words[ct]|0;if(ht!==vt){htvt&&(bt=1);break}}return bt},tt.prototype.gtn=function(yt){return this.cmpn(yt)===1},tt.prototype.gt=function(yt){return this.cmp(yt)===1},tt.prototype.gten=function(yt){return this.cmpn(yt)>=0},tt.prototype.gte=function(yt){return this.cmp(yt)>=0},tt.prototype.ltn=function(yt){return this.cmpn(yt)===-1},tt.prototype.lt=function(yt){return this.cmp(yt)===-1},tt.prototype.lten=function(yt){return this.cmpn(yt)<=0},tt.prototype.lte=function(yt){return this.cmp(yt)<=0},tt.prototype.eqn=function(yt){return this.cmpn(yt)===0},tt.prototype.eq=function(yt){return this.cmp(yt)===0},tt.red=function(yt){return new Dt(yt)},tt.prototype.toRed=function(yt){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),yt.convertTo(this)._forceRed(yt)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(yt){return this.red=yt,this},tt.prototype.forceRed=function(yt){return j(!this.red,"Already a number in reduction context"),this._forceRed(yt)},tt.prototype.redAdd=function(yt){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,yt)},tt.prototype.redIAdd=function(yt){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,yt)},tt.prototype.redSub=function(yt){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,yt)},tt.prototype.redISub=function(yt){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,yt)},tt.prototype.redShl=function(yt){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,yt)},tt.prototype.redMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.mul(this,yt)},tt.prototype.redIMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.imul(this,yt)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(yt){return j(this.red&&!yt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,yt)};var kt={k256:null,p224:null,p192:null,p25519:null};function Lt(Bt,yt){this.name=Bt,this.p=new tt(yt,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Lt.prototype._tmp=function(){var yt=new tt(null);return yt.words=new Array(Math.ceil(this.n/13)),yt},Lt.prototype.ireduce=function(yt){var bt=yt,ct;do this.split(bt,this.tmp),bt=this.imulK(bt),bt=bt.iadd(this.tmp),ct=bt.bitLength();while(ct>this.n);var ht=ct0?bt.isub(this.p):bt.strip!==void 0?bt.strip():bt._strip(),bt},Lt.prototype.split=function(yt,bt){yt.iushrn(this.n,0,bt)},Lt.prototype.imulK=function(yt){return yt.imul(this.k)};function Nt(){Lt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Nt,Lt),Nt.prototype.split=function(yt,bt){for(var ct=4194303,ht=Math.min(yt.length,9),vt=0;vt>>22,St=Rt}St>>>=22,yt.words[vt-10]=St,St===0&&yt.length>10?yt.length-=10:yt.length-=9},Nt.prototype.imulK=function(yt){yt.words[yt.length]=0,yt.words[yt.length+1]=0,yt.length+=2;for(var bt=0,ct=0;ct>>=26,yt.words[ct]=vt,bt=ht}return bt!==0&&(yt.words[yt.length++]=bt),yt},tt._prime=function(yt){if(kt[yt])return kt[yt];var bt;if(yt==="k256")bt=new Nt;else if(yt==="p224")bt=new zt;else if(yt==="p192")bt=new jt;else if(yt==="p25519")bt=new Mt;else throw new Error("Unknown prime "+yt);return kt[yt]=bt,bt};function Dt(Bt){if(typeof Bt=="string"){var yt=tt._prime(Bt);this.m=yt.p,this.prime=yt}else j(Bt.gtn(1),"modulus must be greater than 1"),this.m=Bt,this.prime=null}Dt.prototype._verify1=function(yt){j(yt.negative===0,"red works only with positives"),j(yt.red,"red works only with red numbers")},Dt.prototype._verify2=function(yt,bt){j((yt.negative|bt.negative)===0,"red works only with positives"),j(yt.red&&yt.red===bt.red,"red works only with red numbers")},Dt.prototype.imod=function(yt){return this.prime?this.prime.ireduce(yt)._forceRed(this):yt.umod(this.m)._forceRed(this)},Dt.prototype.neg=function(yt){return yt.isZero()?yt.clone():this.m.sub(yt)._forceRed(this)},Dt.prototype.add=function(yt,bt){this._verify2(yt,bt);var ct=yt.add(bt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct._forceRed(this)},Dt.prototype.iadd=function(yt,bt){this._verify2(yt,bt);var ct=yt.iadd(bt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct},Dt.prototype.sub=function(yt,bt){this._verify2(yt,bt);var ct=yt.sub(bt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct._forceRed(this)},Dt.prototype.isub=function(yt,bt){this._verify2(yt,bt);var ct=yt.isub(bt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct},Dt.prototype.shl=function(yt,bt){return this._verify1(yt),this.imod(yt.ushln(bt))},Dt.prototype.imul=function(yt,bt){return this._verify2(yt,bt),this.imod(yt.imul(bt))},Dt.prototype.mul=function(yt,bt){return this._verify2(yt,bt),this.imod(yt.mul(bt))},Dt.prototype.isqr=function(yt){return this.imul(yt,yt.clone())},Dt.prototype.sqr=function(yt){return this.mul(yt,yt)},Dt.prototype.sqrt=function(yt){if(yt.isZero())return yt.clone();var bt=this.m.andln(3);if(j(bt%2===1),bt===3){var ct=this.m.add(new tt(1)).iushrn(2);return this.pow(yt,ct)}for(var ht=this.m.subn(1),vt=0;!ht.isZero()&&ht.andln(1)===0;)vt++,ht.iushrn(1);j(!ht.isZero());var St=new tt(1).toRed(this),Rt=St.redNeg(),$t=this.m.subn(1).iushrn(1),Et=this.m.bitLength();for(Et=new tt(2*Et*Et).toRed(this);this.pow(Et,$t).cmp(Rt)!==0;)Et.redIAdd(Rt);for(var At=this.pow(Et,ht),wt=this.pow(yt,ht.addn(1).iushrn(1)),Ot=this.pow(yt,ht),tr=vt;Ot.cmp(St)!==0;){for(var nr=Ot,ir=0;nr.cmp(St)!==0;ir++)nr=nr.redSqr();j(ir=0;vt--){for(var At=bt.words[vt],wt=Et-1;wt>=0;wt--){var Ot=At>>wt&1;if(St!==ht[0]&&(St=this.sqr(St)),Ot===0&&Rt===0){$t=0;continue}Rt<<=1,Rt|=Ot,$t++,!($t!==ct&&(vt!==0||wt!==0))&&(St=this.mul(St,ht[Rt]),$t=0,Rt=0)}Et=26}return St},Dt.prototype.convertTo=function(yt){var bt=yt.umod(this.m);return bt===yt?bt.clone():bt},Dt.prototype.convertFrom=function(yt){var bt=yt.clone();return bt.red=null,bt},tt.mont=function(yt){return new Ft(yt)};function Ft(Bt){Dt.call(this,Bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(Ft,Dt),Ft.prototype.convertTo=function(yt){return this.imod(yt.ushln(this.shift))},Ft.prototype.convertFrom=function(yt){var bt=this.imod(yt.mul(this.rinv));return bt.red=null,bt},Ft.prototype.imul=function(yt,bt){if(yt.isZero()||bt.isZero())return yt.words[0]=0,yt.length=1,yt;var ct=yt.imul(bt),ht=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(ht).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.mul=function(yt,bt){if(yt.isZero()||bt.isZero())return new tt(0)._forceRed(this);var ct=yt.mul(bt),ht=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(ht).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.invm=function(yt){var bt=this.imod(yt._invmp(this.m).mul(this.r2));return bt._forceRed(this)}})(_,commonjsGlobal)})(bn$4);var bnExports$1=bn$4.exports;const BN$p=getDefaultExportFromCjs$1(bnExports$1);var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var _;brorand.exports=function(et){return _||(_=new a(null)),_.generate(et)};function a(j){this.rand=j}if(brorand.exports.Rand=a,a.prototype.generate=function(et){return this._rand(et)},a.prototype._rand=function(et){if(this.rand.getBytes)return this.rand.getBytes(et);for(var tt=new Uint8Array(et),rt=0;rt=0);return nt},$.prototype._randrange=function(et,tt){var rt=tt.sub(et);return et.add(this._randbelow(rt))},$.prototype.test=function(et,tt,rt){var nt=et.bitLength(),it=_.mont(et),at=new _(1).toRed(it);tt||(tt=Math.max(1,nt/48|0));for(var st=et.subn(1),ot=0;!st.testn(ot);ot++);for(var ut=et.shrn(ot),dt=st.toRed(it),mt=!0;tt>0;tt--){var xt=this._randrange(new _(2),st);rt&&rt(xt);var Ct=xt.toRed(it).redPow(ut);if(!(Ct.cmp(at)===0||Ct.cmp(dt)===0)){for(var Pt=1;Pt0;tt--){var dt=this._randrange(new _(2),at),mt=et.gcd(dt);if(mt.cmpn(1)!==0)return mt;var xt=dt.toRed(nt).redPow(ot);if(!(xt.cmp(it)===0||xt.cmp(ut)===0)){for(var Ct=1;CtPt;)kt.ishrn(1);if(kt.isEven()&&kt.iadd(tt),kt.testn(1)||kt.iadd(rt),Tt.cmp(rt)){if(!Tt.cmp(nt))for(;kt.mod(it).cmp(at);)kt.iadd(ot)}else for(;kt.mod($).cmp(st);)kt.iadd(ot);if(Lt=kt.shrn(1),mt(Lt)&&mt(kt)&&xt(Lt)&&xt(kt)&&et.test(Lt)&&et.test(kt))return kt}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$2={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var _=bnExports$1,a=requireMr(),$=new a,j=new _(24),et=new _(11),tt=new _(10),rt=new _(3),nt=new _(7),it=requireGeneratePrime(),at=requireBrowser$8();dh=mt;function st(Ct,Pt){return Pt=Pt||"utf8",Buffer$g.isBuffer(Ct)||(Ct=new Buffer$g(Ct,Pt)),this._pub=new _(Ct),this}function ot(Ct,Pt){return Pt=Pt||"utf8",Buffer$g.isBuffer(Ct)||(Ct=new Buffer$g(Ct,Pt)),this._priv=new _(Ct),this}var ut={};function dt(Ct,Pt){var Tt=Pt.toString("hex"),kt=[Tt,Ct.toString(16)].join("_");if(kt in ut)return ut[kt];var Lt=0;if(Ct.isEven()||!it.simpleSieve||!it.fermatTest(Ct)||!$.test(Ct))return Lt+=1,Tt==="02"||Tt==="05"?Lt+=8:Lt+=4,ut[kt]=Lt,Lt;$.test(Ct.shrn(1))||(Lt+=2);var Nt;switch(Tt){case"02":Ct.mod(j).cmp(et)&&(Lt+=8);break;case"05":Nt=Ct.mod(tt),Nt.cmp(rt)&&Nt.cmp(nt)&&(Lt+=8);break;default:Lt+=4}return ut[kt]=Lt,Lt}function mt(Ct,Pt,Tt){this.setGenerator(Pt),this.__prime=new _(Ct),this._prime=_.mont(this.__prime),this._primeLen=Ct.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,Tt?(this.setPublicKey=st,this.setPrivateKey=ot):this._primeCode=8}Object.defineProperty(mt.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=dt(this.__prime,this.__gen)),this._primeCode}}),mt.prototype.generateKeys=function(){return this._priv||(this._priv=new _(at(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},mt.prototype.computeSecret=function(Ct){Ct=new _(Ct),Ct=Ct.toRed(this._prime);var Pt=Ct.redPow(this._priv).fromRed(),Tt=new Buffer$g(Pt.toArray()),kt=this.getPrime();if(Tt.length"u"||!process$1$1.version||process$1$1.version.indexOf("v0.")===0||process$1$1.version.indexOf("v1.")===0&&process$1$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:_}:processNextickArgs.exports=process$1$1;function _(a,$,j,et){if(typeof a!="function")throw new TypeError('"callback" argument must be a function');var tt=arguments.length,rt,nt;switch(tt){case 0:case 1:return process$1$1.nextTick(a);case 2:return process$1$1.nextTick(function(){a.call(null,$)});case 3:return process$1$1.nextTick(function(){a.call(null,$,j)});case 4:return process$1$1.nextTick(function(){a.call(null,$,j,et)});default:for(rt=new Array(tt-1),nt=0;nt"u"}util$4.isPrimitive=dt,util$4.isBuffer=buffer$1.Buffer.isBuffer;function mt(xt){return Object.prototype.toString.call(xt)}return util$4}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(_){function a(tt,rt){if(!(tt instanceof rt))throw new TypeError("Cannot call a class as a function")}var $=requireSafeBuffer$1().Buffer,j=util$5;function et(tt,rt,nt){tt.copy(rt,nt)}_.exports=function(){function tt(){a(this,tt),this.head=null,this.tail=null,this.length=0}return tt.prototype.push=function(nt){var it={data:nt,next:null};this.length>0?this.tail.next=it:this.head=it,this.tail=it,++this.length},tt.prototype.unshift=function(nt){var it={data:nt,next:this.head};this.length===0&&(this.tail=it),this.head=it,++this.length},tt.prototype.shift=function(){if(this.length!==0){var nt=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,nt}},tt.prototype.clear=function(){this.head=this.tail=null,this.length=0},tt.prototype.join=function(nt){if(this.length===0)return"";for(var it=this.head,at=""+it.data;it=it.next;)at+=nt+it.data;return at},tt.prototype.concat=function(nt){if(this.length===0)return $.alloc(0);for(var it=$.allocUnsafe(nt>>>0),at=this.head,st=0;at;)et(at.data,it,st),st+=at.data.length,at=at.next;return it},tt}(),j&&j.inspect&&j.inspect.custom&&(_.exports.prototype[j.inspect.custom]=function(){var tt=j.inspect({length:this.length});return this.constructor.name+" "+tt})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var _=requireProcessNextickArgs();function a(et,tt){var rt=this,nt=this._readableState&&this._readableState.destroyed,it=this._writableState&&this._writableState.destroyed;return nt||it?(tt?tt(et):et&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,_.nextTick(j,this,et)):_.nextTick(j,this,et)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(et||null,function(at){!tt&&at?rt._writableState?rt._writableState.errorEmitted||(rt._writableState.errorEmitted=!0,_.nextTick(j,rt,at)):_.nextTick(j,rt,at):tt&&tt(at)}),this)}function $(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function j(et,tt){et.emit("error",tt)}return destroy_1={destroy:a,undestroy:$},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var _=requireProcessNextickArgs();_stream_writable=xt;function a(St){var Rt=this;this.next=null,this.entry=null,this.finish=function(){vt(Rt,St)}}var $=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:_.nextTick,j;xt.WritableState=dt;var et=Object.create(requireUtil());et.inherits=inherits_browserExports;var tt={deprecate:browser$c},rt=requireStreamBrowser(),nt=requireSafeBuffer$1().Buffer,it=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function at(St){return nt.from(St)}function st(St){return nt.isBuffer(St)||St instanceof it}var ot=requireDestroy();et.inherits(xt,rt);function ut(){}function dt(St,Rt){j=j||require_stream_duplex(),St=St||{};var $t=Rt instanceof j;this.objectMode=!!St.objectMode,$t&&(this.objectMode=this.objectMode||!!St.writableObjectMode);var Et=St.highWaterMark,At=St.writableHighWaterMark,wt=this.objectMode?16:16*1024;Et||Et===0?this.highWaterMark=Et:$t&&(At||At===0)?this.highWaterMark=At:this.highWaterMark=wt,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ot=St.decodeStrings===!1;this.decodeStrings=!Ot,this.defaultEncoding=St.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(tr){jt(Rt,tr)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}dt.prototype.getBuffer=function(){for(var Rt=this.bufferedRequest,$t=[];Rt;)$t.push(Rt),Rt=Rt.next;return $t},function(){try{Object.defineProperty(dt.prototype,"buffer",{get:tt.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var mt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(mt=Function.prototype[Symbol.hasInstance],Object.defineProperty(xt,Symbol.hasInstance,{value:function(St){return mt.call(this,St)?!0:this!==xt?!1:St&&St._writableState instanceof dt}})):mt=function(St){return St instanceof this};function xt(St){if(j=j||require_stream_duplex(),!mt.call(xt,this)&&!(this instanceof j))return new xt(St);this._writableState=new dt(St,this),this.writable=!0,St&&(typeof St.write=="function"&&(this._write=St.write),typeof St.writev=="function"&&(this._writev=St.writev),typeof St.destroy=="function"&&(this._destroy=St.destroy),typeof St.final=="function"&&(this._final=St.final)),rt.call(this)}xt.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Ct(St,Rt){var $t=new Error("write after end");St.emit("error",$t),_.nextTick(Rt,$t)}function Pt(St,Rt,$t,Et){var At=!0,wt=!1;return $t===null?wt=new TypeError("May not write null values to stream"):typeof $t!="string"&&$t!==void 0&&!Rt.objectMode&&(wt=new TypeError("Invalid non-string/buffer chunk")),wt&&(St.emit("error",wt),_.nextTick(Et,wt),At=!1),At}xt.prototype.write=function(St,Rt,$t){var Et=this._writableState,At=!1,wt=!Et.objectMode&&st(St);return wt&&!nt.isBuffer(St)&&(St=at(St)),typeof Rt=="function"&&($t=Rt,Rt=null),wt?Rt="buffer":Rt||(Rt=Et.defaultEncoding),typeof $t!="function"&&($t=ut),Et.ended?Ct(this,$t):(wt||Pt(this,Et,St,$t))&&(Et.pendingcb++,At=kt(this,Et,wt,St,Rt,$t)),At},xt.prototype.cork=function(){var St=this._writableState;St.corked++},xt.prototype.uncork=function(){var St=this._writableState;St.corked&&(St.corked--,!St.writing&&!St.corked&&!St.bufferProcessing&&St.bufferedRequest&&Ft(this,St))},xt.prototype.setDefaultEncoding=function(Rt){if(typeof Rt=="string"&&(Rt=Rt.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Rt+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Rt);return this._writableState.defaultEncoding=Rt,this};function Tt(St,Rt,$t){return!St.objectMode&&St.decodeStrings!==!1&&typeof Rt=="string"&&(Rt=nt.from(Rt,$t)),Rt}Object.defineProperty(xt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function kt(St,Rt,$t,Et,At,wt){if(!$t){var Ot=Tt(Rt,Et,At);Et!==Ot&&($t=!0,At="buffer",Et=Ot)}var tr=Rt.objectMode?1:Et.length;Rt.length+=tr;var nr=Rt.length>5===6?2:Pt>>4===14?3:Pt>>3===30?4:Pt>>6===2?-1:-2}function rt(Pt,Tt,kt){var Lt=Tt.length-1;if(Lt=0?(Nt>0&&(Pt.lastNeed=Nt-1),Nt):--Lt=0?(Nt>0&&(Pt.lastNeed=Nt-2),Nt):--Lt=0?(Nt>0&&(Nt===2?Nt=0:Pt.lastNeed=Nt-3),Nt):0))}function nt(Pt,Tt,kt){if((Tt[0]&192)!==128)return Pt.lastNeed=0,"�";if(Pt.lastNeed>1&&Tt.length>1){if((Tt[1]&192)!==128)return Pt.lastNeed=1,"�";if(Pt.lastNeed>2&&Tt.length>2&&(Tt[2]&192)!==128)return Pt.lastNeed=2,"�"}}function it(Pt){var Tt=this.lastTotal-this.lastNeed,kt=nt(this,Pt);if(kt!==void 0)return kt;if(this.lastNeed<=Pt.length)return Pt.copy(this.lastChar,Tt,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Pt.copy(this.lastChar,Tt,0,Pt.length),this.lastNeed-=Pt.length}function at(Pt,Tt){var kt=rt(this,Pt,Tt);if(!this.lastNeed)return Pt.toString("utf8",Tt);this.lastTotal=kt;var Lt=Pt.length-(kt-this.lastNeed);return Pt.copy(this.lastChar,0,Lt),Pt.toString("utf8",Tt,Lt)}function st(Pt){var Tt=Pt&&Pt.length?this.write(Pt):"";return this.lastNeed?Tt+"�":Tt}function ot(Pt,Tt){if((Pt.length-Tt)%2===0){var kt=Pt.toString("utf16le",Tt);if(kt){var Lt=kt.charCodeAt(kt.length-1);if(Lt>=55296&&Lt<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=Pt[Pt.length-2],this.lastChar[1]=Pt[Pt.length-1],kt.slice(0,-1)}return kt}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=Pt[Pt.length-1],Pt.toString("utf16le",Tt,Pt.length-1)}function ut(Pt){var Tt=Pt&&Pt.length?this.write(Pt):"";if(this.lastNeed){var kt=this.lastTotal-this.lastNeed;return Tt+this.lastChar.toString("utf16le",0,kt)}return Tt}function dt(Pt,Tt){var kt=(Pt.length-Tt)%3;return kt===0?Pt.toString("base64",Tt):(this.lastNeed=3-kt,this.lastTotal=3,kt===1?this.lastChar[0]=Pt[Pt.length-1]:(this.lastChar[0]=Pt[Pt.length-2],this.lastChar[1]=Pt[Pt.length-1]),Pt.toString("base64",Tt,Pt.length-kt))}function mt(Pt){var Tt=Pt&&Pt.length?this.write(Pt):"";return this.lastNeed?Tt+this.lastChar.toString("base64",0,3-this.lastNeed):Tt}function xt(Pt){return Pt.toString(this.encoding)}function Ct(Pt){return Pt&&Pt.length?this.write(Pt):""}return string_decoder}var _stream_readable,hasRequired_stream_readable;function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var _=requireProcessNextickArgs();_stream_readable=Tt;var a=requireIsarray(),$;Tt.ReadableState=Pt,eventsExports.EventEmitter;var j=function(Wt,Kt){return Wt.listeners(Kt).length},et=requireStreamBrowser(),tt=requireSafeBuffer$1().Buffer,rt=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function nt(Wt){return tt.from(Wt)}function it(Wt){return tt.isBuffer(Wt)||Wt instanceof rt}var at=Object.create(requireUtil());at.inherits=inherits_browserExports;var st=util$5,ot=void 0;st&&st.debuglog?ot=st.debuglog("stream"):ot=function(){};var ut=requireBufferList(),dt=requireDestroy(),mt;at.inherits(Tt,et);var xt=["error","close","destroy","pause","resume"];function Ct(Wt,Kt,Jt){if(typeof Wt.prependListener=="function")return Wt.prependListener(Kt,Jt);!Wt._events||!Wt._events[Kt]?Wt.on(Kt,Jt):a(Wt._events[Kt])?Wt._events[Kt].unshift(Jt):Wt._events[Kt]=[Jt,Wt._events[Kt]]}function Pt(Wt,Kt){$=$||require_stream_duplex(),Wt=Wt||{};var Jt=Kt instanceof $;this.objectMode=!!Wt.objectMode,Jt&&(this.objectMode=this.objectMode||!!Wt.readableObjectMode);var Ht=Wt.highWaterMark,Vt=Wt.readableHighWaterMark,Qt=this.objectMode?16:16*1024;Ht||Ht===0?this.highWaterMark=Ht:Jt&&(Vt||Vt===0)?this.highWaterMark=Vt:this.highWaterMark=Qt,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new ut,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=Wt.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Wt.encoding&&(mt||(mt=requireString_decoder().StringDecoder),this.decoder=new mt(Wt.encoding),this.encoding=Wt.encoding)}function Tt(Wt){if($=$||require_stream_duplex(),!(this instanceof Tt))return new Tt(Wt);this._readableState=new Pt(Wt,this),this.readable=!0,Wt&&(typeof Wt.read=="function"&&(this._read=Wt.read),typeof Wt.destroy=="function"&&(this._destroy=Wt.destroy)),et.call(this)}Object.defineProperty(Tt.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Wt){this._readableState&&(this._readableState.destroyed=Wt)}}),Tt.prototype.destroy=dt.destroy,Tt.prototype._undestroy=dt.undestroy,Tt.prototype._destroy=function(Wt,Kt){this.push(null),Kt(Wt)},Tt.prototype.push=function(Wt,Kt){var Jt=this._readableState,Ht;return Jt.objectMode?Ht=!0:typeof Wt=="string"&&(Kt=Kt||Jt.defaultEncoding,Kt!==Jt.encoding&&(Wt=tt.from(Wt,Kt),Kt=""),Ht=!0),kt(this,Wt,Kt,!1,Ht)},Tt.prototype.unshift=function(Wt){return kt(this,Wt,null,!0,!1)};function kt(Wt,Kt,Jt,Ht,Vt){var Qt=Wt._readableState;if(Kt===null)Qt.reading=!1,Ft(Wt,Qt);else{var dr;Vt||(dr=Nt(Qt,Kt)),dr?Wt.emit("error",dr):Qt.objectMode||Kt&&Kt.length>0?(typeof Kt!="string"&&!Qt.objectMode&&Object.getPrototypeOf(Kt)!==tt.prototype&&(Kt=nt(Kt)),Ht?Qt.endEmitted?Wt.emit("error",new Error("stream.unshift() after end event")):Lt(Wt,Qt,Kt,!0):Qt.ended?Wt.emit("error",new Error("stream.push() after EOF")):(Qt.reading=!1,Qt.decoder&&!Jt?(Kt=Qt.decoder.write(Kt),Qt.objectMode||Kt.length!==0?Lt(Wt,Qt,Kt,!1):bt(Wt,Qt)):Lt(Wt,Qt,Kt,!1))):Ht||(Qt.reading=!1)}return zt(Qt)}function Lt(Wt,Kt,Jt,Ht){Kt.flowing&&Kt.length===0&&!Kt.sync?(Wt.emit("data",Jt),Wt.read(0)):(Kt.length+=Kt.objectMode?1:Jt.length,Ht?Kt.buffer.unshift(Jt):Kt.buffer.push(Jt),Kt.needReadable&&Bt(Wt)),bt(Wt,Kt)}function Nt(Wt,Kt){var Jt;return!it(Kt)&&typeof Kt!="string"&&Kt!==void 0&&!Wt.objectMode&&(Jt=new TypeError("Invalid non-string/buffer chunk")),Jt}function zt(Wt){return!Wt.ended&&(Wt.needReadable||Wt.length=jt?Wt=jt:(Wt--,Wt|=Wt>>>1,Wt|=Wt>>>2,Wt|=Wt>>>4,Wt|=Wt>>>8,Wt|=Wt>>>16,Wt++),Wt}function Dt(Wt,Kt){return Wt<=0||Kt.length===0&&Kt.ended?0:Kt.objectMode?1:Wt!==Wt?Kt.flowing&&Kt.length?Kt.buffer.head.data.length:Kt.length:(Wt>Kt.highWaterMark&&(Kt.highWaterMark=Mt(Wt)),Wt<=Kt.length?Wt:Kt.ended?Kt.length:(Kt.needReadable=!0,0))}Tt.prototype.read=function(Wt){ot("read",Wt),Wt=parseInt(Wt,10);var Kt=this._readableState,Jt=Wt;if(Wt!==0&&(Kt.emittedReadable=!1),Wt===0&&Kt.needReadable&&(Kt.length>=Kt.highWaterMark||Kt.ended))return ot("read: emitReadable",Kt.length,Kt.ended),Kt.length===0&&Kt.ended?tr(this):Bt(this),null;if(Wt=Dt(Wt,Kt),Wt===0&&Kt.ended)return Kt.length===0&&tr(this),null;var Ht=Kt.needReadable;ot("need readable",Ht),(Kt.length===0||Kt.length-Wt0?Vt=Et(Wt,Kt):Vt=null,Vt===null?(Kt.needReadable=!0,Wt=0):Kt.length-=Wt,Kt.length===0&&(Kt.ended||(Kt.needReadable=!0),Jt!==Wt&&Kt.ended&&tr(this)),Vt!==null&&this.emit("data",Vt),Vt};function Ft(Wt,Kt){if(!Kt.ended){if(Kt.decoder){var Jt=Kt.decoder.end();Jt&&Jt.length&&(Kt.buffer.push(Jt),Kt.length+=Kt.objectMode?1:Jt.length)}Kt.ended=!0,Bt(Wt)}}function Bt(Wt){var Kt=Wt._readableState;Kt.needReadable=!1,Kt.emittedReadable||(ot("emitReadable",Kt.flowing),Kt.emittedReadable=!0,Kt.sync?_.nextTick(yt,Wt):yt(Wt))}function yt(Wt){ot("emit readable"),Wt.emit("readable"),$t(Wt)}function bt(Wt,Kt){Kt.readingMore||(Kt.readingMore=!0,_.nextTick(ct,Wt,Kt))}function ct(Wt,Kt){for(var Jt=Kt.length;!Kt.reading&&!Kt.flowing&&!Kt.ended&&Kt.length1&&ir(Ht.pipes,Wt)!==-1)&&!Ir&&(ot("false write response, pause",Ht.awaitDrain),Ht.awaitDrain++,lr=!0),Jt.pause())}function Er(Ar){ot("onerror",Ar),Rr(),Wt.removeListener("error",Er),j(Wt,"error")===0&&Wt.emit("error",Ar)}Ct(Wt,"error",Er);function $r(){Wt.removeListener("finish",Pr),Rr()}Wt.once("close",$r);function Pr(){ot("onfinish"),Wt.removeListener("close",$r),Rr()}Wt.once("finish",Pr);function Rr(){ot("unpipe"),Jt.unpipe(Wt)}return Wt.emit("pipe",Jt),Ht.flowing||(ot("pipe resume"),Jt.resume()),Wt};function ht(Wt){return function(){var Kt=Wt._readableState;ot("pipeOnDrain",Kt.awaitDrain),Kt.awaitDrain&&Kt.awaitDrain--,Kt.awaitDrain===0&&j(Wt,"data")&&(Kt.flowing=!0,$t(Wt))}}Tt.prototype.unpipe=function(Wt){var Kt=this._readableState,Jt={hasUnpiped:!1};if(Kt.pipesCount===0)return this;if(Kt.pipesCount===1)return Wt&&Wt!==Kt.pipes?this:(Wt||(Wt=Kt.pipes),Kt.pipes=null,Kt.pipesCount=0,Kt.flowing=!1,Wt&&Wt.emit("unpipe",this,Jt),this);if(!Wt){var Ht=Kt.pipes,Vt=Kt.pipesCount;Kt.pipes=null,Kt.pipesCount=0,Kt.flowing=!1;for(var Qt=0;Qt=Kt.length?(Kt.decoder?Jt=Kt.buffer.join(""):Kt.buffer.length===1?Jt=Kt.buffer.head.data:Jt=Kt.buffer.concat(Kt.length),Kt.buffer.clear()):Jt=At(Wt,Kt.buffer,Kt.decoder),Jt}function At(Wt,Kt,Jt){var Ht;return WtQt.length?Qt.length:Wt;if(dr===Qt.length?Vt+=Qt:Vt+=Qt.slice(0,Wt),Wt-=dr,Wt===0){dr===Qt.length?(++Ht,Jt.next?Kt.head=Jt.next:Kt.head=Kt.tail=null):(Kt.head=Jt,Jt.data=Qt.slice(dr));break}++Ht}return Kt.length-=Ht,Vt}function Ot(Wt,Kt){var Jt=tt.allocUnsafe(Wt),Ht=Kt.head,Vt=1;for(Ht.data.copy(Jt),Wt-=Ht.data.length;Ht=Ht.next;){var Qt=Ht.data,dr=Wt>Qt.length?Qt.length:Wt;if(Qt.copy(Jt,Jt.length-Wt,0,dr),Wt-=dr,Wt===0){dr===Qt.length?(++Vt,Ht.next?Kt.head=Ht.next:Kt.head=Kt.tail=null):(Kt.head=Ht,Ht.data=Qt.slice(dr));break}++Vt}return Kt.length-=Vt,Jt}function tr(Wt){var Kt=Wt._readableState;if(Kt.length>0)throw new Error('"endReadable()" called on non-empty stream');Kt.endEmitted||(Kt.ended=!0,_.nextTick(nr,Kt,Wt))}function nr(Wt,Kt){!Wt.endEmitted&&Wt.length===0&&(Wt.endEmitted=!0,Kt.readable=!1,Kt.emit("end"))}function ir(Wt,Kt){for(var Jt=0,Ht=Wt.length;Jt0?ct:ht},tt.min=function(ct,ht){return ct.cmp(ht)<0?ct:ht},tt.prototype._init=function(ct,ht,vt){if(typeof ct=="number")return this._initNumber(ct,ht,vt);if(typeof ct=="object")return this._initArray(ct,ht,vt);ht==="hex"&&(ht=16),j(ht===(ht|0)&&ht>=2&&ht<=36),ct=ct.toString().replace(/\s+/g,"");var St=0;ct[0]==="-"&&(St++,this.negative=1),St=0;St-=3)$t=ct[St]|ct[St-1]<<8|ct[St-2]<<16,this.words[Rt]|=$t<>>26-Et&67108863,Et+=24,Et>=26&&(Et-=26,Rt++);else if(vt==="le")for(St=0,Rt=0;St>>26-Et&67108863,Et+=24,Et>=26&&(Et-=26,Rt++);return this._strip()};function nt(bt,ct){var ht=bt.charCodeAt(ct);if(ht>=48&&ht<=57)return ht-48;if(ht>=65&&ht<=70)return ht-55;if(ht>=97&&ht<=102)return ht-87;j(!1,"Invalid character in "+bt)}function it(bt,ct,ht){var vt=nt(bt,ht);return ht-1>=ct&&(vt|=nt(bt,ht-1)<<4),vt}tt.prototype._parseHex=function(ct,ht,vt){this.length=Math.ceil((ct.length-ht)/6),this.words=new Array(this.length);for(var St=0;St=ht;St-=2)Et=it(ct,ht,St)<=18?(Rt-=18,$t+=1,this.words[$t]|=Et>>>26):Rt+=8;else{var At=ct.length-ht;for(St=At%2===0?ht+1:ht;St=18?(Rt-=18,$t+=1,this.words[$t]|=Et>>>26):Rt+=8}this._strip()};function at(bt,ct,ht,vt){for(var St=0,Rt=0,$t=Math.min(bt.length,ht),Et=ct;Et<$t;Et++){var At=bt.charCodeAt(Et)-48;St*=vt,At>=49?Rt=At-49+10:At>=17?Rt=At-17+10:Rt=At,j(At>=0&&Rt1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=ot}catch{tt.prototype.inspect=ot}else tt.prototype.inspect=ot;function ot(){return(this.red?""}var ut=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],dt=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],mt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(ct,ht){ct=ct||10,ht=ht|0||1;var vt;if(ct===16||ct==="hex"){vt="";for(var St=0,Rt=0,$t=0;$t>>24-St&16777215,St+=2,St>=26&&(St-=26,$t--),Rt!==0||$t!==this.length-1?vt=ut[6-At.length]+At+vt:vt=At+vt}for(Rt!==0&&(vt=Rt.toString(16)+vt);vt.length%ht!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}if(ct===(ct|0)&&ct>=2&&ct<=36){var wt=dt[ct],Ot=mt[ct];vt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var nr=tr.modrn(Ot).toString(ct);tr=tr.idivn(Ot),tr.isZero()?vt=nr+vt:vt=ut[wt-nr.length]+nr+vt}for(this.isZero()&&(vt="0"+vt);vt.length%ht!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var ct=this.words[0];return this.length===2?ct+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ct+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-ct:ct},tt.prototype.toJSON=function(){return this.toString(16,2)},rt&&(tt.prototype.toBuffer=function(ct,ht){return this.toArrayLike(rt,ct,ht)}),tt.prototype.toArray=function(ct,ht){return this.toArrayLike(Array,ct,ht)};var xt=function(ct,ht){return ct.allocUnsafe?ct.allocUnsafe(ht):new ct(ht)};tt.prototype.toArrayLike=function(ct,ht,vt){this._strip();var St=this.byteLength(),Rt=vt||Math.max(1,St);j(St<=Rt,"byte array longer than desired length"),j(Rt>0,"Requested array length <= 0");var $t=xt(ct,Rt),Et=ht==="le"?"LE":"BE";return this["_toArrayLike"+Et]($t,St),$t},tt.prototype._toArrayLikeLE=function(ct,ht){for(var vt=0,St=0,Rt=0,$t=0;Rt>8&255),vt>16&255),$t===6?(vt>24&255),St=0,$t=0):(St=Et>>>24,$t+=2)}if(vt=0&&(ct[vt--]=Et>>8&255),vt>=0&&(ct[vt--]=Et>>16&255),$t===6?(vt>=0&&(ct[vt--]=Et>>24&255),St=0,$t=0):(St=Et>>>24,$t+=2)}if(vt>=0)for(ct[vt--]=St;vt>=0;)ct[vt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var ht=ct,vt=0;return ht>=4096&&(vt+=13,ht>>>=13),ht>=64&&(vt+=7,ht>>>=7),ht>=8&&(vt+=4,ht>>>=4),ht>=2&&(vt+=2,ht>>>=2),vt+ht},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var ht=ct,vt=0;return ht&8191||(vt+=13,ht>>>=13),ht&127||(vt+=7,ht>>>=7),ht&15||(vt+=4,ht>>>=4),ht&3||(vt+=2,ht>>>=2),ht&1||vt++,vt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],ht=this._countBits(ct);return(this.length-1)*26+ht};function Ct(bt){for(var ct=new Array(bt.bitLength()),ht=0;ht>>St&1}return ct}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var ct=0,ht=0;htct.length?this.clone().ior(ct):ct.clone().ior(this)},tt.prototype.uor=function(ct){return this.length>ct.length?this.clone().iuor(ct):ct.clone().iuor(this)},tt.prototype.iuand=function(ct){var ht;this.length>ct.length?ht=ct:ht=this;for(var vt=0;vtct.length?this.clone().iand(ct):ct.clone().iand(this)},tt.prototype.uand=function(ct){return this.length>ct.length?this.clone().iuand(ct):ct.clone().iuand(this)},tt.prototype.iuxor=function(ct){var ht,vt;this.length>ct.length?(ht=this,vt=ct):(ht=ct,vt=this);for(var St=0;Stct.length?this.clone().ixor(ct):ct.clone().ixor(this)},tt.prototype.uxor=function(ct){return this.length>ct.length?this.clone().iuxor(ct):ct.clone().iuxor(this)},tt.prototype.inotn=function(ct){j(typeof ct=="number"&&ct>=0);var ht=Math.ceil(ct/26)|0,vt=ct%26;this._expand(ht),vt>0&&ht--;for(var St=0;St0&&(this.words[St]=~this.words[St]&67108863>>26-vt),this._strip()},tt.prototype.notn=function(ct){return this.clone().inotn(ct)},tt.prototype.setn=function(ct,ht){j(typeof ct=="number"&&ct>=0);var vt=ct/26|0,St=ct%26;return this._expand(vt+1),ht?this.words[vt]=this.words[vt]|1<ct.length?(vt=this,St=ct):(vt=ct,St=this);for(var Rt=0,$t=0;$t>>26;for(;Rt!==0&&$t>>26;if(this.length=vt.length,Rt!==0)this.words[this.length]=Rt,this.length++;else if(vt!==this)for(;$tct.length?this.clone().iadd(ct):ct.clone().iadd(this)},tt.prototype.isub=function(ct){if(ct.negative!==0){ct.negative=0;var ht=this.iadd(ct);return ct.negative=1,ht._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(ct),this.negative=1,this._normSign();var vt=this.cmp(ct);if(vt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Rt;vt>0?(St=this,Rt=ct):(St=ct,Rt=this);for(var $t=0,Et=0;Et>26,this.words[Et]=ht&67108863;for(;$t!==0&&Et>26,this.words[Et]=ht&67108863;if($t===0&&Et>>26,tr=At&67108863,nr=Math.min(wt,ct.length-1),ir=Math.max(0,wt-bt.length+1);ir<=nr;ir++){var Wt=wt-ir|0;St=bt.words[Wt]|0,Rt=ct.words[ir]|0,$t=St*Rt+tr,Ot+=$t/67108864|0,tr=$t&67108863}ht.words[wt]=tr|0,At=Ot|0}return At!==0?ht.words[wt]=At|0:ht.length--,ht._strip()}var Tt=function(ct,ht,vt){var St=ct.words,Rt=ht.words,$t=vt.words,Et=0,At,wt,Ot,tr=St[0]|0,nr=tr&8191,ir=tr>>>13,Wt=St[1]|0,Kt=Wt&8191,Jt=Wt>>>13,Ht=St[2]|0,Vt=Ht&8191,Qt=Ht>>>13,dr=St[3]|0,xr=dr&8191,pr=dr>>>13,Ir=St[4]|0,kr=Ir&8191,lr=Ir>>>13,fr=St[5]|0,Er=fr&8191,$r=fr>>>13,Pr=St[6]|0,Rr=Pr&8191,Ar=Pr>>>13,Or=St[7]|0,Lr=Or&8191,ar=Or>>>13,Yt=St[8]|0,er=Yt&8191,Zt=Yt>>>13,qt=St[9]|0,Gt=qt&8191,or=qt>>>13,vr=Rt[0]|0,wr=vr&8191,Sr=vr>>>13,Wr=Rt[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=Rt[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=Rt[3]|0,ln=mn&8191,Vr=mn>>>13,wn=Rt[4]|0,un=wn&8191,qr=wn>>>13,hn=Rt[5]|0,fn=hn&8191,Kr=hn>>>13,$n=Rt[6]|0,dn=$n&8191,Gr=$n>>>13,gn=Rt[7]|0,an=gn&8191,Zr=gn>>>13,Rn=Rt[8]|0,Sn=Rn&8191,nn=Rn>>>13,Tn=Rt[9]|0,yn=Tn&8191,En=Tn>>>13;vt.negative=ct.negative^ht.negative,vt.length=19,At=Math.imul(nr,wr),wt=Math.imul(nr,Sr),wt=wt+Math.imul(ir,wr)|0,Ot=Math.imul(ir,Sr);var ds=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ds>>>26)|0,ds&=67108863,At=Math.imul(Kt,wr),wt=Math.imul(Kt,Sr),wt=wt+Math.imul(Jt,wr)|0,Ot=Math.imul(Jt,Sr),At=At+Math.imul(nr,Hr)|0,wt=wt+Math.imul(nr,Fr)|0,wt=wt+Math.imul(ir,Hr)|0,Ot=Ot+Math.imul(ir,Fr)|0;var fs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(fs>>>26)|0,fs&=67108863,At=Math.imul(Vt,wr),wt=Math.imul(Vt,Sr),wt=wt+Math.imul(Qt,wr)|0,Ot=Math.imul(Qt,Sr),At=At+Math.imul(Kt,Hr)|0,wt=wt+Math.imul(Kt,Fr)|0,wt=wt+Math.imul(Jt,Hr)|0,Ot=Ot+Math.imul(Jt,Fr)|0,At=At+Math.imul(nr,Jr)|0,wt=wt+Math.imul(nr,Qr)|0,wt=wt+Math.imul(ir,Jr)|0,Ot=Ot+Math.imul(ir,Qr)|0;var hs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(hs>>>26)|0,hs&=67108863,At=Math.imul(xr,wr),wt=Math.imul(xr,Sr),wt=wt+Math.imul(pr,wr)|0,Ot=Math.imul(pr,Sr),At=At+Math.imul(Vt,Hr)|0,wt=wt+Math.imul(Vt,Fr)|0,wt=wt+Math.imul(Qt,Hr)|0,Ot=Ot+Math.imul(Qt,Fr)|0,At=At+Math.imul(Kt,Jr)|0,wt=wt+Math.imul(Kt,Qr)|0,wt=wt+Math.imul(Jt,Jr)|0,Ot=Ot+Math.imul(Jt,Qr)|0,At=At+Math.imul(nr,ln)|0,wt=wt+Math.imul(nr,Vr)|0,wt=wt+Math.imul(ir,ln)|0,Ot=Ot+Math.imul(ir,Vr)|0;var ps=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ps>>>26)|0,ps&=67108863,At=Math.imul(kr,wr),wt=Math.imul(kr,Sr),wt=wt+Math.imul(lr,wr)|0,Ot=Math.imul(lr,Sr),At=At+Math.imul(xr,Hr)|0,wt=wt+Math.imul(xr,Fr)|0,wt=wt+Math.imul(pr,Hr)|0,Ot=Ot+Math.imul(pr,Fr)|0,At=At+Math.imul(Vt,Jr)|0,wt=wt+Math.imul(Vt,Qr)|0,wt=wt+Math.imul(Qt,Jr)|0,Ot=Ot+Math.imul(Qt,Qr)|0,At=At+Math.imul(Kt,ln)|0,wt=wt+Math.imul(Kt,Vr)|0,wt=wt+Math.imul(Jt,ln)|0,Ot=Ot+Math.imul(Jt,Vr)|0,At=At+Math.imul(nr,un)|0,wt=wt+Math.imul(nr,qr)|0,wt=wt+Math.imul(ir,un)|0,Ot=Ot+Math.imul(ir,qr)|0;var qn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(qn>>>26)|0,qn&=67108863,At=Math.imul(Er,wr),wt=Math.imul(Er,Sr),wt=wt+Math.imul($r,wr)|0,Ot=Math.imul($r,Sr),At=At+Math.imul(kr,Hr)|0,wt=wt+Math.imul(kr,Fr)|0,wt=wt+Math.imul(lr,Hr)|0,Ot=Ot+Math.imul(lr,Fr)|0,At=At+Math.imul(xr,Jr)|0,wt=wt+Math.imul(xr,Qr)|0,wt=wt+Math.imul(pr,Jr)|0,Ot=Ot+Math.imul(pr,Qr)|0,At=At+Math.imul(Vt,ln)|0,wt=wt+Math.imul(Vt,Vr)|0,wt=wt+Math.imul(Qt,ln)|0,Ot=Ot+Math.imul(Qt,Vr)|0,At=At+Math.imul(Kt,un)|0,wt=wt+Math.imul(Kt,qr)|0,wt=wt+Math.imul(Jt,un)|0,Ot=Ot+Math.imul(Jt,qr)|0,At=At+Math.imul(nr,fn)|0,wt=wt+Math.imul(nr,Kr)|0,wt=wt+Math.imul(ir,fn)|0,Ot=Ot+Math.imul(ir,Kr)|0;var ss=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ss>>>26)|0,ss&=67108863,At=Math.imul(Rr,wr),wt=Math.imul(Rr,Sr),wt=wt+Math.imul(Ar,wr)|0,Ot=Math.imul(Ar,Sr),At=At+Math.imul(Er,Hr)|0,wt=wt+Math.imul(Er,Fr)|0,wt=wt+Math.imul($r,Hr)|0,Ot=Ot+Math.imul($r,Fr)|0,At=At+Math.imul(kr,Jr)|0,wt=wt+Math.imul(kr,Qr)|0,wt=wt+Math.imul(lr,Jr)|0,Ot=Ot+Math.imul(lr,Qr)|0,At=At+Math.imul(xr,ln)|0,wt=wt+Math.imul(xr,Vr)|0,wt=wt+Math.imul(pr,ln)|0,Ot=Ot+Math.imul(pr,Vr)|0,At=At+Math.imul(Vt,un)|0,wt=wt+Math.imul(Vt,qr)|0,wt=wt+Math.imul(Qt,un)|0,Ot=Ot+Math.imul(Qt,qr)|0,At=At+Math.imul(Kt,fn)|0,wt=wt+Math.imul(Kt,Kr)|0,wt=wt+Math.imul(Jt,fn)|0,Ot=Ot+Math.imul(Jt,Kr)|0,At=At+Math.imul(nr,dn)|0,wt=wt+Math.imul(nr,Gr)|0,wt=wt+Math.imul(ir,dn)|0,Ot=Ot+Math.imul(ir,Gr)|0;var Jn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,At=Math.imul(Lr,wr),wt=Math.imul(Lr,Sr),wt=wt+Math.imul(ar,wr)|0,Ot=Math.imul(ar,Sr),At=At+Math.imul(Rr,Hr)|0,wt=wt+Math.imul(Rr,Fr)|0,wt=wt+Math.imul(Ar,Hr)|0,Ot=Ot+Math.imul(Ar,Fr)|0,At=At+Math.imul(Er,Jr)|0,wt=wt+Math.imul(Er,Qr)|0,wt=wt+Math.imul($r,Jr)|0,Ot=Ot+Math.imul($r,Qr)|0,At=At+Math.imul(kr,ln)|0,wt=wt+Math.imul(kr,Vr)|0,wt=wt+Math.imul(lr,ln)|0,Ot=Ot+Math.imul(lr,Vr)|0,At=At+Math.imul(xr,un)|0,wt=wt+Math.imul(xr,qr)|0,wt=wt+Math.imul(pr,un)|0,Ot=Ot+Math.imul(pr,qr)|0,At=At+Math.imul(Vt,fn)|0,wt=wt+Math.imul(Vt,Kr)|0,wt=wt+Math.imul(Qt,fn)|0,Ot=Ot+Math.imul(Qt,Kr)|0,At=At+Math.imul(Kt,dn)|0,wt=wt+Math.imul(Kt,Gr)|0,wt=wt+Math.imul(Jt,dn)|0,Ot=Ot+Math.imul(Jt,Gr)|0,At=At+Math.imul(nr,an)|0,wt=wt+Math.imul(nr,Zr)|0,wt=wt+Math.imul(ir,an)|0,Ot=Ot+Math.imul(ir,Zr)|0;var Yn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,At=Math.imul(er,wr),wt=Math.imul(er,Sr),wt=wt+Math.imul(Zt,wr)|0,Ot=Math.imul(Zt,Sr),At=At+Math.imul(Lr,Hr)|0,wt=wt+Math.imul(Lr,Fr)|0,wt=wt+Math.imul(ar,Hr)|0,Ot=Ot+Math.imul(ar,Fr)|0,At=At+Math.imul(Rr,Jr)|0,wt=wt+Math.imul(Rr,Qr)|0,wt=wt+Math.imul(Ar,Jr)|0,Ot=Ot+Math.imul(Ar,Qr)|0,At=At+Math.imul(Er,ln)|0,wt=wt+Math.imul(Er,Vr)|0,wt=wt+Math.imul($r,ln)|0,Ot=Ot+Math.imul($r,Vr)|0,At=At+Math.imul(kr,un)|0,wt=wt+Math.imul(kr,qr)|0,wt=wt+Math.imul(lr,un)|0,Ot=Ot+Math.imul(lr,qr)|0,At=At+Math.imul(xr,fn)|0,wt=wt+Math.imul(xr,Kr)|0,wt=wt+Math.imul(pr,fn)|0,Ot=Ot+Math.imul(pr,Kr)|0,At=At+Math.imul(Vt,dn)|0,wt=wt+Math.imul(Vt,Gr)|0,wt=wt+Math.imul(Qt,dn)|0,Ot=Ot+Math.imul(Qt,Gr)|0,At=At+Math.imul(Kt,an)|0,wt=wt+Math.imul(Kt,Zr)|0,wt=wt+Math.imul(Jt,an)|0,Ot=Ot+Math.imul(Jt,Zr)|0,At=At+Math.imul(nr,Sn)|0,wt=wt+Math.imul(nr,nn)|0,wt=wt+Math.imul(ir,Sn)|0,Ot=Ot+Math.imul(ir,nn)|0;var ms=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ms>>>26)|0,ms&=67108863,At=Math.imul(Gt,wr),wt=Math.imul(Gt,Sr),wt=wt+Math.imul(or,wr)|0,Ot=Math.imul(or,Sr),At=At+Math.imul(er,Hr)|0,wt=wt+Math.imul(er,Fr)|0,wt=wt+Math.imul(Zt,Hr)|0,Ot=Ot+Math.imul(Zt,Fr)|0,At=At+Math.imul(Lr,Jr)|0,wt=wt+Math.imul(Lr,Qr)|0,wt=wt+Math.imul(ar,Jr)|0,Ot=Ot+Math.imul(ar,Qr)|0,At=At+Math.imul(Rr,ln)|0,wt=wt+Math.imul(Rr,Vr)|0,wt=wt+Math.imul(Ar,ln)|0,Ot=Ot+Math.imul(Ar,Vr)|0,At=At+Math.imul(Er,un)|0,wt=wt+Math.imul(Er,qr)|0,wt=wt+Math.imul($r,un)|0,Ot=Ot+Math.imul($r,qr)|0,At=At+Math.imul(kr,fn)|0,wt=wt+Math.imul(kr,Kr)|0,wt=wt+Math.imul(lr,fn)|0,Ot=Ot+Math.imul(lr,Kr)|0,At=At+Math.imul(xr,dn)|0,wt=wt+Math.imul(xr,Gr)|0,wt=wt+Math.imul(pr,dn)|0,Ot=Ot+Math.imul(pr,Gr)|0,At=At+Math.imul(Vt,an)|0,wt=wt+Math.imul(Vt,Zr)|0,wt=wt+Math.imul(Qt,an)|0,Ot=Ot+Math.imul(Qt,Zr)|0,At=At+Math.imul(Kt,Sn)|0,wt=wt+Math.imul(Kt,nn)|0,wt=wt+Math.imul(Jt,Sn)|0,Ot=Ot+Math.imul(Jt,nn)|0,At=At+Math.imul(nr,yn)|0,wt=wt+Math.imul(nr,En)|0,wt=wt+Math.imul(ir,yn)|0,Ot=Ot+Math.imul(ir,En)|0;var Qn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,At=Math.imul(Gt,Hr),wt=Math.imul(Gt,Fr),wt=wt+Math.imul(or,Hr)|0,Ot=Math.imul(or,Fr),At=At+Math.imul(er,Jr)|0,wt=wt+Math.imul(er,Qr)|0,wt=wt+Math.imul(Zt,Jr)|0,Ot=Ot+Math.imul(Zt,Qr)|0,At=At+Math.imul(Lr,ln)|0,wt=wt+Math.imul(Lr,Vr)|0,wt=wt+Math.imul(ar,ln)|0,Ot=Ot+Math.imul(ar,Vr)|0,At=At+Math.imul(Rr,un)|0,wt=wt+Math.imul(Rr,qr)|0,wt=wt+Math.imul(Ar,un)|0,Ot=Ot+Math.imul(Ar,qr)|0,At=At+Math.imul(Er,fn)|0,wt=wt+Math.imul(Er,Kr)|0,wt=wt+Math.imul($r,fn)|0,Ot=Ot+Math.imul($r,Kr)|0,At=At+Math.imul(kr,dn)|0,wt=wt+Math.imul(kr,Gr)|0,wt=wt+Math.imul(lr,dn)|0,Ot=Ot+Math.imul(lr,Gr)|0,At=At+Math.imul(xr,an)|0,wt=wt+Math.imul(xr,Zr)|0,wt=wt+Math.imul(pr,an)|0,Ot=Ot+Math.imul(pr,Zr)|0,At=At+Math.imul(Vt,Sn)|0,wt=wt+Math.imul(Vt,nn)|0,wt=wt+Math.imul(Qt,Sn)|0,Ot=Ot+Math.imul(Qt,nn)|0,At=At+Math.imul(Kt,yn)|0,wt=wt+Math.imul(Kt,En)|0,wt=wt+Math.imul(Jt,yn)|0,Ot=Ot+Math.imul(Jt,En)|0;var es=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(es>>>26)|0,es&=67108863,At=Math.imul(Gt,Jr),wt=Math.imul(Gt,Qr),wt=wt+Math.imul(or,Jr)|0,Ot=Math.imul(or,Qr),At=At+Math.imul(er,ln)|0,wt=wt+Math.imul(er,Vr)|0,wt=wt+Math.imul(Zt,ln)|0,Ot=Ot+Math.imul(Zt,Vr)|0,At=At+Math.imul(Lr,un)|0,wt=wt+Math.imul(Lr,qr)|0,wt=wt+Math.imul(ar,un)|0,Ot=Ot+Math.imul(ar,qr)|0,At=At+Math.imul(Rr,fn)|0,wt=wt+Math.imul(Rr,Kr)|0,wt=wt+Math.imul(Ar,fn)|0,Ot=Ot+Math.imul(Ar,Kr)|0,At=At+Math.imul(Er,dn)|0,wt=wt+Math.imul(Er,Gr)|0,wt=wt+Math.imul($r,dn)|0,Ot=Ot+Math.imul($r,Gr)|0,At=At+Math.imul(kr,an)|0,wt=wt+Math.imul(kr,Zr)|0,wt=wt+Math.imul(lr,an)|0,Ot=Ot+Math.imul(lr,Zr)|0,At=At+Math.imul(xr,Sn)|0,wt=wt+Math.imul(xr,nn)|0,wt=wt+Math.imul(pr,Sn)|0,Ot=Ot+Math.imul(pr,nn)|0,At=At+Math.imul(Vt,yn)|0,wt=wt+Math.imul(Vt,En)|0,wt=wt+Math.imul(Qt,yn)|0,Ot=Ot+Math.imul(Qt,En)|0;var ls=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ls>>>26)|0,ls&=67108863,At=Math.imul(Gt,ln),wt=Math.imul(Gt,Vr),wt=wt+Math.imul(or,ln)|0,Ot=Math.imul(or,Vr),At=At+Math.imul(er,un)|0,wt=wt+Math.imul(er,qr)|0,wt=wt+Math.imul(Zt,un)|0,Ot=Ot+Math.imul(Zt,qr)|0,At=At+Math.imul(Lr,fn)|0,wt=wt+Math.imul(Lr,Kr)|0,wt=wt+Math.imul(ar,fn)|0,Ot=Ot+Math.imul(ar,Kr)|0,At=At+Math.imul(Rr,dn)|0,wt=wt+Math.imul(Rr,Gr)|0,wt=wt+Math.imul(Ar,dn)|0,Ot=Ot+Math.imul(Ar,Gr)|0,At=At+Math.imul(Er,an)|0,wt=wt+Math.imul(Er,Zr)|0,wt=wt+Math.imul($r,an)|0,Ot=Ot+Math.imul($r,Zr)|0,At=At+Math.imul(kr,Sn)|0,wt=wt+Math.imul(kr,nn)|0,wt=wt+Math.imul(lr,Sn)|0,Ot=Ot+Math.imul(lr,nn)|0,At=At+Math.imul(xr,yn)|0,wt=wt+Math.imul(xr,En)|0,wt=wt+Math.imul(pr,yn)|0,Ot=Ot+Math.imul(pr,En)|0;var us=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(us>>>26)|0,us&=67108863,At=Math.imul(Gt,un),wt=Math.imul(Gt,qr),wt=wt+Math.imul(or,un)|0,Ot=Math.imul(or,qr),At=At+Math.imul(er,fn)|0,wt=wt+Math.imul(er,Kr)|0,wt=wt+Math.imul(Zt,fn)|0,Ot=Ot+Math.imul(Zt,Kr)|0,At=At+Math.imul(Lr,dn)|0,wt=wt+Math.imul(Lr,Gr)|0,wt=wt+Math.imul(ar,dn)|0,Ot=Ot+Math.imul(ar,Gr)|0,At=At+Math.imul(Rr,an)|0,wt=wt+Math.imul(Rr,Zr)|0,wt=wt+Math.imul(Ar,an)|0,Ot=Ot+Math.imul(Ar,Zr)|0,At=At+Math.imul(Er,Sn)|0,wt=wt+Math.imul(Er,nn)|0,wt=wt+Math.imul($r,Sn)|0,Ot=Ot+Math.imul($r,nn)|0,At=At+Math.imul(kr,yn)|0,wt=wt+Math.imul(kr,En)|0,wt=wt+Math.imul(lr,yn)|0,Ot=Ot+Math.imul(lr,En)|0;var Wn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,At=Math.imul(Gt,fn),wt=Math.imul(Gt,Kr),wt=wt+Math.imul(or,fn)|0,Ot=Math.imul(or,Kr),At=At+Math.imul(er,dn)|0,wt=wt+Math.imul(er,Gr)|0,wt=wt+Math.imul(Zt,dn)|0,Ot=Ot+Math.imul(Zt,Gr)|0,At=At+Math.imul(Lr,an)|0,wt=wt+Math.imul(Lr,Zr)|0,wt=wt+Math.imul(ar,an)|0,Ot=Ot+Math.imul(ar,Zr)|0,At=At+Math.imul(Rr,Sn)|0,wt=wt+Math.imul(Rr,nn)|0,wt=wt+Math.imul(Ar,Sn)|0,Ot=Ot+Math.imul(Ar,nn)|0,At=At+Math.imul(Er,yn)|0,wt=wt+Math.imul(Er,En)|0,wt=wt+Math.imul($r,yn)|0,Ot=Ot+Math.imul($r,En)|0;var os=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(os>>>26)|0,os&=67108863,At=Math.imul(Gt,dn),wt=Math.imul(Gt,Gr),wt=wt+Math.imul(or,dn)|0,Ot=Math.imul(or,Gr),At=At+Math.imul(er,an)|0,wt=wt+Math.imul(er,Zr)|0,wt=wt+Math.imul(Zt,an)|0,Ot=Ot+Math.imul(Zt,Zr)|0,At=At+Math.imul(Lr,Sn)|0,wt=wt+Math.imul(Lr,nn)|0,wt=wt+Math.imul(ar,Sn)|0,Ot=Ot+Math.imul(ar,nn)|0,At=At+Math.imul(Rr,yn)|0,wt=wt+Math.imul(Rr,En)|0,wt=wt+Math.imul(Ar,yn)|0,Ot=Ot+Math.imul(Ar,En)|0;var gs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(gs>>>26)|0,gs&=67108863,At=Math.imul(Gt,an),wt=Math.imul(Gt,Zr),wt=wt+Math.imul(or,an)|0,Ot=Math.imul(or,Zr),At=At+Math.imul(er,Sn)|0,wt=wt+Math.imul(er,nn)|0,wt=wt+Math.imul(Zt,Sn)|0,Ot=Ot+Math.imul(Zt,nn)|0,At=At+Math.imul(Lr,yn)|0,wt=wt+Math.imul(Lr,En)|0,wt=wt+Math.imul(ar,yn)|0,Ot=Ot+Math.imul(ar,En)|0;var bs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(bs>>>26)|0,bs&=67108863,At=Math.imul(Gt,Sn),wt=Math.imul(Gt,nn),wt=wt+Math.imul(or,Sn)|0,Ot=Math.imul(or,nn),At=At+Math.imul(er,yn)|0,wt=wt+Math.imul(er,En)|0,wt=wt+Math.imul(Zt,yn)|0,Ot=Ot+Math.imul(Zt,En)|0;var Ps=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,At=Math.imul(Gt,yn),wt=Math.imul(Gt,En),wt=wt+Math.imul(or,yn)|0,Ot=Math.imul(or,En);var As=(Et+At|0)+((wt&8191)<<13)|0;return Et=(Ot+(wt>>>13)|0)+(As>>>26)|0,As&=67108863,$t[0]=ds,$t[1]=fs,$t[2]=hs,$t[3]=ps,$t[4]=qn,$t[5]=ss,$t[6]=Jn,$t[7]=Yn,$t[8]=ms,$t[9]=Qn,$t[10]=es,$t[11]=ls,$t[12]=us,$t[13]=Wn,$t[14]=os,$t[15]=gs,$t[16]=bs,$t[17]=Ps,$t[18]=As,Et!==0&&($t[19]=Et,vt.length++),vt};Math.imul||(Tt=Pt);function kt(bt,ct,ht){ht.negative=ct.negative^bt.negative,ht.length=bt.length+ct.length;for(var vt=0,St=0,Rt=0;Rt>>26)|0,St+=$t>>>26,$t&=67108863}ht.words[Rt]=Et,vt=$t,$t=St}return vt!==0?ht.words[Rt]=vt:ht.length--,ht._strip()}function Lt(bt,ct,ht){return kt(bt,ct,ht)}tt.prototype.mulTo=function(ct,ht){var vt,St=this.length+ct.length;return this.length===10&&ct.length===10?vt=Tt(this,ct,ht):St<63?vt=Pt(this,ct,ht):St<1024?vt=kt(this,ct,ht):vt=Lt(this,ct,ht),vt},tt.prototype.mul=function(ct){var ht=new tt(null);return ht.words=new Array(this.length+ct.length),this.mulTo(ct,ht)},tt.prototype.mulf=function(ct){var ht=new tt(null);return ht.words=new Array(this.length+ct.length),Lt(this,ct,ht)},tt.prototype.imul=function(ct){return this.clone().mulTo(ct,this)},tt.prototype.imuln=function(ct){var ht=ct<0;ht&&(ct=-ct),j(typeof ct=="number"),j(ct<67108864);for(var vt=0,St=0;St>=26,vt+=Rt/67108864|0,vt+=$t>>>26,this.words[St]=$t&67108863}return vt!==0&&(this.words[St]=vt,this.length++),ht?this.ineg():this},tt.prototype.muln=function(ct){return this.clone().imuln(ct)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(ct){var ht=Ct(ct);if(ht.length===0)return new tt(1);for(var vt=this,St=0;St=0);var ht=ct%26,vt=(ct-ht)/26,St=67108863>>>26-ht<<26-ht,Rt;if(ht!==0){var $t=0;for(Rt=0;Rt>>26-ht}$t&&(this.words[Rt]=$t,this.length++)}if(vt!==0){for(Rt=this.length-1;Rt>=0;Rt--)this.words[Rt+vt]=this.words[Rt];for(Rt=0;Rt=0);var St;ht?St=(ht-ht%26)/26:St=0;var Rt=ct%26,$t=Math.min((ct-Rt)/26,this.length),Et=67108863^67108863>>>Rt<$t)for(this.length-=$t,wt=0;wt=0&&(Ot!==0||wt>=St);wt--){var tr=this.words[wt]|0;this.words[wt]=Ot<<26-Rt|tr>>>Rt,Ot=tr&Et}return At&&Ot!==0&&(At.words[At.length++]=Ot),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,ht,vt){return j(this.negative===0),this.iushrn(ct,ht,vt)},tt.prototype.shln=function(ct){return this.clone().ishln(ct)},tt.prototype.ushln=function(ct){return this.clone().iushln(ct)},tt.prototype.shrn=function(ct){return this.clone().ishrn(ct)},tt.prototype.ushrn=function(ct){return this.clone().iushrn(ct)},tt.prototype.testn=function(ct){j(typeof ct=="number"&&ct>=0);var ht=ct%26,vt=(ct-ht)/26,St=1<=0);var ht=ct%26,vt=(ct-ht)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=vt)return this;if(ht!==0&&vt++,this.length=Math.min(vt,this.length),ht!==0){var St=67108863^67108863>>>ht<=67108864;ht++)this.words[ht]-=67108864,ht===this.length-1?this.words[ht+1]=1:this.words[ht+1]++;return this.length=Math.max(this.length,ht+1),this},tt.prototype.isubn=function(ct){if(j(typeof ct=="number"),j(ct<67108864),ct<0)return this.iaddn(-ct);if(this.negative!==0)return this.negative=0,this.iaddn(ct),this.negative=1,this;if(this.words[0]-=ct,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ht=0;ht>26)-(At/67108864|0),this.words[Rt+vt]=$t&67108863}for(;Rt>26,this.words[Rt+vt]=$t&67108863;if(Et===0)return this._strip();for(j(Et===-1),Et=0,Rt=0;Rt>26,this.words[Rt]=$t&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,ht){var vt=this.length-ct.length,St=this.clone(),Rt=ct,$t=Rt.words[Rt.length-1]|0,Et=this._countBits($t);vt=26-Et,vt!==0&&(Rt=Rt.ushln(vt),St.iushln(vt),$t=Rt.words[Rt.length-1]|0);var At=St.length-Rt.length,wt;if(ht!=="mod"){wt=new tt(null),wt.length=At+1,wt.words=new Array(wt.length);for(var Ot=0;Ot=0;nr--){var ir=(St.words[Rt.length+nr]|0)*67108864+(St.words[Rt.length+nr-1]|0);for(ir=Math.min(ir/$t|0,67108863),St._ishlnsubmul(Rt,ir,nr);St.negative!==0;)ir--,St.negative=0,St._ishlnsubmul(Rt,1,nr),St.isZero()||(St.negative^=1);wt&&(wt.words[nr]=ir)}return wt&&wt._strip(),St._strip(),ht!=="div"&&vt!==0&&St.iushrn(vt),{div:wt||null,mod:St}},tt.prototype.divmod=function(ct,ht,vt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var St,Rt,$t;return this.negative!==0&&ct.negative===0?($t=this.neg().divmod(ct,ht),ht!=="mod"&&(St=$t.div.neg()),ht!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.iadd(ct)),{div:St,mod:Rt}):this.negative===0&&ct.negative!==0?($t=this.divmod(ct.neg(),ht),ht!=="mod"&&(St=$t.div.neg()),{div:St,mod:$t.mod}):this.negative&ct.negative?($t=this.neg().divmod(ct.neg(),ht),ht!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.isub(ct)),{div:$t.div,mod:Rt}):ct.length>this.length||this.cmp(ct)<0?{div:new tt(0),mod:this}:ct.length===1?ht==="div"?{div:this.divn(ct.words[0]),mod:null}:ht==="mod"?{div:null,mod:new tt(this.modrn(ct.words[0]))}:{div:this.divn(ct.words[0]),mod:new tt(this.modrn(ct.words[0]))}:this._wordDiv(ct,ht)},tt.prototype.div=function(ct){return this.divmod(ct,"div",!1).div},tt.prototype.mod=function(ct){return this.divmod(ct,"mod",!1).mod},tt.prototype.umod=function(ct){return this.divmod(ct,"mod",!0).mod},tt.prototype.divRound=function(ct){var ht=this.divmod(ct);if(ht.mod.isZero())return ht.div;var vt=ht.div.negative!==0?ht.mod.isub(ct):ht.mod,St=ct.ushrn(1),Rt=ct.andln(1),$t=vt.cmp(St);return $t<0||Rt===1&&$t===0?ht.div:ht.div.negative!==0?ht.div.isubn(1):ht.div.iaddn(1)},tt.prototype.modrn=function(ct){var ht=ct<0;ht&&(ct=-ct),j(ct<=67108863);for(var vt=(1<<26)%ct,St=0,Rt=this.length-1;Rt>=0;Rt--)St=(vt*St+(this.words[Rt]|0))%ct;return ht?-St:St},tt.prototype.modn=function(ct){return this.modrn(ct)},tt.prototype.idivn=function(ct){var ht=ct<0;ht&&(ct=-ct),j(ct<=67108863);for(var vt=0,St=this.length-1;St>=0;St--){var Rt=(this.words[St]|0)+vt*67108864;this.words[St]=Rt/ct|0,vt=Rt%ct}return this._strip(),ht?this.ineg():this},tt.prototype.divn=function(ct){return this.clone().idivn(ct)},tt.prototype.egcd=function(ct){j(ct.negative===0),j(!ct.isZero());var ht=this,vt=ct.clone();ht.negative!==0?ht=ht.umod(ct):ht=ht.clone();for(var St=new tt(1),Rt=new tt(0),$t=new tt(0),Et=new tt(1),At=0;ht.isEven()&&vt.isEven();)ht.iushrn(1),vt.iushrn(1),++At;for(var wt=vt.clone(),Ot=ht.clone();!ht.isZero();){for(var tr=0,nr=1;!(ht.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ht.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(wt),Rt.isub(Ot)),St.iushrn(1),Rt.iushrn(1);for(var ir=0,Wt=1;!(vt.words[0]&Wt)&&ir<26;++ir,Wt<<=1);if(ir>0)for(vt.iushrn(ir);ir-- >0;)($t.isOdd()||Et.isOdd())&&($t.iadd(wt),Et.isub(Ot)),$t.iushrn(1),Et.iushrn(1);ht.cmp(vt)>=0?(ht.isub(vt),St.isub($t),Rt.isub(Et)):(vt.isub(ht),$t.isub(St),Et.isub(Rt))}return{a:$t,b:Et,gcd:vt.iushln(At)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var ht=this,vt=ct.clone();ht.negative!==0?ht=ht.umod(ct):ht=ht.clone();for(var St=new tt(1),Rt=new tt(0),$t=vt.clone();ht.cmpn(1)>0&&vt.cmpn(1)>0;){for(var Et=0,At=1;!(ht.words[0]&At)&&Et<26;++Et,At<<=1);if(Et>0)for(ht.iushrn(Et);Et-- >0;)St.isOdd()&&St.iadd($t),St.iushrn(1);for(var wt=0,Ot=1;!(vt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(vt.iushrn(wt);wt-- >0;)Rt.isOdd()&&Rt.iadd($t),Rt.iushrn(1);ht.cmp(vt)>=0?(ht.isub(vt),St.isub(Rt)):(vt.isub(ht),Rt.isub(St))}var tr;return ht.cmpn(1)===0?tr=St:tr=Rt,tr.cmpn(0)<0&&tr.iadd(ct),tr},tt.prototype.gcd=function(ct){if(this.isZero())return ct.abs();if(ct.isZero())return this.abs();var ht=this.clone(),vt=ct.clone();ht.negative=0,vt.negative=0;for(var St=0;ht.isEven()&&vt.isEven();St++)ht.iushrn(1),vt.iushrn(1);do{for(;ht.isEven();)ht.iushrn(1);for(;vt.isEven();)vt.iushrn(1);var Rt=ht.cmp(vt);if(Rt<0){var $t=ht;ht=vt,vt=$t}else if(Rt===0||vt.cmpn(1)===0)break;ht.isub(vt)}while(!0);return vt.iushln(St)},tt.prototype.invm=function(ct){return this.egcd(ct).a.umod(ct)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(ct){return this.words[0]&ct},tt.prototype.bincn=function(ct){j(typeof ct=="number");var ht=ct%26,vt=(ct-ht)/26,St=1<>>26,Et&=67108863,this.words[$t]=Et}return Rt!==0&&(this.words[$t]=Rt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(ct){var ht=ct<0;if(this.negative!==0&&!ht)return-1;if(this.negative===0&&ht)return 1;this._strip();var vt;if(this.length>1)vt=1;else{ht&&(ct=-ct),j(ct<=67108863,"Number is too big");var St=this.words[0]|0;vt=St===ct?0:Stct.length)return 1;if(this.length=0;vt--){var St=this.words[vt]|0,Rt=ct.words[vt]|0;if(St!==Rt){StRt&&(ht=1);break}}return ht},tt.prototype.gtn=function(ct){return this.cmpn(ct)===1},tt.prototype.gt=function(ct){return this.cmp(ct)===1},tt.prototype.gten=function(ct){return this.cmpn(ct)>=0},tt.prototype.gte=function(ct){return this.cmp(ct)>=0},tt.prototype.ltn=function(ct){return this.cmpn(ct)===-1},tt.prototype.lt=function(ct){return this.cmp(ct)===-1},tt.prototype.lten=function(ct){return this.cmpn(ct)<=0},tt.prototype.lte=function(ct){return this.cmp(ct)<=0},tt.prototype.eqn=function(ct){return this.cmpn(ct)===0},tt.prototype.eq=function(ct){return this.cmp(ct)===0},tt.red=function(ct){return new Bt(ct)},tt.prototype.toRed=function(ct){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),ct.convertTo(this)._forceRed(ct)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(ct){return this.red=ct,this},tt.prototype.forceRed=function(ct){return j(!this.red,"Already a number in reduction context"),this._forceRed(ct)},tt.prototype.redAdd=function(ct){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,ct)},tt.prototype.redIAdd=function(ct){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,ct)},tt.prototype.redSub=function(ct){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,ct)},tt.prototype.redISub=function(ct){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,ct)},tt.prototype.redShl=function(ct){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,ct)},tt.prototype.redMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.mul(this,ct)},tt.prototype.redIMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.imul(this,ct)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(ct){return j(this.red&&!ct.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,ct)};var Nt={k256:null,p224:null,p192:null,p25519:null};function zt(bt,ct){this.name=bt,this.p=new tt(ct,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}zt.prototype._tmp=function(){var ct=new tt(null);return ct.words=new Array(Math.ceil(this.n/13)),ct},zt.prototype.ireduce=function(ct){var ht=ct,vt;do this.split(ht,this.tmp),ht=this.imulK(ht),ht=ht.iadd(this.tmp),vt=ht.bitLength();while(vt>this.n);var St=vt0?ht.isub(this.p):ht.strip!==void 0?ht.strip():ht._strip(),ht},zt.prototype.split=function(ct,ht){ct.iushrn(this.n,0,ht)},zt.prototype.imulK=function(ct){return ct.imul(this.k)};function jt(){zt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(jt,zt),jt.prototype.split=function(ct,ht){for(var vt=4194303,St=Math.min(ct.length,9),Rt=0;Rt>>22,$t=Et}$t>>>=22,ct.words[Rt-10]=$t,$t===0&&ct.length>10?ct.length-=10:ct.length-=9},jt.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var ht=0,vt=0;vt>>=26,ct.words[vt]=Rt,ht=St}return ht!==0&&(ct.words[ct.length++]=ht),ct},tt._prime=function(ct){if(Nt[ct])return Nt[ct];var ht;if(ct==="k256")ht=new jt;else if(ct==="p224")ht=new Mt;else if(ct==="p192")ht=new Dt;else if(ct==="p25519")ht=new Ft;else throw new Error("Unknown prime "+ct);return Nt[ct]=ht,ht};function Bt(bt){if(typeof bt=="string"){var ct=tt._prime(bt);this.m=ct.p,this.prime=ct}else j(bt.gtn(1),"modulus must be greater than 1"),this.m=bt,this.prime=null}Bt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},Bt.prototype._verify2=function(ct,ht){j((ct.negative|ht.negative)===0,"red works only with positives"),j(ct.red&&ct.red===ht.red,"red works only with red numbers")},Bt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(st(ct,ct.umod(this.m)._forceRed(this)),ct)},Bt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},Bt.prototype.add=function(ct,ht){this._verify2(ct,ht);var vt=ct.add(ht);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt._forceRed(this)},Bt.prototype.iadd=function(ct,ht){this._verify2(ct,ht);var vt=ct.iadd(ht);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt},Bt.prototype.sub=function(ct,ht){this._verify2(ct,ht);var vt=ct.sub(ht);return vt.cmpn(0)<0&&vt.iadd(this.m),vt._forceRed(this)},Bt.prototype.isub=function(ct,ht){this._verify2(ct,ht);var vt=ct.isub(ht);return vt.cmpn(0)<0&&vt.iadd(this.m),vt},Bt.prototype.shl=function(ct,ht){return this._verify1(ct),this.imod(ct.ushln(ht))},Bt.prototype.imul=function(ct,ht){return this._verify2(ct,ht),this.imod(ct.imul(ht))},Bt.prototype.mul=function(ct,ht){return this._verify2(ct,ht),this.imod(ct.mul(ht))},Bt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},Bt.prototype.sqr=function(ct){return this.mul(ct,ct)},Bt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var ht=this.m.andln(3);if(j(ht%2===1),ht===3){var vt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,vt)}for(var St=this.m.subn(1),Rt=0;!St.isZero()&&St.andln(1)===0;)Rt++,St.iushrn(1);j(!St.isZero());var $t=new tt(1).toRed(this),Et=$t.redNeg(),At=this.m.subn(1).iushrn(1),wt=this.m.bitLength();for(wt=new tt(2*wt*wt).toRed(this);this.pow(wt,At).cmp(Et)!==0;)wt.redIAdd(Et);for(var Ot=this.pow(wt,St),tr=this.pow(ct,St.addn(1).iushrn(1)),nr=this.pow(ct,St),ir=Rt;nr.cmp($t)!==0;){for(var Wt=nr,Kt=0;Wt.cmp($t)!==0;Kt++)Wt=Wt.redSqr();j(Kt=0;Rt--){for(var Ot=ht.words[Rt],tr=wt-1;tr>=0;tr--){var nr=Ot>>tr&1;if($t!==St[0]&&($t=this.sqr($t)),nr===0&&Et===0){At=0;continue}Et<<=1,Et|=nr,At++,!(At!==vt&&(Rt!==0||tr!==0))&&($t=this.mul($t,St[Et]),At=0,Et=0)}wt=26}return $t},Bt.prototype.convertTo=function(ct){var ht=ct.umod(this.m);return ht===ct?ht.clone():ht},Bt.prototype.convertFrom=function(ct){var ht=ct.clone();return ht.red=null,ht},tt.mont=function(ct){return new yt(ct)};function yt(bt){Bt.call(this,bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(yt,Bt),yt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},yt.prototype.convertFrom=function(ct){var ht=this.imod(ct.mul(this.rinv));return ht.red=null,ht},yt.prototype.imul=function(ct,ht){if(ct.isZero()||ht.isZero())return ct.words[0]=0,ct.length=1,ct;var vt=ct.imul(ht),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.mul=function(ct,ht){if(ct.isZero()||ht.isZero())return new tt(0)._forceRed(this);var vt=ct.mul(ht),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.invm=function(ct){var ht=this.imod(ct._invmp(this.m).mul(this.r2));return ht._forceRed(this)}})(_,commonjsGlobal)}(bn$3)),bn$3.exports}var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var _=requireBn$2(),a=requireBrowser$8();function $(tt){var rt=j(tt),nt=rt.toRed(_.mont(tt.modulus)).redPow(new _(tt.publicExponent)).fromRed();return{blinder:nt,unblinder:rt.invm(tt.modulus)}}function j(tt){var rt=tt.modulus.byteLength(),nt;do nt=new _(a(rt));while(nt.cmp(tt.modulus)>=0||!nt.umod(tt.prime1)||!nt.umod(tt.prime2));return nt}function et(tt,rt){var nt=$(rt),it=rt.modulus.byteLength(),at=new _(tt).mul(nt.blinder).umod(rt.modulus),st=at.toRed(_.mont(rt.prime1)),ot=at.toRed(_.mont(rt.prime2)),ut=rt.coefficient,dt=rt.prime1,mt=rt.prime2,xt=st.redPow(rt.exponent1).fromRed(),Ct=ot.redPow(rt.exponent2).fromRed(),Pt=xt.isub(Ct).imul(ut).umod(dt).imul(mt);return Ct.iadd(Pt).imul(nt.unblinder).umod(rt.modulus).toArrayLike(Buffer$g,"be",it)}return et.getr=j,browserifyRsa=et,browserifyRsa}var elliptic$5={};const name$5="elliptic",version$5="6.5.5",description$5="EC cryptography",main$5="lib/elliptic.js",files$4=["lib"],scripts$5={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository$5={type:"git",url:"git@github.com:indutny/elliptic"},keywords$4=["EC","Elliptic","curve","Cryptography"],author$5="Fedor Indutny ",license$5="MIT",bugs$4={url:"https://github.com/indutny/elliptic/issues"},homepage$5="https://github.com/indutny/elliptic",devDependencies$5={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$5={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$5={name:name$5,version:version$5,description:description$5,main:main$5,files:files$4,scripts:scripts$5,repository:repository$5,keywords:keywords$4,author:author$5,license:license$5,bugs:bugs$4,homepage:homepage$5,devDependencies:devDependencies$5,dependencies:dependencies$5};var utils$S={},bn$2={exports:{}};bn$2.exports;var hasRequiredBn$1;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(_){(function(a,$){function j(Bt,yt){if(!Bt)throw new Error(yt||"Assertion failed")}function et(Bt,yt){Bt.super_=yt;var bt=function(){};bt.prototype=yt.prototype,Bt.prototype=new bt,Bt.prototype.constructor=Bt}function tt(Bt,yt,bt){if(tt.isBN(Bt))return Bt;this.negative=0,this.words=null,this.length=0,this.red=null,Bt!==null&&((yt==="le"||yt==="be")&&(bt=yt,yt=10),this._init(Bt||0,yt||10,bt||"be"))}typeof a=="object"?a.exports=tt:$.BN=tt,tt.BN=tt,tt.wordSize=26;var rt;try{typeof window<"u"&&typeof window.Buffer<"u"?rt=window.Buffer:rt=require$$0$6.Buffer}catch{}tt.isBN=function(yt){return yt instanceof tt?!0:yt!==null&&typeof yt=="object"&&yt.constructor.wordSize===tt.wordSize&&Array.isArray(yt.words)},tt.max=function(yt,bt){return yt.cmp(bt)>0?yt:bt},tt.min=function(yt,bt){return yt.cmp(bt)<0?yt:bt},tt.prototype._init=function(yt,bt,ct){if(typeof yt=="number")return this._initNumber(yt,bt,ct);if(typeof yt=="object")return this._initArray(yt,bt,ct);bt==="hex"&&(bt=16),j(bt===(bt|0)&&bt>=2&&bt<=36),yt=yt.toString().replace(/\s+/g,"");var ht=0;yt[0]==="-"&&(ht++,this.negative=1),ht=0;ht-=3)St=yt[ht]|yt[ht-1]<<8|yt[ht-2]<<16,this.words[vt]|=St<>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);else if(ct==="le")for(ht=0,vt=0;ht>>26-Rt&67108863,Rt+=24,Rt>=26&&(Rt-=26,vt++);return this.strip()};function nt(Bt,yt){var bt=Bt.charCodeAt(yt);return bt>=65&&bt<=70?bt-55:bt>=97&&bt<=102?bt-87:bt-48&15}function it(Bt,yt,bt){var ct=nt(Bt,bt);return bt-1>=yt&&(ct|=nt(Bt,bt-1)<<4),ct}tt.prototype._parseHex=function(yt,bt,ct){this.length=Math.ceil((yt.length-bt)/6),this.words=new Array(this.length);for(var ht=0;ht=bt;ht-=2)Rt=it(yt,bt,ht)<=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8;else{var $t=yt.length-bt;for(ht=$t%2===0?bt+1:bt;ht=18?(vt-=18,St+=1,this.words[St]|=Rt>>>26):vt+=8}this.strip()};function at(Bt,yt,bt,ct){for(var ht=0,vt=Math.min(Bt.length,bt),St=yt;St=49?ht+=Rt-49+10:Rt>=17?ht+=Rt-17+10:ht+=Rt}return ht}tt.prototype._parseBase=function(yt,bt,ct){this.words=[0],this.length=1;for(var ht=0,vt=1;vt<=67108863;vt*=bt)ht++;ht--,vt=vt/bt|0;for(var St=yt.length-ct,Rt=St%ht,$t=Math.min(St,St-Rt)+ct,Et=0,At=ct;At<$t;At+=ht)Et=at(yt,At,At+ht,bt),this.imuln(vt),this.words[0]+Et<67108864?this.words[0]+=Et:this._iaddn(Et);if(Rt!==0){var wt=1;for(Et=at(yt,At,yt.length,bt),At=0;At1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},tt.prototype.inspect=function(){return(this.red?""};var st=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ot=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ut=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(yt,bt){yt=yt||10,bt=bt|0||1;var ct;if(yt===16||yt==="hex"){ct="";for(var ht=0,vt=0,St=0;St>>24-ht&16777215,vt!==0||St!==this.length-1?ct=st[6-$t.length]+$t+ct:ct=$t+ct,ht+=2,ht>=26&&(ht-=26,St--)}for(vt!==0&&(ct=vt.toString(16)+ct);ct.length%bt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}if(yt===(yt|0)&&yt>=2&&yt<=36){var Et=ot[yt],At=ut[yt];ct="";var wt=this.clone();for(wt.negative=0;!wt.isZero();){var Ot=wt.modn(At).toString(yt);wt=wt.idivn(At),wt.isZero()?ct=Ot+ct:ct=st[Et-Ot.length]+Ot+ct}for(this.isZero()&&(ct="0"+ct);ct.length%bt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var yt=this.words[0];return this.length===2?yt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?yt+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-yt:yt},tt.prototype.toJSON=function(){return this.toString(16)},tt.prototype.toBuffer=function(yt,bt){return j(typeof rt<"u"),this.toArrayLike(rt,yt,bt)},tt.prototype.toArray=function(yt,bt){return this.toArrayLike(Array,yt,bt)},tt.prototype.toArrayLike=function(yt,bt,ct){var ht=this.byteLength(),vt=ct||Math.max(1,ht);j(ht<=vt,"byte array longer than desired length"),j(vt>0,"Requested array length <= 0"),this.strip();var St=bt==="le",Rt=new yt(vt),$t,Et,At=this.clone();if(St){for(Et=0;!At.isZero();Et++)$t=At.andln(255),At.iushrn(8),Rt[Et]=$t;for(;Et=4096&&(ct+=13,bt>>>=13),bt>=64&&(ct+=7,bt>>>=7),bt>=8&&(ct+=4,bt>>>=4),bt>=2&&(ct+=2,bt>>>=2),ct+bt},tt.prototype._zeroBits=function(yt){if(yt===0)return 26;var bt=yt,ct=0;return bt&8191||(ct+=13,bt>>>=13),bt&127||(ct+=7,bt>>>=7),bt&15||(ct+=4,bt>>>=4),bt&3||(ct+=2,bt>>>=2),bt&1||ct++,ct},tt.prototype.bitLength=function(){var yt=this.words[this.length-1],bt=this._countBits(yt);return(this.length-1)*26+bt};function dt(Bt){for(var yt=new Array(Bt.bitLength()),bt=0;bt>>ht}return yt}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var yt=0,bt=0;btyt.length?this.clone().ior(yt):yt.clone().ior(this)},tt.prototype.uor=function(yt){return this.length>yt.length?this.clone().iuor(yt):yt.clone().iuor(this)},tt.prototype.iuand=function(yt){var bt;this.length>yt.length?bt=yt:bt=this;for(var ct=0;ctyt.length?this.clone().iand(yt):yt.clone().iand(this)},tt.prototype.uand=function(yt){return this.length>yt.length?this.clone().iuand(yt):yt.clone().iuand(this)},tt.prototype.iuxor=function(yt){var bt,ct;this.length>yt.length?(bt=this,ct=yt):(bt=yt,ct=this);for(var ht=0;htyt.length?this.clone().ixor(yt):yt.clone().ixor(this)},tt.prototype.uxor=function(yt){return this.length>yt.length?this.clone().iuxor(yt):yt.clone().iuxor(this)},tt.prototype.inotn=function(yt){j(typeof yt=="number"&&yt>=0);var bt=Math.ceil(yt/26)|0,ct=yt%26;this._expand(bt),ct>0&&bt--;for(var ht=0;ht0&&(this.words[ht]=~this.words[ht]&67108863>>26-ct),this.strip()},tt.prototype.notn=function(yt){return this.clone().inotn(yt)},tt.prototype.setn=function(yt,bt){j(typeof yt=="number"&&yt>=0);var ct=yt/26|0,ht=yt%26;return this._expand(ct+1),bt?this.words[ct]=this.words[ct]|1<yt.length?(ct=this,ht=yt):(ct=yt,ht=this);for(var vt=0,St=0;St>>26;for(;vt!==0&&St>>26;if(this.length=ct.length,vt!==0)this.words[this.length]=vt,this.length++;else if(ct!==this)for(;Styt.length?this.clone().iadd(yt):yt.clone().iadd(this)},tt.prototype.isub=function(yt){if(yt.negative!==0){yt.negative=0;var bt=this.iadd(yt);return yt.negative=1,bt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(yt),this.negative=1,this._normSign();var ct=this.cmp(yt);if(ct===0)return this.negative=0,this.length=1,this.words[0]=0,this;var ht,vt;ct>0?(ht=this,vt=yt):(ht=yt,vt=this);for(var St=0,Rt=0;Rt>26,this.words[Rt]=bt&67108863;for(;St!==0&&Rt>26,this.words[Rt]=bt&67108863;if(St===0&&Rt>>26,wt=$t&67108863,Ot=Math.min(Et,yt.length-1),tr=Math.max(0,Et-Bt.length+1);tr<=Ot;tr++){var nr=Et-tr|0;ht=Bt.words[nr]|0,vt=yt.words[tr]|0,St=ht*vt+wt,At+=St/67108864|0,wt=St&67108863}bt.words[Et]=wt|0,$t=At|0}return $t!==0?bt.words[Et]=$t|0:bt.length--,bt.strip()}var xt=function(yt,bt,ct){var ht=yt.words,vt=bt.words,St=ct.words,Rt=0,$t,Et,At,wt=ht[0]|0,Ot=wt&8191,tr=wt>>>13,nr=ht[1]|0,ir=nr&8191,Wt=nr>>>13,Kt=ht[2]|0,Jt=Kt&8191,Ht=Kt>>>13,Vt=ht[3]|0,Qt=Vt&8191,dr=Vt>>>13,xr=ht[4]|0,pr=xr&8191,Ir=xr>>>13,kr=ht[5]|0,lr=kr&8191,fr=kr>>>13,Er=ht[6]|0,$r=Er&8191,Pr=Er>>>13,Rr=ht[7]|0,Ar=Rr&8191,Or=Rr>>>13,Lr=ht[8]|0,ar=Lr&8191,Yt=Lr>>>13,er=ht[9]|0,Zt=er&8191,qt=er>>>13,Gt=vt[0]|0,or=Gt&8191,vr=Gt>>>13,wr=vt[1]|0,Sr=wr&8191,Wr=wr>>>13,Hr=vt[2]|0,Fr=Hr&8191,pn=Hr>>>13,Jr=vt[3]|0,Qr=Jr&8191,mn=Jr>>>13,ln=vt[4]|0,Vr=ln&8191,wn=ln>>>13,un=vt[5]|0,qr=un&8191,hn=un>>>13,fn=vt[6]|0,Kr=fn&8191,$n=fn>>>13,dn=vt[7]|0,Gr=dn&8191,gn=dn>>>13,an=vt[8]|0,Zr=an&8191,Rn=an>>>13,Sn=vt[9]|0,nn=Sn&8191,Tn=Sn>>>13;ct.negative=yt.negative^bt.negative,ct.length=19,$t=Math.imul(Ot,or),Et=Math.imul(Ot,vr),Et=Et+Math.imul(tr,or)|0,At=Math.imul(tr,vr);var yn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(yn>>>26)|0,yn&=67108863,$t=Math.imul(ir,or),Et=Math.imul(ir,vr),Et=Et+Math.imul(Wt,or)|0,At=Math.imul(Wt,vr),$t=$t+Math.imul(Ot,Sr)|0,Et=Et+Math.imul(Ot,Wr)|0,Et=Et+Math.imul(tr,Sr)|0,At=At+Math.imul(tr,Wr)|0;var En=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(En>>>26)|0,En&=67108863,$t=Math.imul(Jt,or),Et=Math.imul(Jt,vr),Et=Et+Math.imul(Ht,or)|0,At=Math.imul(Ht,vr),$t=$t+Math.imul(ir,Sr)|0,Et=Et+Math.imul(ir,Wr)|0,Et=Et+Math.imul(Wt,Sr)|0,At=At+Math.imul(Wt,Wr)|0,$t=$t+Math.imul(Ot,Fr)|0,Et=Et+Math.imul(Ot,pn)|0,Et=Et+Math.imul(tr,Fr)|0,At=At+Math.imul(tr,pn)|0;var ds=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ds>>>26)|0,ds&=67108863,$t=Math.imul(Qt,or),Et=Math.imul(Qt,vr),Et=Et+Math.imul(dr,or)|0,At=Math.imul(dr,vr),$t=$t+Math.imul(Jt,Sr)|0,Et=Et+Math.imul(Jt,Wr)|0,Et=Et+Math.imul(Ht,Sr)|0,At=At+Math.imul(Ht,Wr)|0,$t=$t+Math.imul(ir,Fr)|0,Et=Et+Math.imul(ir,pn)|0,Et=Et+Math.imul(Wt,Fr)|0,At=At+Math.imul(Wt,pn)|0,$t=$t+Math.imul(Ot,Qr)|0,Et=Et+Math.imul(Ot,mn)|0,Et=Et+Math.imul(tr,Qr)|0,At=At+Math.imul(tr,mn)|0;var fs=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(fs>>>26)|0,fs&=67108863,$t=Math.imul(pr,or),Et=Math.imul(pr,vr),Et=Et+Math.imul(Ir,or)|0,At=Math.imul(Ir,vr),$t=$t+Math.imul(Qt,Sr)|0,Et=Et+Math.imul(Qt,Wr)|0,Et=Et+Math.imul(dr,Sr)|0,At=At+Math.imul(dr,Wr)|0,$t=$t+Math.imul(Jt,Fr)|0,Et=Et+Math.imul(Jt,pn)|0,Et=Et+Math.imul(Ht,Fr)|0,At=At+Math.imul(Ht,pn)|0,$t=$t+Math.imul(ir,Qr)|0,Et=Et+Math.imul(ir,mn)|0,Et=Et+Math.imul(Wt,Qr)|0,At=At+Math.imul(Wt,mn)|0,$t=$t+Math.imul(Ot,Vr)|0,Et=Et+Math.imul(Ot,wn)|0,Et=Et+Math.imul(tr,Vr)|0,At=At+Math.imul(tr,wn)|0;var hs=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(hs>>>26)|0,hs&=67108863,$t=Math.imul(lr,or),Et=Math.imul(lr,vr),Et=Et+Math.imul(fr,or)|0,At=Math.imul(fr,vr),$t=$t+Math.imul(pr,Sr)|0,Et=Et+Math.imul(pr,Wr)|0,Et=Et+Math.imul(Ir,Sr)|0,At=At+Math.imul(Ir,Wr)|0,$t=$t+Math.imul(Qt,Fr)|0,Et=Et+Math.imul(Qt,pn)|0,Et=Et+Math.imul(dr,Fr)|0,At=At+Math.imul(dr,pn)|0,$t=$t+Math.imul(Jt,Qr)|0,Et=Et+Math.imul(Jt,mn)|0,Et=Et+Math.imul(Ht,Qr)|0,At=At+Math.imul(Ht,mn)|0,$t=$t+Math.imul(ir,Vr)|0,Et=Et+Math.imul(ir,wn)|0,Et=Et+Math.imul(Wt,Vr)|0,At=At+Math.imul(Wt,wn)|0,$t=$t+Math.imul(Ot,qr)|0,Et=Et+Math.imul(Ot,hn)|0,Et=Et+Math.imul(tr,qr)|0,At=At+Math.imul(tr,hn)|0;var ps=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ps>>>26)|0,ps&=67108863,$t=Math.imul($r,or),Et=Math.imul($r,vr),Et=Et+Math.imul(Pr,or)|0,At=Math.imul(Pr,vr),$t=$t+Math.imul(lr,Sr)|0,Et=Et+Math.imul(lr,Wr)|0,Et=Et+Math.imul(fr,Sr)|0,At=At+Math.imul(fr,Wr)|0,$t=$t+Math.imul(pr,Fr)|0,Et=Et+Math.imul(pr,pn)|0,Et=Et+Math.imul(Ir,Fr)|0,At=At+Math.imul(Ir,pn)|0,$t=$t+Math.imul(Qt,Qr)|0,Et=Et+Math.imul(Qt,mn)|0,Et=Et+Math.imul(dr,Qr)|0,At=At+Math.imul(dr,mn)|0,$t=$t+Math.imul(Jt,Vr)|0,Et=Et+Math.imul(Jt,wn)|0,Et=Et+Math.imul(Ht,Vr)|0,At=At+Math.imul(Ht,wn)|0,$t=$t+Math.imul(ir,qr)|0,Et=Et+Math.imul(ir,hn)|0,Et=Et+Math.imul(Wt,qr)|0,At=At+Math.imul(Wt,hn)|0,$t=$t+Math.imul(Ot,Kr)|0,Et=Et+Math.imul(Ot,$n)|0,Et=Et+Math.imul(tr,Kr)|0,At=At+Math.imul(tr,$n)|0;var qn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(qn>>>26)|0,qn&=67108863,$t=Math.imul(Ar,or),Et=Math.imul(Ar,vr),Et=Et+Math.imul(Or,or)|0,At=Math.imul(Or,vr),$t=$t+Math.imul($r,Sr)|0,Et=Et+Math.imul($r,Wr)|0,Et=Et+Math.imul(Pr,Sr)|0,At=At+Math.imul(Pr,Wr)|0,$t=$t+Math.imul(lr,Fr)|0,Et=Et+Math.imul(lr,pn)|0,Et=Et+Math.imul(fr,Fr)|0,At=At+Math.imul(fr,pn)|0,$t=$t+Math.imul(pr,Qr)|0,Et=Et+Math.imul(pr,mn)|0,Et=Et+Math.imul(Ir,Qr)|0,At=At+Math.imul(Ir,mn)|0,$t=$t+Math.imul(Qt,Vr)|0,Et=Et+Math.imul(Qt,wn)|0,Et=Et+Math.imul(dr,Vr)|0,At=At+Math.imul(dr,wn)|0,$t=$t+Math.imul(Jt,qr)|0,Et=Et+Math.imul(Jt,hn)|0,Et=Et+Math.imul(Ht,qr)|0,At=At+Math.imul(Ht,hn)|0,$t=$t+Math.imul(ir,Kr)|0,Et=Et+Math.imul(ir,$n)|0,Et=Et+Math.imul(Wt,Kr)|0,At=At+Math.imul(Wt,$n)|0,$t=$t+Math.imul(Ot,Gr)|0,Et=Et+Math.imul(Ot,gn)|0,Et=Et+Math.imul(tr,Gr)|0,At=At+Math.imul(tr,gn)|0;var ss=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ss>>>26)|0,ss&=67108863,$t=Math.imul(ar,or),Et=Math.imul(ar,vr),Et=Et+Math.imul(Yt,or)|0,At=Math.imul(Yt,vr),$t=$t+Math.imul(Ar,Sr)|0,Et=Et+Math.imul(Ar,Wr)|0,Et=Et+Math.imul(Or,Sr)|0,At=At+Math.imul(Or,Wr)|0,$t=$t+Math.imul($r,Fr)|0,Et=Et+Math.imul($r,pn)|0,Et=Et+Math.imul(Pr,Fr)|0,At=At+Math.imul(Pr,pn)|0,$t=$t+Math.imul(lr,Qr)|0,Et=Et+Math.imul(lr,mn)|0,Et=Et+Math.imul(fr,Qr)|0,At=At+Math.imul(fr,mn)|0,$t=$t+Math.imul(pr,Vr)|0,Et=Et+Math.imul(pr,wn)|0,Et=Et+Math.imul(Ir,Vr)|0,At=At+Math.imul(Ir,wn)|0,$t=$t+Math.imul(Qt,qr)|0,Et=Et+Math.imul(Qt,hn)|0,Et=Et+Math.imul(dr,qr)|0,At=At+Math.imul(dr,hn)|0,$t=$t+Math.imul(Jt,Kr)|0,Et=Et+Math.imul(Jt,$n)|0,Et=Et+Math.imul(Ht,Kr)|0,At=At+Math.imul(Ht,$n)|0,$t=$t+Math.imul(ir,Gr)|0,Et=Et+Math.imul(ir,gn)|0,Et=Et+Math.imul(Wt,Gr)|0,At=At+Math.imul(Wt,gn)|0,$t=$t+Math.imul(Ot,Zr)|0,Et=Et+Math.imul(Ot,Rn)|0,Et=Et+Math.imul(tr,Zr)|0,At=At+Math.imul(tr,Rn)|0;var Jn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,$t=Math.imul(Zt,or),Et=Math.imul(Zt,vr),Et=Et+Math.imul(qt,or)|0,At=Math.imul(qt,vr),$t=$t+Math.imul(ar,Sr)|0,Et=Et+Math.imul(ar,Wr)|0,Et=Et+Math.imul(Yt,Sr)|0,At=At+Math.imul(Yt,Wr)|0,$t=$t+Math.imul(Ar,Fr)|0,Et=Et+Math.imul(Ar,pn)|0,Et=Et+Math.imul(Or,Fr)|0,At=At+Math.imul(Or,pn)|0,$t=$t+Math.imul($r,Qr)|0,Et=Et+Math.imul($r,mn)|0,Et=Et+Math.imul(Pr,Qr)|0,At=At+Math.imul(Pr,mn)|0,$t=$t+Math.imul(lr,Vr)|0,Et=Et+Math.imul(lr,wn)|0,Et=Et+Math.imul(fr,Vr)|0,At=At+Math.imul(fr,wn)|0,$t=$t+Math.imul(pr,qr)|0,Et=Et+Math.imul(pr,hn)|0,Et=Et+Math.imul(Ir,qr)|0,At=At+Math.imul(Ir,hn)|0,$t=$t+Math.imul(Qt,Kr)|0,Et=Et+Math.imul(Qt,$n)|0,Et=Et+Math.imul(dr,Kr)|0,At=At+Math.imul(dr,$n)|0,$t=$t+Math.imul(Jt,Gr)|0,Et=Et+Math.imul(Jt,gn)|0,Et=Et+Math.imul(Ht,Gr)|0,At=At+Math.imul(Ht,gn)|0,$t=$t+Math.imul(ir,Zr)|0,Et=Et+Math.imul(ir,Rn)|0,Et=Et+Math.imul(Wt,Zr)|0,At=At+Math.imul(Wt,Rn)|0,$t=$t+Math.imul(Ot,nn)|0,Et=Et+Math.imul(Ot,Tn)|0,Et=Et+Math.imul(tr,nn)|0,At=At+Math.imul(tr,Tn)|0;var Yn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,$t=Math.imul(Zt,Sr),Et=Math.imul(Zt,Wr),Et=Et+Math.imul(qt,Sr)|0,At=Math.imul(qt,Wr),$t=$t+Math.imul(ar,Fr)|0,Et=Et+Math.imul(ar,pn)|0,Et=Et+Math.imul(Yt,Fr)|0,At=At+Math.imul(Yt,pn)|0,$t=$t+Math.imul(Ar,Qr)|0,Et=Et+Math.imul(Ar,mn)|0,Et=Et+Math.imul(Or,Qr)|0,At=At+Math.imul(Or,mn)|0,$t=$t+Math.imul($r,Vr)|0,Et=Et+Math.imul($r,wn)|0,Et=Et+Math.imul(Pr,Vr)|0,At=At+Math.imul(Pr,wn)|0,$t=$t+Math.imul(lr,qr)|0,Et=Et+Math.imul(lr,hn)|0,Et=Et+Math.imul(fr,qr)|0,At=At+Math.imul(fr,hn)|0,$t=$t+Math.imul(pr,Kr)|0,Et=Et+Math.imul(pr,$n)|0,Et=Et+Math.imul(Ir,Kr)|0,At=At+Math.imul(Ir,$n)|0,$t=$t+Math.imul(Qt,Gr)|0,Et=Et+Math.imul(Qt,gn)|0,Et=Et+Math.imul(dr,Gr)|0,At=At+Math.imul(dr,gn)|0,$t=$t+Math.imul(Jt,Zr)|0,Et=Et+Math.imul(Jt,Rn)|0,Et=Et+Math.imul(Ht,Zr)|0,At=At+Math.imul(Ht,Rn)|0,$t=$t+Math.imul(ir,nn)|0,Et=Et+Math.imul(ir,Tn)|0,Et=Et+Math.imul(Wt,nn)|0,At=At+Math.imul(Wt,Tn)|0;var ms=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ms>>>26)|0,ms&=67108863,$t=Math.imul(Zt,Fr),Et=Math.imul(Zt,pn),Et=Et+Math.imul(qt,Fr)|0,At=Math.imul(qt,pn),$t=$t+Math.imul(ar,Qr)|0,Et=Et+Math.imul(ar,mn)|0,Et=Et+Math.imul(Yt,Qr)|0,At=At+Math.imul(Yt,mn)|0,$t=$t+Math.imul(Ar,Vr)|0,Et=Et+Math.imul(Ar,wn)|0,Et=Et+Math.imul(Or,Vr)|0,At=At+Math.imul(Or,wn)|0,$t=$t+Math.imul($r,qr)|0,Et=Et+Math.imul($r,hn)|0,Et=Et+Math.imul(Pr,qr)|0,At=At+Math.imul(Pr,hn)|0,$t=$t+Math.imul(lr,Kr)|0,Et=Et+Math.imul(lr,$n)|0,Et=Et+Math.imul(fr,Kr)|0,At=At+Math.imul(fr,$n)|0,$t=$t+Math.imul(pr,Gr)|0,Et=Et+Math.imul(pr,gn)|0,Et=Et+Math.imul(Ir,Gr)|0,At=At+Math.imul(Ir,gn)|0,$t=$t+Math.imul(Qt,Zr)|0,Et=Et+Math.imul(Qt,Rn)|0,Et=Et+Math.imul(dr,Zr)|0,At=At+Math.imul(dr,Rn)|0,$t=$t+Math.imul(Jt,nn)|0,Et=Et+Math.imul(Jt,Tn)|0,Et=Et+Math.imul(Ht,nn)|0,At=At+Math.imul(Ht,Tn)|0;var Qn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,$t=Math.imul(Zt,Qr),Et=Math.imul(Zt,mn),Et=Et+Math.imul(qt,Qr)|0,At=Math.imul(qt,mn),$t=$t+Math.imul(ar,Vr)|0,Et=Et+Math.imul(ar,wn)|0,Et=Et+Math.imul(Yt,Vr)|0,At=At+Math.imul(Yt,wn)|0,$t=$t+Math.imul(Ar,qr)|0,Et=Et+Math.imul(Ar,hn)|0,Et=Et+Math.imul(Or,qr)|0,At=At+Math.imul(Or,hn)|0,$t=$t+Math.imul($r,Kr)|0,Et=Et+Math.imul($r,$n)|0,Et=Et+Math.imul(Pr,Kr)|0,At=At+Math.imul(Pr,$n)|0,$t=$t+Math.imul(lr,Gr)|0,Et=Et+Math.imul(lr,gn)|0,Et=Et+Math.imul(fr,Gr)|0,At=At+Math.imul(fr,gn)|0,$t=$t+Math.imul(pr,Zr)|0,Et=Et+Math.imul(pr,Rn)|0,Et=Et+Math.imul(Ir,Zr)|0,At=At+Math.imul(Ir,Rn)|0,$t=$t+Math.imul(Qt,nn)|0,Et=Et+Math.imul(Qt,Tn)|0,Et=Et+Math.imul(dr,nn)|0,At=At+Math.imul(dr,Tn)|0;var es=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(es>>>26)|0,es&=67108863,$t=Math.imul(Zt,Vr),Et=Math.imul(Zt,wn),Et=Et+Math.imul(qt,Vr)|0,At=Math.imul(qt,wn),$t=$t+Math.imul(ar,qr)|0,Et=Et+Math.imul(ar,hn)|0,Et=Et+Math.imul(Yt,qr)|0,At=At+Math.imul(Yt,hn)|0,$t=$t+Math.imul(Ar,Kr)|0,Et=Et+Math.imul(Ar,$n)|0,Et=Et+Math.imul(Or,Kr)|0,At=At+Math.imul(Or,$n)|0,$t=$t+Math.imul($r,Gr)|0,Et=Et+Math.imul($r,gn)|0,Et=Et+Math.imul(Pr,Gr)|0,At=At+Math.imul(Pr,gn)|0,$t=$t+Math.imul(lr,Zr)|0,Et=Et+Math.imul(lr,Rn)|0,Et=Et+Math.imul(fr,Zr)|0,At=At+Math.imul(fr,Rn)|0,$t=$t+Math.imul(pr,nn)|0,Et=Et+Math.imul(pr,Tn)|0,Et=Et+Math.imul(Ir,nn)|0,At=At+Math.imul(Ir,Tn)|0;var ls=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(ls>>>26)|0,ls&=67108863,$t=Math.imul(Zt,qr),Et=Math.imul(Zt,hn),Et=Et+Math.imul(qt,qr)|0,At=Math.imul(qt,hn),$t=$t+Math.imul(ar,Kr)|0,Et=Et+Math.imul(ar,$n)|0,Et=Et+Math.imul(Yt,Kr)|0,At=At+Math.imul(Yt,$n)|0,$t=$t+Math.imul(Ar,Gr)|0,Et=Et+Math.imul(Ar,gn)|0,Et=Et+Math.imul(Or,Gr)|0,At=At+Math.imul(Or,gn)|0,$t=$t+Math.imul($r,Zr)|0,Et=Et+Math.imul($r,Rn)|0,Et=Et+Math.imul(Pr,Zr)|0,At=At+Math.imul(Pr,Rn)|0,$t=$t+Math.imul(lr,nn)|0,Et=Et+Math.imul(lr,Tn)|0,Et=Et+Math.imul(fr,nn)|0,At=At+Math.imul(fr,Tn)|0;var us=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(us>>>26)|0,us&=67108863,$t=Math.imul(Zt,Kr),Et=Math.imul(Zt,$n),Et=Et+Math.imul(qt,Kr)|0,At=Math.imul(qt,$n),$t=$t+Math.imul(ar,Gr)|0,Et=Et+Math.imul(ar,gn)|0,Et=Et+Math.imul(Yt,Gr)|0,At=At+Math.imul(Yt,gn)|0,$t=$t+Math.imul(Ar,Zr)|0,Et=Et+Math.imul(Ar,Rn)|0,Et=Et+Math.imul(Or,Zr)|0,At=At+Math.imul(Or,Rn)|0,$t=$t+Math.imul($r,nn)|0,Et=Et+Math.imul($r,Tn)|0,Et=Et+Math.imul(Pr,nn)|0,At=At+Math.imul(Pr,Tn)|0;var Wn=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,$t=Math.imul(Zt,Gr),Et=Math.imul(Zt,gn),Et=Et+Math.imul(qt,Gr)|0,At=Math.imul(qt,gn),$t=$t+Math.imul(ar,Zr)|0,Et=Et+Math.imul(ar,Rn)|0,Et=Et+Math.imul(Yt,Zr)|0,At=At+Math.imul(Yt,Rn)|0,$t=$t+Math.imul(Ar,nn)|0,Et=Et+Math.imul(Ar,Tn)|0,Et=Et+Math.imul(Or,nn)|0,At=At+Math.imul(Or,Tn)|0;var os=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(os>>>26)|0,os&=67108863,$t=Math.imul(Zt,Zr),Et=Math.imul(Zt,Rn),Et=Et+Math.imul(qt,Zr)|0,At=Math.imul(qt,Rn),$t=$t+Math.imul(ar,nn)|0,Et=Et+Math.imul(ar,Tn)|0,Et=Et+Math.imul(Yt,nn)|0,At=At+Math.imul(Yt,Tn)|0;var gs=(Rt+$t|0)+((Et&8191)<<13)|0;Rt=(At+(Et>>>13)|0)+(gs>>>26)|0,gs&=67108863,$t=Math.imul(Zt,nn),Et=Math.imul(Zt,Tn),Et=Et+Math.imul(qt,nn)|0,At=Math.imul(qt,Tn);var bs=(Rt+$t|0)+((Et&8191)<<13)|0;return Rt=(At+(Et>>>13)|0)+(bs>>>26)|0,bs&=67108863,St[0]=yn,St[1]=En,St[2]=ds,St[3]=fs,St[4]=hs,St[5]=ps,St[6]=qn,St[7]=ss,St[8]=Jn,St[9]=Yn,St[10]=ms,St[11]=Qn,St[12]=es,St[13]=ls,St[14]=us,St[15]=Wn,St[16]=os,St[17]=gs,St[18]=bs,Rt!==0&&(St[19]=Rt,ct.length++),ct};Math.imul||(xt=mt);function Ct(Bt,yt,bt){bt.negative=yt.negative^Bt.negative,bt.length=Bt.length+yt.length;for(var ct=0,ht=0,vt=0;vt>>26)|0,ht+=St>>>26,St&=67108863}bt.words[vt]=Rt,ct=St,St=ht}return ct!==0?bt.words[vt]=ct:bt.length--,bt.strip()}function Pt(Bt,yt,bt){var ct=new Tt;return ct.mulp(Bt,yt,bt)}tt.prototype.mulTo=function(yt,bt){var ct,ht=this.length+yt.length;return this.length===10&&yt.length===10?ct=xt(this,yt,bt):ht<63?ct=mt(this,yt,bt):ht<1024?ct=Ct(this,yt,bt):ct=Pt(this,yt,bt),ct};function Tt(Bt,yt){this.x=Bt,this.y=yt}Tt.prototype.makeRBT=function(yt){for(var bt=new Array(yt),ct=tt.prototype._countBits(yt)-1,ht=0;ht>=1;return ht},Tt.prototype.permute=function(yt,bt,ct,ht,vt,St){for(var Rt=0;Rt>>1)vt++;return 1<>>13,ct[2*St+1]=vt&8191,vt=vt>>>13;for(St=2*bt;St>=26,bt+=ht/67108864|0,bt+=vt>>>26,this.words[ct]=vt&67108863}return bt!==0&&(this.words[ct]=bt,this.length++),this},tt.prototype.muln=function(yt){return this.clone().imuln(yt)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(yt){var bt=dt(yt);if(bt.length===0)return new tt(1);for(var ct=this,ht=0;ht=0);var bt=yt%26,ct=(yt-bt)/26,ht=67108863>>>26-bt<<26-bt,vt;if(bt!==0){var St=0;for(vt=0;vt>>26-bt}St&&(this.words[vt]=St,this.length++)}if(ct!==0){for(vt=this.length-1;vt>=0;vt--)this.words[vt+ct]=this.words[vt];for(vt=0;vt=0);var ht;bt?ht=(bt-bt%26)/26:ht=0;var vt=yt%26,St=Math.min((yt-vt)/26,this.length),Rt=67108863^67108863>>>vt<St)for(this.length-=St,Et=0;Et=0&&(At!==0||Et>=ht);Et--){var wt=this.words[Et]|0;this.words[Et]=At<<26-vt|wt>>>vt,At=wt&Rt}return $t&&At!==0&&($t.words[$t.length++]=At),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},tt.prototype.ishrn=function(yt,bt,ct){return j(this.negative===0),this.iushrn(yt,bt,ct)},tt.prototype.shln=function(yt){return this.clone().ishln(yt)},tt.prototype.ushln=function(yt){return this.clone().iushln(yt)},tt.prototype.shrn=function(yt){return this.clone().ishrn(yt)},tt.prototype.ushrn=function(yt){return this.clone().iushrn(yt)},tt.prototype.testn=function(yt){j(typeof yt=="number"&&yt>=0);var bt=yt%26,ct=(yt-bt)/26,ht=1<=0);var bt=yt%26,ct=(yt-bt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=ct)return this;if(bt!==0&&ct++,this.length=Math.min(ct,this.length),bt!==0){var ht=67108863^67108863>>>bt<=67108864;bt++)this.words[bt]-=67108864,bt===this.length-1?this.words[bt+1]=1:this.words[bt+1]++;return this.length=Math.max(this.length,bt+1),this},tt.prototype.isubn=function(yt){if(j(typeof yt=="number"),j(yt<67108864),yt<0)return this.iaddn(-yt);if(this.negative!==0)return this.negative=0,this.iaddn(yt),this.negative=1,this;if(this.words[0]-=yt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var bt=0;bt>26)-($t/67108864|0),this.words[vt+ct]=St&67108863}for(;vt>26,this.words[vt+ct]=St&67108863;if(Rt===0)return this.strip();for(j(Rt===-1),Rt=0,vt=0;vt>26,this.words[vt]=St&67108863;return this.negative=1,this.strip()},tt.prototype._wordDiv=function(yt,bt){var ct=this.length-yt.length,ht=this.clone(),vt=yt,St=vt.words[vt.length-1]|0,Rt=this._countBits(St);ct=26-Rt,ct!==0&&(vt=vt.ushln(ct),ht.iushln(ct),St=vt.words[vt.length-1]|0);var $t=ht.length-vt.length,Et;if(bt!=="mod"){Et=new tt(null),Et.length=$t+1,Et.words=new Array(Et.length);for(var At=0;At=0;Ot--){var tr=(ht.words[vt.length+Ot]|0)*67108864+(ht.words[vt.length+Ot-1]|0);for(tr=Math.min(tr/St|0,67108863),ht._ishlnsubmul(vt,tr,Ot);ht.negative!==0;)tr--,ht.negative=0,ht._ishlnsubmul(vt,1,Ot),ht.isZero()||(ht.negative^=1);Et&&(Et.words[Ot]=tr)}return Et&&Et.strip(),ht.strip(),bt!=="div"&&ct!==0&&ht.iushrn(ct),{div:Et||null,mod:ht}},tt.prototype.divmod=function(yt,bt,ct){if(j(!yt.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var ht,vt,St;return this.negative!==0&&yt.negative===0?(St=this.neg().divmod(yt,bt),bt!=="mod"&&(ht=St.div.neg()),bt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.iadd(yt)),{div:ht,mod:vt}):this.negative===0&&yt.negative!==0?(St=this.divmod(yt.neg(),bt),bt!=="mod"&&(ht=St.div.neg()),{div:ht,mod:St.mod}):this.negative&yt.negative?(St=this.neg().divmod(yt.neg(),bt),bt!=="div"&&(vt=St.mod.neg(),ct&&vt.negative!==0&&vt.isub(yt)),{div:St.div,mod:vt}):yt.length>this.length||this.cmp(yt)<0?{div:new tt(0),mod:this}:yt.length===1?bt==="div"?{div:this.divn(yt.words[0]),mod:null}:bt==="mod"?{div:null,mod:new tt(this.modn(yt.words[0]))}:{div:this.divn(yt.words[0]),mod:new tt(this.modn(yt.words[0]))}:this._wordDiv(yt,bt)},tt.prototype.div=function(yt){return this.divmod(yt,"div",!1).div},tt.prototype.mod=function(yt){return this.divmod(yt,"mod",!1).mod},tt.prototype.umod=function(yt){return this.divmod(yt,"mod",!0).mod},tt.prototype.divRound=function(yt){var bt=this.divmod(yt);if(bt.mod.isZero())return bt.div;var ct=bt.div.negative!==0?bt.mod.isub(yt):bt.mod,ht=yt.ushrn(1),vt=yt.andln(1),St=ct.cmp(ht);return St<0||vt===1&&St===0?bt.div:bt.div.negative!==0?bt.div.isubn(1):bt.div.iaddn(1)},tt.prototype.modn=function(yt){j(yt<=67108863);for(var bt=(1<<26)%yt,ct=0,ht=this.length-1;ht>=0;ht--)ct=(bt*ct+(this.words[ht]|0))%yt;return ct},tt.prototype.idivn=function(yt){j(yt<=67108863);for(var bt=0,ct=this.length-1;ct>=0;ct--){var ht=(this.words[ct]|0)+bt*67108864;this.words[ct]=ht/yt|0,bt=ht%yt}return this.strip()},tt.prototype.divn=function(yt){return this.clone().idivn(yt)},tt.prototype.egcd=function(yt){j(yt.negative===0),j(!yt.isZero());var bt=this,ct=yt.clone();bt.negative!==0?bt=bt.umod(yt):bt=bt.clone();for(var ht=new tt(1),vt=new tt(0),St=new tt(0),Rt=new tt(1),$t=0;bt.isEven()&&ct.isEven();)bt.iushrn(1),ct.iushrn(1),++$t;for(var Et=ct.clone(),At=bt.clone();!bt.isZero();){for(var wt=0,Ot=1;!(bt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(bt.iushrn(wt);wt-- >0;)(ht.isOdd()||vt.isOdd())&&(ht.iadd(Et),vt.isub(At)),ht.iushrn(1),vt.iushrn(1);for(var tr=0,nr=1;!(ct.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ct.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(Et),Rt.isub(At)),St.iushrn(1),Rt.iushrn(1);bt.cmp(ct)>=0?(bt.isub(ct),ht.isub(St),vt.isub(Rt)):(ct.isub(bt),St.isub(ht),Rt.isub(vt))}return{a:St,b:Rt,gcd:ct.iushln($t)}},tt.prototype._invmp=function(yt){j(yt.negative===0),j(!yt.isZero());var bt=this,ct=yt.clone();bt.negative!==0?bt=bt.umod(yt):bt=bt.clone();for(var ht=new tt(1),vt=new tt(0),St=ct.clone();bt.cmpn(1)>0&&ct.cmpn(1)>0;){for(var Rt=0,$t=1;!(bt.words[0]&$t)&&Rt<26;++Rt,$t<<=1);if(Rt>0)for(bt.iushrn(Rt);Rt-- >0;)ht.isOdd()&&ht.iadd(St),ht.iushrn(1);for(var Et=0,At=1;!(ct.words[0]&At)&&Et<26;++Et,At<<=1);if(Et>0)for(ct.iushrn(Et);Et-- >0;)vt.isOdd()&&vt.iadd(St),vt.iushrn(1);bt.cmp(ct)>=0?(bt.isub(ct),ht.isub(vt)):(ct.isub(bt),vt.isub(ht))}var wt;return bt.cmpn(1)===0?wt=ht:wt=vt,wt.cmpn(0)<0&&wt.iadd(yt),wt},tt.prototype.gcd=function(yt){if(this.isZero())return yt.abs();if(yt.isZero())return this.abs();var bt=this.clone(),ct=yt.clone();bt.negative=0,ct.negative=0;for(var ht=0;bt.isEven()&&ct.isEven();ht++)bt.iushrn(1),ct.iushrn(1);do{for(;bt.isEven();)bt.iushrn(1);for(;ct.isEven();)ct.iushrn(1);var vt=bt.cmp(ct);if(vt<0){var St=bt;bt=ct,ct=St}else if(vt===0||ct.cmpn(1)===0)break;bt.isub(ct)}while(!0);return ct.iushln(ht)},tt.prototype.invm=function(yt){return this.egcd(yt).a.umod(yt)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(yt){return this.words[0]&yt},tt.prototype.bincn=function(yt){j(typeof yt=="number");var bt=yt%26,ct=(yt-bt)/26,ht=1<>>26,Rt&=67108863,this.words[St]=Rt}return vt!==0&&(this.words[St]=vt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(yt){var bt=yt<0;if(this.negative!==0&&!bt)return-1;if(this.negative===0&&bt)return 1;this.strip();var ct;if(this.length>1)ct=1;else{bt&&(yt=-yt),j(yt<=67108863,"Number is too big");var ht=this.words[0]|0;ct=ht===yt?0:htyt.length)return 1;if(this.length=0;ct--){var ht=this.words[ct]|0,vt=yt.words[ct]|0;if(ht!==vt){htvt&&(bt=1);break}}return bt},tt.prototype.gtn=function(yt){return this.cmpn(yt)===1},tt.prototype.gt=function(yt){return this.cmp(yt)===1},tt.prototype.gten=function(yt){return this.cmpn(yt)>=0},tt.prototype.gte=function(yt){return this.cmp(yt)>=0},tt.prototype.ltn=function(yt){return this.cmpn(yt)===-1},tt.prototype.lt=function(yt){return this.cmp(yt)===-1},tt.prototype.lten=function(yt){return this.cmpn(yt)<=0},tt.prototype.lte=function(yt){return this.cmp(yt)<=0},tt.prototype.eqn=function(yt){return this.cmpn(yt)===0},tt.prototype.eq=function(yt){return this.cmp(yt)===0},tt.red=function(yt){return new Dt(yt)},tt.prototype.toRed=function(yt){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),yt.convertTo(this)._forceRed(yt)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(yt){return this.red=yt,this},tt.prototype.forceRed=function(yt){return j(!this.red,"Already a number in reduction context"),this._forceRed(yt)},tt.prototype.redAdd=function(yt){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,yt)},tt.prototype.redIAdd=function(yt){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,yt)},tt.prototype.redSub=function(yt){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,yt)},tt.prototype.redISub=function(yt){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,yt)},tt.prototype.redShl=function(yt){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,yt)},tt.prototype.redMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.mul(this,yt)},tt.prototype.redIMul=function(yt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,yt),this.red.imul(this,yt)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(yt){return j(this.red&&!yt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,yt)};var kt={k256:null,p224:null,p192:null,p25519:null};function Lt(Bt,yt){this.name=Bt,this.p=new tt(yt,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Lt.prototype._tmp=function(){var yt=new tt(null);return yt.words=new Array(Math.ceil(this.n/13)),yt},Lt.prototype.ireduce=function(yt){var bt=yt,ct;do this.split(bt,this.tmp),bt=this.imulK(bt),bt=bt.iadd(this.tmp),ct=bt.bitLength();while(ct>this.n);var ht=ct0?bt.isub(this.p):bt.strip!==void 0?bt.strip():bt._strip(),bt},Lt.prototype.split=function(yt,bt){yt.iushrn(this.n,0,bt)},Lt.prototype.imulK=function(yt){return yt.imul(this.k)};function Nt(){Lt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Nt,Lt),Nt.prototype.split=function(yt,bt){for(var ct=4194303,ht=Math.min(yt.length,9),vt=0;vt>>22,St=Rt}St>>>=22,yt.words[vt-10]=St,St===0&&yt.length>10?yt.length-=10:yt.length-=9},Nt.prototype.imulK=function(yt){yt.words[yt.length]=0,yt.words[yt.length+1]=0,yt.length+=2;for(var bt=0,ct=0;ct>>=26,yt.words[ct]=vt,bt=ht}return bt!==0&&(yt.words[yt.length++]=bt),yt},tt._prime=function(yt){if(kt[yt])return kt[yt];var bt;if(yt==="k256")bt=new Nt;else if(yt==="p224")bt=new zt;else if(yt==="p192")bt=new jt;else if(yt==="p25519")bt=new Mt;else throw new Error("Unknown prime "+yt);return kt[yt]=bt,bt};function Dt(Bt){if(typeof Bt=="string"){var yt=tt._prime(Bt);this.m=yt.p,this.prime=yt}else j(Bt.gtn(1),"modulus must be greater than 1"),this.m=Bt,this.prime=null}Dt.prototype._verify1=function(yt){j(yt.negative===0,"red works only with positives"),j(yt.red,"red works only with red numbers")},Dt.prototype._verify2=function(yt,bt){j((yt.negative|bt.negative)===0,"red works only with positives"),j(yt.red&&yt.red===bt.red,"red works only with red numbers")},Dt.prototype.imod=function(yt){return this.prime?this.prime.ireduce(yt)._forceRed(this):yt.umod(this.m)._forceRed(this)},Dt.prototype.neg=function(yt){return yt.isZero()?yt.clone():this.m.sub(yt)._forceRed(this)},Dt.prototype.add=function(yt,bt){this._verify2(yt,bt);var ct=yt.add(bt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct._forceRed(this)},Dt.prototype.iadd=function(yt,bt){this._verify2(yt,bt);var ct=yt.iadd(bt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct},Dt.prototype.sub=function(yt,bt){this._verify2(yt,bt);var ct=yt.sub(bt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct._forceRed(this)},Dt.prototype.isub=function(yt,bt){this._verify2(yt,bt);var ct=yt.isub(bt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct},Dt.prototype.shl=function(yt,bt){return this._verify1(yt),this.imod(yt.ushln(bt))},Dt.prototype.imul=function(yt,bt){return this._verify2(yt,bt),this.imod(yt.imul(bt))},Dt.prototype.mul=function(yt,bt){return this._verify2(yt,bt),this.imod(yt.mul(bt))},Dt.prototype.isqr=function(yt){return this.imul(yt,yt.clone())},Dt.prototype.sqr=function(yt){return this.mul(yt,yt)},Dt.prototype.sqrt=function(yt){if(yt.isZero())return yt.clone();var bt=this.m.andln(3);if(j(bt%2===1),bt===3){var ct=this.m.add(new tt(1)).iushrn(2);return this.pow(yt,ct)}for(var ht=this.m.subn(1),vt=0;!ht.isZero()&&ht.andln(1)===0;)vt++,ht.iushrn(1);j(!ht.isZero());var St=new tt(1).toRed(this),Rt=St.redNeg(),$t=this.m.subn(1).iushrn(1),Et=this.m.bitLength();for(Et=new tt(2*Et*Et).toRed(this);this.pow(Et,$t).cmp(Rt)!==0;)Et.redIAdd(Rt);for(var At=this.pow(Et,ht),wt=this.pow(yt,ht.addn(1).iushrn(1)),Ot=this.pow(yt,ht),tr=vt;Ot.cmp(St)!==0;){for(var nr=Ot,ir=0;nr.cmp(St)!==0;ir++)nr=nr.redSqr();j(ir=0;vt--){for(var At=bt.words[vt],wt=Et-1;wt>=0;wt--){var Ot=At>>wt&1;if(St!==ht[0]&&(St=this.sqr(St)),Ot===0&&Rt===0){$t=0;continue}Rt<<=1,Rt|=Ot,$t++,!($t!==ct&&(vt!==0||wt!==0))&&(St=this.mul(St,ht[Rt]),$t=0,Rt=0)}Et=26}return St},Dt.prototype.convertTo=function(yt){var bt=yt.umod(this.m);return bt===yt?bt.clone():bt},Dt.prototype.convertFrom=function(yt){var bt=yt.clone();return bt.red=null,bt},tt.mont=function(yt){return new Ft(yt)};function Ft(Bt){Dt.call(this,Bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(Ft,Dt),Ft.prototype.convertTo=function(yt){return this.imod(yt.ushln(this.shift))},Ft.prototype.convertFrom=function(yt){var bt=this.imod(yt.mul(this.rinv));return bt.red=null,bt},Ft.prototype.imul=function(yt,bt){if(yt.isZero()||bt.isZero())return yt.words[0]=0,yt.length=1,yt;var ct=yt.imul(bt),ht=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(ht).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.mul=function(yt,bt){if(yt.isZero()||bt.isZero())return new tt(0)._forceRed(this);var ct=yt.mul(bt),ht=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),vt=ct.isub(ht).iushrn(this.shift),St=vt;return vt.cmp(this.m)>=0?St=vt.isub(this.m):vt.cmpn(0)<0&&(St=vt.iadd(this.m)),St._forceRed(this)},Ft.prototype.invm=function(yt){var bt=this.imod(yt._invmp(this.m).mul(this.r2));return bt._forceRed(this)}})(_,commonjsGlobal)}(bn$2)),bn$2.exports}var utils$R={};(function(_){var a=_;function $(tt,rt){if(Array.isArray(tt))return tt.slice();if(!tt)return[];var nt=[];if(typeof tt!="string"){for(var it=0;it>8,ot=at&255;st?nt.push(st,ot):nt.push(ot)}return nt}a.toArray=$;function j(tt){return tt.length===1?"0"+tt:tt}a.zero2=j;function et(tt){for(var rt="",nt=0;nt(xt>>1)-1?Pt=(xt>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,dt[mt]=Pt,Ct.iushrn(1)}return dt}a.getNAF=tt;function rt(st,ot){var ut=[[],[]];st=st.clone(),ot=ot.clone();for(var dt=0,mt=0,xt;st.cmpn(-dt)>0||ot.cmpn(-mt)>0;){var Ct=st.andln(3)+dt&3,Pt=ot.andln(3)+mt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(xt=st.andln(7)+dt&7,(xt===3||xt===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var kt;Pt&1?(xt=ot.andln(7)+mt&7,(xt===3||xt===5)&&Ct===2?kt=-Pt:kt=Pt):kt=0,ut[1].push(kt),2*dt===Tt+1&&(dt=1-dt),2*mt===kt+1&&(mt=1-mt),st.iushrn(1),ot.iushrn(1)}return ut}a.getJSF=rt;function nt(st,ot,ut){var dt="_"+ot;st.prototype[ot]=function(){return this[dt]!==void 0?this[dt]:this[dt]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function at(st){return new $(st,"hex","le")}a.intFromLE=at}(utils$S)),utils$S}var curve$4={},base$7,hasRequiredBase$2;function requireBase$2(){if(hasRequiredBase$2)return base$7;hasRequiredBase$2=1;var _=requireBn$1(),a=requireUtils$1(),$=a.getNAF,j=a.getJSF,et=a.assert;function tt(nt,it){this.type=nt,this.p=new _(it.p,16),this.red=it.prime?_.red(it.prime):_.mont(this.p),this.zero=new _(0).toRed(this.red),this.one=new _(1).toRed(this.red),this.two=new _(2).toRed(this.red),this.n=it.n&&new _(it.n,16),this.g=it.g&&this.pointFromJSON(it.g,it.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var at=this.n&&this.p.div(this.n);!at||at.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$7=tt,tt.prototype.point=function(){throw new Error("Not implemented")},tt.prototype.validate=function(){throw new Error("Not implemented")},tt.prototype._fixedNafMul=function(it,at){et(it.precomputed);var st=it._getDoubles(),ot=$(at,1,this._bitLength),ut=(1<=mt;Ct--)xt=(xt<<1)+ot[Ct];dt.push(xt)}for(var Pt=this.jpoint(null,null,null),Tt=this.jpoint(null,null,null),kt=ut;kt>0;kt--){for(mt=0;mt=0;xt--){for(var Ct=0;xt>=0&&dt[xt]===0;xt--)Ct++;if(xt>=0&&Ct++,mt=mt.dblp(Ct),xt<0)break;var Pt=dt[xt];et(Pt!==0),it.type==="affine"?Pt>0?mt=mt.mixedAdd(ut[Pt-1>>1]):mt=mt.mixedAdd(ut[-Pt-1>>1].neg()):Pt>0?mt=mt.add(ut[Pt-1>>1]):mt=mt.add(ut[-Pt-1>>1].neg())}return it.type==="affine"?mt.toP():mt},tt.prototype._wnafMulAdd=function(it,at,st,ot,ut){var dt=this._wnafT1,mt=this._wnafT2,xt=this._wnafT3,Ct=0,Pt,Tt,kt;for(Pt=0;Pt=1;Pt-=2){var Nt=Pt-1,zt=Pt;if(dt[Nt]!==1||dt[zt]!==1){xt[Nt]=$(st[Nt],dt[Nt],this._bitLength),xt[zt]=$(st[zt],dt[zt],this._bitLength),Ct=Math.max(xt[Nt].length,Ct),Ct=Math.max(xt[zt].length,Ct);continue}var jt=[at[Nt],null,null,at[zt]];at[Nt].y.cmp(at[zt].y)===0?(jt[1]=at[Nt].add(at[zt]),jt[2]=at[Nt].toJ().mixedAdd(at[zt].neg())):at[Nt].y.cmp(at[zt].y.redNeg())===0?(jt[1]=at[Nt].toJ().mixedAdd(at[zt]),jt[2]=at[Nt].add(at[zt].neg())):(jt[1]=at[Nt].toJ().mixedAdd(at[zt]),jt[2]=at[Nt].toJ().mixedAdd(at[zt].neg()));var Mt=[-3,-1,-5,-7,0,7,5,1,3],Dt=j(st[Nt],st[zt]);for(Ct=Math.max(Dt[0].length,Ct),xt[Nt]=new Array(Ct),xt[zt]=new Array(Ct),Tt=0;Tt=0;Pt--){for(var ct=0;Pt>=0;){var ht=!0;for(Tt=0;Tt=0&&ct++,yt=yt.dblp(ct),Pt<0)break;for(Tt=0;Tt0?kt=mt[Tt][vt-1>>1]:vt<0&&(kt=mt[Tt][-vt-1>>1].neg()),kt.type==="affine"?yt=yt.mixedAdd(kt):yt=yt.add(kt))}}for(Pt=0;Pt=Math.ceil((it.bitLength()+1)/at.step):!1},rt.prototype._getDoubles=function(it,at){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var st=[this],ot=this,ut=0;ut=0&&(Nt=Pt,zt=Tt),kt.negative&&(kt=kt.neg(),Lt=Lt.neg()),Nt.negative&&(Nt=Nt.neg(),zt=zt.neg()),[{a:kt,b:Lt},{a:Nt,b:zt}]},tt.prototype._endoSplit=function(at){var st=this.endo.basis,ot=st[0],ut=st[1],dt=ut.b.mul(at).divRound(this.n),mt=ot.b.neg().mul(at).divRound(this.n),xt=dt.mul(ot.a),Ct=mt.mul(ut.a),Pt=dt.mul(ot.b),Tt=mt.mul(ut.b),kt=at.sub(xt).sub(Ct),Lt=Pt.add(Tt).neg();return{k1:kt,k2:Lt}},tt.prototype.pointFromX=function(at,st){at=new a(at,16),at.red||(at=at.toRed(this.red));var ot=at.redSqr().redMul(at).redIAdd(at.redMul(this.a)).redIAdd(this.b),ut=ot.redSqrt();if(ut.redSqr().redSub(ot).cmp(this.zero)!==0)throw new Error("invalid point");var dt=ut.fromRed().isOdd();return(st&&!dt||!st&&dt)&&(ut=ut.redNeg()),this.point(at,ut)},tt.prototype.validate=function(at){if(at.inf)return!0;var st=at.x,ot=at.y,ut=this.a.redMul(st),dt=st.redSqr().redMul(st).redIAdd(ut).redIAdd(this.b);return ot.redSqr().redISub(dt).cmpn(0)===0},tt.prototype._endoWnafMulAdd=function(at,st,ot){for(var ut=this._endoWnafT1,dt=this._endoWnafT2,mt=0;mt":""},rt.prototype.isInfinity=function(){return this.inf},rt.prototype.add=function(at){if(this.inf)return at;if(at.inf)return this;if(this.eq(at))return this.dbl();if(this.neg().eq(at))return this.curve.point(null,null);if(this.x.cmp(at.x)===0)return this.curve.point(null,null);var st=this.y.redSub(at.y);st.cmpn(0)!==0&&(st=st.redMul(this.x.redSub(at.x).redInvm()));var ot=st.redSqr().redISub(this.x).redISub(at.x),ut=st.redMul(this.x.redSub(ot)).redISub(this.y);return this.curve.point(ot,ut)},rt.prototype.dbl=function(){if(this.inf)return this;var at=this.y.redAdd(this.y);if(at.cmpn(0)===0)return this.curve.point(null,null);var st=this.curve.a,ot=this.x.redSqr(),ut=at.redInvm(),dt=ot.redAdd(ot).redIAdd(ot).redIAdd(st).redMul(ut),mt=dt.redSqr().redISub(this.x.redAdd(this.x)),xt=dt.redMul(this.x.redSub(mt)).redISub(this.y);return this.curve.point(mt,xt)},rt.prototype.getX=function(){return this.x.fromRed()},rt.prototype.getY=function(){return this.y.fromRed()},rt.prototype.mul=function(at){return at=new a(at,16),this.isInfinity()?this:this._hasDoubles(at)?this.curve._fixedNafMul(this,at):this.curve.endo?this.curve._endoWnafMulAdd([this],[at]):this.curve._wnafMul(this,at)},rt.prototype.mulAdd=function(at,st,ot){var ut=[this,st],dt=[at,ot];return this.curve.endo?this.curve._endoWnafMulAdd(ut,dt):this.curve._wnafMulAdd(1,ut,dt,2)},rt.prototype.jmulAdd=function(at,st,ot){var ut=[this,st],dt=[at,ot];return this.curve.endo?this.curve._endoWnafMulAdd(ut,dt,!0):this.curve._wnafMulAdd(1,ut,dt,2,!0)},rt.prototype.eq=function(at){return this===at||this.inf===at.inf&&(this.inf||this.x.cmp(at.x)===0&&this.y.cmp(at.y)===0)},rt.prototype.neg=function(at){if(this.inf)return this;var st=this.curve.point(this.x,this.y.redNeg());if(at&&this.precomputed){var ot=this.precomputed,ut=function(dt){return dt.neg()};st.precomputed={naf:ot.naf&&{wnd:ot.naf.wnd,points:ot.naf.points.map(ut)},doubles:ot.doubles&&{step:ot.doubles.step,points:ot.doubles.points.map(ut)}}}return st},rt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var at=this.curve.jpoint(this.x,this.y,this.curve.one);return at};function nt(it,at,st,ot){j.BasePoint.call(this,it,"jacobian"),at===null&&st===null&&ot===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new a(0)):(this.x=new a(at,16),this.y=new a(st,16),this.z=new a(ot,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return $(nt,j.BasePoint),tt.prototype.jpoint=function(at,st,ot){return new nt(this,at,st,ot)},nt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var at=this.z.redInvm(),st=at.redSqr(),ot=this.x.redMul(st),ut=this.y.redMul(st).redMul(at);return this.curve.point(ot,ut)},nt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},nt.prototype.add=function(at){if(this.isInfinity())return at;if(at.isInfinity())return this;var st=at.z.redSqr(),ot=this.z.redSqr(),ut=this.x.redMul(st),dt=at.x.redMul(ot),mt=this.y.redMul(st.redMul(at.z)),xt=at.y.redMul(ot.redMul(this.z)),Ct=ut.redSub(dt),Pt=mt.redSub(xt);if(Ct.cmpn(0)===0)return Pt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Tt=Ct.redSqr(),kt=Tt.redMul(Ct),Lt=ut.redMul(Tt),Nt=Pt.redSqr().redIAdd(kt).redISub(Lt).redISub(Lt),zt=Pt.redMul(Lt.redISub(Nt)).redISub(mt.redMul(kt)),jt=this.z.redMul(at.z).redMul(Ct);return this.curve.jpoint(Nt,zt,jt)},nt.prototype.mixedAdd=function(at){if(this.isInfinity())return at.toJ();if(at.isInfinity())return this;var st=this.z.redSqr(),ot=this.x,ut=at.x.redMul(st),dt=this.y,mt=at.y.redMul(st).redMul(this.z),xt=ot.redSub(ut),Ct=dt.redSub(mt);if(xt.cmpn(0)===0)return Ct.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Pt=xt.redSqr(),Tt=Pt.redMul(xt),kt=ot.redMul(Pt),Lt=Ct.redSqr().redIAdd(Tt).redISub(kt).redISub(kt),Nt=Ct.redMul(kt.redISub(Lt)).redISub(dt.redMul(Tt)),zt=this.z.redMul(xt);return this.curve.jpoint(Lt,Nt,zt)},nt.prototype.dblp=function(at){if(at===0)return this;if(this.isInfinity())return this;if(!at)return this.dbl();var st;if(this.curve.zeroA||this.curve.threeA){var ot=this;for(st=0;st=0)return!1;if(ot.redIAdd(dt),this.x.cmp(ot)===0)return!0}},nt.prototype.inspect=function(){return this.isInfinity()?"":""},nt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short$4}var mont$4,hasRequiredMont$1;function requireMont$1(){if(hasRequiredMont$1)return mont$4;hasRequiredMont$1=1;var _=requireBn$1(),a=inherits_browserExports,$=requireBase$2(),j=requireUtils$1();function et(rt){$.call(this,"mont",rt),this.a=new _(rt.a,16).toRed(this.red),this.b=new _(rt.b,16).toRed(this.red),this.i4=new _(4).toRed(this.red).redInvm(),this.two=new _(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}a(et,$),mont$4=et,et.prototype.validate=function(nt){var it=nt.normalize().x,at=it.redSqr(),st=at.redMul(it).redAdd(at.redMul(this.a)).redAdd(it),ot=st.redSqrt();return ot.redSqr().cmp(st)===0};function tt(rt,nt,it){$.BasePoint.call(this,rt,"projective"),nt===null&&it===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _(nt,16),this.z=new _(it,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return a(tt,$.BasePoint),et.prototype.decodePoint=function(nt,it){return this.point(j.toArray(nt,it),1)},et.prototype.point=function(nt,it){return new tt(this,nt,it)},et.prototype.pointFromJSON=function(nt){return tt.fromJSON(this,nt)},tt.prototype.precompute=function(){},tt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},tt.fromJSON=function(nt,it){return new tt(nt,it[0],it[1]||nt.one)},tt.prototype.inspect=function(){return this.isInfinity()?"":""},tt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},tt.prototype.dbl=function(){var nt=this.x.redAdd(this.z),it=nt.redSqr(),at=this.x.redSub(this.z),st=at.redSqr(),ot=it.redSub(st),ut=it.redMul(st),dt=ot.redMul(st.redAdd(this.curve.a24.redMul(ot)));return this.curve.point(ut,dt)},tt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.diffAdd=function(nt,it){var at=this.x.redAdd(this.z),st=this.x.redSub(this.z),ot=nt.x.redAdd(nt.z),ut=nt.x.redSub(nt.z),dt=ut.redMul(at),mt=ot.redMul(st),xt=it.z.redMul(dt.redAdd(mt).redSqr()),Ct=it.x.redMul(dt.redISub(mt).redSqr());return this.curve.point(xt,Ct)},tt.prototype.mul=function(nt){for(var it=nt.clone(),at=this,st=this.curve.point(null,null),ot=this,ut=[];it.cmpn(0)!==0;it.iushrn(1))ut.push(it.andln(1));for(var dt=ut.length-1;dt>=0;dt--)ut[dt]===0?(at=at.diffAdd(st,ot),st=st.dbl()):(st=at.diffAdd(st,ot),at=at.dbl());return st},tt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.eq=function(nt){return this.getX().cmp(nt.getX())===0},tt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},tt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont$4}var edwards$4,hasRequiredEdwards$1;function requireEdwards$1(){if(hasRequiredEdwards$1)return edwards$4;hasRequiredEdwards$1=1;var _=requireUtils$1(),a=requireBn$1(),$=inherits_browserExports,j=requireBase$2(),et=_.assert;function tt(nt){this.twisted=(nt.a|0)!==1,this.mOneA=this.twisted&&(nt.a|0)===-1,this.extended=this.mOneA,j.call(this,"edwards",nt),this.a=new a(nt.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(nt.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(nt.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),et(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(nt.c|0)===1}$(tt,j),edwards$4=tt,tt.prototype._mulA=function(it){return this.mOneA?it.redNeg():this.a.redMul(it)},tt.prototype._mulC=function(it){return this.oneC?it:this.c.redMul(it)},tt.prototype.jpoint=function(it,at,st,ot){return this.point(it,at,st,ot)},tt.prototype.pointFromX=function(it,at){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),ot=this.c2.redSub(this.a.redMul(st)),ut=this.one.redSub(this.c2.redMul(this.d).redMul(st)),dt=ot.redMul(ut.redInvm()),mt=dt.redSqrt();if(mt.redSqr().redSub(dt).cmp(this.zero)!==0)throw new Error("invalid point");var xt=mt.fromRed().isOdd();return(at&&!xt||!at&&xt)&&(mt=mt.redNeg()),this.point(it,mt)},tt.prototype.pointFromY=function(it,at){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),ot=st.redSub(this.c2),ut=st.redMul(this.d).redMul(this.c2).redSub(this.a),dt=ot.redMul(ut.redInvm());if(dt.cmp(this.zero)===0){if(at)throw new Error("invalid point");return this.point(this.zero,it)}var mt=dt.redSqrt();if(mt.redSqr().redSub(dt).cmp(this.zero)!==0)throw new Error("invalid point");return mt.fromRed().isOdd()!==at&&(mt=mt.redNeg()),this.point(mt,it)},tt.prototype.validate=function(it){if(it.isInfinity())return!0;it.normalize();var at=it.x.redSqr(),st=it.y.redSqr(),ot=at.redMul(this.a).redAdd(st),ut=this.c2.redMul(this.one.redAdd(this.d.redMul(at).redMul(st)));return ot.cmp(ut)===0};function rt(nt,it,at,st,ot){j.BasePoint.call(this,nt,"projective"),it===null&&at===null&&st===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new a(it,16),this.y=new a(at,16),this.z=st?new a(st,16):this.curve.one,this.t=ot&&new a(ot,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return $(rt,j.BasePoint),tt.prototype.pointFromJSON=function(it){return rt.fromJSON(this,it)},tt.prototype.point=function(it,at,st,ot){return new rt(this,it,at,st,ot)},rt.fromJSON=function(it,at){return new rt(it,at[0],at[1],at[2])},rt.prototype.inspect=function(){return this.isInfinity()?"":""},rt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},rt.prototype._extDbl=function(){var it=this.x.redSqr(),at=this.y.redSqr(),st=this.z.redSqr();st=st.redIAdd(st);var ot=this.curve._mulA(it),ut=this.x.redAdd(this.y).redSqr().redISub(it).redISub(at),dt=ot.redAdd(at),mt=dt.redSub(st),xt=ot.redSub(at),Ct=ut.redMul(mt),Pt=dt.redMul(xt),Tt=ut.redMul(xt),kt=mt.redMul(dt);return this.curve.point(Ct,Pt,kt,Tt)},rt.prototype._projDbl=function(){var it=this.x.redAdd(this.y).redSqr(),at=this.x.redSqr(),st=this.y.redSqr(),ot,ut,dt,mt,xt,Ct;if(this.curve.twisted){mt=this.curve._mulA(at);var Pt=mt.redAdd(st);this.zOne?(ot=it.redSub(at).redSub(st).redMul(Pt.redSub(this.curve.two)),ut=Pt.redMul(mt.redSub(st)),dt=Pt.redSqr().redSub(Pt).redSub(Pt)):(xt=this.z.redSqr(),Ct=Pt.redSub(xt).redISub(xt),ot=it.redSub(at).redISub(st).redMul(Ct),ut=Pt.redMul(mt.redSub(st)),dt=Pt.redMul(Ct))}else mt=at.redAdd(st),xt=this.curve._mulC(this.z).redSqr(),Ct=mt.redSub(xt).redSub(xt),ot=this.curve._mulC(it.redISub(mt)).redMul(Ct),ut=this.curve._mulC(mt).redMul(at.redISub(st)),dt=mt.redMul(Ct);return this.curve.point(ot,ut,dt)},rt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},rt.prototype._extAdd=function(it){var at=this.y.redSub(this.x).redMul(it.y.redSub(it.x)),st=this.y.redAdd(this.x).redMul(it.y.redAdd(it.x)),ot=this.t.redMul(this.curve.dd).redMul(it.t),ut=this.z.redMul(it.z.redAdd(it.z)),dt=st.redSub(at),mt=ut.redSub(ot),xt=ut.redAdd(ot),Ct=st.redAdd(at),Pt=dt.redMul(mt),Tt=xt.redMul(Ct),kt=dt.redMul(Ct),Lt=mt.redMul(xt);return this.curve.point(Pt,Tt,Lt,kt)},rt.prototype._projAdd=function(it){var at=this.z.redMul(it.z),st=at.redSqr(),ot=this.x.redMul(it.x),ut=this.y.redMul(it.y),dt=this.curve.d.redMul(ot).redMul(ut),mt=st.redSub(dt),xt=st.redAdd(dt),Ct=this.x.redAdd(this.y).redMul(it.x.redAdd(it.y)).redISub(ot).redISub(ut),Pt=at.redMul(mt).redMul(Ct),Tt,kt;return this.curve.twisted?(Tt=at.redMul(xt).redMul(ut.redSub(this.curve._mulA(ot))),kt=mt.redMul(xt)):(Tt=at.redMul(xt).redMul(ut.redSub(ot)),kt=this.curve._mulC(mt).redMul(xt)),this.curve.point(Pt,Tt,kt)},rt.prototype.add=function(it){return this.isInfinity()?it:it.isInfinity()?this:this.curve.extended?this._extAdd(it):this._projAdd(it)},rt.prototype.mul=function(it){return this._hasDoubles(it)?this.curve._fixedNafMul(this,it):this.curve._wnafMul(this,it)},rt.prototype.mulAdd=function(it,at,st){return this.curve._wnafMulAdd(1,[this,at],[it,st],2,!1)},rt.prototype.jmulAdd=function(it,at,st){return this.curve._wnafMulAdd(1,[this,at],[it,st],2,!0)},rt.prototype.normalize=function(){if(this.zOne)return this;var it=this.z.redInvm();return this.x=this.x.redMul(it),this.y=this.y.redMul(it),this.t&&(this.t=this.t.redMul(it)),this.z=this.curve.one,this.zOne=!0,this},rt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},rt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},rt.prototype.getY=function(){return this.normalize(),this.y.fromRed()},rt.prototype.eq=function(it){return this===it||this.getX().cmp(it.getX())===0&&this.getY().cmp(it.getY())===0},rt.prototype.eqXToP=function(it){var at=it.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(at)===0)return!0;for(var st=it.clone(),ot=this.curve.redN.redMul(this.z);;){if(st.iadd(this.curve.n),st.cmp(this.curve.p)>=0)return!1;if(at.redIAdd(ot),this.x.cmp(at)===0)return!0}},rt.prototype.toP=rt.prototype.normalize,rt.prototype.mixedAdd=rt.prototype.add,edwards$4}var hasRequiredCurve$1;function requireCurve$1(){return hasRequiredCurve$1||(hasRequiredCurve$1=1,function(_){var a=_;a.base=requireBase$2(),a.short=requireShort$1(),a.mont=requireMont$1(),a.edwards=requireEdwards$1()}(curve$4)),curve$4}var curves$a={},hash$8={},utils$Q={},assert$A=minimalisticAssert,inherits$b=inherits_browserExports;utils$Q.inherits=inherits$b;function isSurrogatePair(_,a){return(_.charCodeAt(a)&64512)!==55296||a<0||a+1>=_.length?!1:(_.charCodeAt(a+1)&64512)===56320}function toArray$3(_,a){if(Array.isArray(_))return _.slice();if(!_)return[];var $=[];if(typeof _=="string")if(a){if(a==="hex")for(_=_.replace(/[^a-z0-9]+/ig,""),_.length%2!==0&&(_="0"+_),et=0;et<_.length;et+=2)$.push(parseInt(_[et]+_[et+1],16))}else for(var j=0,et=0;et<_.length;et++){var tt=_.charCodeAt(et);tt<128?$[j++]=tt:tt<2048?($[j++]=tt>>6|192,$[j++]=tt&63|128):isSurrogatePair(_,et)?(tt=65536+((tt&1023)<<10)+(_.charCodeAt(++et)&1023),$[j++]=tt>>18|240,$[j++]=tt>>12&63|128,$[j++]=tt>>6&63|128,$[j++]=tt&63|128):($[j++]=tt>>12|224,$[j++]=tt>>6&63|128,$[j++]=tt&63|128)}else for(et=0;et<_.length;et++)$[et]=_[et]|0;return $}utils$Q.toArray=toArray$3;function toHex$2(_){for(var a="",$=0;$<_.length;$++)a+=zero2(_[$].toString(16));return a}utils$Q.toHex=toHex$2;function htonl(_){var a=_>>>24|_>>>8&65280|_<<8&16711680|(_&255)<<24;return a>>>0}utils$Q.htonl=htonl;function toHex32(_,a){for(var $="",j=0;j<_.length;j++){var et=_[j];a==="little"&&(et=htonl(et)),$+=zero8(et.toString(16))}return $}utils$Q.toHex32=toHex32;function zero2(_){return _.length===1?"0"+_:_}utils$Q.zero2=zero2;function zero8(_){return _.length===7?"0"+_:_.length===6?"00"+_:_.length===5?"000"+_:_.length===4?"0000"+_:_.length===3?"00000"+_:_.length===2?"000000"+_:_.length===1?"0000000"+_:_}utils$Q.zero8=zero8;function join32(_,a,$,j){var et=$-a;assert$A(et%4===0);for(var tt=new Array(et/4),rt=0,nt=a;rt>>0}return tt}utils$Q.join32=join32;function split32(_,a){for(var $=new Array(_.length*4),j=0,et=0;j<_.length;j++,et+=4){var tt=_[j];a==="big"?($[et]=tt>>>24,$[et+1]=tt>>>16&255,$[et+2]=tt>>>8&255,$[et+3]=tt&255):($[et+3]=tt>>>24,$[et+2]=tt>>>16&255,$[et+1]=tt>>>8&255,$[et]=tt&255)}return $}utils$Q.split32=split32;function rotr32$1(_,a){return _>>>a|_<<32-a}utils$Q.rotr32=rotr32$1;function rotl32$2(_,a){return _<>>32-a}utils$Q.rotl32=rotl32$2;function sum32$3(_,a){return _+a>>>0}utils$Q.sum32=sum32$3;function sum32_3$1(_,a,$){return _+a+$>>>0}utils$Q.sum32_3=sum32_3$1;function sum32_4$2(_,a,$,j){return _+a+$+j>>>0}utils$Q.sum32_4=sum32_4$2;function sum32_5$2(_,a,$,j,et){return _+a+$+j+et>>>0}utils$Q.sum32_5=sum32_5$2;function sum64$1(_,a,$,j){var et=_[a],tt=_[a+1],rt=j+tt>>>0,nt=(rt>>0,_[a+1]=rt}utils$Q.sum64=sum64$1;function sum64_hi$1(_,a,$,j){var et=a+j>>>0,tt=(et>>0}utils$Q.sum64_hi=sum64_hi$1;function sum64_lo$1(_,a,$,j){var et=a+j;return et>>>0}utils$Q.sum64_lo=sum64_lo$1;function sum64_4_hi$1(_,a,$,j,et,tt,rt,nt){var it=0,at=a;at=at+j>>>0,it+=at>>0,it+=at>>0,it+=at>>0}utils$Q.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(_,a,$,j,et,tt,rt,nt){var it=a+j+tt+nt;return it>>>0}utils$Q.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(_,a,$,j,et,tt,rt,nt,it,at){var st=0,ot=a;ot=ot+j>>>0,st+=ot>>0,st+=ot>>0,st+=ot>>0,st+=ot>>0}utils$Q.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(_,a,$,j,et,tt,rt,nt,it,at){var st=a+j+tt+nt+at;return st>>>0}utils$Q.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(_,a,$){var j=a<<32-$|_>>>$;return j>>>0}utils$Q.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(_,a,$){var j=_<<32-$|a>>>$;return j>>>0}utils$Q.rotr64_lo=rotr64_lo$1;function shr64_hi$1(_,a,$){return _>>>$}utils$Q.shr64_hi=shr64_hi$1;function shr64_lo$1(_,a,$){var j=_<<32-$|a>>>$;return j>>>0}utils$Q.shr64_lo=shr64_lo$1;var common$5={},utils$P=utils$Q,assert$z=minimalisticAssert;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$5.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(a,$){if(a=utils$P.toArray(a,$),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;var j=a.length%this._delta8;this.pending=a.slice(a.length-j,a.length),this.pending.length===0&&(this.pending=null),a=utils$P.join32(a,0,a.length-j,this.endian);for(var et=0;et>>24&255,et[tt++]=a>>>16&255,et[tt++]=a>>>8&255,et[tt++]=a&255}else for(et[tt++]=a&255,et[tt++]=a>>>8&255,et[tt++]=a>>>16&255,et[tt++]=a>>>24&255,et[tt++]=0,et[tt++]=0,et[tt++]=0,et[tt++]=0,rt=8;rt>>3}common$4.g0_256=g0_256$1;function g1_256$1(_){return rotr32(_,17)^rotr32(_,19)^_>>>10}common$4.g1_256=g1_256$1;var utils$N=utils$Q,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$N.rotl32,sum32$2=utils$N.sum32,sum32_5$1=utils$N.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$N.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(a,$){for(var j=this.W,et=0;et<16;et++)j[et]=a[$+et];for(;etthis.blockSize&&(a=new this.Hash().update(a).digest()),assert$w(a.length<=this.blockSize);for(var $=a.length;$=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,$,j)}var hmacDrbg=HmacDRBG$3;HmacDRBG$3.prototype._init=function(a,$,j){var et=a.concat($).concat(j);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var tt=0;tt=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(j||[])),this._reseed=1};HmacDRBG$3.prototype.generate=function(a,$,j,et){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof $!="string"&&(et=j,j=$,$=null),j&&(j=utils$G.toArray(j,et||"hex"),this._update(j));for(var tt=[];tt.length"},key$9}var signature$9,hasRequiredSignature$3;function requireSignature$3(){if(hasRequiredSignature$3)return signature$9;hasRequiredSignature$3=1;var _=requireBn$1(),a=requireUtils$1(),$=a.assert;function j(it,at){if(it instanceof j)return it;this._importDER(it,at)||($(it.r&&it.s,"Signature without r or s"),this.r=new _(it.r,16),this.s=new _(it.s,16),it.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=it.recoveryParam)}signature$9=j;function et(){this.place=0}function tt(it,at){var st=it[at.place++];if(!(st&128))return st;var ot=st&15;if(ot===0||ot>4)return!1;for(var ut=0,dt=0,mt=at.place;dt>>=0;return ut<=127?!1:(at.place=mt,ut)}function rt(it){for(var at=0,st=it.length-1;!it[at]&&!(it[at+1]&128)&&at>>3);for(it.push(st|128);--st;)it.push(at>>>(st<<3)&255);it.push(at)}return j.prototype.toDER=function(at){var st=this.r.toArray(),ot=this.s.toArray();for(st[0]&128&&(st=[0].concat(st)),ot[0]&128&&(ot=[0].concat(ot)),st=rt(st),ot=rt(ot);!ot[0]&&!(ot[1]&128);)ot=ot.slice(1);var ut=[2];nt(ut,st.length),ut=ut.concat(st),ut.push(2),nt(ut,ot.length);var dt=ut.concat(ot),mt=[48];return nt(mt,dt.length),mt=mt.concat(dt),a.encode(mt,at)},signature$9}var ec$7,hasRequiredEc$1;function requireEc$1(){if(hasRequiredEc$1)return ec$7;hasRequiredEc$1=1;var _=requireBn$1(),a=hmacDrbg,$=requireUtils$1(),j=requireCurves$1(),et=requireBrorand(),tt=$.assert,rt=requireKey$3(),nt=requireSignature$3();function it(at){if(!(this instanceof it))return new it(at);typeof at=="string"&&(tt(Object.prototype.hasOwnProperty.call(j,at),"Unknown curve "+at),at=j[at]),at instanceof j.PresetCurve&&(at={curve:at}),this.curve=at.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=at.curve.g,this.g.precompute(at.curve.n.bitLength()+1),this.hash=at.hash||at.curve.hash}return ec$7=it,it.prototype.keyPair=function(st){return new rt(this,st)},it.prototype.keyFromPrivate=function(st,ot){return rt.fromPrivate(this,st,ot)},it.prototype.keyFromPublic=function(st,ot){return rt.fromPublic(this,st,ot)},it.prototype.genKeyPair=function(st){st||(st={});for(var ot=new a({hash:this.hash,pers:st.pers,persEnc:st.persEnc||"utf8",entropy:st.entropy||et(this.hash.hmacStrength),entropyEnc:st.entropy&&st.entropyEnc||"utf8",nonce:this.n.toArray()}),ut=this.n.byteLength(),dt=this.n.sub(new _(2));;){var mt=new _(ot.generate(ut));if(!(mt.cmp(dt)>0))return mt.iaddn(1),this.keyFromPrivate(mt)}},it.prototype._truncateToN=function(st,ot){var ut=st.byteLength()*8-this.n.bitLength();return ut>0&&(st=st.ushrn(ut)),!ot&&st.cmp(this.n)>=0?st.sub(this.n):st},it.prototype.sign=function(st,ot,ut,dt){typeof ut=="object"&&(dt=ut,ut=null),dt||(dt={}),ot=this.keyFromPrivate(ot,ut),st=this._truncateToN(new _(st,16));for(var mt=this.n.byteLength(),xt=ot.getPrivate().toArray("be",mt),Ct=st.toArray("be",mt),Pt=new a({hash:this.hash,entropy:xt,nonce:Ct,pers:dt.pers,persEnc:dt.persEnc||"utf8"}),Tt=this.n.sub(new _(1)),kt=0;;kt++){var Lt=dt.k?dt.k(kt):new _(Pt.generate(this.n.byteLength()));if(Lt=this._truncateToN(Lt,!0),!(Lt.cmpn(1)<=0||Lt.cmp(Tt)>=0)){var Nt=this.g.mul(Lt);if(!Nt.isInfinity()){var zt=Nt.getX(),jt=zt.umod(this.n);if(jt.cmpn(0)!==0){var Mt=Lt.invm(this.n).mul(jt.mul(ot.getPrivate()).iadd(st));if(Mt=Mt.umod(this.n),Mt.cmpn(0)!==0){var Dt=(Nt.getY().isOdd()?1:0)|(zt.cmp(jt)!==0?2:0);return dt.canonical&&Mt.cmp(this.nh)>0&&(Mt=this.n.sub(Mt),Dt^=1),new nt({r:jt,s:Mt,recoveryParam:Dt})}}}}}},it.prototype.verify=function(st,ot,ut,dt){st=this._truncateToN(new _(st,16)),ut=this.keyFromPublic(ut,dt),ot=new nt(ot,"hex");var mt=ot.r,xt=ot.s;if(mt.cmpn(1)<0||mt.cmp(this.n)>=0||xt.cmpn(1)<0||xt.cmp(this.n)>=0)return!1;var Ct=xt.invm(this.n),Pt=Ct.mul(st).umod(this.n),Tt=Ct.mul(mt).umod(this.n),kt;return this.curve._maxwellTrick?(kt=this.g.jmulAdd(Pt,ut.getPublic(),Tt),kt.isInfinity()?!1:kt.eqXToP(mt)):(kt=this.g.mulAdd(Pt,ut.getPublic(),Tt),kt.isInfinity()?!1:kt.getX().umod(this.n).cmp(mt)===0)},it.prototype.recoverPubKey=function(at,st,ot,ut){tt((3&ot)===ot,"The recovery param is more than two bits"),st=new nt(st,ut);var dt=this.n,mt=new _(at),xt=st.r,Ct=st.s,Pt=ot&1,Tt=ot>>1;if(xt.cmp(this.curve.p.umod(this.curve.n))>=0&&Tt)throw new Error("Unable to find sencond key candinate");Tt?xt=this.curve.pointFromX(xt.add(this.curve.n),Pt):xt=this.curve.pointFromX(xt,Pt);var kt=st.r.invm(dt),Lt=dt.sub(mt).mul(kt).umod(dt),Nt=Ct.mul(kt).umod(dt);return this.g.mulAdd(Lt,xt,Nt)},it.prototype.getKeyRecoveryParam=function(at,st,ot,ut){if(st=new nt(st,ut),st.recoveryParam!==null)return st.recoveryParam;for(var dt=0;dt<4;dt++){var mt;try{mt=this.recoverPubKey(at,st,dt)}catch{continue}if(mt.eq(ot))return dt}throw new Error("Unable to find valid recovery factor")},ec$7}var key$8,hasRequiredKey$2;function requireKey$2(){if(hasRequiredKey$2)return key$8;hasRequiredKey$2=1;var _=requireUtils$1(),a=_.assert,$=_.parseBytes,j=_.cachedProperty;function et(tt,rt){this.eddsa=tt,this._secret=$(rt.secret),tt.isPoint(rt.pub)?this._pub=rt.pub:this._pubBytes=$(rt.pub)}return et.fromPublic=function(rt,nt){return nt instanceof et?nt:new et(rt,{pub:nt})},et.fromSecret=function(rt,nt){return nt instanceof et?nt:new et(rt,{secret:nt})},et.prototype.secret=function(){return this._secret},j(et,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),j(et,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),j(et,"privBytes",function(){var rt=this.eddsa,nt=this.hash(),it=rt.encodingLength-1,at=nt.slice(0,rt.encodingLength);return at[0]&=248,at[it]&=127,at[it]|=64,at}),j(et,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),j(et,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),j(et,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),et.prototype.sign=function(rt){return a(this._secret,"KeyPair can only verify"),this.eddsa.sign(rt,this)},et.prototype.verify=function(rt,nt){return this.eddsa.verify(rt,nt,this)},et.prototype.getSecret=function(rt){return a(this._secret,"KeyPair is public only"),_.encode(this.secret(),rt)},et.prototype.getPublic=function(rt){return _.encode(this.pubBytes(),rt)},key$8=et,key$8}var signature$8,hasRequiredSignature$2;function requireSignature$2(){if(hasRequiredSignature$2)return signature$8;hasRequiredSignature$2=1;var _=requireBn$1(),a=requireUtils$1(),$=a.assert,j=a.cachedProperty,et=a.parseBytes;function tt(rt,nt){this.eddsa=rt,typeof nt!="object"&&(nt=et(nt)),Array.isArray(nt)&&(nt={R:nt.slice(0,rt.encodingLength),S:nt.slice(rt.encodingLength)}),$(nt.R&&nt.S,"Signature without R or S"),rt.isPoint(nt.R)&&(this._R=nt.R),nt.S instanceof _&&(this._S=nt.S),this._Rencoded=Array.isArray(nt.R)?nt.R:nt.Rencoded,this._Sencoded=Array.isArray(nt.S)?nt.S:nt.Sencoded}return j(tt,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),j(tt,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),j(tt,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),j(tt,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),tt.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},tt.prototype.toHex=function(){return a.encode(this.toBytes(),"hex").toUpperCase()},signature$8=tt,signature$8}var eddsa$4,hasRequiredEddsa$1;function requireEddsa$1(){if(hasRequiredEddsa$1)return eddsa$4;hasRequiredEddsa$1=1;var _=hash$8,a=requireCurves$1(),$=requireUtils$1(),j=$.assert,et=$.parseBytes,tt=requireKey$2(),rt=requireSignature$2();function nt(it){if(j(it==="ed25519","only tested with ed25519 so far"),!(this instanceof nt))return new nt(it);it=a[it].curve,this.curve=it,this.g=it.g,this.g.precompute(it.n.bitLength()+1),this.pointClass=it.point().constructor,this.encodingLength=Math.ceil(it.n.bitLength()/8),this.hash=_.sha512}return eddsa$4=nt,nt.prototype.sign=function(at,st){at=et(at);var ot=this.keyFromSecret(st),ut=this.hashInt(ot.messagePrefix(),at),dt=this.g.mul(ut),mt=this.encodePoint(dt),xt=this.hashInt(mt,ot.pubBytes(),at).mul(ot.priv()),Ct=ut.add(xt).umod(this.curve.n);return this.makeSignature({R:dt,S:Ct,Rencoded:mt})},nt.prototype.verify=function(at,st,ot){at=et(at),st=this.makeSignature(st);var ut=this.keyFromPublic(ot),dt=this.hashInt(st.Rencoded(),ut.pubBytes(),at),mt=this.g.mul(st.S()),xt=st.R().add(ut.pub().mul(dt));return xt.eq(mt)},nt.prototype.hashInt=function(){for(var at=this.hash(),st=0;st0?ct:ht},tt.min=function(ct,ht){return ct.cmp(ht)<0?ct:ht},tt.prototype._init=function(ct,ht,vt){if(typeof ct=="number")return this._initNumber(ct,ht,vt);if(typeof ct=="object")return this._initArray(ct,ht,vt);ht==="hex"&&(ht=16),j(ht===(ht|0)&&ht>=2&&ht<=36),ct=ct.toString().replace(/\s+/g,"");var St=0;ct[0]==="-"&&(St++,this.negative=1),St=0;St-=3)$t=ct[St]|ct[St-1]<<8|ct[St-2]<<16,this.words[Rt]|=$t<>>26-Et&67108863,Et+=24,Et>=26&&(Et-=26,Rt++);else if(vt==="le")for(St=0,Rt=0;St>>26-Et&67108863,Et+=24,Et>=26&&(Et-=26,Rt++);return this._strip()};function nt(bt,ct){var ht=bt.charCodeAt(ct);if(ht>=48&&ht<=57)return ht-48;if(ht>=65&&ht<=70)return ht-55;if(ht>=97&&ht<=102)return ht-87;j(!1,"Invalid character in "+bt)}function it(bt,ct,ht){var vt=nt(bt,ht);return ht-1>=ct&&(vt|=nt(bt,ht-1)<<4),vt}tt.prototype._parseHex=function(ct,ht,vt){this.length=Math.ceil((ct.length-ht)/6),this.words=new Array(this.length);for(var St=0;St=ht;St-=2)Et=it(ct,ht,St)<=18?(Rt-=18,$t+=1,this.words[$t]|=Et>>>26):Rt+=8;else{var At=ct.length-ht;for(St=At%2===0?ht+1:ht;St=18?(Rt-=18,$t+=1,this.words[$t]|=Et>>>26):Rt+=8}this._strip()};function at(bt,ct,ht,vt){for(var St=0,Rt=0,$t=Math.min(bt.length,ht),Et=ct;Et<$t;Et++){var At=bt.charCodeAt(Et)-48;St*=vt,At>=49?Rt=At-49+10:At>=17?Rt=At-17+10:Rt=At,j(At>=0&&Rt1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=ot}catch{tt.prototype.inspect=ot}else tt.prototype.inspect=ot;function ot(){return(this.red?""}var ut=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],dt=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],mt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(ct,ht){ct=ct||10,ht=ht|0||1;var vt;if(ct===16||ct==="hex"){vt="";for(var St=0,Rt=0,$t=0;$t>>24-St&16777215,St+=2,St>=26&&(St-=26,$t--),Rt!==0||$t!==this.length-1?vt=ut[6-At.length]+At+vt:vt=At+vt}for(Rt!==0&&(vt=Rt.toString(16)+vt);vt.length%ht!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}if(ct===(ct|0)&&ct>=2&&ct<=36){var wt=dt[ct],Ot=mt[ct];vt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var nr=tr.modrn(Ot).toString(ct);tr=tr.idivn(Ot),tr.isZero()?vt=nr+vt:vt=ut[wt-nr.length]+nr+vt}for(this.isZero()&&(vt="0"+vt);vt.length%ht!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var ct=this.words[0];return this.length===2?ct+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ct+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-ct:ct},tt.prototype.toJSON=function(){return this.toString(16,2)},rt&&(tt.prototype.toBuffer=function(ct,ht){return this.toArrayLike(rt,ct,ht)}),tt.prototype.toArray=function(ct,ht){return this.toArrayLike(Array,ct,ht)};var xt=function(ct,ht){return ct.allocUnsafe?ct.allocUnsafe(ht):new ct(ht)};tt.prototype.toArrayLike=function(ct,ht,vt){this._strip();var St=this.byteLength(),Rt=vt||Math.max(1,St);j(St<=Rt,"byte array longer than desired length"),j(Rt>0,"Requested array length <= 0");var $t=xt(ct,Rt),Et=ht==="le"?"LE":"BE";return this["_toArrayLike"+Et]($t,St),$t},tt.prototype._toArrayLikeLE=function(ct,ht){for(var vt=0,St=0,Rt=0,$t=0;Rt>8&255),vt>16&255),$t===6?(vt>24&255),St=0,$t=0):(St=Et>>>24,$t+=2)}if(vt=0&&(ct[vt--]=Et>>8&255),vt>=0&&(ct[vt--]=Et>>16&255),$t===6?(vt>=0&&(ct[vt--]=Et>>24&255),St=0,$t=0):(St=Et>>>24,$t+=2)}if(vt>=0)for(ct[vt--]=St;vt>=0;)ct[vt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var ht=ct,vt=0;return ht>=4096&&(vt+=13,ht>>>=13),ht>=64&&(vt+=7,ht>>>=7),ht>=8&&(vt+=4,ht>>>=4),ht>=2&&(vt+=2,ht>>>=2),vt+ht},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var ht=ct,vt=0;return ht&8191||(vt+=13,ht>>>=13),ht&127||(vt+=7,ht>>>=7),ht&15||(vt+=4,ht>>>=4),ht&3||(vt+=2,ht>>>=2),ht&1||vt++,vt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],ht=this._countBits(ct);return(this.length-1)*26+ht};function Ct(bt){for(var ct=new Array(bt.bitLength()),ht=0;ht>>St&1}return ct}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var ct=0,ht=0;htct.length?this.clone().ior(ct):ct.clone().ior(this)},tt.prototype.uor=function(ct){return this.length>ct.length?this.clone().iuor(ct):ct.clone().iuor(this)},tt.prototype.iuand=function(ct){var ht;this.length>ct.length?ht=ct:ht=this;for(var vt=0;vtct.length?this.clone().iand(ct):ct.clone().iand(this)},tt.prototype.uand=function(ct){return this.length>ct.length?this.clone().iuand(ct):ct.clone().iuand(this)},tt.prototype.iuxor=function(ct){var ht,vt;this.length>ct.length?(ht=this,vt=ct):(ht=ct,vt=this);for(var St=0;Stct.length?this.clone().ixor(ct):ct.clone().ixor(this)},tt.prototype.uxor=function(ct){return this.length>ct.length?this.clone().iuxor(ct):ct.clone().iuxor(this)},tt.prototype.inotn=function(ct){j(typeof ct=="number"&&ct>=0);var ht=Math.ceil(ct/26)|0,vt=ct%26;this._expand(ht),vt>0&&ht--;for(var St=0;St0&&(this.words[St]=~this.words[St]&67108863>>26-vt),this._strip()},tt.prototype.notn=function(ct){return this.clone().inotn(ct)},tt.prototype.setn=function(ct,ht){j(typeof ct=="number"&&ct>=0);var vt=ct/26|0,St=ct%26;return this._expand(vt+1),ht?this.words[vt]=this.words[vt]|1<ct.length?(vt=this,St=ct):(vt=ct,St=this);for(var Rt=0,$t=0;$t>>26;for(;Rt!==0&&$t>>26;if(this.length=vt.length,Rt!==0)this.words[this.length]=Rt,this.length++;else if(vt!==this)for(;$tct.length?this.clone().iadd(ct):ct.clone().iadd(this)},tt.prototype.isub=function(ct){if(ct.negative!==0){ct.negative=0;var ht=this.iadd(ct);return ct.negative=1,ht._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(ct),this.negative=1,this._normSign();var vt=this.cmp(ct);if(vt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Rt;vt>0?(St=this,Rt=ct):(St=ct,Rt=this);for(var $t=0,Et=0;Et>26,this.words[Et]=ht&67108863;for(;$t!==0&&Et>26,this.words[Et]=ht&67108863;if($t===0&&Et>>26,tr=At&67108863,nr=Math.min(wt,ct.length-1),ir=Math.max(0,wt-bt.length+1);ir<=nr;ir++){var Wt=wt-ir|0;St=bt.words[Wt]|0,Rt=ct.words[ir]|0,$t=St*Rt+tr,Ot+=$t/67108864|0,tr=$t&67108863}ht.words[wt]=tr|0,At=Ot|0}return At!==0?ht.words[wt]=At|0:ht.length--,ht._strip()}var Tt=function(ct,ht,vt){var St=ct.words,Rt=ht.words,$t=vt.words,Et=0,At,wt,Ot,tr=St[0]|0,nr=tr&8191,ir=tr>>>13,Wt=St[1]|0,Kt=Wt&8191,Jt=Wt>>>13,Ht=St[2]|0,Vt=Ht&8191,Qt=Ht>>>13,dr=St[3]|0,xr=dr&8191,pr=dr>>>13,Ir=St[4]|0,kr=Ir&8191,lr=Ir>>>13,fr=St[5]|0,Er=fr&8191,$r=fr>>>13,Pr=St[6]|0,Rr=Pr&8191,Ar=Pr>>>13,Or=St[7]|0,Lr=Or&8191,ar=Or>>>13,Yt=St[8]|0,er=Yt&8191,Zt=Yt>>>13,qt=St[9]|0,Gt=qt&8191,or=qt>>>13,vr=Rt[0]|0,wr=vr&8191,Sr=vr>>>13,Wr=Rt[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=Rt[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=Rt[3]|0,ln=mn&8191,Vr=mn>>>13,wn=Rt[4]|0,un=wn&8191,qr=wn>>>13,hn=Rt[5]|0,fn=hn&8191,Kr=hn>>>13,$n=Rt[6]|0,dn=$n&8191,Gr=$n>>>13,gn=Rt[7]|0,an=gn&8191,Zr=gn>>>13,Rn=Rt[8]|0,Sn=Rn&8191,nn=Rn>>>13,Tn=Rt[9]|0,yn=Tn&8191,En=Tn>>>13;vt.negative=ct.negative^ht.negative,vt.length=19,At=Math.imul(nr,wr),wt=Math.imul(nr,Sr),wt=wt+Math.imul(ir,wr)|0,Ot=Math.imul(ir,Sr);var ds=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ds>>>26)|0,ds&=67108863,At=Math.imul(Kt,wr),wt=Math.imul(Kt,Sr),wt=wt+Math.imul(Jt,wr)|0,Ot=Math.imul(Jt,Sr),At=At+Math.imul(nr,Hr)|0,wt=wt+Math.imul(nr,Fr)|0,wt=wt+Math.imul(ir,Hr)|0,Ot=Ot+Math.imul(ir,Fr)|0;var fs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(fs>>>26)|0,fs&=67108863,At=Math.imul(Vt,wr),wt=Math.imul(Vt,Sr),wt=wt+Math.imul(Qt,wr)|0,Ot=Math.imul(Qt,Sr),At=At+Math.imul(Kt,Hr)|0,wt=wt+Math.imul(Kt,Fr)|0,wt=wt+Math.imul(Jt,Hr)|0,Ot=Ot+Math.imul(Jt,Fr)|0,At=At+Math.imul(nr,Jr)|0,wt=wt+Math.imul(nr,Qr)|0,wt=wt+Math.imul(ir,Jr)|0,Ot=Ot+Math.imul(ir,Qr)|0;var hs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(hs>>>26)|0,hs&=67108863,At=Math.imul(xr,wr),wt=Math.imul(xr,Sr),wt=wt+Math.imul(pr,wr)|0,Ot=Math.imul(pr,Sr),At=At+Math.imul(Vt,Hr)|0,wt=wt+Math.imul(Vt,Fr)|0,wt=wt+Math.imul(Qt,Hr)|0,Ot=Ot+Math.imul(Qt,Fr)|0,At=At+Math.imul(Kt,Jr)|0,wt=wt+Math.imul(Kt,Qr)|0,wt=wt+Math.imul(Jt,Jr)|0,Ot=Ot+Math.imul(Jt,Qr)|0,At=At+Math.imul(nr,ln)|0,wt=wt+Math.imul(nr,Vr)|0,wt=wt+Math.imul(ir,ln)|0,Ot=Ot+Math.imul(ir,Vr)|0;var ps=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ps>>>26)|0,ps&=67108863,At=Math.imul(kr,wr),wt=Math.imul(kr,Sr),wt=wt+Math.imul(lr,wr)|0,Ot=Math.imul(lr,Sr),At=At+Math.imul(xr,Hr)|0,wt=wt+Math.imul(xr,Fr)|0,wt=wt+Math.imul(pr,Hr)|0,Ot=Ot+Math.imul(pr,Fr)|0,At=At+Math.imul(Vt,Jr)|0,wt=wt+Math.imul(Vt,Qr)|0,wt=wt+Math.imul(Qt,Jr)|0,Ot=Ot+Math.imul(Qt,Qr)|0,At=At+Math.imul(Kt,ln)|0,wt=wt+Math.imul(Kt,Vr)|0,wt=wt+Math.imul(Jt,ln)|0,Ot=Ot+Math.imul(Jt,Vr)|0,At=At+Math.imul(nr,un)|0,wt=wt+Math.imul(nr,qr)|0,wt=wt+Math.imul(ir,un)|0,Ot=Ot+Math.imul(ir,qr)|0;var qn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(qn>>>26)|0,qn&=67108863,At=Math.imul(Er,wr),wt=Math.imul(Er,Sr),wt=wt+Math.imul($r,wr)|0,Ot=Math.imul($r,Sr),At=At+Math.imul(kr,Hr)|0,wt=wt+Math.imul(kr,Fr)|0,wt=wt+Math.imul(lr,Hr)|0,Ot=Ot+Math.imul(lr,Fr)|0,At=At+Math.imul(xr,Jr)|0,wt=wt+Math.imul(xr,Qr)|0,wt=wt+Math.imul(pr,Jr)|0,Ot=Ot+Math.imul(pr,Qr)|0,At=At+Math.imul(Vt,ln)|0,wt=wt+Math.imul(Vt,Vr)|0,wt=wt+Math.imul(Qt,ln)|0,Ot=Ot+Math.imul(Qt,Vr)|0,At=At+Math.imul(Kt,un)|0,wt=wt+Math.imul(Kt,qr)|0,wt=wt+Math.imul(Jt,un)|0,Ot=Ot+Math.imul(Jt,qr)|0,At=At+Math.imul(nr,fn)|0,wt=wt+Math.imul(nr,Kr)|0,wt=wt+Math.imul(ir,fn)|0,Ot=Ot+Math.imul(ir,Kr)|0;var ss=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ss>>>26)|0,ss&=67108863,At=Math.imul(Rr,wr),wt=Math.imul(Rr,Sr),wt=wt+Math.imul(Ar,wr)|0,Ot=Math.imul(Ar,Sr),At=At+Math.imul(Er,Hr)|0,wt=wt+Math.imul(Er,Fr)|0,wt=wt+Math.imul($r,Hr)|0,Ot=Ot+Math.imul($r,Fr)|0,At=At+Math.imul(kr,Jr)|0,wt=wt+Math.imul(kr,Qr)|0,wt=wt+Math.imul(lr,Jr)|0,Ot=Ot+Math.imul(lr,Qr)|0,At=At+Math.imul(xr,ln)|0,wt=wt+Math.imul(xr,Vr)|0,wt=wt+Math.imul(pr,ln)|0,Ot=Ot+Math.imul(pr,Vr)|0,At=At+Math.imul(Vt,un)|0,wt=wt+Math.imul(Vt,qr)|0,wt=wt+Math.imul(Qt,un)|0,Ot=Ot+Math.imul(Qt,qr)|0,At=At+Math.imul(Kt,fn)|0,wt=wt+Math.imul(Kt,Kr)|0,wt=wt+Math.imul(Jt,fn)|0,Ot=Ot+Math.imul(Jt,Kr)|0,At=At+Math.imul(nr,dn)|0,wt=wt+Math.imul(nr,Gr)|0,wt=wt+Math.imul(ir,dn)|0,Ot=Ot+Math.imul(ir,Gr)|0;var Jn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,At=Math.imul(Lr,wr),wt=Math.imul(Lr,Sr),wt=wt+Math.imul(ar,wr)|0,Ot=Math.imul(ar,Sr),At=At+Math.imul(Rr,Hr)|0,wt=wt+Math.imul(Rr,Fr)|0,wt=wt+Math.imul(Ar,Hr)|0,Ot=Ot+Math.imul(Ar,Fr)|0,At=At+Math.imul(Er,Jr)|0,wt=wt+Math.imul(Er,Qr)|0,wt=wt+Math.imul($r,Jr)|0,Ot=Ot+Math.imul($r,Qr)|0,At=At+Math.imul(kr,ln)|0,wt=wt+Math.imul(kr,Vr)|0,wt=wt+Math.imul(lr,ln)|0,Ot=Ot+Math.imul(lr,Vr)|0,At=At+Math.imul(xr,un)|0,wt=wt+Math.imul(xr,qr)|0,wt=wt+Math.imul(pr,un)|0,Ot=Ot+Math.imul(pr,qr)|0,At=At+Math.imul(Vt,fn)|0,wt=wt+Math.imul(Vt,Kr)|0,wt=wt+Math.imul(Qt,fn)|0,Ot=Ot+Math.imul(Qt,Kr)|0,At=At+Math.imul(Kt,dn)|0,wt=wt+Math.imul(Kt,Gr)|0,wt=wt+Math.imul(Jt,dn)|0,Ot=Ot+Math.imul(Jt,Gr)|0,At=At+Math.imul(nr,an)|0,wt=wt+Math.imul(nr,Zr)|0,wt=wt+Math.imul(ir,an)|0,Ot=Ot+Math.imul(ir,Zr)|0;var Yn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,At=Math.imul(er,wr),wt=Math.imul(er,Sr),wt=wt+Math.imul(Zt,wr)|0,Ot=Math.imul(Zt,Sr),At=At+Math.imul(Lr,Hr)|0,wt=wt+Math.imul(Lr,Fr)|0,wt=wt+Math.imul(ar,Hr)|0,Ot=Ot+Math.imul(ar,Fr)|0,At=At+Math.imul(Rr,Jr)|0,wt=wt+Math.imul(Rr,Qr)|0,wt=wt+Math.imul(Ar,Jr)|0,Ot=Ot+Math.imul(Ar,Qr)|0,At=At+Math.imul(Er,ln)|0,wt=wt+Math.imul(Er,Vr)|0,wt=wt+Math.imul($r,ln)|0,Ot=Ot+Math.imul($r,Vr)|0,At=At+Math.imul(kr,un)|0,wt=wt+Math.imul(kr,qr)|0,wt=wt+Math.imul(lr,un)|0,Ot=Ot+Math.imul(lr,qr)|0,At=At+Math.imul(xr,fn)|0,wt=wt+Math.imul(xr,Kr)|0,wt=wt+Math.imul(pr,fn)|0,Ot=Ot+Math.imul(pr,Kr)|0,At=At+Math.imul(Vt,dn)|0,wt=wt+Math.imul(Vt,Gr)|0,wt=wt+Math.imul(Qt,dn)|0,Ot=Ot+Math.imul(Qt,Gr)|0,At=At+Math.imul(Kt,an)|0,wt=wt+Math.imul(Kt,Zr)|0,wt=wt+Math.imul(Jt,an)|0,Ot=Ot+Math.imul(Jt,Zr)|0,At=At+Math.imul(nr,Sn)|0,wt=wt+Math.imul(nr,nn)|0,wt=wt+Math.imul(ir,Sn)|0,Ot=Ot+Math.imul(ir,nn)|0;var ms=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ms>>>26)|0,ms&=67108863,At=Math.imul(Gt,wr),wt=Math.imul(Gt,Sr),wt=wt+Math.imul(or,wr)|0,Ot=Math.imul(or,Sr),At=At+Math.imul(er,Hr)|0,wt=wt+Math.imul(er,Fr)|0,wt=wt+Math.imul(Zt,Hr)|0,Ot=Ot+Math.imul(Zt,Fr)|0,At=At+Math.imul(Lr,Jr)|0,wt=wt+Math.imul(Lr,Qr)|0,wt=wt+Math.imul(ar,Jr)|0,Ot=Ot+Math.imul(ar,Qr)|0,At=At+Math.imul(Rr,ln)|0,wt=wt+Math.imul(Rr,Vr)|0,wt=wt+Math.imul(Ar,ln)|0,Ot=Ot+Math.imul(Ar,Vr)|0,At=At+Math.imul(Er,un)|0,wt=wt+Math.imul(Er,qr)|0,wt=wt+Math.imul($r,un)|0,Ot=Ot+Math.imul($r,qr)|0,At=At+Math.imul(kr,fn)|0,wt=wt+Math.imul(kr,Kr)|0,wt=wt+Math.imul(lr,fn)|0,Ot=Ot+Math.imul(lr,Kr)|0,At=At+Math.imul(xr,dn)|0,wt=wt+Math.imul(xr,Gr)|0,wt=wt+Math.imul(pr,dn)|0,Ot=Ot+Math.imul(pr,Gr)|0,At=At+Math.imul(Vt,an)|0,wt=wt+Math.imul(Vt,Zr)|0,wt=wt+Math.imul(Qt,an)|0,Ot=Ot+Math.imul(Qt,Zr)|0,At=At+Math.imul(Kt,Sn)|0,wt=wt+Math.imul(Kt,nn)|0,wt=wt+Math.imul(Jt,Sn)|0,Ot=Ot+Math.imul(Jt,nn)|0,At=At+Math.imul(nr,yn)|0,wt=wt+Math.imul(nr,En)|0,wt=wt+Math.imul(ir,yn)|0,Ot=Ot+Math.imul(ir,En)|0;var Qn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,At=Math.imul(Gt,Hr),wt=Math.imul(Gt,Fr),wt=wt+Math.imul(or,Hr)|0,Ot=Math.imul(or,Fr),At=At+Math.imul(er,Jr)|0,wt=wt+Math.imul(er,Qr)|0,wt=wt+Math.imul(Zt,Jr)|0,Ot=Ot+Math.imul(Zt,Qr)|0,At=At+Math.imul(Lr,ln)|0,wt=wt+Math.imul(Lr,Vr)|0,wt=wt+Math.imul(ar,ln)|0,Ot=Ot+Math.imul(ar,Vr)|0,At=At+Math.imul(Rr,un)|0,wt=wt+Math.imul(Rr,qr)|0,wt=wt+Math.imul(Ar,un)|0,Ot=Ot+Math.imul(Ar,qr)|0,At=At+Math.imul(Er,fn)|0,wt=wt+Math.imul(Er,Kr)|0,wt=wt+Math.imul($r,fn)|0,Ot=Ot+Math.imul($r,Kr)|0,At=At+Math.imul(kr,dn)|0,wt=wt+Math.imul(kr,Gr)|0,wt=wt+Math.imul(lr,dn)|0,Ot=Ot+Math.imul(lr,Gr)|0,At=At+Math.imul(xr,an)|0,wt=wt+Math.imul(xr,Zr)|0,wt=wt+Math.imul(pr,an)|0,Ot=Ot+Math.imul(pr,Zr)|0,At=At+Math.imul(Vt,Sn)|0,wt=wt+Math.imul(Vt,nn)|0,wt=wt+Math.imul(Qt,Sn)|0,Ot=Ot+Math.imul(Qt,nn)|0,At=At+Math.imul(Kt,yn)|0,wt=wt+Math.imul(Kt,En)|0,wt=wt+Math.imul(Jt,yn)|0,Ot=Ot+Math.imul(Jt,En)|0;var es=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(es>>>26)|0,es&=67108863,At=Math.imul(Gt,Jr),wt=Math.imul(Gt,Qr),wt=wt+Math.imul(or,Jr)|0,Ot=Math.imul(or,Qr),At=At+Math.imul(er,ln)|0,wt=wt+Math.imul(er,Vr)|0,wt=wt+Math.imul(Zt,ln)|0,Ot=Ot+Math.imul(Zt,Vr)|0,At=At+Math.imul(Lr,un)|0,wt=wt+Math.imul(Lr,qr)|0,wt=wt+Math.imul(ar,un)|0,Ot=Ot+Math.imul(ar,qr)|0,At=At+Math.imul(Rr,fn)|0,wt=wt+Math.imul(Rr,Kr)|0,wt=wt+Math.imul(Ar,fn)|0,Ot=Ot+Math.imul(Ar,Kr)|0,At=At+Math.imul(Er,dn)|0,wt=wt+Math.imul(Er,Gr)|0,wt=wt+Math.imul($r,dn)|0,Ot=Ot+Math.imul($r,Gr)|0,At=At+Math.imul(kr,an)|0,wt=wt+Math.imul(kr,Zr)|0,wt=wt+Math.imul(lr,an)|0,Ot=Ot+Math.imul(lr,Zr)|0,At=At+Math.imul(xr,Sn)|0,wt=wt+Math.imul(xr,nn)|0,wt=wt+Math.imul(pr,Sn)|0,Ot=Ot+Math.imul(pr,nn)|0,At=At+Math.imul(Vt,yn)|0,wt=wt+Math.imul(Vt,En)|0,wt=wt+Math.imul(Qt,yn)|0,Ot=Ot+Math.imul(Qt,En)|0;var ls=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ls>>>26)|0,ls&=67108863,At=Math.imul(Gt,ln),wt=Math.imul(Gt,Vr),wt=wt+Math.imul(or,ln)|0,Ot=Math.imul(or,Vr),At=At+Math.imul(er,un)|0,wt=wt+Math.imul(er,qr)|0,wt=wt+Math.imul(Zt,un)|0,Ot=Ot+Math.imul(Zt,qr)|0,At=At+Math.imul(Lr,fn)|0,wt=wt+Math.imul(Lr,Kr)|0,wt=wt+Math.imul(ar,fn)|0,Ot=Ot+Math.imul(ar,Kr)|0,At=At+Math.imul(Rr,dn)|0,wt=wt+Math.imul(Rr,Gr)|0,wt=wt+Math.imul(Ar,dn)|0,Ot=Ot+Math.imul(Ar,Gr)|0,At=At+Math.imul(Er,an)|0,wt=wt+Math.imul(Er,Zr)|0,wt=wt+Math.imul($r,an)|0,Ot=Ot+Math.imul($r,Zr)|0,At=At+Math.imul(kr,Sn)|0,wt=wt+Math.imul(kr,nn)|0,wt=wt+Math.imul(lr,Sn)|0,Ot=Ot+Math.imul(lr,nn)|0,At=At+Math.imul(xr,yn)|0,wt=wt+Math.imul(xr,En)|0,wt=wt+Math.imul(pr,yn)|0,Ot=Ot+Math.imul(pr,En)|0;var us=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(us>>>26)|0,us&=67108863,At=Math.imul(Gt,un),wt=Math.imul(Gt,qr),wt=wt+Math.imul(or,un)|0,Ot=Math.imul(or,qr),At=At+Math.imul(er,fn)|0,wt=wt+Math.imul(er,Kr)|0,wt=wt+Math.imul(Zt,fn)|0,Ot=Ot+Math.imul(Zt,Kr)|0,At=At+Math.imul(Lr,dn)|0,wt=wt+Math.imul(Lr,Gr)|0,wt=wt+Math.imul(ar,dn)|0,Ot=Ot+Math.imul(ar,Gr)|0,At=At+Math.imul(Rr,an)|0,wt=wt+Math.imul(Rr,Zr)|0,wt=wt+Math.imul(Ar,an)|0,Ot=Ot+Math.imul(Ar,Zr)|0,At=At+Math.imul(Er,Sn)|0,wt=wt+Math.imul(Er,nn)|0,wt=wt+Math.imul($r,Sn)|0,Ot=Ot+Math.imul($r,nn)|0,At=At+Math.imul(kr,yn)|0,wt=wt+Math.imul(kr,En)|0,wt=wt+Math.imul(lr,yn)|0,Ot=Ot+Math.imul(lr,En)|0;var Wn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,At=Math.imul(Gt,fn),wt=Math.imul(Gt,Kr),wt=wt+Math.imul(or,fn)|0,Ot=Math.imul(or,Kr),At=At+Math.imul(er,dn)|0,wt=wt+Math.imul(er,Gr)|0,wt=wt+Math.imul(Zt,dn)|0,Ot=Ot+Math.imul(Zt,Gr)|0,At=At+Math.imul(Lr,an)|0,wt=wt+Math.imul(Lr,Zr)|0,wt=wt+Math.imul(ar,an)|0,Ot=Ot+Math.imul(ar,Zr)|0,At=At+Math.imul(Rr,Sn)|0,wt=wt+Math.imul(Rr,nn)|0,wt=wt+Math.imul(Ar,Sn)|0,Ot=Ot+Math.imul(Ar,nn)|0,At=At+Math.imul(Er,yn)|0,wt=wt+Math.imul(Er,En)|0,wt=wt+Math.imul($r,yn)|0,Ot=Ot+Math.imul($r,En)|0;var os=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(os>>>26)|0,os&=67108863,At=Math.imul(Gt,dn),wt=Math.imul(Gt,Gr),wt=wt+Math.imul(or,dn)|0,Ot=Math.imul(or,Gr),At=At+Math.imul(er,an)|0,wt=wt+Math.imul(er,Zr)|0,wt=wt+Math.imul(Zt,an)|0,Ot=Ot+Math.imul(Zt,Zr)|0,At=At+Math.imul(Lr,Sn)|0,wt=wt+Math.imul(Lr,nn)|0,wt=wt+Math.imul(ar,Sn)|0,Ot=Ot+Math.imul(ar,nn)|0,At=At+Math.imul(Rr,yn)|0,wt=wt+Math.imul(Rr,En)|0,wt=wt+Math.imul(Ar,yn)|0,Ot=Ot+Math.imul(Ar,En)|0;var gs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(gs>>>26)|0,gs&=67108863,At=Math.imul(Gt,an),wt=Math.imul(Gt,Zr),wt=wt+Math.imul(or,an)|0,Ot=Math.imul(or,Zr),At=At+Math.imul(er,Sn)|0,wt=wt+Math.imul(er,nn)|0,wt=wt+Math.imul(Zt,Sn)|0,Ot=Ot+Math.imul(Zt,nn)|0,At=At+Math.imul(Lr,yn)|0,wt=wt+Math.imul(Lr,En)|0,wt=wt+Math.imul(ar,yn)|0,Ot=Ot+Math.imul(ar,En)|0;var bs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(bs>>>26)|0,bs&=67108863,At=Math.imul(Gt,Sn),wt=Math.imul(Gt,nn),wt=wt+Math.imul(or,Sn)|0,Ot=Math.imul(or,nn),At=At+Math.imul(er,yn)|0,wt=wt+Math.imul(er,En)|0,wt=wt+Math.imul(Zt,yn)|0,Ot=Ot+Math.imul(Zt,En)|0;var Ps=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,At=Math.imul(Gt,yn),wt=Math.imul(Gt,En),wt=wt+Math.imul(or,yn)|0,Ot=Math.imul(or,En);var As=(Et+At|0)+((wt&8191)<<13)|0;return Et=(Ot+(wt>>>13)|0)+(As>>>26)|0,As&=67108863,$t[0]=ds,$t[1]=fs,$t[2]=hs,$t[3]=ps,$t[4]=qn,$t[5]=ss,$t[6]=Jn,$t[7]=Yn,$t[8]=ms,$t[9]=Qn,$t[10]=es,$t[11]=ls,$t[12]=us,$t[13]=Wn,$t[14]=os,$t[15]=gs,$t[16]=bs,$t[17]=Ps,$t[18]=As,Et!==0&&($t[19]=Et,vt.length++),vt};Math.imul||(Tt=Pt);function kt(bt,ct,ht){ht.negative=ct.negative^bt.negative,ht.length=bt.length+ct.length;for(var vt=0,St=0,Rt=0;Rt>>26)|0,St+=$t>>>26,$t&=67108863}ht.words[Rt]=Et,vt=$t,$t=St}return vt!==0?ht.words[Rt]=vt:ht.length--,ht._strip()}function Lt(bt,ct,ht){return kt(bt,ct,ht)}tt.prototype.mulTo=function(ct,ht){var vt,St=this.length+ct.length;return this.length===10&&ct.length===10?vt=Tt(this,ct,ht):St<63?vt=Pt(this,ct,ht):St<1024?vt=kt(this,ct,ht):vt=Lt(this,ct,ht),vt},tt.prototype.mul=function(ct){var ht=new tt(null);return ht.words=new Array(this.length+ct.length),this.mulTo(ct,ht)},tt.prototype.mulf=function(ct){var ht=new tt(null);return ht.words=new Array(this.length+ct.length),Lt(this,ct,ht)},tt.prototype.imul=function(ct){return this.clone().mulTo(ct,this)},tt.prototype.imuln=function(ct){var ht=ct<0;ht&&(ct=-ct),j(typeof ct=="number"),j(ct<67108864);for(var vt=0,St=0;St>=26,vt+=Rt/67108864|0,vt+=$t>>>26,this.words[St]=$t&67108863}return vt!==0&&(this.words[St]=vt,this.length++),ht?this.ineg():this},tt.prototype.muln=function(ct){return this.clone().imuln(ct)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(ct){var ht=Ct(ct);if(ht.length===0)return new tt(1);for(var vt=this,St=0;St=0);var ht=ct%26,vt=(ct-ht)/26,St=67108863>>>26-ht<<26-ht,Rt;if(ht!==0){var $t=0;for(Rt=0;Rt>>26-ht}$t&&(this.words[Rt]=$t,this.length++)}if(vt!==0){for(Rt=this.length-1;Rt>=0;Rt--)this.words[Rt+vt]=this.words[Rt];for(Rt=0;Rt=0);var St;ht?St=(ht-ht%26)/26:St=0;var Rt=ct%26,$t=Math.min((ct-Rt)/26,this.length),Et=67108863^67108863>>>Rt<$t)for(this.length-=$t,wt=0;wt=0&&(Ot!==0||wt>=St);wt--){var tr=this.words[wt]|0;this.words[wt]=Ot<<26-Rt|tr>>>Rt,Ot=tr&Et}return At&&Ot!==0&&(At.words[At.length++]=Ot),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,ht,vt){return j(this.negative===0),this.iushrn(ct,ht,vt)},tt.prototype.shln=function(ct){return this.clone().ishln(ct)},tt.prototype.ushln=function(ct){return this.clone().iushln(ct)},tt.prototype.shrn=function(ct){return this.clone().ishrn(ct)},tt.prototype.ushrn=function(ct){return this.clone().iushrn(ct)},tt.prototype.testn=function(ct){j(typeof ct=="number"&&ct>=0);var ht=ct%26,vt=(ct-ht)/26,St=1<=0);var ht=ct%26,vt=(ct-ht)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=vt)return this;if(ht!==0&&vt++,this.length=Math.min(vt,this.length),ht!==0){var St=67108863^67108863>>>ht<=67108864;ht++)this.words[ht]-=67108864,ht===this.length-1?this.words[ht+1]=1:this.words[ht+1]++;return this.length=Math.max(this.length,ht+1),this},tt.prototype.isubn=function(ct){if(j(typeof ct=="number"),j(ct<67108864),ct<0)return this.iaddn(-ct);if(this.negative!==0)return this.negative=0,this.iaddn(ct),this.negative=1,this;if(this.words[0]-=ct,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ht=0;ht>26)-(At/67108864|0),this.words[Rt+vt]=$t&67108863}for(;Rt>26,this.words[Rt+vt]=$t&67108863;if(Et===0)return this._strip();for(j(Et===-1),Et=0,Rt=0;Rt>26,this.words[Rt]=$t&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,ht){var vt=this.length-ct.length,St=this.clone(),Rt=ct,$t=Rt.words[Rt.length-1]|0,Et=this._countBits($t);vt=26-Et,vt!==0&&(Rt=Rt.ushln(vt),St.iushln(vt),$t=Rt.words[Rt.length-1]|0);var At=St.length-Rt.length,wt;if(ht!=="mod"){wt=new tt(null),wt.length=At+1,wt.words=new Array(wt.length);for(var Ot=0;Ot=0;nr--){var ir=(St.words[Rt.length+nr]|0)*67108864+(St.words[Rt.length+nr-1]|0);for(ir=Math.min(ir/$t|0,67108863),St._ishlnsubmul(Rt,ir,nr);St.negative!==0;)ir--,St.negative=0,St._ishlnsubmul(Rt,1,nr),St.isZero()||(St.negative^=1);wt&&(wt.words[nr]=ir)}return wt&&wt._strip(),St._strip(),ht!=="div"&&vt!==0&&St.iushrn(vt),{div:wt||null,mod:St}},tt.prototype.divmod=function(ct,ht,vt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var St,Rt,$t;return this.negative!==0&&ct.negative===0?($t=this.neg().divmod(ct,ht),ht!=="mod"&&(St=$t.div.neg()),ht!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.iadd(ct)),{div:St,mod:Rt}):this.negative===0&&ct.negative!==0?($t=this.divmod(ct.neg(),ht),ht!=="mod"&&(St=$t.div.neg()),{div:St,mod:$t.mod}):this.negative&ct.negative?($t=this.neg().divmod(ct.neg(),ht),ht!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.isub(ct)),{div:$t.div,mod:Rt}):ct.length>this.length||this.cmp(ct)<0?{div:new tt(0),mod:this}:ct.length===1?ht==="div"?{div:this.divn(ct.words[0]),mod:null}:ht==="mod"?{div:null,mod:new tt(this.modrn(ct.words[0]))}:{div:this.divn(ct.words[0]),mod:new tt(this.modrn(ct.words[0]))}:this._wordDiv(ct,ht)},tt.prototype.div=function(ct){return this.divmod(ct,"div",!1).div},tt.prototype.mod=function(ct){return this.divmod(ct,"mod",!1).mod},tt.prototype.umod=function(ct){return this.divmod(ct,"mod",!0).mod},tt.prototype.divRound=function(ct){var ht=this.divmod(ct);if(ht.mod.isZero())return ht.div;var vt=ht.div.negative!==0?ht.mod.isub(ct):ht.mod,St=ct.ushrn(1),Rt=ct.andln(1),$t=vt.cmp(St);return $t<0||Rt===1&&$t===0?ht.div:ht.div.negative!==0?ht.div.isubn(1):ht.div.iaddn(1)},tt.prototype.modrn=function(ct){var ht=ct<0;ht&&(ct=-ct),j(ct<=67108863);for(var vt=(1<<26)%ct,St=0,Rt=this.length-1;Rt>=0;Rt--)St=(vt*St+(this.words[Rt]|0))%ct;return ht?-St:St},tt.prototype.modn=function(ct){return this.modrn(ct)},tt.prototype.idivn=function(ct){var ht=ct<0;ht&&(ct=-ct),j(ct<=67108863);for(var vt=0,St=this.length-1;St>=0;St--){var Rt=(this.words[St]|0)+vt*67108864;this.words[St]=Rt/ct|0,vt=Rt%ct}return this._strip(),ht?this.ineg():this},tt.prototype.divn=function(ct){return this.clone().idivn(ct)},tt.prototype.egcd=function(ct){j(ct.negative===0),j(!ct.isZero());var ht=this,vt=ct.clone();ht.negative!==0?ht=ht.umod(ct):ht=ht.clone();for(var St=new tt(1),Rt=new tt(0),$t=new tt(0),Et=new tt(1),At=0;ht.isEven()&&vt.isEven();)ht.iushrn(1),vt.iushrn(1),++At;for(var wt=vt.clone(),Ot=ht.clone();!ht.isZero();){for(var tr=0,nr=1;!(ht.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ht.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(wt),Rt.isub(Ot)),St.iushrn(1),Rt.iushrn(1);for(var ir=0,Wt=1;!(vt.words[0]&Wt)&&ir<26;++ir,Wt<<=1);if(ir>0)for(vt.iushrn(ir);ir-- >0;)($t.isOdd()||Et.isOdd())&&($t.iadd(wt),Et.isub(Ot)),$t.iushrn(1),Et.iushrn(1);ht.cmp(vt)>=0?(ht.isub(vt),St.isub($t),Rt.isub(Et)):(vt.isub(ht),$t.isub(St),Et.isub(Rt))}return{a:$t,b:Et,gcd:vt.iushln(At)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var ht=this,vt=ct.clone();ht.negative!==0?ht=ht.umod(ct):ht=ht.clone();for(var St=new tt(1),Rt=new tt(0),$t=vt.clone();ht.cmpn(1)>0&&vt.cmpn(1)>0;){for(var Et=0,At=1;!(ht.words[0]&At)&&Et<26;++Et,At<<=1);if(Et>0)for(ht.iushrn(Et);Et-- >0;)St.isOdd()&&St.iadd($t),St.iushrn(1);for(var wt=0,Ot=1;!(vt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(vt.iushrn(wt);wt-- >0;)Rt.isOdd()&&Rt.iadd($t),Rt.iushrn(1);ht.cmp(vt)>=0?(ht.isub(vt),St.isub(Rt)):(vt.isub(ht),Rt.isub(St))}var tr;return ht.cmpn(1)===0?tr=St:tr=Rt,tr.cmpn(0)<0&&tr.iadd(ct),tr},tt.prototype.gcd=function(ct){if(this.isZero())return ct.abs();if(ct.isZero())return this.abs();var ht=this.clone(),vt=ct.clone();ht.negative=0,vt.negative=0;for(var St=0;ht.isEven()&&vt.isEven();St++)ht.iushrn(1),vt.iushrn(1);do{for(;ht.isEven();)ht.iushrn(1);for(;vt.isEven();)vt.iushrn(1);var Rt=ht.cmp(vt);if(Rt<0){var $t=ht;ht=vt,vt=$t}else if(Rt===0||vt.cmpn(1)===0)break;ht.isub(vt)}while(!0);return vt.iushln(St)},tt.prototype.invm=function(ct){return this.egcd(ct).a.umod(ct)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(ct){return this.words[0]&ct},tt.prototype.bincn=function(ct){j(typeof ct=="number");var ht=ct%26,vt=(ct-ht)/26,St=1<>>26,Et&=67108863,this.words[$t]=Et}return Rt!==0&&(this.words[$t]=Rt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(ct){var ht=ct<0;if(this.negative!==0&&!ht)return-1;if(this.negative===0&&ht)return 1;this._strip();var vt;if(this.length>1)vt=1;else{ht&&(ct=-ct),j(ct<=67108863,"Number is too big");var St=this.words[0]|0;vt=St===ct?0:Stct.length)return 1;if(this.length=0;vt--){var St=this.words[vt]|0,Rt=ct.words[vt]|0;if(St!==Rt){StRt&&(ht=1);break}}return ht},tt.prototype.gtn=function(ct){return this.cmpn(ct)===1},tt.prototype.gt=function(ct){return this.cmp(ct)===1},tt.prototype.gten=function(ct){return this.cmpn(ct)>=0},tt.prototype.gte=function(ct){return this.cmp(ct)>=0},tt.prototype.ltn=function(ct){return this.cmpn(ct)===-1},tt.prototype.lt=function(ct){return this.cmp(ct)===-1},tt.prototype.lten=function(ct){return this.cmpn(ct)<=0},tt.prototype.lte=function(ct){return this.cmp(ct)<=0},tt.prototype.eqn=function(ct){return this.cmpn(ct)===0},tt.prototype.eq=function(ct){return this.cmp(ct)===0},tt.red=function(ct){return new Bt(ct)},tt.prototype.toRed=function(ct){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),ct.convertTo(this)._forceRed(ct)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(ct){return this.red=ct,this},tt.prototype.forceRed=function(ct){return j(!this.red,"Already a number in reduction context"),this._forceRed(ct)},tt.prototype.redAdd=function(ct){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,ct)},tt.prototype.redIAdd=function(ct){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,ct)},tt.prototype.redSub=function(ct){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,ct)},tt.prototype.redISub=function(ct){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,ct)},tt.prototype.redShl=function(ct){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,ct)},tt.prototype.redMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.mul(this,ct)},tt.prototype.redIMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.imul(this,ct)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(ct){return j(this.red&&!ct.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,ct)};var Nt={k256:null,p224:null,p192:null,p25519:null};function zt(bt,ct){this.name=bt,this.p=new tt(ct,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}zt.prototype._tmp=function(){var ct=new tt(null);return ct.words=new Array(Math.ceil(this.n/13)),ct},zt.prototype.ireduce=function(ct){var ht=ct,vt;do this.split(ht,this.tmp),ht=this.imulK(ht),ht=ht.iadd(this.tmp),vt=ht.bitLength();while(vt>this.n);var St=vt0?ht.isub(this.p):ht.strip!==void 0?ht.strip():ht._strip(),ht},zt.prototype.split=function(ct,ht){ct.iushrn(this.n,0,ht)},zt.prototype.imulK=function(ct){return ct.imul(this.k)};function jt(){zt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(jt,zt),jt.prototype.split=function(ct,ht){for(var vt=4194303,St=Math.min(ct.length,9),Rt=0;Rt>>22,$t=Et}$t>>>=22,ct.words[Rt-10]=$t,$t===0&&ct.length>10?ct.length-=10:ct.length-=9},jt.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var ht=0,vt=0;vt>>=26,ct.words[vt]=Rt,ht=St}return ht!==0&&(ct.words[ct.length++]=ht),ct},tt._prime=function(ct){if(Nt[ct])return Nt[ct];var ht;if(ct==="k256")ht=new jt;else if(ct==="p224")ht=new Mt;else if(ct==="p192")ht=new Dt;else if(ct==="p25519")ht=new Ft;else throw new Error("Unknown prime "+ct);return Nt[ct]=ht,ht};function Bt(bt){if(typeof bt=="string"){var ct=tt._prime(bt);this.m=ct.p,this.prime=ct}else j(bt.gtn(1),"modulus must be greater than 1"),this.m=bt,this.prime=null}Bt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},Bt.prototype._verify2=function(ct,ht){j((ct.negative|ht.negative)===0,"red works only with positives"),j(ct.red&&ct.red===ht.red,"red works only with red numbers")},Bt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(st(ct,ct.umod(this.m)._forceRed(this)),ct)},Bt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},Bt.prototype.add=function(ct,ht){this._verify2(ct,ht);var vt=ct.add(ht);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt._forceRed(this)},Bt.prototype.iadd=function(ct,ht){this._verify2(ct,ht);var vt=ct.iadd(ht);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt},Bt.prototype.sub=function(ct,ht){this._verify2(ct,ht);var vt=ct.sub(ht);return vt.cmpn(0)<0&&vt.iadd(this.m),vt._forceRed(this)},Bt.prototype.isub=function(ct,ht){this._verify2(ct,ht);var vt=ct.isub(ht);return vt.cmpn(0)<0&&vt.iadd(this.m),vt},Bt.prototype.shl=function(ct,ht){return this._verify1(ct),this.imod(ct.ushln(ht))},Bt.prototype.imul=function(ct,ht){return this._verify2(ct,ht),this.imod(ct.imul(ht))},Bt.prototype.mul=function(ct,ht){return this._verify2(ct,ht),this.imod(ct.mul(ht))},Bt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},Bt.prototype.sqr=function(ct){return this.mul(ct,ct)},Bt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var ht=this.m.andln(3);if(j(ht%2===1),ht===3){var vt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,vt)}for(var St=this.m.subn(1),Rt=0;!St.isZero()&&St.andln(1)===0;)Rt++,St.iushrn(1);j(!St.isZero());var $t=new tt(1).toRed(this),Et=$t.redNeg(),At=this.m.subn(1).iushrn(1),wt=this.m.bitLength();for(wt=new tt(2*wt*wt).toRed(this);this.pow(wt,At).cmp(Et)!==0;)wt.redIAdd(Et);for(var Ot=this.pow(wt,St),tr=this.pow(ct,St.addn(1).iushrn(1)),nr=this.pow(ct,St),ir=Rt;nr.cmp($t)!==0;){for(var Wt=nr,Kt=0;Wt.cmp($t)!==0;Kt++)Wt=Wt.redSqr();j(Kt=0;Rt--){for(var Ot=ht.words[Rt],tr=wt-1;tr>=0;tr--){var nr=Ot>>tr&1;if($t!==St[0]&&($t=this.sqr($t)),nr===0&&Et===0){At=0;continue}Et<<=1,Et|=nr,At++,!(At!==vt&&(Rt!==0||tr!==0))&&($t=this.mul($t,St[Et]),At=0,Et=0)}wt=26}return $t},Bt.prototype.convertTo=function(ct){var ht=ct.umod(this.m);return ht===ct?ht.clone():ht},Bt.prototype.convertFrom=function(ct){var ht=ct.clone();return ht.red=null,ht},tt.mont=function(ct){return new yt(ct)};function yt(bt){Bt.call(this,bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(yt,Bt),yt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},yt.prototype.convertFrom=function(ct){var ht=this.imod(ct.mul(this.rinv));return ht.red=null,ht},yt.prototype.imul=function(ct,ht){if(ct.isZero()||ht.isZero())return ct.words[0]=0,ct.length=1,ct;var vt=ct.imul(ht),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.mul=function(ct,ht){if(ct.isZero()||ht.isZero())return new tt(0)._forceRed(this);var vt=ct.mul(ht),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.invm=function(ct){var ht=this.imod(ct._invmp(this.m).mul(this.r2));return ht._forceRed(this)}})(_,commonjsGlobal)}(bn$1)),bn$1.exports}var asn1$1={},asn1={},api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(_,a){if(_.indexOf)return _.indexOf(a);for(var $=0;$<_.length;$++)if(_[$]===a)return $;return-1},Object_keys=function(_){if(Object.keys)return Object.keys(_);var a=[];for(var $ in _)a.push($);return a},forEach=function(_,a){if(_.forEach)return _.forEach(a);for(var $=0;$<_.length;$++)a(_[$],$,_)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(_,a,$){Object.defineProperty(_,a,{writable:!0,enumerable:!1,configurable:!0,value:$})}}catch{return function(a,$,j){a[$]=j}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(a){if(!(this instanceof Script))return new Script(a);this.code=a};Script.prototype.runInContext=function(_){if(!(_ instanceof Context))throw new TypeError("needs a 'context' argument.");var a=document.createElement("iframe");a.style||(a.style={}),a.style.display="none",document.body.appendChild(a);var $=a.contentWindow,j=$.eval,et=$.execScript;!j&&et&&(et.call($,"null"),j=$.eval),forEach(Object_keys(_),function(nt){$[nt]=_[nt]}),forEach(globals,function(nt){_[nt]&&($[nt]=_[nt])});var tt=Object_keys($),rt=j.call($,this.code);return forEach(Object_keys($),function(nt){(nt in _||indexOf(tt,nt)===-1)&&(_[nt]=$[nt])}),forEach(globals,function(nt){nt in _||defineProp(_,nt,$[nt])}),document.body.removeChild(a),rt},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(_){var a=Script.createContext(_),$=this.runInContext(a);return _&&forEach(Object_keys(a),function(j){_[j]=a[j]}),$},forEach(Object_keys(Script.prototype),function(_){exports[_]=Script[_]=function(a){var $=Script(a);return $[_].apply($,[].slice.call(arguments,1))}}),exports.isContext=function(_){return _ instanceof Context},exports.createScript=function(_){return exports.Script(_)},exports.createContext=Script.createContext=function(_){var a=new Context;return typeof _=="object"&&forEach(Object_keys(_),function($){a[$]=_[$]}),a}}(vmBrowserify)),vmBrowserify}var hasRequiredApi;function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(_){var a=requireAsn1$1(),$=inherits_browserExports,j=_;j.define=function(rt,nt){return new et(rt,nt)};function et(tt,rt){this.name=tt,this.body=rt,this.decoders={},this.encoders={}}et.prototype._createNamed=function(rt){var nt;try{nt=requireVmBrowserify().runInThisContext("(function "+this.name+`(entity) { this._initNamed(entity); -})`)}catch{nt=function(ot){this._initNamed(ot)}}return $(nt,rt),nt.prototype._initNamed=function(ot){rt.call(this,ot)},new nt(this)},et.prototype._getDecoder=function(rt){return rt=rt||"der",this.decoders.hasOwnProperty(rt)||(this.decoders[rt]=this._createNamed(a.decoders[rt])),this.decoders[rt]},et.prototype.decode=function(rt,nt,it){return this._getDecoder(nt).decode(rt,it)},et.prototype._getEncoder=function(rt){return rt=rt||"der",this.encoders.hasOwnProperty(rt)||(this.encoders[rt]=this._createNamed(a.encoders[rt])),this.encoders[rt]},et.prototype.encode=function(rt,nt,it){return this._getEncoder(nt).encode(rt,it)}}(api)),api}var base$5={},reporter={},hasRequiredReporter;function requireReporter(){if(hasRequiredReporter)return reporter;hasRequiredReporter=1;var _=inherits_browserExports;function a(j){this._reporterState={obj:null,path:[],options:j||{},errors:[]}}reporter.Reporter=a,a.prototype.isError=function(et){return et instanceof $},a.prototype.save=function(){var et=this._reporterState;return{obj:et.obj,pathLen:et.path.length}},a.prototype.restore=function(et){var tt=this._reporterState;tt.obj=et.obj,tt.path=tt.path.slice(0,et.pathLen)},a.prototype.enterKey=function(et){return this._reporterState.path.push(et)},a.prototype.exitKey=function(et){var tt=this._reporterState;tt.path=tt.path.slice(0,et-1)},a.prototype.leaveKey=function(et,tt,rt){var nt=this._reporterState;this.exitKey(et),nt.obj!==null&&(nt.obj[tt]=rt)},a.prototype.path=function(){return this._reporterState.path.join("/")},a.prototype.enterObject=function(){var et=this._reporterState,tt=et.obj;return et.obj={},tt},a.prototype.leaveObject=function(et){var tt=this._reporterState,rt=tt.obj;return tt.obj=et,rt},a.prototype.error=function(et){var tt,rt=this._reporterState,nt=et instanceof $;if(nt?tt=et:tt=new $(rt.path.map(function(it){return"["+JSON.stringify(it)+"]"}).join(""),et.message||et,et.stack),!rt.options.partial)throw tt;return nt||rt.errors.push(tt),tt},a.prototype.wrapResult=function(et){var tt=this._reporterState;return tt.options.partial?{result:this.isError(et)?null:et,errors:tt.errors}:et};function $(j,et){this.path=j,this.rethrow(et)}return _($,Error),$.prototype.rethrow=function(et){if(this.message=et+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,$),!this.stack)try{throw new Error(this.message)}catch(tt){this.stack=tt.stack}return this},reporter}var buffer={},hasRequiredBuffer;function requireBuffer(){if(hasRequiredBuffer)return buffer;hasRequiredBuffer=1;var _=inherits_browserExports,a=requireBase$1().Reporter,$=buffer$1.Buffer;function j(tt,rt){if(a.call(this,rt),!$.isBuffer(tt)){this.error("Input not Buffer");return}this.base=tt,this.offset=0,this.length=tt.length}_(j,a),buffer.DecoderBuffer=j,j.prototype.save=function(){return{offset:this.offset,reporter:a.prototype.save.call(this)}},j.prototype.restore=function(rt){var nt=new j(this.base);return nt.offset=rt.offset,nt.length=this.offset,this.offset=rt.offset,a.prototype.restore.call(this,rt.reporter),nt},j.prototype.isEmpty=function(){return this.offset===this.length},j.prototype.readUInt8=function(rt){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(rt||"DecoderBuffer overrun")},j.prototype.skip=function(rt,nt){if(!(this.offset+rt<=this.length))return this.error(nt||"DecoderBuffer overrun");var it=new j(this.base);return it._reporterState=this._reporterState,it.offset=this.offset,it.length=this.offset+rt,this.offset+=rt,it},j.prototype.raw=function(rt){return this.base.slice(rt?rt.offset:this.offset,this.length)};function et(tt,rt){if(Array.isArray(tt))this.length=0,this.value=tt.map(function(nt){return nt instanceof et||(nt=new et(nt,rt)),this.length+=nt.length,nt},this);else if(typeof tt=="number"){if(!(0<=tt&&tt<=255))return rt.error("non-byte EncoderBuffer value");this.value=tt,this.length=1}else if(typeof tt=="string")this.value=tt,this.length=$.byteLength(tt);else if($.isBuffer(tt))this.value=tt,this.length=tt.length;else return rt.error("Unsupported type: "+typeof tt)}return buffer.EncoderBuffer=et,et.prototype.join=function(rt,nt){return rt||(rt=new $(this.length)),nt||(nt=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(it){it.join(rt,nt),nt+=it.length}):(typeof this.value=="number"?rt[nt]=this.value:typeof this.value=="string"?rt.write(this.value,nt):$.isBuffer(this.value)&&this.value.copy(rt,nt),nt+=this.length)),rt},buffer}var node$1,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node$1;hasRequiredNode=1;var _=requireBase$1().Reporter,a=requireBase$1().EncoderBuffer,$=requireBase$1().DecoderBuffer,j=minimalisticAssert,et=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],tt=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(et),rt=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function nt(ot,st){var at={};this._baseState=at,at.enc=ot,at.parent=st||null,at.children=null,at.tag=null,at.args=null,at.reverseArgs=null,at.choice=null,at.optional=!1,at.any=!1,at.obj=!1,at.use=null,at.useDecoder=null,at.key=null,at.default=null,at.explicit=null,at.implicit=null,at.contains=null,at.parent||(at.children=[],this._wrap())}node$1=nt;var it=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return nt.prototype.clone=function(){var st=this._baseState,at={};it.forEach(function(ht){at[ht]=st[ht]});var ut=new this.constructor(at.parent);return ut._baseState=at,ut},nt.prototype._wrap=function(){var st=this._baseState;tt.forEach(function(at){this[at]=function(){var ht=new this.constructor(this);return st.children.push(ht),ht[at].apply(ht,arguments)}},this)},nt.prototype._init=function(st){var at=this._baseState;j(at.parent===null),st.call(this),at.children=at.children.filter(function(ut){return ut._baseState.parent===this},this),j.equal(at.children.length,1,"Root node can have only one child")},nt.prototype._useArgs=function(st){var at=this._baseState,ut=st.filter(function(ht){return ht instanceof this.constructor},this);st=st.filter(function(ht){return!(ht instanceof this.constructor)},this),ut.length!==0&&(j(at.children===null),at.children=ut,ut.forEach(function(ht){ht._baseState.parent=this},this)),st.length!==0&&(j(at.args===null),at.args=st,at.reverseArgs=st.map(function(ht){if(typeof ht!="object"||ht.constructor!==Object)return ht;var bt={};return Object.keys(ht).forEach(function(Et){Et==(Et|0)&&(Et|=0);var Ct=ht[Et];bt[Ct]=Et}),bt}))},rt.forEach(function(ot){nt.prototype[ot]=function(){var at=this._baseState;throw new Error(ot+" not implemented for encoding: "+at.enc)}}),et.forEach(function(ot){nt.prototype[ot]=function(){var at=this._baseState,ut=Array.prototype.slice.call(arguments);return j(at.tag===null),at.tag=ot,this._useArgs(ut),this}}),nt.prototype.use=function(st){j(st);var at=this._baseState;return j(at.use===null),at.use=st,this},nt.prototype.optional=function(){var st=this._baseState;return st.optional=!0,this},nt.prototype.def=function(st){var at=this._baseState;return j(at.default===null),at.default=st,at.optional=!0,this},nt.prototype.explicit=function(st){var at=this._baseState;return j(at.explicit===null&&at.implicit===null),at.explicit=st,this},nt.prototype.implicit=function(st){var at=this._baseState;return j(at.explicit===null&&at.implicit===null),at.implicit=st,this},nt.prototype.obj=function(){var st=this._baseState,at=Array.prototype.slice.call(arguments);return st.obj=!0,at.length!==0&&this._useArgs(at),this},nt.prototype.key=function(st){var at=this._baseState;return j(at.key===null),at.key=st,this},nt.prototype.any=function(){var st=this._baseState;return st.any=!0,this},nt.prototype.choice=function(st){var at=this._baseState;return j(at.choice===null),at.choice=st,this._useArgs(Object.keys(st).map(function(ut){return st[ut]})),this},nt.prototype.contains=function(st){var at=this._baseState;return j(at.use===null),at.contains=st,this},nt.prototype._decode=function(st,at){var ut=this._baseState;if(ut.parent===null)return st.wrapResult(ut.children[0]._decode(st,at));var ht=ut.default,bt=!0,Et=null;if(ut.key!==null&&(Et=st.enterKey(ut.key)),ut.optional){var Ct=null;if(ut.explicit!==null?Ct=ut.explicit:ut.implicit!==null?Ct=ut.implicit:ut.tag!==null&&(Ct=ut.tag),Ct===null&&!ut.any){var Pt=st.save();try{ut.choice===null?this._decodeGeneric(ut.tag,st,at):this._decodeChoice(st,at),bt=!0}catch{bt=!1}st.restore(Pt)}else if(bt=this._peekTag(st,Ct,ut.any),st.isError(bt))return bt}var Tt;if(ut.obj&&bt&&(Tt=st.enterObject()),bt){if(ut.explicit!==null){var It=this._decodeTag(st,ut.explicit);if(st.isError(It))return It;st=It}var Lt=st.offset;if(ut.use===null&&ut.choice===null){if(ut.any)var Pt=st.save();var Nt=this._decodeTag(st,ut.implicit!==null?ut.implicit:ut.tag,ut.any);if(st.isError(Nt))return Nt;ut.any?ht=st.raw(Pt):st=Nt}if(at&&at.track&&ut.tag!==null&&at.track(st.path(),Lt,st.length,"tagged"),at&&at.track&&ut.tag!==null&&at.track(st.path(),st.offset,st.length,"content"),ut.any?ht=ht:ut.choice===null?ht=this._decodeGeneric(ut.tag,st,at):ht=this._decodeChoice(st,at),st.isError(ht))return ht;if(!ut.any&&ut.choice===null&&ut.children!==null&&ut.children.forEach(function(Mt){Mt._decode(st,at)}),ut.contains&&(ut.tag==="octstr"||ut.tag==="bitstr")){var Ut=new $(ht);ht=this._getUse(ut.contains,st._reporterState.obj)._decode(Ut,at)}}return ut.obj&&bt&&(ht=st.leaveObject(Tt)),ut.key!==null&&(ht!==null||bt===!0)?st.leaveKey(Et,ut.key,ht):Et!==null&&st.exitKey(Et),ht},nt.prototype._decodeGeneric=function(st,at,ut){var ht=this._baseState;return st==="seq"||st==="set"?null:st==="seqof"||st==="setof"?this._decodeList(at,st,ht.args[0],ut):/str$/.test(st)?this._decodeStr(at,st,ut):st==="objid"&&ht.args?this._decodeObjid(at,ht.args[0],ht.args[1],ut):st==="objid"?this._decodeObjid(at,null,null,ut):st==="gentime"||st==="utctime"?this._decodeTime(at,st,ut):st==="null_"?this._decodeNull(at,ut):st==="bool"?this._decodeBool(at,ut):st==="objDesc"?this._decodeStr(at,st,ut):st==="int"||st==="enum"?this._decodeInt(at,ht.args&&ht.args[0],ut):ht.use!==null?this._getUse(ht.use,at._reporterState.obj)._decode(at,ut):at.error("unknown tag: "+st)},nt.prototype._getUse=function(st,at){var ut=this._baseState;return ut.useDecoder=this._use(st,at),j(ut.useDecoder._baseState.parent===null),ut.useDecoder=ut.useDecoder._baseState.children[0],ut.implicit!==ut.useDecoder._baseState.implicit&&(ut.useDecoder=ut.useDecoder.clone(),ut.useDecoder._baseState.implicit=ut.implicit),ut.useDecoder},nt.prototype._decodeChoice=function(st,at){var ut=this._baseState,ht=null,bt=!1;return Object.keys(ut.choice).some(function(Et){var Ct=st.save(),Pt=ut.choice[Et];try{var Tt=Pt._decode(st,at);if(st.isError(Tt))return!1;ht={type:Et,value:Tt},bt=!0}catch{return st.restore(Ct),!1}return!0},this),bt?ht:st.error("Choice not matched")},nt.prototype._createEncoderBuffer=function(st){return new a(st,this.reporter)},nt.prototype._encode=function(st,at,ut){var ht=this._baseState;if(!(ht.default!==null&&ht.default===st)){var bt=this._encodeValue(st,at,ut);if(bt!==void 0&&!this._skipDefault(bt,at,ut))return bt}},nt.prototype._encodeValue=function(st,at,ut){var ht=this._baseState;if(ht.parent===null)return ht.children[0]._encode(st,at||new _);var Pt=null;if(this.reporter=at,ht.optional&&st===void 0)if(ht.default!==null)st=ht.default;else return;var bt=null,Et=!1;if(ht.any)Pt=this._createEncoderBuffer(st);else if(ht.choice)Pt=this._encodeChoice(st,at);else if(ht.contains)bt=this._getUse(ht.contains,ut)._encode(st,at),Et=!0;else if(ht.children)bt=ht.children.map(function(Lt){if(Lt._baseState.tag==="null_")return Lt._encode(null,at,st);if(Lt._baseState.key===null)return at.error("Child should have a key");var Nt=at.enterKey(Lt._baseState.key);if(typeof st!="object")return at.error("Child expected, but input is not object");var Ut=Lt._encode(st[Lt._baseState.key],at,st);return at.leaveKey(Nt),Ut},this).filter(function(Lt){return Lt}),bt=this._createEncoderBuffer(bt);else if(ht.tag==="seqof"||ht.tag==="setof"){if(!(ht.args&&ht.args.length===1))return at.error("Too many args for : "+ht.tag);if(!Array.isArray(st))return at.error("seqof/setof, but data is not Array");var Ct=this.clone();Ct._baseState.implicit=null,bt=this._createEncoderBuffer(st.map(function(Lt){var Nt=this._baseState;return this._getUse(Nt.args[0],st)._encode(Lt,at)},Ct))}else ht.use!==null?Pt=this._getUse(ht.use,ut)._encode(st,at):(bt=this._encodePrimitive(ht.tag,st),Et=!0);var Pt;if(!ht.any&&ht.choice===null){var Tt=ht.implicit!==null?ht.implicit:ht.tag,It=ht.implicit===null?"universal":"context";Tt===null?ht.use===null&&at.error("Tag could be omitted only for .use()"):ht.use===null&&(Pt=this._encodeComposite(Tt,Et,It,bt))}return ht.explicit!==null&&(Pt=this._encodeComposite(ht.explicit,!1,"context",Pt)),Pt},nt.prototype._encodeChoice=function(st,at){var ut=this._baseState,ht=ut.choice[st.type];return ht||j(!1,st.type+" not found in "+JSON.stringify(Object.keys(ut.choice))),ht._encode(st.value,at)},nt.prototype._encodePrimitive=function(st,at){var ut=this._baseState;if(/str$/.test(st))return this._encodeStr(at,st);if(st==="objid"&&ut.args)return this._encodeObjid(at,ut.reverseArgs[0],ut.args[1]);if(st==="objid")return this._encodeObjid(at,null,null);if(st==="gentime"||st==="utctime")return this._encodeTime(at,st);if(st==="null_")return this._encodeNull();if(st==="int"||st==="enum")return this._encodeInt(at,ut.args&&ut.reverseArgs[0]);if(st==="bool")return this._encodeBool(at);if(st==="objDesc")return this._encodeStr(at,st);throw new Error("Unsupported tag: "+st)},nt.prototype._isNumstr=function(st){return/^[0-9 ]*$/.test(st)},nt.prototype._isPrintstr=function(st){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(st)},node$1}var hasRequiredBase$1;function requireBase$1(){return hasRequiredBase$1||(hasRequiredBase$1=1,function(_){var a=_;a.Reporter=requireReporter().Reporter,a.DecoderBuffer=requireBuffer().DecoderBuffer,a.EncoderBuffer=requireBuffer().EncoderBuffer,a.Node=requireNode()}(base$5)),base$5}var constants$2={},der={},hasRequiredDer$2;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(_){var a=requireConstants();_.tagClass={0:"universal",1:"application",2:"context",3:"private"},_.tagClassByName=a._reverse(_.tagClass),_.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},_.tagByName=a._reverse(_.tag)}(der)),der}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(_){var a=_;a._reverse=function(j){var et={};return Object.keys(j).forEach(function(tt){(tt|0)==tt&&(tt=tt|0);var rt=j[tt];et[rt]=tt}),et},a.der=requireDer$2()}(constants$2)),constants$2}var decoders$1={},der_1$1,hasRequiredDer$1;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var _=inherits_browserExports,a=requireAsn1$1(),$=a.base,j=a.bignum,et=a.constants.der;function tt(ot){this.enc="der",this.name=ot.name,this.entity=ot,this.tree=new rt,this.tree._init(ot.body)}der_1$1=tt,tt.prototype.decode=function(st,at){return st instanceof $.DecoderBuffer||(st=new $.DecoderBuffer(st,at)),this.tree._decode(st,at)};function rt(ot){$.Node.call(this,"der",ot)}_(rt,$.Node),rt.prototype._peekTag=function(st,at,ut){if(st.isEmpty())return!1;var ht=st.save(),bt=nt(st,'Failed to peek tag: "'+at+'"');return st.isError(bt)?bt:(st.restore(ht),bt.tag===at||bt.tagStr===at||bt.tagStr+"of"===at||ut)},rt.prototype._decodeTag=function(st,at,ut){var ht=nt(st,'Failed to decode tag of "'+at+'"');if(st.isError(ht))return ht;var bt=it(st,ht.primitive,'Failed to get length of "'+at+'"');if(st.isError(bt))return bt;if(!ut&&ht.tag!==at&&ht.tagStr!==at&&ht.tagStr+"of"!==at)return st.error('Failed to match tag: "'+at+'"');if(ht.primitive||bt!==null)return st.skip(bt,'Failed to match body of: "'+at+'"');var Et=st.save(),Ct=this._skipUntilEnd(st,'Failed to skip indefinite length body: "'+this.tag+'"');return st.isError(Ct)?Ct:(bt=st.offset-Et.offset,st.restore(Et),st.skip(bt,'Failed to match body of: "'+at+'"'))},rt.prototype._skipUntilEnd=function(st,at){for(;;){var ut=nt(st,at);if(st.isError(ut))return ut;var ht=it(st,ut.primitive,at);if(st.isError(ht))return ht;var bt;if(ut.primitive||ht!==null?bt=st.skip(ht):bt=this._skipUntilEnd(st,at),st.isError(bt))return bt;if(ut.tagStr==="end")break}},rt.prototype._decodeList=function(st,at,ut,ht){for(var bt=[];!st.isEmpty();){var Et=this._peekTag(st,"end");if(st.isError(Et))return Et;var Ct=ut.decode(st,"der",ht);if(st.isError(Ct)&&Et)break;bt.push(Ct)}return bt},rt.prototype._decodeStr=function(st,at){if(at==="bitstr"){var ut=st.readUInt8();return st.isError(ut)?ut:{unused:ut,data:st.raw()}}else if(at==="bmpstr"){var ht=st.raw();if(ht.length%2===1)return st.error("Decoding of string type: bmpstr length mismatch");for(var bt="",Et=0;Et>6],ht=(at&32)===0;if((at&31)===31){var bt=at;for(at=0;(bt&128)===128;){if(bt=ot.readUInt8(st),ot.isError(bt))return bt;at<<=7,at|=bt&127}}else at&=31;var Et=et.tag[at];return{cls:ut,primitive:ht,tag:at,tagStr:Et}}function it(ot,st,at){var ut=ot.readUInt8(at);if(ot.isError(ut))return ut;if(!st&&ut===128)return null;if(!(ut&128))return ut;var ht=ut&127;if(ht>4)return ot.error("length octect is too long");ut=0;for(var bt=0;bt=256;Ct>>=8)Et++;var Pt=new a(2+Et);Pt[0]=bt,Pt[1]=128|Et;for(var Ct=1+Et,Tt=ht.length;Tt>0;Ct--,Tt>>=8)Pt[Ct]=Tt&255;return this._createEncoderBuffer([Pt,ht])},rt.prototype._encodeStr=function(st,at){if(at==="bitstr")return this._createEncoderBuffer([st.unused|0,st.data]);if(at==="bmpstr"){for(var ut=new a(st.length*2),ht=0;ht=40)return this.reporter.error("Second objid identifier OOB");st.splice(0,2,st[0]*40+st[1])}for(var bt=0,ht=0;ht=128;Et>>=7)bt++}for(var Ct=new a(bt),Pt=Ct.length-1,ht=st.length-1;ht>=0;ht--){var Et=st[ht];for(Ct[Pt--]=Et&127;(Et>>=7)>0;)Ct[Pt--]=128|Et&127}return this._createEncoderBuffer(Ct)};function nt(ot){return ot<10?"0"+ot:ot}rt.prototype._encodeTime=function(st,at){var ut,ht=new Date(st);return at==="gentime"?ut=[nt(ht.getFullYear()),nt(ht.getUTCMonth()+1),nt(ht.getUTCDate()),nt(ht.getUTCHours()),nt(ht.getUTCMinutes()),nt(ht.getUTCSeconds()),"Z"].join(""):at==="utctime"?ut=[nt(ht.getFullYear()%100),nt(ht.getUTCMonth()+1),nt(ht.getUTCDate()),nt(ht.getUTCHours()),nt(ht.getUTCMinutes()),nt(ht.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+at+" time is not supported yet"),this._encodeStr(ut,"octstr")},rt.prototype._encodeNull=function(){return this._createEncoderBuffer("")},rt.prototype._encodeInt=function(st,at){if(typeof st=="string"){if(!at)return this.reporter.error("String int or enum given, but no values map");if(!at.hasOwnProperty(st))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(st));st=at[st]}if(typeof st!="number"&&!a.isBuffer(st)){var ut=st.toArray();!st.sign&&ut[0]&128&&ut.unshift(0),st=new a(ut)}if(a.isBuffer(st)){var ht=st.length;st.length===0&&ht++;var Et=new a(ht);return st.copy(Et),st.length===0&&(Et[0]=0),this._createEncoderBuffer(Et)}if(st<128)return this._createEncoderBuffer(st);if(st<256)return this._createEncoderBuffer([0,st]);for(var ht=1,bt=st;bt>=256;bt>>=8)ht++;for(var Et=new Array(ht),bt=Et.length-1;bt>=0;bt--)Et[bt]=st&255,st>>=8;return Et[0]&128&&Et.unshift(0),this._createEncoderBuffer(new a(Et))},rt.prototype._encodeBool=function(st){return this._createEncoderBuffer(st?255:0)},rt.prototype._use=function(st,at){return typeof st=="function"&&(st=st(at)),st._getEncoder("der").tree},rt.prototype._skipDefault=function(st,at,ut){var ht=this._baseState,bt;if(ht.default===null)return!1;var Et=st.join();if(ht.defaultBuffer===void 0&&(ht.defaultBuffer=this._encodeValue(ht.default,at,ut).join()),Et.length!==ht.defaultBuffer.length)return!1;for(bt=0;bt=31?ut.error("Multi-octet tag encoding unsupported"):(st||(ht|=32),ht|=et.tagClassByName[at||"universal"]<<6,ht)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var _=inherits_browserExports,a=requireDer();function $(j){a.call(this,j),this.enc="pem"}return _($,a),pem=$,$.prototype.encode=function(et,tt){for(var rt=a.prototype.encode.call(this,et),nt=rt.toString("base64"),it=["-----BEGIN "+tt.label+"-----"],ot=0;ot0&&It.ishrn(Lt),It}function bt(Pt,Tt){Pt=ht(Pt,Tt),Pt=Pt.mod(Tt);var It=_.from(Pt.toArray());if(It.length=0)throw new Error("invalid sig")}return verify_1=tt,verify_1}var browser$3,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$3;hasRequiredBrowser$3=1;var _=safeBufferExports.Buffer,a=browser$b,$=requireReadableBrowser(),j=inherits_browserExports,et=requireSign(),tt=requireVerify(),rt=require$$6$1;Object.keys(rt).forEach(function(at){rt[at].id=_.from(rt[at].id,"hex"),rt[at.toLowerCase()]=rt[at]});function nt(at){$.Writable.call(this);var ut=rt[at];if(!ut)throw new Error("Unknown message digest");this._hashType=ut.hash,this._hash=a(ut.hash),this._tag=ut.id,this._signType=ut.sign}j(nt,$.Writable),nt.prototype._write=function(ut,ht,bt){this._hash.update(ut),bt()},nt.prototype.update=function(ut,ht){return this._hash.update(typeof ut=="string"?_.from(ut,ht):ut),this},nt.prototype.sign=function(ut,ht){this.end();var bt=this._hash.digest(),Et=et(bt,ut,this._hashType,this._signType,this._tag);return ht?Et.toString(ht):Et};function it(at){$.Writable.call(this);var ut=rt[at];if(!ut)throw new Error("Unknown message digest");this._hash=a(ut.hash),this._tag=ut.id,this._signType=ut.sign}j(it,$.Writable),it.prototype._write=function(ut,ht,bt){this._hash.update(ut),bt()},it.prototype.update=function(ut,ht){return this._hash.update(typeof ut=="string"?_.from(ut,ht):ut),this},it.prototype.verify=function(ut,ht,bt){var Et=typeof ht=="string"?_.from(ht,bt):ht;this.end();var Ct=this._hash.digest();return tt(Et,Ct,ut,this._signType,this._tag)};function ot(at){return new nt(at)}function st(at){return new it(at)}return browser$3={Sign:ot,Verify:st,createSign:ot,createVerify:st},browser$3}var elliptic$3={};const name$3="elliptic",version$3="6.5.5",description$3="EC cryptography",main$3="lib/elliptic.js",files$2=["lib"],scripts$3={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository$3={type:"git",url:"git@github.com:indutny/elliptic"},keywords$2=["EC","Elliptic","curve","Cryptography"],author$3="Fedor Indutny ",license$3="MIT",bugs$2={url:"https://github.com/indutny/elliptic/issues"},homepage$3="https://github.com/indutny/elliptic",devDependencies$3={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$3={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$3={name:name$3,version:version$3,description:description$3,main:main$3,files:files$2,scripts:scripts$3,repository:repository$3,keywords:keywords$2,author:author$3,license:license$3,bugs:bugs$2,homepage:homepage$3,devDependencies:devDependencies$3,dependencies:dependencies$3};var utils$u={},hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$G;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,at,ut){var ht=new Array(Math.max(st.bitLength(),ut)+1),bt;for(bt=0;bt(Et>>1)-1?Pt=(Et>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,ht[bt]=Pt,Ct.iushrn(1)}return ht}a.getNAF=tt;function rt(st,at){var ut=[[],[]];st=st.clone(),at=at.clone();for(var ht=0,bt=0,Et;st.cmpn(-ht)>0||at.cmpn(-bt)>0;){var Ct=st.andln(3)+ht&3,Pt=at.andln(3)+bt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(Et=st.andln(7)+ht&7,(Et===3||Et===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var It;Pt&1?(Et=at.andln(7)+bt&7,(Et===3||Et===5)&&Ct===2?It=-Pt:It=Pt):It=0,ut[1].push(It),2*ht===Tt+1&&(ht=1-ht),2*bt===It+1&&(bt=1-bt),st.iushrn(1),at.iushrn(1)}return ut}a.getJSF=rt;function nt(st,at,ut){var ht="_"+at;st.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function ot(st){return new $(st,"hex","le")}a.intFromLE=ot}(utils$u)),utils$u}var curve$2={},base$4,hasRequiredBase;function requireBase(){if(hasRequiredBase)return base$4;hasRequiredBase=1;var _=bnExports$1,a=requireUtils(),$=a.getNAF,j=a.getJSF,et=a.assert;function tt(nt,it){this.type=nt,this.p=new _(it.p,16),this.red=it.prime?_.red(it.prime):_.mont(this.p),this.zero=new _(0).toRed(this.red),this.one=new _(1).toRed(this.red),this.two=new _(2).toRed(this.red),this.n=it.n&&new _(it.n,16),this.g=it.g&&this.pointFromJSON(it.g,it.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var ot=this.n&&this.p.div(this.n);!ot||ot.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$4=tt,tt.prototype.point=function(){throw new Error("Not implemented")},tt.prototype.validate=function(){throw new Error("Not implemented")},tt.prototype._fixedNafMul=function(it,ot){et(it.precomputed);var st=it._getDoubles(),at=$(ot,1,this._bitLength),ut=(1<=bt;Ct--)Et=(Et<<1)+at[Ct];ht.push(Et)}for(var Pt=this.jpoint(null,null,null),Tt=this.jpoint(null,null,null),It=ut;It>0;It--){for(bt=0;bt=0;Et--){for(var Ct=0;Et>=0&&ht[Et]===0;Et--)Ct++;if(Et>=0&&Ct++,bt=bt.dblp(Ct),Et<0)break;var Pt=ht[Et];et(Pt!==0),it.type==="affine"?Pt>0?bt=bt.mixedAdd(ut[Pt-1>>1]):bt=bt.mixedAdd(ut[-Pt-1>>1].neg()):Pt>0?bt=bt.add(ut[Pt-1>>1]):bt=bt.add(ut[-Pt-1>>1].neg())}return it.type==="affine"?bt.toP():bt},tt.prototype._wnafMulAdd=function(it,ot,st,at,ut){var ht=this._wnafT1,bt=this._wnafT2,Et=this._wnafT3,Ct=0,Pt,Tt,It;for(Pt=0;Pt=1;Pt-=2){var Nt=Pt-1,Ut=Pt;if(ht[Nt]!==1||ht[Ut]!==1){Et[Nt]=$(st[Nt],ht[Nt],this._bitLength),Et[Ut]=$(st[Ut],ht[Ut],this._bitLength),Ct=Math.max(Et[Nt].length,Ct),Ct=Math.max(Et[Ut].length,Ct);continue}var jt=[ot[Nt],null,null,ot[Ut]];ot[Nt].y.cmp(ot[Ut].y)===0?(jt[1]=ot[Nt].add(ot[Ut]),jt[2]=ot[Nt].toJ().mixedAdd(ot[Ut].neg())):ot[Nt].y.cmp(ot[Ut].y.redNeg())===0?(jt[1]=ot[Nt].toJ().mixedAdd(ot[Ut]),jt[2]=ot[Nt].add(ot[Ut].neg())):(jt[1]=ot[Nt].toJ().mixedAdd(ot[Ut]),jt[2]=ot[Nt].toJ().mixedAdd(ot[Ut].neg()));var Mt=[-3,-1,-5,-7,0,7,5,1,3],Dt=j(st[Nt],st[Ut]);for(Ct=Math.max(Dt[0].length,Ct),Et[Nt]=new Array(Ct),Et[Ut]=new Array(Ct),Tt=0;Tt=0;Pt--){for(var ct=0;Pt>=0;){var dt=!0;for(Tt=0;Tt=0&&ct++,yt=yt.dblp(ct),Pt<0)break;for(Tt=0;Tt0?It=bt[Tt][vt-1>>1]:vt<0&&(It=bt[Tt][-vt-1>>1].neg()),It.type==="affine"?yt=yt.mixedAdd(It):yt=yt.add(It))}}for(Pt=0;Pt=Math.ceil((it.bitLength()+1)/ot.step):!1},rt.prototype._getDoubles=function(it,ot){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var st=[this],at=this,ut=0;ut=0&&(Nt=Pt,Ut=Tt),It.negative&&(It=It.neg(),Lt=Lt.neg()),Nt.negative&&(Nt=Nt.neg(),Ut=Ut.neg()),[{a:It,b:Lt},{a:Nt,b:Ut}]},tt.prototype._endoSplit=function(ot){var st=this.endo.basis,at=st[0],ut=st[1],ht=ut.b.mul(ot).divRound(this.n),bt=at.b.neg().mul(ot).divRound(this.n),Et=ht.mul(at.a),Ct=bt.mul(ut.a),Pt=ht.mul(at.b),Tt=bt.mul(ut.b),It=ot.sub(Et).sub(Ct),Lt=Pt.add(Tt).neg();return{k1:It,k2:Lt}},tt.prototype.pointFromX=function(ot,st){ot=new a(ot,16),ot.red||(ot=ot.toRed(this.red));var at=ot.redSqr().redMul(ot).redIAdd(ot.redMul(this.a)).redIAdd(this.b),ut=at.redSqrt();if(ut.redSqr().redSub(at).cmp(this.zero)!==0)throw new Error("invalid point");var ht=ut.fromRed().isOdd();return(st&&!ht||!st&&ht)&&(ut=ut.redNeg()),this.point(ot,ut)},tt.prototype.validate=function(ot){if(ot.inf)return!0;var st=ot.x,at=ot.y,ut=this.a.redMul(st),ht=st.redSqr().redMul(st).redIAdd(ut).redIAdd(this.b);return at.redSqr().redISub(ht).cmpn(0)===0},tt.prototype._endoWnafMulAdd=function(ot,st,at){for(var ut=this._endoWnafT1,ht=this._endoWnafT2,bt=0;bt":""},rt.prototype.isInfinity=function(){return this.inf},rt.prototype.add=function(ot){if(this.inf)return ot;if(ot.inf)return this;if(this.eq(ot))return this.dbl();if(this.neg().eq(ot))return this.curve.point(null,null);if(this.x.cmp(ot.x)===0)return this.curve.point(null,null);var st=this.y.redSub(ot.y);st.cmpn(0)!==0&&(st=st.redMul(this.x.redSub(ot.x).redInvm()));var at=st.redSqr().redISub(this.x).redISub(ot.x),ut=st.redMul(this.x.redSub(at)).redISub(this.y);return this.curve.point(at,ut)},rt.prototype.dbl=function(){if(this.inf)return this;var ot=this.y.redAdd(this.y);if(ot.cmpn(0)===0)return this.curve.point(null,null);var st=this.curve.a,at=this.x.redSqr(),ut=ot.redInvm(),ht=at.redAdd(at).redIAdd(at).redIAdd(st).redMul(ut),bt=ht.redSqr().redISub(this.x.redAdd(this.x)),Et=ht.redMul(this.x.redSub(bt)).redISub(this.y);return this.curve.point(bt,Et)},rt.prototype.getX=function(){return this.x.fromRed()},rt.prototype.getY=function(){return this.y.fromRed()},rt.prototype.mul=function(ot){return ot=new a(ot,16),this.isInfinity()?this:this._hasDoubles(ot)?this.curve._fixedNafMul(this,ot):this.curve.endo?this.curve._endoWnafMulAdd([this],[ot]):this.curve._wnafMul(this,ot)},rt.prototype.mulAdd=function(ot,st,at){var ut=[this,st],ht=[ot,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht):this.curve._wnafMulAdd(1,ut,ht,2)},rt.prototype.jmulAdd=function(ot,st,at){var ut=[this,st],ht=[ot,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht,!0):this.curve._wnafMulAdd(1,ut,ht,2,!0)},rt.prototype.eq=function(ot){return this===ot||this.inf===ot.inf&&(this.inf||this.x.cmp(ot.x)===0&&this.y.cmp(ot.y)===0)},rt.prototype.neg=function(ot){if(this.inf)return this;var st=this.curve.point(this.x,this.y.redNeg());if(ot&&this.precomputed){var at=this.precomputed,ut=function(ht){return ht.neg()};st.precomputed={naf:at.naf&&{wnd:at.naf.wnd,points:at.naf.points.map(ut)},doubles:at.doubles&&{step:at.doubles.step,points:at.doubles.points.map(ut)}}}return st},rt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var ot=this.curve.jpoint(this.x,this.y,this.curve.one);return ot};function nt(it,ot,st,at){j.BasePoint.call(this,it,"jacobian"),ot===null&&st===null&&at===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new a(0)):(this.x=new a(ot,16),this.y=new a(st,16),this.z=new a(at,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return $(nt,j.BasePoint),tt.prototype.jpoint=function(ot,st,at){return new nt(this,ot,st,at)},nt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var ot=this.z.redInvm(),st=ot.redSqr(),at=this.x.redMul(st),ut=this.y.redMul(st).redMul(ot);return this.curve.point(at,ut)},nt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},nt.prototype.add=function(ot){if(this.isInfinity())return ot;if(ot.isInfinity())return this;var st=ot.z.redSqr(),at=this.z.redSqr(),ut=this.x.redMul(st),ht=ot.x.redMul(at),bt=this.y.redMul(st.redMul(ot.z)),Et=ot.y.redMul(at.redMul(this.z)),Ct=ut.redSub(ht),Pt=bt.redSub(Et);if(Ct.cmpn(0)===0)return Pt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Tt=Ct.redSqr(),It=Tt.redMul(Ct),Lt=ut.redMul(Tt),Nt=Pt.redSqr().redIAdd(It).redISub(Lt).redISub(Lt),Ut=Pt.redMul(Lt.redISub(Nt)).redISub(bt.redMul(It)),jt=this.z.redMul(ot.z).redMul(Ct);return this.curve.jpoint(Nt,Ut,jt)},nt.prototype.mixedAdd=function(ot){if(this.isInfinity())return ot.toJ();if(ot.isInfinity())return this;var st=this.z.redSqr(),at=this.x,ut=ot.x.redMul(st),ht=this.y,bt=ot.y.redMul(st).redMul(this.z),Et=at.redSub(ut),Ct=ht.redSub(bt);if(Et.cmpn(0)===0)return Ct.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Pt=Et.redSqr(),Tt=Pt.redMul(Et),It=at.redMul(Pt),Lt=Ct.redSqr().redIAdd(Tt).redISub(It).redISub(It),Nt=Ct.redMul(It.redISub(Lt)).redISub(ht.redMul(Tt)),Ut=this.z.redMul(Et);return this.curve.jpoint(Lt,Nt,Ut)},nt.prototype.dblp=function(ot){if(ot===0)return this;if(this.isInfinity())return this;if(!ot)return this.dbl();var st;if(this.curve.zeroA||this.curve.threeA){var at=this;for(st=0;st=0)return!1;if(at.redIAdd(ht),this.x.cmp(at)===0)return!0}},nt.prototype.inspect=function(){return this.isInfinity()?"":""},nt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short$2}var mont$2,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont$2;hasRequiredMont=1;var _=bnExports$1,a=inherits_browserExports,$=requireBase(),j=requireUtils();function et(rt){$.call(this,"mont",rt),this.a=new _(rt.a,16).toRed(this.red),this.b=new _(rt.b,16).toRed(this.red),this.i4=new _(4).toRed(this.red).redInvm(),this.two=new _(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}a(et,$),mont$2=et,et.prototype.validate=function(nt){var it=nt.normalize().x,ot=it.redSqr(),st=ot.redMul(it).redAdd(ot.redMul(this.a)).redAdd(it),at=st.redSqrt();return at.redSqr().cmp(st)===0};function tt(rt,nt,it){$.BasePoint.call(this,rt,"projective"),nt===null&&it===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _(nt,16),this.z=new _(it,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return a(tt,$.BasePoint),et.prototype.decodePoint=function(nt,it){return this.point(j.toArray(nt,it),1)},et.prototype.point=function(nt,it){return new tt(this,nt,it)},et.prototype.pointFromJSON=function(nt){return tt.fromJSON(this,nt)},tt.prototype.precompute=function(){},tt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},tt.fromJSON=function(nt,it){return new tt(nt,it[0],it[1]||nt.one)},tt.prototype.inspect=function(){return this.isInfinity()?"":""},tt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},tt.prototype.dbl=function(){var nt=this.x.redAdd(this.z),it=nt.redSqr(),ot=this.x.redSub(this.z),st=ot.redSqr(),at=it.redSub(st),ut=it.redMul(st),ht=at.redMul(st.redAdd(this.curve.a24.redMul(at)));return this.curve.point(ut,ht)},tt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.diffAdd=function(nt,it){var ot=this.x.redAdd(this.z),st=this.x.redSub(this.z),at=nt.x.redAdd(nt.z),ut=nt.x.redSub(nt.z),ht=ut.redMul(ot),bt=at.redMul(st),Et=it.z.redMul(ht.redAdd(bt).redSqr()),Ct=it.x.redMul(ht.redISub(bt).redSqr());return this.curve.point(Et,Ct)},tt.prototype.mul=function(nt){for(var it=nt.clone(),ot=this,st=this.curve.point(null,null),at=this,ut=[];it.cmpn(0)!==0;it.iushrn(1))ut.push(it.andln(1));for(var ht=ut.length-1;ht>=0;ht--)ut[ht]===0?(ot=ot.diffAdd(st,at),st=st.dbl()):(st=ot.diffAdd(st,at),ot=ot.dbl());return st},tt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.eq=function(nt){return this.getX().cmp(nt.getX())===0},tt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},tt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont$2}var edwards$2,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards$2;hasRequiredEdwards=1;var _=requireUtils(),a=bnExports$1,$=inherits_browserExports,j=requireBase(),et=_.assert;function tt(nt){this.twisted=(nt.a|0)!==1,this.mOneA=this.twisted&&(nt.a|0)===-1,this.extended=this.mOneA,j.call(this,"edwards",nt),this.a=new a(nt.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(nt.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(nt.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),et(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(nt.c|0)===1}$(tt,j),edwards$2=tt,tt.prototype._mulA=function(it){return this.mOneA?it.redNeg():this.a.redMul(it)},tt.prototype._mulC=function(it){return this.oneC?it:this.c.redMul(it)},tt.prototype.jpoint=function(it,ot,st,at){return this.point(it,ot,st,at)},tt.prototype.pointFromX=function(it,ot){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),at=this.c2.redSub(this.a.redMul(st)),ut=this.one.redSub(this.c2.redMul(this.d).redMul(st)),ht=at.redMul(ut.redInvm()),bt=ht.redSqrt();if(bt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");var Et=bt.fromRed().isOdd();return(ot&&!Et||!ot&&Et)&&(bt=bt.redNeg()),this.point(it,bt)},tt.prototype.pointFromY=function(it,ot){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),at=st.redSub(this.c2),ut=st.redMul(this.d).redMul(this.c2).redSub(this.a),ht=at.redMul(ut.redInvm());if(ht.cmp(this.zero)===0){if(ot)throw new Error("invalid point");return this.point(this.zero,it)}var bt=ht.redSqrt();if(bt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");return bt.fromRed().isOdd()!==ot&&(bt=bt.redNeg()),this.point(bt,it)},tt.prototype.validate=function(it){if(it.isInfinity())return!0;it.normalize();var ot=it.x.redSqr(),st=it.y.redSqr(),at=ot.redMul(this.a).redAdd(st),ut=this.c2.redMul(this.one.redAdd(this.d.redMul(ot).redMul(st)));return at.cmp(ut)===0};function rt(nt,it,ot,st,at){j.BasePoint.call(this,nt,"projective"),it===null&&ot===null&&st===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new a(it,16),this.y=new a(ot,16),this.z=st?new a(st,16):this.curve.one,this.t=at&&new a(at,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return $(rt,j.BasePoint),tt.prototype.pointFromJSON=function(it){return rt.fromJSON(this,it)},tt.prototype.point=function(it,ot,st,at){return new rt(this,it,ot,st,at)},rt.fromJSON=function(it,ot){return new rt(it,ot[0],ot[1],ot[2])},rt.prototype.inspect=function(){return this.isInfinity()?"":""},rt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},rt.prototype._extDbl=function(){var it=this.x.redSqr(),ot=this.y.redSqr(),st=this.z.redSqr();st=st.redIAdd(st);var at=this.curve._mulA(it),ut=this.x.redAdd(this.y).redSqr().redISub(it).redISub(ot),ht=at.redAdd(ot),bt=ht.redSub(st),Et=at.redSub(ot),Ct=ut.redMul(bt),Pt=ht.redMul(Et),Tt=ut.redMul(Et),It=bt.redMul(ht);return this.curve.point(Ct,Pt,It,Tt)},rt.prototype._projDbl=function(){var it=this.x.redAdd(this.y).redSqr(),ot=this.x.redSqr(),st=this.y.redSqr(),at,ut,ht,bt,Et,Ct;if(this.curve.twisted){bt=this.curve._mulA(ot);var Pt=bt.redAdd(st);this.zOne?(at=it.redSub(ot).redSub(st).redMul(Pt.redSub(this.curve.two)),ut=Pt.redMul(bt.redSub(st)),ht=Pt.redSqr().redSub(Pt).redSub(Pt)):(Et=this.z.redSqr(),Ct=Pt.redSub(Et).redISub(Et),at=it.redSub(ot).redISub(st).redMul(Ct),ut=Pt.redMul(bt.redSub(st)),ht=Pt.redMul(Ct))}else bt=ot.redAdd(st),Et=this.curve._mulC(this.z).redSqr(),Ct=bt.redSub(Et).redSub(Et),at=this.curve._mulC(it.redISub(bt)).redMul(Ct),ut=this.curve._mulC(bt).redMul(ot.redISub(st)),ht=bt.redMul(Ct);return this.curve.point(at,ut,ht)},rt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},rt.prototype._extAdd=function(it){var ot=this.y.redSub(this.x).redMul(it.y.redSub(it.x)),st=this.y.redAdd(this.x).redMul(it.y.redAdd(it.x)),at=this.t.redMul(this.curve.dd).redMul(it.t),ut=this.z.redMul(it.z.redAdd(it.z)),ht=st.redSub(ot),bt=ut.redSub(at),Et=ut.redAdd(at),Ct=st.redAdd(ot),Pt=ht.redMul(bt),Tt=Et.redMul(Ct),It=ht.redMul(Ct),Lt=bt.redMul(Et);return this.curve.point(Pt,Tt,Lt,It)},rt.prototype._projAdd=function(it){var ot=this.z.redMul(it.z),st=ot.redSqr(),at=this.x.redMul(it.x),ut=this.y.redMul(it.y),ht=this.curve.d.redMul(at).redMul(ut),bt=st.redSub(ht),Et=st.redAdd(ht),Ct=this.x.redAdd(this.y).redMul(it.x.redAdd(it.y)).redISub(at).redISub(ut),Pt=ot.redMul(bt).redMul(Ct),Tt,It;return this.curve.twisted?(Tt=ot.redMul(Et).redMul(ut.redSub(this.curve._mulA(at))),It=bt.redMul(Et)):(Tt=ot.redMul(Et).redMul(ut.redSub(at)),It=this.curve._mulC(bt).redMul(Et)),this.curve.point(Pt,Tt,It)},rt.prototype.add=function(it){return this.isInfinity()?it:it.isInfinity()?this:this.curve.extended?this._extAdd(it):this._projAdd(it)},rt.prototype.mul=function(it){return this._hasDoubles(it)?this.curve._fixedNafMul(this,it):this.curve._wnafMul(this,it)},rt.prototype.mulAdd=function(it,ot,st){return this.curve._wnafMulAdd(1,[this,ot],[it,st],2,!1)},rt.prototype.jmulAdd=function(it,ot,st){return this.curve._wnafMulAdd(1,[this,ot],[it,st],2,!0)},rt.prototype.normalize=function(){if(this.zOne)return this;var it=this.z.redInvm();return this.x=this.x.redMul(it),this.y=this.y.redMul(it),this.t&&(this.t=this.t.redMul(it)),this.z=this.curve.one,this.zOne=!0,this},rt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},rt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},rt.prototype.getY=function(){return this.normalize(),this.y.fromRed()},rt.prototype.eq=function(it){return this===it||this.getX().cmp(it.getX())===0&&this.getY().cmp(it.getY())===0},rt.prototype.eqXToP=function(it){var ot=it.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(ot)===0)return!0;for(var st=it.clone(),at=this.curve.redN.redMul(this.z);;){if(st.iadd(this.curve.n),st.cmp(this.curve.p)>=0)return!1;if(ot.redIAdd(at),this.x.cmp(ot)===0)return!0}},rt.prototype.toP=rt.prototype.normalize,rt.prototype.mixedAdd=rt.prototype.add,edwards$2}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(_){var a=_;a.base=requireBase(),a.short=requireShort(),a.mont=requireMont(),a.edwards=requireEdwards()}(curve$2)),curve$2}var curves$6={},secp256k1$2,hasRequiredSecp256k1$2;function requireSecp256k1$2(){return hasRequiredSecp256k1$2||(hasRequiredSecp256k1$2=1,secp256k1$2={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1$2}var hasRequiredCurves;function requireCurves(){return hasRequiredCurves||(hasRequiredCurves=1,function(_){var a=_,$=hash$7,j=requireCurve(),et=requireUtils(),tt=et.assert;function rt(ot){ot.type==="short"?this.curve=new j.short(ot):ot.type==="edwards"?this.curve=new j.edwards(ot):this.curve=new j.mont(ot),this.g=this.curve.g,this.n=this.curve.n,this.hash=ot.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(ot,st){Object.defineProperty(a,ot,{configurable:!0,enumerable:!0,get:function(){var at=new rt(st);return Object.defineProperty(a,ot,{configurable:!0,enumerable:!0,value:at}),at}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1$2()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})}(curves$6)),curves$6}var key$5,hasRequiredKey$1;function requireKey$1(){if(hasRequiredKey$1)return key$5;hasRequiredKey$1=1;var _=bnExports$1,a=requireUtils(),$=a.assert;function j(et,tt){this.ec=et,this.priv=null,this.pub=null,tt.priv&&this._importPrivate(tt.priv,tt.privEnc),tt.pub&&this._importPublic(tt.pub,tt.pubEnc)}return key$5=j,j.fromPublic=function(tt,rt,nt){return rt instanceof j?rt:new j(tt,{pub:rt,pubEnc:nt})},j.fromPrivate=function(tt,rt,nt){return rt instanceof j?rt:new j(tt,{priv:rt,privEnc:nt})},j.prototype.validate=function(){var tt=this.getPublic();return tt.isInfinity()?{result:!1,reason:"Invalid public key"}:tt.validate()?tt.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},j.prototype.getPublic=function(tt,rt){return typeof tt=="string"&&(rt=tt,tt=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),rt?this.pub.encode(rt,tt):this.pub},j.prototype.getPrivate=function(tt){return tt==="hex"?this.priv.toString(16,2):this.priv},j.prototype._importPrivate=function(tt,rt){this.priv=new _(tt,rt||16),this.priv=this.priv.umod(this.ec.curve.n)},j.prototype._importPublic=function(tt,rt){if(tt.x||tt.y){this.ec.curve.type==="mont"?$(tt.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&$(tt.x&&tt.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(tt.x,tt.y);return}this.pub=this.ec.curve.decodePoint(tt,rt)},j.prototype.derive=function(tt){return tt.validate()||$(tt.validate(),"public point not validated"),tt.mul(this.priv).getX()},j.prototype.sign=function(tt,rt,nt){return this.ec.sign(tt,this,rt,nt)},j.prototype.verify=function(tt,rt){return this.ec.verify(tt,rt,this)},j.prototype.inspect=function(){return""},key$5}var signature$5,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$5;hasRequiredSignature$1=1;var _=bnExports$1,a=requireUtils(),$=a.assert;function j(it,ot){if(it instanceof j)return it;this._importDER(it,ot)||($(it.r&&it.s,"Signature without r or s"),this.r=new _(it.r,16),this.s=new _(it.s,16),it.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=it.recoveryParam)}signature$5=j;function et(){this.place=0}function tt(it,ot){var st=it[ot.place++];if(!(st&128))return st;var at=st&15;if(at===0||at>4)return!1;for(var ut=0,ht=0,bt=ot.place;ht>>=0;return ut<=127?!1:(ot.place=bt,ut)}function rt(it){for(var ot=0,st=it.length-1;!it[ot]&&!(it[ot+1]&128)&&ot>>3);for(it.push(st|128);--st;)it.push(ot>>>(st<<3)&255);it.push(ot)}return j.prototype.toDER=function(ot){var st=this.r.toArray(),at=this.s.toArray();for(st[0]&128&&(st=[0].concat(st)),at[0]&128&&(at=[0].concat(at)),st=rt(st),at=rt(at);!at[0]&&!(at[1]&128);)at=at.slice(1);var ut=[2];nt(ut,st.length),ut=ut.concat(st),ut.push(2),nt(ut,at.length);var ht=ut.concat(at),bt=[48];return nt(bt,ht.length),bt=bt.concat(ht),a.encode(bt,ot)},signature$5}var ec$4,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec$4;hasRequiredEc=1;var _=bnExports$1,a=hmacDrbg,$=requireUtils(),j=requireCurves(),et=requireBrorand(),tt=$.assert,rt=requireKey$1(),nt=requireSignature$1();function it(ot){if(!(this instanceof it))return new it(ot);typeof ot=="string"&&(tt(Object.prototype.hasOwnProperty.call(j,ot),"Unknown curve "+ot),ot=j[ot]),ot instanceof j.PresetCurve&&(ot={curve:ot}),this.curve=ot.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=ot.curve.g,this.g.precompute(ot.curve.n.bitLength()+1),this.hash=ot.hash||ot.curve.hash}return ec$4=it,it.prototype.keyPair=function(st){return new rt(this,st)},it.prototype.keyFromPrivate=function(st,at){return rt.fromPrivate(this,st,at)},it.prototype.keyFromPublic=function(st,at){return rt.fromPublic(this,st,at)},it.prototype.genKeyPair=function(st){st||(st={});for(var at=new a({hash:this.hash,pers:st.pers,persEnc:st.persEnc||"utf8",entropy:st.entropy||et(this.hash.hmacStrength),entropyEnc:st.entropy&&st.entropyEnc||"utf8",nonce:this.n.toArray()}),ut=this.n.byteLength(),ht=this.n.sub(new _(2));;){var bt=new _(at.generate(ut));if(!(bt.cmp(ht)>0))return bt.iaddn(1),this.keyFromPrivate(bt)}},it.prototype._truncateToN=function(st,at){var ut=st.byteLength()*8-this.n.bitLength();return ut>0&&(st=st.ushrn(ut)),!at&&st.cmp(this.n)>=0?st.sub(this.n):st},it.prototype.sign=function(st,at,ut,ht){typeof ut=="object"&&(ht=ut,ut=null),ht||(ht={}),at=this.keyFromPrivate(at,ut),st=this._truncateToN(new _(st,16));for(var bt=this.n.byteLength(),Et=at.getPrivate().toArray("be",bt),Ct=st.toArray("be",bt),Pt=new a({hash:this.hash,entropy:Et,nonce:Ct,pers:ht.pers,persEnc:ht.persEnc||"utf8"}),Tt=this.n.sub(new _(1)),It=0;;It++){var Lt=ht.k?ht.k(It):new _(Pt.generate(this.n.byteLength()));if(Lt=this._truncateToN(Lt,!0),!(Lt.cmpn(1)<=0||Lt.cmp(Tt)>=0)){var Nt=this.g.mul(Lt);if(!Nt.isInfinity()){var Ut=Nt.getX(),jt=Ut.umod(this.n);if(jt.cmpn(0)!==0){var Mt=Lt.invm(this.n).mul(jt.mul(at.getPrivate()).iadd(st));if(Mt=Mt.umod(this.n),Mt.cmpn(0)!==0){var Dt=(Nt.getY().isOdd()?1:0)|(Ut.cmp(jt)!==0?2:0);return ht.canonical&&Mt.cmp(this.nh)>0&&(Mt=this.n.sub(Mt),Dt^=1),new nt({r:jt,s:Mt,recoveryParam:Dt})}}}}}},it.prototype.verify=function(st,at,ut,ht){st=this._truncateToN(new _(st,16)),ut=this.keyFromPublic(ut,ht),at=new nt(at,"hex");var bt=at.r,Et=at.s;if(bt.cmpn(1)<0||bt.cmp(this.n)>=0||Et.cmpn(1)<0||Et.cmp(this.n)>=0)return!1;var Ct=Et.invm(this.n),Pt=Ct.mul(st).umod(this.n),Tt=Ct.mul(bt).umod(this.n),It;return this.curve._maxwellTrick?(It=this.g.jmulAdd(Pt,ut.getPublic(),Tt),It.isInfinity()?!1:It.eqXToP(bt)):(It=this.g.mulAdd(Pt,ut.getPublic(),Tt),It.isInfinity()?!1:It.getX().umod(this.n).cmp(bt)===0)},it.prototype.recoverPubKey=function(ot,st,at,ut){tt((3&at)===at,"The recovery param is more than two bits"),st=new nt(st,ut);var ht=this.n,bt=new _(ot),Et=st.r,Ct=st.s,Pt=at&1,Tt=at>>1;if(Et.cmp(this.curve.p.umod(this.curve.n))>=0&&Tt)throw new Error("Unable to find sencond key candinate");Tt?Et=this.curve.pointFromX(Et.add(this.curve.n),Pt):Et=this.curve.pointFromX(Et,Pt);var It=st.r.invm(ht),Lt=ht.sub(bt).mul(It).umod(ht),Nt=Ct.mul(It).umod(ht);return this.g.mulAdd(Lt,Et,Nt)},it.prototype.getKeyRecoveryParam=function(ot,st,at,ut){if(st=new nt(st,ut),st.recoveryParam!==null)return st.recoveryParam;for(var ht=0;ht<4;ht++){var bt;try{bt=this.recoverPubKey(ot,st,ht)}catch{continue}if(bt.eq(at))return ht}throw new Error("Unable to find valid recovery factor")},ec$4}var key$4,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key$4;hasRequiredKey=1;var _=requireUtils(),a=_.assert,$=_.parseBytes,j=_.cachedProperty;function et(tt,rt){this.eddsa=tt,this._secret=$(rt.secret),tt.isPoint(rt.pub)?this._pub=rt.pub:this._pubBytes=$(rt.pub)}return et.fromPublic=function(rt,nt){return nt instanceof et?nt:new et(rt,{pub:nt})},et.fromSecret=function(rt,nt){return nt instanceof et?nt:new et(rt,{secret:nt})},et.prototype.secret=function(){return this._secret},j(et,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),j(et,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),j(et,"privBytes",function(){var rt=this.eddsa,nt=this.hash(),it=rt.encodingLength-1,ot=nt.slice(0,rt.encodingLength);return ot[0]&=248,ot[it]&=127,ot[it]|=64,ot}),j(et,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),j(et,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),j(et,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),et.prototype.sign=function(rt){return a(this._secret,"KeyPair can only verify"),this.eddsa.sign(rt,this)},et.prototype.verify=function(rt,nt){return this.eddsa.verify(rt,nt,this)},et.prototype.getSecret=function(rt){return a(this._secret,"KeyPair is public only"),_.encode(this.secret(),rt)},et.prototype.getPublic=function(rt){return _.encode(this.pubBytes(),rt)},key$4=et,key$4}var signature$4,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$4;hasRequiredSignature=1;var _=bnExports$1,a=requireUtils(),$=a.assert,j=a.cachedProperty,et=a.parseBytes;function tt(rt,nt){this.eddsa=rt,typeof nt!="object"&&(nt=et(nt)),Array.isArray(nt)&&(nt={R:nt.slice(0,rt.encodingLength),S:nt.slice(rt.encodingLength)}),$(nt.R&&nt.S,"Signature without R or S"),rt.isPoint(nt.R)&&(this._R=nt.R),nt.S instanceof _&&(this._S=nt.S),this._Rencoded=Array.isArray(nt.R)?nt.R:nt.Rencoded,this._Sencoded=Array.isArray(nt.S)?nt.S:nt.Sencoded}return j(tt,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),j(tt,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),j(tt,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),j(tt,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),tt.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},tt.prototype.toHex=function(){return a.encode(this.toBytes(),"hex").toUpperCase()},signature$4=tt,signature$4}var eddsa$2,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa$2;hasRequiredEddsa=1;var _=hash$7,a=requireCurves(),$=requireUtils(),j=$.assert,et=$.parseBytes,tt=requireKey(),rt=requireSignature();function nt(it){if(j(it==="ed25519","only tested with ed25519 so far"),!(this instanceof nt))return new nt(it);it=a[it].curve,this.curve=it,this.g=it.g,this.g.precompute(it.n.bitLength()+1),this.pointClass=it.point().constructor,this.encodingLength=Math.ceil(it.n.bitLength()/8),this.hash=_.sha512}return eddsa$2=nt,nt.prototype.sign=function(ot,st){ot=et(ot);var at=this.keyFromSecret(st),ut=this.hashInt(at.messagePrefix(),ot),ht=this.g.mul(ut),bt=this.encodePoint(ht),Et=this.hashInt(bt,at.pubBytes(),ot).mul(at.priv()),Ct=ut.add(Et).umod(this.curve.n);return this.makeSignature({R:ht,S:Ct,Rencoded:bt})},nt.prototype.verify=function(ot,st,at){ot=et(ot),st=this.makeSignature(st);var ut=this.keyFromPublic(at),ht=this.hashInt(st.Rencoded(),ut.pubBytes(),ot),bt=this.g.mul(st.S()),Et=st.R().add(ut.pub().mul(ht));return Et.eq(bt)},nt.prototype.hashInt=function(){for(var ot=this.hash(),st=0;st=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return Et?nt(Tt,Pt):rt(Tt,Pt)};function ot(ut,ht){var bt=ut.modulus.byteLength(),Et=ht.length,Ct=$("sha1").update(it.alloc(0)).digest(),Pt=Ct.length,Tt=2*Pt;if(Et>bt-Tt-2)throw new Error("message too long");var It=it.alloc(bt-Et-Tt-2),Lt=bt-Pt-1,Nt=a(Pt),Ut=et(it.concat([Ct,It,it.alloc(1,1),ht],Lt),j(Nt,Lt)),jt=et(Nt,j(Ut,Pt));return new tt(it.concat([it.alloc(1),jt,Ut],bt))}function st(ut,ht,bt){var Et=ht.length,Ct=ut.modulus.byteLength();if(Et>Ct-11)throw new Error("message too long");var Pt;return bt?Pt=it.alloc(Ct-Et-3,255):Pt=at(Ct-Et-3),new tt(it.concat([it.from([0,bt?1:2]),Pt,it.alloc(1),ht],Ct))}function at(ut){for(var ht=it.allocUnsafe(ut),bt=0,Et=a(ut*2),Ct=0,Pt;btPt||new j(ht).cmp(Ct.modulus)>=0)throw new Error("decryption error");var Tt;bt?Tt=rt(new j(ht),Ct):Tt=et(ht,Ct);var It=nt.alloc(Pt-Tt.length);if(Tt=nt.concat([It,Tt],Pt),Et===4)return it(Ct,Tt);if(Et===1)return ot(Ct,Tt,bt);if(Et===3)return Tt;throw new Error("unknown padding")};function it(at,ut){var ht=at.modulus.byteLength(),bt=tt("sha1").update(nt.alloc(0)).digest(),Et=bt.length;if(ut[0]!==0)throw new Error("decryption error");var Ct=ut.slice(1,Et+1),Pt=ut.slice(Et+1),Tt=$(Ct,a(Pt,Et)),It=$(Pt,a(Tt,ht-Et-1));if(st(bt,It.slice(0,Et)))throw new Error("decryption error");for(var Lt=Et;It[Lt]===0;)Lt++;if(It[Lt++]!==1)throw new Error("decryption error");return It.slice(Lt)}function ot(at,ut,ht){for(var bt=ut.slice(0,2),Et=2,Ct=0;ut[Et++]!==0;)if(Et>=ut.length){Ct++;break}var Pt=ut.slice(2,Et-1);if((bt.toString("hex")!=="0002"&&!ht||bt.toString("hex")!=="0001"&&ht)&&Ct++,Pt.length<8&&Ct++,Ct)throw new Error("decryption error");return ut.slice(Et)}function st(at,ut){at=nt.from(at),ut=nt.from(ut);var ht=0,bt=at.length;at.length!==ut.length&&(ht++,bt=Math.min(at.length,ut.length));for(var Et=-1;++Etrt||ut<0)throw new TypeError("offset must be a uint32");if(ut>et||ut>ht)throw new RangeError("offset out of range")}function it(ut,ht,bt){if(typeof ut!="number"||ut!==ut)throw new TypeError("size must be a number");if(ut>rt||ut<0)throw new TypeError("size must be a uint32");if(ut+ht>bt||ut>et)throw new RangeError("buffer too small")}tt&&tt.getRandomValues||!process$1$1.browser?(browser.randomFill=ot,browser.randomFillSync=at):(browser.randomFill=_,browser.randomFillSync=_);function ot(ut,ht,bt,Et){if(!j.isBuffer(ut)&&!(ut instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof ht=="function")Et=ht,ht=0,bt=ut.length;else if(typeof bt=="function")Et=bt,bt=ut.length-ht;else if(typeof Et!="function")throw new TypeError('"cb" argument must be a function');return nt(ht,ut.length),it(bt,ht,ut.length),st(ut,ht,bt,Et)}function st(ut,ht,bt,Et){if(process$1$1.browser){var Ct=ut.buffer,Pt=new Uint8Array(Ct,ht,bt);if(tt.getRandomValues(Pt),Et){process$1$1.nextTick(function(){Et(null,ut)});return}return ut}if(Et){$(bt,function(It,Lt){if(It)return Et(It);Lt.copy(ut,ht),Et(null,ut)});return}var Tt=$(bt);return Tt.copy(ut,ht),ut}function at(ut,ht,bt){if(typeof ht>"u"&&(ht=0),!j.isBuffer(ut)&&!(ut instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return nt(ht,ut.length),bt===void 0&&(bt=ut.length-ht),it(bt,ht,ut.length),st(ut,ht,bt)}return browser}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$8(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$b,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$7();var _=requireAlgos(),a=Object.keys(_),$=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(a);cryptoBrowserify.getHashes=function(){return $};var j=browser$7;cryptoBrowserify.pbkdf2=j.pbkdf2,cryptoBrowserify.pbkdf2Sync=j.pbkdf2Sync;var et=requireBrowser$5();cryptoBrowserify.Cipher=et.Cipher,cryptoBrowserify.createCipher=et.createCipher,cryptoBrowserify.Cipheriv=et.Cipheriv,cryptoBrowserify.createCipheriv=et.createCipheriv,cryptoBrowserify.Decipher=et.Decipher,cryptoBrowserify.createDecipher=et.createDecipher,cryptoBrowserify.Decipheriv=et.Decipheriv,cryptoBrowserify.createDecipheriv=et.createDecipheriv,cryptoBrowserify.getCiphers=et.getCiphers,cryptoBrowserify.listCiphers=et.listCiphers;var tt=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=tt.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=tt.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=tt.getDiffieHellman,cryptoBrowserify.createDiffieHellman=tt.createDiffieHellman,cryptoBrowserify.DiffieHellman=tt.DiffieHellman;var rt=requireBrowser$3();cryptoBrowserify.createSign=rt.createSign,cryptoBrowserify.Sign=rt.Sign,cryptoBrowserify.createVerify=rt.createVerify,cryptoBrowserify.Verify=rt.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var nt=requireBrowser$1();cryptoBrowserify.publicEncrypt=nt.publicEncrypt,cryptoBrowserify.privateEncrypt=nt.privateEncrypt,cryptoBrowserify.publicDecrypt=nt.publicDecrypt,cryptoBrowserify.privateDecrypt=nt.privateDecrypt;var it=requireBrowser();return cryptoBrowserify.randomFill=it.randomFill,cryptoBrowserify.randomFillSync=it.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` -`))},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}Object.defineProperty(node$2,"__esModule",{value:!0});node$2.NodeRandomSource=void 0;const wipe_1$4=wipe$1;class NodeRandomSource{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof commonjsRequire<"u"){const a=requireCryptoBrowserify();a&&a.randomBytes&&(this._crypto=a,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(a){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let $=this._crypto.randomBytes(a);if($.length!==a)throw new Error("NodeRandomSource: got fewer bytes than requested");const j=new Uint8Array(a);for(let et=0;et>>16&65535,st=nt&65535,at=it>>>16&65535,ut=it&65535;return st*ut+(ot*ut+st*at<<16>>>0)|0}_.mul=Math.imul||a;function $(nt,it){return nt+it|0}_.add=$;function j(nt,it){return nt-it|0}_.sub=j;function et(nt,it){return nt<>>32-it}_.rotl=et;function tt(nt,it){return nt<<32-it|nt>>>it}_.rotr=tt;function rt(nt){return typeof nt=="number"&&isFinite(nt)&&Math.floor(nt)===nt}_.isInteger=Number.isInteger||rt,_.MAX_SAFE_INTEGER=9007199254740991,_.isSafeInteger=function(nt){return _.isInteger(nt)&&nt>=-_.MAX_SAFE_INTEGER&&nt<=_.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(_,a){return a===void 0&&(a=0),(_[a+0]<<8|_[a+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(_,a){return a===void 0&&(a=0),(_[a+0]<<8|_[a+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(_,a){return a===void 0&&(a=0),(_[a+1]<<8|_[a])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(_,a){return a===void 0&&(a=0),(_[a+1]<<8|_[a])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(_,a,$){return a===void 0&&(a=new Uint8Array(2)),$===void 0&&($=0),a[$+0]=_>>>8,a[$+1]=_>>>0,a}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(_,a,$){return a===void 0&&(a=new Uint8Array(2)),$===void 0&&($=0),a[$+0]=_>>>0,a[$+1]=_>>>8,a}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(_,a){return a===void 0&&(a=0),_[a]<<24|_[a+1]<<16|_[a+2]<<8|_[a+3]}binary.readInt32BE=readInt32BE;function readUint32BE(_,a){return a===void 0&&(a=0),(_[a]<<24|_[a+1]<<16|_[a+2]<<8|_[a+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(_,a){return a===void 0&&(a=0),_[a+3]<<24|_[a+2]<<16|_[a+1]<<8|_[a]}binary.readInt32LE=readInt32LE;function readUint32LE(_,a){return a===void 0&&(a=0),(_[a+3]<<24|_[a+2]<<16|_[a+1]<<8|_[a])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(_,a,$){return a===void 0&&(a=new Uint8Array(4)),$===void 0&&($=0),a[$+0]=_>>>24,a[$+1]=_>>>16,a[$+2]=_>>>8,a[$+3]=_>>>0,a}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(_,a,$){return a===void 0&&(a=new Uint8Array(4)),$===void 0&&($=0),a[$+0]=_>>>0,a[$+1]=_>>>8,a[$+2]=_>>>16,a[$+3]=_>>>24,a}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(_,a){a===void 0&&(a=0);var $=readInt32BE(_,a),j=readInt32BE(_,a+4);return $*4294967296+j-(j>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(_,a){a===void 0&&(a=0);var $=readUint32BE(_,a),j=readUint32BE(_,a+4);return $*4294967296+j}binary.readUint64BE=readUint64BE;function readInt64LE(_,a){a===void 0&&(a=0);var $=readInt32LE(_,a),j=readInt32LE(_,a+4);return j*4294967296+$-($>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(_,a){a===void 0&&(a=0);var $=readUint32LE(_,a),j=readUint32LE(_,a+4);return j*4294967296+$}binary.readUint64LE=readUint64LE;function writeUint64BE(_,a,$){return a===void 0&&(a=new Uint8Array(8)),$===void 0&&($=0),writeUint32BE(_/4294967296>>>0,a,$),writeUint32BE(_>>>0,a,$+4),a}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(_,a,$){return a===void 0&&(a=new Uint8Array(8)),$===void 0&&($=0),writeUint32LE(_>>>0,a,$),writeUint32LE(_/4294967296>>>0,a,$+4),a}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(_,a,$){if($===void 0&&($=0),_%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(_/8>a.length-$)throw new Error("readUintBE: array is too short for the given bitLength");for(var j=0,et=1,tt=_/8+$-1;tt>=$;tt--)j+=a[tt]*et,et*=256;return j}binary.readUintBE=readUintBE;function readUintLE(_,a,$){if($===void 0&&($=0),_%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(_/8>a.length-$)throw new Error("readUintLE: array is too short for the given bitLength");for(var j=0,et=1,tt=$;tt<$+_/8;tt++)j+=a[tt]*et,et*=256;return j}binary.readUintLE=readUintLE;function writeUintBE(_,a,$,j){if($===void 0&&($=new Uint8Array(_/8)),j===void 0&&(j=0),_%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(a))throw new Error("writeUintBE value must be an integer");for(var et=1,tt=_/8+j-1;tt>=j;tt--)$[tt]=a/et&255,et*=256;return $}binary.writeUintBE=writeUintBE;function writeUintLE(_,a,$,j){if($===void 0&&($=new Uint8Array(_/8)),j===void 0&&(j=0),_%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(a))throw new Error("writeUintLE value must be an integer");for(var et=1,tt=j;tt256)throw new Error("randomString charset is too long");let ut="";const ht=st.length,bt=256-256%ht;for(;ot>0;){const Et=et(Math.ceil(ot*256/bt),at);for(let Ct=0;Ct0;Ct++){const Pt=Et[Ct];Pt>16&1),Ut[Ft-1]&=65535;Ut[15]=jt[15]-32767-(Ut[14]>>16&1);const Dt=Ut[15]>>16&1;Ut[14]&=65535,nt(jt,Ut,1-Dt)}for(let Mt=0;Mt<16;Mt++)Lt[2*Mt]=jt[Mt]&255,Lt[2*Mt+1]=jt[Mt]>>8}function ot(Lt,Nt){for(let Ut=0;Ut<16;Ut++)Lt[Ut]=Nt[2*Ut]+(Nt[2*Ut+1]<<8);Lt[15]&=32767}function st(Lt,Nt,Ut){for(let jt=0;jt<16;jt++)Lt[jt]=Nt[jt]+Ut[jt]}function at(Lt,Nt,Ut){for(let jt=0;jt<16;jt++)Lt[jt]=Nt[jt]-Ut[jt]}function ut(Lt,Nt,Ut){let jt,Mt,Dt=0,Ft=0,Bt=0,yt=0,mt=0,ct=0,dt=0,vt=0,St=0,Rt=0,$t=0,xt=0,At=0,wt=0,Ot=0,tr=0,nr=0,ir=0,Wt=0,Kt=0,Jt=0,Ht=0,qt=0,Qt=0,dr=0,xr=0,pr=0,kr=0,Ir=0,lr=0,fr=0,Er=Ut[0],$r=Ut[1],Pr=Ut[2],Rr=Ut[3],Ar=Ut[4],Or=Ut[5],Lr=Ut[6],or=Ut[7],Yt=Ut[8],er=Ut[9],Zt=Ut[10],Vt=Ut[11],Gt=Ut[12],ar=Ut[13],br=Ut[14],wr=Ut[15];jt=Nt[0],Dt+=jt*Er,Ft+=jt*$r,Bt+=jt*Pr,yt+=jt*Rr,mt+=jt*Ar,ct+=jt*Or,dt+=jt*Lr,vt+=jt*or,St+=jt*Yt,Rt+=jt*er,$t+=jt*Zt,xt+=jt*Vt,At+=jt*Gt,wt+=jt*ar,Ot+=jt*br,tr+=jt*wr,jt=Nt[1],Ft+=jt*Er,Bt+=jt*$r,yt+=jt*Pr,mt+=jt*Rr,ct+=jt*Ar,dt+=jt*Or,vt+=jt*Lr,St+=jt*or,Rt+=jt*Yt,$t+=jt*er,xt+=jt*Zt,At+=jt*Vt,wt+=jt*Gt,Ot+=jt*ar,tr+=jt*br,nr+=jt*wr,jt=Nt[2],Bt+=jt*Er,yt+=jt*$r,mt+=jt*Pr,ct+=jt*Rr,dt+=jt*Ar,vt+=jt*Or,St+=jt*Lr,Rt+=jt*or,$t+=jt*Yt,xt+=jt*er,At+=jt*Zt,wt+=jt*Vt,Ot+=jt*Gt,tr+=jt*ar,nr+=jt*br,ir+=jt*wr,jt=Nt[3],yt+=jt*Er,mt+=jt*$r,ct+=jt*Pr,dt+=jt*Rr,vt+=jt*Ar,St+=jt*Or,Rt+=jt*Lr,$t+=jt*or,xt+=jt*Yt,At+=jt*er,wt+=jt*Zt,Ot+=jt*Vt,tr+=jt*Gt,nr+=jt*ar,ir+=jt*br,Wt+=jt*wr,jt=Nt[4],mt+=jt*Er,ct+=jt*$r,dt+=jt*Pr,vt+=jt*Rr,St+=jt*Ar,Rt+=jt*Or,$t+=jt*Lr,xt+=jt*or,At+=jt*Yt,wt+=jt*er,Ot+=jt*Zt,tr+=jt*Vt,nr+=jt*Gt,ir+=jt*ar,Wt+=jt*br,Kt+=jt*wr,jt=Nt[5],ct+=jt*Er,dt+=jt*$r,vt+=jt*Pr,St+=jt*Rr,Rt+=jt*Ar,$t+=jt*Or,xt+=jt*Lr,At+=jt*or,wt+=jt*Yt,Ot+=jt*er,tr+=jt*Zt,nr+=jt*Vt,ir+=jt*Gt,Wt+=jt*ar,Kt+=jt*br,Jt+=jt*wr,jt=Nt[6],dt+=jt*Er,vt+=jt*$r,St+=jt*Pr,Rt+=jt*Rr,$t+=jt*Ar,xt+=jt*Or,At+=jt*Lr,wt+=jt*or,Ot+=jt*Yt,tr+=jt*er,nr+=jt*Zt,ir+=jt*Vt,Wt+=jt*Gt,Kt+=jt*ar,Jt+=jt*br,Ht+=jt*wr,jt=Nt[7],vt+=jt*Er,St+=jt*$r,Rt+=jt*Pr,$t+=jt*Rr,xt+=jt*Ar,At+=jt*Or,wt+=jt*Lr,Ot+=jt*or,tr+=jt*Yt,nr+=jt*er,ir+=jt*Zt,Wt+=jt*Vt,Kt+=jt*Gt,Jt+=jt*ar,Ht+=jt*br,qt+=jt*wr,jt=Nt[8],St+=jt*Er,Rt+=jt*$r,$t+=jt*Pr,xt+=jt*Rr,At+=jt*Ar,wt+=jt*Or,Ot+=jt*Lr,tr+=jt*or,nr+=jt*Yt,ir+=jt*er,Wt+=jt*Zt,Kt+=jt*Vt,Jt+=jt*Gt,Ht+=jt*ar,qt+=jt*br,Qt+=jt*wr,jt=Nt[9],Rt+=jt*Er,$t+=jt*$r,xt+=jt*Pr,At+=jt*Rr,wt+=jt*Ar,Ot+=jt*Or,tr+=jt*Lr,nr+=jt*or,ir+=jt*Yt,Wt+=jt*er,Kt+=jt*Zt,Jt+=jt*Vt,Ht+=jt*Gt,qt+=jt*ar,Qt+=jt*br,dr+=jt*wr,jt=Nt[10],$t+=jt*Er,xt+=jt*$r,At+=jt*Pr,wt+=jt*Rr,Ot+=jt*Ar,tr+=jt*Or,nr+=jt*Lr,ir+=jt*or,Wt+=jt*Yt,Kt+=jt*er,Jt+=jt*Zt,Ht+=jt*Vt,qt+=jt*Gt,Qt+=jt*ar,dr+=jt*br,xr+=jt*wr,jt=Nt[11],xt+=jt*Er,At+=jt*$r,wt+=jt*Pr,Ot+=jt*Rr,tr+=jt*Ar,nr+=jt*Or,ir+=jt*Lr,Wt+=jt*or,Kt+=jt*Yt,Jt+=jt*er,Ht+=jt*Zt,qt+=jt*Vt,Qt+=jt*Gt,dr+=jt*ar,xr+=jt*br,pr+=jt*wr,jt=Nt[12],At+=jt*Er,wt+=jt*$r,Ot+=jt*Pr,tr+=jt*Rr,nr+=jt*Ar,ir+=jt*Or,Wt+=jt*Lr,Kt+=jt*or,Jt+=jt*Yt,Ht+=jt*er,qt+=jt*Zt,Qt+=jt*Vt,dr+=jt*Gt,xr+=jt*ar,pr+=jt*br,kr+=jt*wr,jt=Nt[13],wt+=jt*Er,Ot+=jt*$r,tr+=jt*Pr,nr+=jt*Rr,ir+=jt*Ar,Wt+=jt*Or,Kt+=jt*Lr,Jt+=jt*or,Ht+=jt*Yt,qt+=jt*er,Qt+=jt*Zt,dr+=jt*Vt,xr+=jt*Gt,pr+=jt*ar,kr+=jt*br,Ir+=jt*wr,jt=Nt[14],Ot+=jt*Er,tr+=jt*$r,nr+=jt*Pr,ir+=jt*Rr,Wt+=jt*Ar,Kt+=jt*Or,Jt+=jt*Lr,Ht+=jt*or,qt+=jt*Yt,Qt+=jt*er,dr+=jt*Zt,xr+=jt*Vt,pr+=jt*Gt,kr+=jt*ar,Ir+=jt*br,lr+=jt*wr,jt=Nt[15],tr+=jt*Er,nr+=jt*$r,ir+=jt*Pr,Wt+=jt*Rr,Kt+=jt*Ar,Jt+=jt*Or,Ht+=jt*Lr,qt+=jt*or,Qt+=jt*Yt,dr+=jt*er,xr+=jt*Zt,pr+=jt*Vt,kr+=jt*Gt,Ir+=jt*ar,lr+=jt*br,fr+=jt*wr,Dt+=38*nr,Ft+=38*ir,Bt+=38*Wt,yt+=38*Kt,mt+=38*Jt,ct+=38*Ht,dt+=38*qt,vt+=38*Qt,St+=38*dr,Rt+=38*xr,$t+=38*pr,xt+=38*kr,At+=38*Ir,wt+=38*lr,Ot+=38*fr,Mt=1,jt=Dt+Mt+65535,Mt=Math.floor(jt/65536),Dt=jt-Mt*65536,jt=Ft+Mt+65535,Mt=Math.floor(jt/65536),Ft=jt-Mt*65536,jt=Bt+Mt+65535,Mt=Math.floor(jt/65536),Bt=jt-Mt*65536,jt=yt+Mt+65535,Mt=Math.floor(jt/65536),yt=jt-Mt*65536,jt=mt+Mt+65535,Mt=Math.floor(jt/65536),mt=jt-Mt*65536,jt=ct+Mt+65535,Mt=Math.floor(jt/65536),ct=jt-Mt*65536,jt=dt+Mt+65535,Mt=Math.floor(jt/65536),dt=jt-Mt*65536,jt=vt+Mt+65535,Mt=Math.floor(jt/65536),vt=jt-Mt*65536,jt=St+Mt+65535,Mt=Math.floor(jt/65536),St=jt-Mt*65536,jt=Rt+Mt+65535,Mt=Math.floor(jt/65536),Rt=jt-Mt*65536,jt=$t+Mt+65535,Mt=Math.floor(jt/65536),$t=jt-Mt*65536,jt=xt+Mt+65535,Mt=Math.floor(jt/65536),xt=jt-Mt*65536,jt=At+Mt+65535,Mt=Math.floor(jt/65536),At=jt-Mt*65536,jt=wt+Mt+65535,Mt=Math.floor(jt/65536),wt=jt-Mt*65536,jt=Ot+Mt+65535,Mt=Math.floor(jt/65536),Ot=jt-Mt*65536,jt=tr+Mt+65535,Mt=Math.floor(jt/65536),tr=jt-Mt*65536,Dt+=Mt-1+37*(Mt-1),Mt=1,jt=Dt+Mt+65535,Mt=Math.floor(jt/65536),Dt=jt-Mt*65536,jt=Ft+Mt+65535,Mt=Math.floor(jt/65536),Ft=jt-Mt*65536,jt=Bt+Mt+65535,Mt=Math.floor(jt/65536),Bt=jt-Mt*65536,jt=yt+Mt+65535,Mt=Math.floor(jt/65536),yt=jt-Mt*65536,jt=mt+Mt+65535,Mt=Math.floor(jt/65536),mt=jt-Mt*65536,jt=ct+Mt+65535,Mt=Math.floor(jt/65536),ct=jt-Mt*65536,jt=dt+Mt+65535,Mt=Math.floor(jt/65536),dt=jt-Mt*65536,jt=vt+Mt+65535,Mt=Math.floor(jt/65536),vt=jt-Mt*65536,jt=St+Mt+65535,Mt=Math.floor(jt/65536),St=jt-Mt*65536,jt=Rt+Mt+65535,Mt=Math.floor(jt/65536),Rt=jt-Mt*65536,jt=$t+Mt+65535,Mt=Math.floor(jt/65536),$t=jt-Mt*65536,jt=xt+Mt+65535,Mt=Math.floor(jt/65536),xt=jt-Mt*65536,jt=At+Mt+65535,Mt=Math.floor(jt/65536),At=jt-Mt*65536,jt=wt+Mt+65535,Mt=Math.floor(jt/65536),wt=jt-Mt*65536,jt=Ot+Mt+65535,Mt=Math.floor(jt/65536),Ot=jt-Mt*65536,jt=tr+Mt+65535,Mt=Math.floor(jt/65536),tr=jt-Mt*65536,Dt+=Mt-1+37*(Mt-1),Lt[0]=Dt,Lt[1]=Ft,Lt[2]=Bt,Lt[3]=yt,Lt[4]=mt,Lt[5]=ct,Lt[6]=dt,Lt[7]=vt,Lt[8]=St,Lt[9]=Rt,Lt[10]=$t,Lt[11]=xt,Lt[12]=At,Lt[13]=wt,Lt[14]=Ot,Lt[15]=tr}function ht(Lt,Nt){ut(Lt,Nt,Nt)}function bt(Lt,Nt){const Ut=j();for(let jt=0;jt<16;jt++)Ut[jt]=Nt[jt];for(let jt=253;jt>=0;jt--)ht(Ut,Ut),jt!==2&&jt!==4&&ut(Ut,Ut,Nt);for(let jt=0;jt<16;jt++)Lt[jt]=Ut[jt]}function Et(Lt,Nt){const Ut=new Uint8Array(32),jt=new Float64Array(80),Mt=j(),Dt=j(),Ft=j(),Bt=j(),yt=j(),mt=j();for(let St=0;St<31;St++)Ut[St]=Lt[St];Ut[31]=Lt[31]&127|64,Ut[0]&=248,ot(jt,Nt);for(let St=0;St<16;St++)Dt[St]=jt[St];Mt[0]=Bt[0]=1;for(let St=254;St>=0;--St){const Rt=Ut[St>>>3]>>>(St&7)&1;nt(Mt,Dt,Rt),nt(Ft,Bt,Rt),st(yt,Mt,Ft),at(Mt,Mt,Ft),st(Ft,Dt,Bt),at(Dt,Dt,Bt),ht(Bt,yt),ht(mt,Mt),ut(Mt,Ft,Mt),ut(Ft,Dt,yt),st(yt,Mt,Ft),at(Mt,Mt,Ft),ht(Dt,Mt),at(Ft,Bt,mt),ut(Mt,Ft,tt),st(Mt,Mt,Bt),ut(Ft,Ft,Mt),ut(Mt,Bt,mt),ut(Bt,Dt,jt),ht(Dt,yt),nt(Mt,Dt,Rt),nt(Ft,Bt,Rt)}for(let St=0;St<16;St++)jt[St+16]=Mt[St],jt[St+32]=Ft[St],jt[St+48]=Dt[St],jt[St+64]=Bt[St];const ct=jt.subarray(32),dt=jt.subarray(16);bt(ct,ct),ut(dt,dt,ct);const vt=new Uint8Array(32);return it(vt,dt),vt}_.scalarMult=Et;function Ct(Lt){return Et(Lt,et)}_.scalarMultBase=Ct;function Pt(Lt){if(Lt.length!==_.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${_.SECRET_KEY_LENGTH} bytes`);const Nt=new Uint8Array(Lt);return{publicKey:Ct(Nt),secretKey:Nt}}_.generateKeyPairFromSeed=Pt;function Tt(Lt){const Nt=(0,a.randomBytes)(32,Lt),Ut=Pt(Nt);return(0,$.wipe)(Nt),Ut}_.generateKeyPair=Tt;function It(Lt,Nt,Ut=!1){if(Lt.length!==_.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(Nt.length!==_.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const jt=Et(Lt,Nt);if(Ut){let Mt=0;for(let Dt=0;Dt>>25,$t=jt+It|0,Bt^=$t<<9|$t>>>23,$t=Bt+jt|0,dt^=$t<<13|$t>>>19,$t=dt+Bt|0,It^=$t<<18|$t>>>14,$t=Mt+Lt|0,yt^=$t<<7|$t>>>25,$t=yt+Mt|0,vt^=$t<<9|$t>>>23,$t=vt+yt|0,Lt^=$t<<13|$t>>>19,$t=Lt+vt|0,Mt^=$t<<18|$t>>>14,$t=mt+Dt|0,St^=$t<<7|$t>>>25,$t=St+mt|0,Nt^=$t<<9|$t>>>23,$t=Nt+St|0,Dt^=$t<<13|$t>>>19,$t=Dt+Nt|0,mt^=$t<<18|$t>>>14,$t=Rt+ct|0,Ut^=$t<<7|$t>>>25,$t=Ut+Rt|0,Ft^=$t<<9|$t>>>23,$t=Ft+Ut|0,ct^=$t<<13|$t>>>19,$t=ct+Ft|0,Rt^=$t<<18|$t>>>14,$t=It+Ut|0,Lt^=$t<<7|$t>>>25,$t=Lt+It|0,Nt^=$t<<9|$t>>>23,$t=Nt+Lt|0,Ut^=$t<<13|$t>>>19,$t=Ut+Nt|0,It^=$t<<18|$t>>>14,$t=Mt+jt|0,Dt^=$t<<7|$t>>>25,$t=Dt+Mt|0,Ft^=$t<<9|$t>>>23,$t=Ft+Dt|0,jt^=$t<<13|$t>>>19,$t=jt+Ft|0,Mt^=$t<<18|$t>>>14,$t=mt+yt|0,ct^=$t<<7|$t>>>25,$t=ct+mt|0,Bt^=$t<<9|$t>>>23,$t=Bt+ct|0,yt^=$t<<13|$t>>>19,$t=yt+Bt|0,mt^=$t<<18|$t>>>14,$t=Rt+St|0,dt^=$t<<7|$t>>>25,$t=dt+Rt|0,vt^=$t<<9|$t>>>23,$t=vt+dt|0,St^=$t<<13|$t>>>19,$t=St+vt|0,Rt^=$t<<18|$t>>>14;binary_1$1.writeUint32LE(It+j|0,_,0),binary_1$1.writeUint32LE(Lt+et|0,_,4),binary_1$1.writeUint32LE(Nt+tt|0,_,8),binary_1$1.writeUint32LE(Ut+rt|0,_,12),binary_1$1.writeUint32LE(jt+nt|0,_,16),binary_1$1.writeUint32LE(Mt+it|0,_,20),binary_1$1.writeUint32LE(Dt+ot|0,_,24),binary_1$1.writeUint32LE(Ft+st|0,_,28),binary_1$1.writeUint32LE(Bt+at|0,_,32),binary_1$1.writeUint32LE(yt+ut|0,_,36),binary_1$1.writeUint32LE(mt+ht|0,_,40),binary_1$1.writeUint32LE(ct+bt|0,_,44),binary_1$1.writeUint32LE(dt+Et|0,_,48),binary_1$1.writeUint32LE(vt+Ct|0,_,52),binary_1$1.writeUint32LE(St+Pt|0,_,56),binary_1$1.writeUint32LE(Rt+Tt|0,_,60)}function streamXOR$1(_,a,$,j,et){if(et===void 0&&(et=0),_.length!==32)throw new Error("Salsa20: key size must be 32 bytes");if(j.length<$.length)throw new Error("Salsa20: destination is shorter than source");var tt,rt;if(et===0){if(a.length!==8)throw new Error("Salsa20 nonce must be 8 bytes");tt=new Uint8Array(16),tt.set(a),rt=a.length}else{if(a.length!==16)throw new Error("Salsa20 nonce with counter must be 16 bytes");tt=a,rt=16-et}for(var nt=new Uint8Array(64),it=0;it<$.length;it+=64){core(nt,tt,_);for(var ot=it;ot>>=8,a++;if(j>0)throw new Error("Salsa20: counter overflow")}Object.defineProperty(xsalsa20,"__esModule",{value:!0});var binary_1=binary,salsa20_1=salsa20,wipe_1$2=wipe$1;function streamXOR(_,a,$,j,et){if(et===void 0&&(et=0),et===0){if(a.length!==24)throw new Error("XSalsa20 nonce must be 24 bytes")}else if(a.length!==32)throw new Error("XSalsa20 nonce with counter must be 32 bytes");var tt=hsalsa(_,a.subarray(0,16),new Uint8Array(32)),rt=salsa20_1.streamXOR(tt,a.subarray(16),$,j,et);return wipe_1$2.wipe(tt),rt}xsalsa20.streamXOR=streamXOR;function stream(_,a,$,j){return j===void 0&&(j=0),wipe_1$2.wipe($),streamXOR(_,a,$,$,j)}xsalsa20.stream=stream;var ROUNDS=20;function hsalsa(_,a,$){for(var j=1634760805,et=_[3]<<24|_[2]<<16|_[1]<<8|_[0],tt=_[7]<<24|_[6]<<16|_[5]<<8|_[4],rt=_[11]<<24|_[10]<<16|_[9]<<8|_[8],nt=_[15]<<24|_[14]<<16|_[13]<<8|_[12],it=857760878,ot=a[3]<<24|a[2]<<16|a[1]<<8|a[0],st=a[7]<<24|a[6]<<16|a[5]<<8|a[4],at=a[11]<<24|a[10]<<16|a[9]<<8|a[8],ut=a[15]<<24|a[14]<<16|a[13]<<8|a[12],ht=2036477234,bt=_[19]<<24|_[18]<<16|_[17]<<8|_[16],Et=_[23]<<24|_[22]<<16|_[21]<<8|_[20],Ct=_[27]<<24|_[26]<<16|_[25]<<8|_[24],Pt=_[31]<<24|_[30]<<16|_[29]<<8|_[28],Tt=1797285236,It,Lt=0;Lt>>25,It=nt+j|0,at^=It<<9|It>>>23,It=at+nt|0,Et^=It<<13|It>>>19,It=Et+at|0,j^=It<<18|It>>>14,It=it+et|0,ut^=It<<7|It>>>25,It=ut+it|0,Ct^=It<<9|It>>>23,It=Ct+ut|0,et^=It<<13|It>>>19,It=et+Ct|0,it^=It<<18|It>>>14,It=ht+ot|0,Pt^=It<<7|It>>>25,It=Pt+ht|0,tt^=It<<9|It>>>23,It=tt+Pt|0,ot^=It<<13|It>>>19,It=ot+tt|0,ht^=It<<18|It>>>14,It=Tt+bt|0,rt^=It<<7|It>>>25,It=rt+Tt|0,st^=It<<9|It>>>23,It=st+rt|0,bt^=It<<13|It>>>19,It=bt+st|0,Tt^=It<<18|It>>>14,It=j+rt|0,et^=It<<7|It>>>25,It=et+j|0,tt^=It<<9|It>>>23,It=tt+et|0,rt^=It<<13|It>>>19,It=rt+tt|0,j^=It<<18|It>>>14,It=it+nt|0,ot^=It<<7|It>>>25,It=ot+it|0,st^=It<<9|It>>>23,It=st+ot|0,nt^=It<<13|It>>>19,It=nt+st|0,it^=It<<18|It>>>14,It=ht+ut|0,bt^=It<<7|It>>>25,It=bt+ht|0,at^=It<<9|It>>>23,It=at+bt|0,ut^=It<<13|It>>>19,It=ut+at|0,ht^=It<<18|It>>>14,It=Tt+Pt|0,Et^=It<<7|It>>>25,It=Et+Tt|0,Ct^=It<<9|It>>>23,It=Ct+Et|0,Pt^=It<<13|It>>>19,It=Pt+Ct|0,Tt^=It<<18|It>>>14;return binary_1.writeUint32LE(j,$,0),binary_1.writeUint32LE(it,$,4),binary_1.writeUint32LE(ht,$,8),binary_1.writeUint32LE(Tt,$,12),binary_1.writeUint32LE(ot,$,16),binary_1.writeUint32LE(st,$,20),binary_1.writeUint32LE(at,$,24),binary_1.writeUint32LE(ut,$,28),$}xsalsa20.hsalsa=hsalsa;var secretbox={},poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(_,a,$){return~(_-1)&a|_-1&$}constantTime.select=select;function lessOrEqual(_,a){return(_|0)-(a|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare$d(_,a){if(_.length!==a.length)return 0;for(var $=0,j=0;j<_.length;j++)$|=_[j]^a[j];return 1&$-1>>>8}constantTime.compare=compare$d;function equal(_,a){return _.length===0||a.length===0?!1:compare$d(_,a)!==0}constantTime.equal=equal;(function(_){Object.defineProperty(_,"__esModule",{value:!0});var a=constantTime,$=wipe$1;_.DIGEST_LENGTH=16;var j=function(){function rt(nt){this.digestLength=_.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var it=nt[0]|nt[1]<<8;this._r[0]=it&8191;var ot=nt[2]|nt[3]<<8;this._r[1]=(it>>>13|ot<<3)&8191;var st=nt[4]|nt[5]<<8;this._r[2]=(ot>>>10|st<<6)&7939;var at=nt[6]|nt[7]<<8;this._r[3]=(st>>>7|at<<9)&8191;var ut=nt[8]|nt[9]<<8;this._r[4]=(at>>>4|ut<<12)&255,this._r[5]=ut>>>1&8190;var ht=nt[10]|nt[11]<<8;this._r[6]=(ut>>>14|ht<<2)&8191;var bt=nt[12]|nt[13]<<8;this._r[7]=(ht>>>11|bt<<5)&8065;var Et=nt[14]|nt[15]<<8;this._r[8]=(bt>>>8|Et<<8)&8191,this._r[9]=Et>>>5&127,this._pad[0]=nt[16]|nt[17]<<8,this._pad[1]=nt[18]|nt[19]<<8,this._pad[2]=nt[20]|nt[21]<<8,this._pad[3]=nt[22]|nt[23]<<8,this._pad[4]=nt[24]|nt[25]<<8,this._pad[5]=nt[26]|nt[27]<<8,this._pad[6]=nt[28]|nt[29]<<8,this._pad[7]=nt[30]|nt[31]<<8}return rt.prototype._blocks=function(nt,it,ot){for(var st=this._fin?0:2048,at=this._h[0],ut=this._h[1],ht=this._h[2],bt=this._h[3],Et=this._h[4],Ct=this._h[5],Pt=this._h[6],Tt=this._h[7],It=this._h[8],Lt=this._h[9],Nt=this._r[0],Ut=this._r[1],jt=this._r[2],Mt=this._r[3],Dt=this._r[4],Ft=this._r[5],Bt=this._r[6],yt=this._r[7],mt=this._r[8],ct=this._r[9];ot>=16;){var dt=nt[it+0]|nt[it+1]<<8;at+=dt&8191;var vt=nt[it+2]|nt[it+3]<<8;ut+=(dt>>>13|vt<<3)&8191;var St=nt[it+4]|nt[it+5]<<8;ht+=(vt>>>10|St<<6)&8191;var Rt=nt[it+6]|nt[it+7]<<8;bt+=(St>>>7|Rt<<9)&8191;var $t=nt[it+8]|nt[it+9]<<8;Et+=(Rt>>>4|$t<<12)&8191,Ct+=$t>>>1&8191;var xt=nt[it+10]|nt[it+11]<<8;Pt+=($t>>>14|xt<<2)&8191;var At=nt[it+12]|nt[it+13]<<8;Tt+=(xt>>>11|At<<5)&8191;var wt=nt[it+14]|nt[it+15]<<8;It+=(At>>>8|wt<<8)&8191,Lt+=wt>>>5|st;var Ot=0,tr=Ot;tr+=at*Nt,tr+=ut*(5*ct),tr+=ht*(5*mt),tr+=bt*(5*yt),tr+=Et*(5*Bt),Ot=tr>>>13,tr&=8191,tr+=Ct*(5*Ft),tr+=Pt*(5*Dt),tr+=Tt*(5*Mt),tr+=It*(5*jt),tr+=Lt*(5*Ut),Ot+=tr>>>13,tr&=8191;var nr=Ot;nr+=at*Ut,nr+=ut*Nt,nr+=ht*(5*ct),nr+=bt*(5*mt),nr+=Et*(5*yt),Ot=nr>>>13,nr&=8191,nr+=Ct*(5*Bt),nr+=Pt*(5*Ft),nr+=Tt*(5*Dt),nr+=It*(5*Mt),nr+=Lt*(5*jt),Ot+=nr>>>13,nr&=8191;var ir=Ot;ir+=at*jt,ir+=ut*Ut,ir+=ht*Nt,ir+=bt*(5*ct),ir+=Et*(5*mt),Ot=ir>>>13,ir&=8191,ir+=Ct*(5*yt),ir+=Pt*(5*Bt),ir+=Tt*(5*Ft),ir+=It*(5*Dt),ir+=Lt*(5*Mt),Ot+=ir>>>13,ir&=8191;var Wt=Ot;Wt+=at*Mt,Wt+=ut*jt,Wt+=ht*Ut,Wt+=bt*Nt,Wt+=Et*(5*ct),Ot=Wt>>>13,Wt&=8191,Wt+=Ct*(5*mt),Wt+=Pt*(5*yt),Wt+=Tt*(5*Bt),Wt+=It*(5*Ft),Wt+=Lt*(5*Dt),Ot+=Wt>>>13,Wt&=8191;var Kt=Ot;Kt+=at*Dt,Kt+=ut*Mt,Kt+=ht*jt,Kt+=bt*Ut,Kt+=Et*Nt,Ot=Kt>>>13,Kt&=8191,Kt+=Ct*(5*ct),Kt+=Pt*(5*mt),Kt+=Tt*(5*yt),Kt+=It*(5*Bt),Kt+=Lt*(5*Ft),Ot+=Kt>>>13,Kt&=8191;var Jt=Ot;Jt+=at*Ft,Jt+=ut*Dt,Jt+=ht*Mt,Jt+=bt*jt,Jt+=Et*Ut,Ot=Jt>>>13,Jt&=8191,Jt+=Ct*Nt,Jt+=Pt*(5*ct),Jt+=Tt*(5*mt),Jt+=It*(5*yt),Jt+=Lt*(5*Bt),Ot+=Jt>>>13,Jt&=8191;var Ht=Ot;Ht+=at*Bt,Ht+=ut*Ft,Ht+=ht*Dt,Ht+=bt*Mt,Ht+=Et*jt,Ot=Ht>>>13,Ht&=8191,Ht+=Ct*Ut,Ht+=Pt*Nt,Ht+=Tt*(5*ct),Ht+=It*(5*mt),Ht+=Lt*(5*yt),Ot+=Ht>>>13,Ht&=8191;var qt=Ot;qt+=at*yt,qt+=ut*Bt,qt+=ht*Ft,qt+=bt*Dt,qt+=Et*Mt,Ot=qt>>>13,qt&=8191,qt+=Ct*jt,qt+=Pt*Ut,qt+=Tt*Nt,qt+=It*(5*ct),qt+=Lt*(5*mt),Ot+=qt>>>13,qt&=8191;var Qt=Ot;Qt+=at*mt,Qt+=ut*yt,Qt+=ht*Bt,Qt+=bt*Ft,Qt+=Et*Dt,Ot=Qt>>>13,Qt&=8191,Qt+=Ct*Mt,Qt+=Pt*jt,Qt+=Tt*Ut,Qt+=It*Nt,Qt+=Lt*(5*ct),Ot+=Qt>>>13,Qt&=8191;var dr=Ot;dr+=at*ct,dr+=ut*mt,dr+=ht*yt,dr+=bt*Bt,dr+=Et*Ft,Ot=dr>>>13,dr&=8191,dr+=Ct*Dt,dr+=Pt*Mt,dr+=Tt*jt,dr+=It*Ut,dr+=Lt*Nt,Ot+=dr>>>13,dr&=8191,Ot=(Ot<<2)+Ot|0,Ot=Ot+tr|0,tr=Ot&8191,Ot=Ot>>>13,nr+=Ot,at=tr,ut=nr,ht=ir,bt=Wt,Et=Kt,Ct=Jt,Pt=Ht,Tt=qt,It=Qt,Lt=dr,it+=16,ot-=16}this._h[0]=at,this._h[1]=ut,this._h[2]=ht,this._h[3]=bt,this._h[4]=Et,this._h[5]=Ct,this._h[6]=Pt,this._h[7]=Tt,this._h[8]=It,this._h[9]=Lt},rt.prototype.finish=function(nt,it){it===void 0&&(it=0);var ot=new Uint16Array(10),st,at,ut,ht;if(this._leftover){for(ht=this._leftover,this._buffer[ht++]=1;ht<16;ht++)this._buffer[ht]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(st=this._h[1]>>>13,this._h[1]&=8191,ht=2;ht<10;ht++)this._h[ht]+=st,st=this._h[ht]>>>13,this._h[ht]&=8191;for(this._h[0]+=st*5,st=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=st,st=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=st,ot[0]=this._h[0]+5,st=ot[0]>>>13,ot[0]&=8191,ht=1;ht<10;ht++)ot[ht]=this._h[ht]+st,st=ot[ht]>>>13,ot[ht]&=8191;for(ot[9]-=8192,at=(st^1)-1,ht=0;ht<10;ht++)ot[ht]&=at;for(at=~at,ht=0;ht<10;ht++)this._h[ht]=this._h[ht]&at|ot[ht];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,ut=this._h[0]+this._pad[0],this._h[0]=ut&65535,ht=1;ht<8;ht++)ut=(this._h[ht]+this._pad[ht]|0)+(ut>>>16)|0,this._h[ht]=ut&65535;return nt[it+0]=this._h[0]>>>0,nt[it+1]=this._h[0]>>>8,nt[it+2]=this._h[1]>>>0,nt[it+3]=this._h[1]>>>8,nt[it+4]=this._h[2]>>>0,nt[it+5]=this._h[2]>>>8,nt[it+6]=this._h[3]>>>0,nt[it+7]=this._h[3]>>>8,nt[it+8]=this._h[4]>>>0,nt[it+9]=this._h[4]>>>8,nt[it+10]=this._h[5]>>>0,nt[it+11]=this._h[5]>>>8,nt[it+12]=this._h[6]>>>0,nt[it+13]=this._h[6]>>>8,nt[it+14]=this._h[7]>>>0,nt[it+15]=this._h[7]>>>8,this._finished=!0,this},rt.prototype.update=function(nt){var it=0,ot=nt.length,st;if(this._leftover){st=16-this._leftover,st>ot&&(st=ot);for(var at=0;at=16&&(st=ot-ot%16,this._blocks(nt,it,st),it+=st,ot-=st),ot){for(var at=0;at32&&(0,xsalsa20_1.streamXOR)(_,et,$.subarray(32),tt.subarray(48),8);const rt=(0,poly1305_1.oneTimeAuth)(j.subarray(0,32),tt.subarray(16));for(let nt=0;nt32&&(0,xsalsa20_1.streamXOR)(_,et,rt.subarray(32),nt.subarray(32),8),(0,wipe_1$1.wipe)(tt),(0,wipe_1$1.wipe)(j),(0,wipe_1$1.wipe)(et),nt}secretbox.openSecretBox=openSecretBox;function generateKey(_){return(0,random_1.randomBytes)(32,_)}secretbox.generateKey=generateKey;(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.openBox=_.box=_.precomputeSharedKey=_.generateKeyPair=void 0;const a=x25519,$=xsalsa20,j=secretbox,et=wipe$1;var tt=x25519;Object.defineProperty(_,"generateKeyPair",{enumerable:!0,get:function(){return tt.generateKeyPair}});const rt=new Uint8Array(16);function nt(st,at){const ut=(0,a.scalarMult)(at,st);return(0,$.hsalsa)(ut,rt,ut),ut}_.precomputeSharedKey=nt;function it(st,at,ut,ht){const bt=nt(st,at),Et=(0,j.secretBox)(bt,ut,ht);return(0,et.wipe)(bt),Et}_.box=it;function ot(st,at,ut,ht){const bt=nt(st,at),Et=(0,j.openSecretBox)(bt,ut,ht);return(0,et.wipe)(bt),Et}_.openBox=ot})(box);(function(_){var a=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(j,et,tt,rt){rt===void 0&&(rt=tt);var nt=Object.getOwnPropertyDescriptor(et,tt);(!nt||("get"in nt?!et.__esModule:nt.writable||nt.configurable))&&(nt={enumerable:!0,get:function(){return et[tt]}}),Object.defineProperty(j,rt,nt)}:function(j,et,tt,rt){rt===void 0&&(rt=tt),j[rt]=et[tt]}),$=commonjsGlobal&&commonjsGlobal.__exportStar||function(j,et){for(var tt in j)tt!=="default"&&!Object.prototype.hasOwnProperty.call(et,tt)&&a(et,j,tt)};Object.defineProperty(_,"__esModule",{value:!0}),$(box,_),$(secretbox,_)})(nacl);var utf8={};Object.defineProperty(utf8,"__esModule",{value:!0});var INVALID_UTF16="utf8: invalid string",INVALID_UTF8="utf8: invalid source encoding";function encode$8(_){for(var a=new Uint8Array(encodedLength(_)),$=0,j=0;j<_.length;j++){var et=_.charCodeAt(j);et<128?a[$++]=et:et<2048?(a[$++]=192|et>>6,a[$++]=128|et&63):et<55296?(a[$++]=224|et>>12,a[$++]=128|et>>6&63,a[$++]=128|et&63):(j++,et=(et&1023)<<10,et|=_.charCodeAt(j)&1023,et+=65536,a[$++]=240|et>>18,a[$++]=128|et>>12&63,a[$++]=128|et>>6&63,a[$++]=128|et&63)}return a}var encode_1=utf8.encode=encode$8;function encodedLength(_){for(var a=0,$=0;$<_.length;$++){var j=_.charCodeAt($);if(j<128)a+=1;else if(j<2048)a+=2;else if(j<55296)a+=3;else if(j<=57343){if($>=_.length-1)throw new Error(INVALID_UTF16);$++,a+=4}else throw new Error(INVALID_UTF16)}return a}utf8.encodedLength=encodedLength;function decode$4(_){for(var a=[],$=0;$<_.length;$++){var j=_[$];if(j&128){var et=void 0;if(j<224){if($>=_.length)throw new Error(INVALID_UTF8);var tt=_[++$];if((tt&192)!==128)throw new Error(INVALID_UTF8);j=(j&31)<<6|tt&63,et=128}else if(j<240){if($>=_.length-1)throw new Error(INVALID_UTF8);var tt=_[++$],rt=_[++$];if((tt&192)!==128||(rt&192)!==128)throw new Error(INVALID_UTF8);j=(j&15)<<12|(tt&63)<<6|rt&63,et=2048}else if(j<248){if($>=_.length-2)throw new Error(INVALID_UTF8);var tt=_[++$],rt=_[++$],nt=_[++$];if((tt&192)!==128||(rt&192)!==128||(nt&192)!==128)throw new Error(INVALID_UTF8);j=(j&15)<<18|(tt&63)<<12|(rt&63)<<6|nt&63,et=65536}else throw new Error(INVALID_UTF8);if(j=55296&&j<=57343)throw new Error(INVALID_UTF8);if(j>=65536){if(j>1114111)throw new Error(INVALID_UTF8);j-=65536,a.push(String.fromCharCode(55296|j>>10)),j=56320|j&1023}}a.push(String.fromCharCode(j))}return a.join("")}utf8.decode=decode$4;var blake2b$1={};(function(_){Object.defineProperty(_,"__esModule",{value:!0});var a=binary,$=wipe$1;_.BLOCK_SIZE=128,_.DIGEST_LENGTH=64,_.KEY_LENGTH=64,_.PERSONALIZATION_LENGTH=16,_.SALT_LENGTH=16,_.MAX_LEAF_SIZE=Math.pow(2,32)-1,_.MAX_FANOUT=255,_.MAX_MAX_DEPTH=255;var j=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),et=[[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6],[22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8],[14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16],[18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26],[4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18],[24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22],[26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20],[12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10],[20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0],[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6]],tt=function(){function nt(it,ot){if(it===void 0&&(it=64),this.digestLength=it,this.blockSize=_.BLOCK_SIZE,this._state=new Int32Array(j),this._buffer=new Uint8Array(_.BLOCK_SIZE),this._bufferLength=0,this._ctr=new Uint32Array(4),this._flag=new Uint32Array(4),this._lastNode=!1,this._finished=!1,this._vtmp=new Uint32Array(32),this._mtmp=new Uint32Array(32),it<1||it>_.DIGEST_LENGTH)throw new Error("blake2b: wrong digest length");ot&&this.validateConfig(ot);var st=0;ot&&ot.key&&(st=ot.key.length);var at=1,ut=1;ot&&ot.tree&&(at=ot.tree.fanout,ut=ot.tree.maxDepth),this._state[0]^=it|st<<8|at<<16|ut<<24,ot&&ot.tree&&(this._state[1]^=ot.tree.leafSize,this._state[2]^=ot.tree.nodeOffsetLowBits,this._state[3]^=ot.tree.nodeOffsetHighBits,this._state[4]^=ot.tree.nodeDepth|ot.tree.innerDigestLength<<8,this._lastNode=ot.tree.lastNode),ot&&ot.salt&&(this._state[8]^=a.readUint32LE(ot.salt,0),this._state[9]^=a.readUint32LE(ot.salt,4),this._state[10]^=a.readUint32LE(ot.salt,8),this._state[11]^=a.readUint32LE(ot.salt,12)),ot&&ot.personalization&&(this._state[12]^=a.readUint32LE(ot.personalization,0),this._state[13]^=a.readUint32LE(ot.personalization,4),this._state[14]^=a.readUint32LE(ot.personalization,8),this._state[15]^=a.readUint32LE(ot.personalization,12)),this._initialState=new Uint32Array(this._state),ot&&ot.key&&st>0&&(this._paddedKey=new Uint8Array(_.BLOCK_SIZE),this._paddedKey.set(ot.key),this._buffer.set(this._paddedKey),this._bufferLength=_.BLOCK_SIZE)}return nt.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=_.BLOCK_SIZE):this._bufferLength=0,$.wipe(this._ctr),$.wipe(this._flag),this._finished=!1,this},nt.prototype.validateConfig=function(it){if(it.key&&it.key.length>_.KEY_LENGTH)throw new Error("blake2b: wrong key length");if(it.salt&&it.salt.length!==_.SALT_LENGTH)throw new Error("blake2b: wrong salt length");if(it.personalization&&it.personalization.length!==_.PERSONALIZATION_LENGTH)throw new Error("blake2b: wrong personalization length");if(it.tree){if(it.tree.fanout<0||it.tree.fanout>_.MAX_FANOUT)throw new Error("blake2b: wrong tree fanout");if(it.tree.maxDepth<0||it.tree.maxDepth>_.MAX_MAX_DEPTH)throw new Error("blake2b: wrong tree depth");if(it.tree.leafSize<0||it.tree.leafSize>_.MAX_LEAF_SIZE)throw new Error("blake2b: wrong leaf size");if(it.tree.innerDigestLength<0||it.tree.innerDigestLength>_.DIGEST_LENGTH)throw new Error("blake2b: wrong tree inner digest length")}},nt.prototype.update=function(it,ot){if(ot===void 0&&(ot=it.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var st=_.BLOCK_SIZE-this._bufferLength,at=0;if(ot===0)return this;if(ot>st){for(var ut=0;ut_.BLOCK_SIZE;){for(var ut=0;ut<_.BLOCK_SIZE;ut++)this._buffer[ut]=it[at+ut];this._processBlock(_.BLOCK_SIZE),at+=_.BLOCK_SIZE,ot-=_.BLOCK_SIZE,this._bufferLength=0}for(var ut=0;ut>>16,dt=Ut&65535,vt=Ut>>>16;mt+=jt&65535,ct+=jt>>>16,dt+=Mt&65535,vt+=Mt>>>16,ct+=mt>>>16,dt+=ct>>>16,vt+=dt>>>16,Ut=dt&65535|vt<<16,Nt=mt&65535|ct<<16,mt=Nt&65535,ct=Nt>>>16,dt=Ut&65535,vt=Ut>>>16,mt+=Pt&65535,ct+=Pt>>>16,dt+=Tt&65535,vt+=Tt>>>16,ct+=mt>>>16,dt+=ct>>>16,vt+=dt>>>16,Ut=dt&65535|vt<<16,Nt=mt&65535|ct<<16,Bt^=Nt,yt^=Ut,mt=yt,yt=Bt,Bt=mt,mt=Dt&65535,ct=Dt>>>16,dt=Ft&65535,vt=Ft>>>16,mt+=Bt&65535,ct+=Bt>>>16,dt+=yt&65535,vt+=yt>>>16,ct+=mt>>>16,dt+=ct>>>16,vt+=dt>>>16,Ft=dt&65535|vt<<16,Dt=mt&65535|ct<<16,jt^=Dt,Mt^=Ft,mt=jt<<8|Mt>>>24,jt=Mt<<8|jt>>>24,Mt=mt,mt=Nt&65535,ct=Nt>>>16,dt=Ut&65535,vt=Ut>>>16,mt+=jt&65535,ct+=jt>>>16,dt+=Mt&65535,vt+=Mt>>>16,ct+=mt>>>16,dt+=ct>>>16,vt+=dt>>>16,Ut=dt&65535|vt<<16,Nt=mt&65535|ct<<16,mt=Nt&65535,ct=Nt>>>16,dt=Ut&65535,vt=Ut>>>16,mt+=It&65535,ct+=It>>>16,dt+=Lt&65535,vt+=Lt>>>16,ct+=mt>>>16,dt+=ct>>>16,vt+=dt>>>16,Ut=dt&65535|vt<<16,Nt=mt&65535|ct<<16,Bt^=Nt,yt^=Ut,mt=Bt<<16|yt>>>16,Bt=yt<<16|Bt>>>16,yt=mt,mt=Dt&65535,ct=Dt>>>16,dt=Ft&65535,vt=Ft>>>16,mt+=Bt&65535,ct+=Bt>>>16,dt+=yt&65535,vt+=yt>>>16,ct+=mt>>>16,dt+=ct>>>16,vt+=dt>>>16,Ft=dt&65535|vt<<16,Dt=mt&65535|ct<<16,jt^=Dt,Mt^=Ft,mt=Mt<<1|jt>>>31,jt=jt<<1|Mt>>>31,Mt=mt,it[ot]=Nt,it[ht]=Ut,it[st]=jt,it[bt]=Mt,it[at]=Dt,it[Et]=Ft,it[ut]=Bt,it[Ct]=yt},nt.prototype._incrementCounter=function(it){for(var ot=0;ot<3;ot++){var st=this._ctr[ot]+it;if(this._ctr[ot]=st>>>0,this._ctr[ot]===st)return;it=1}},nt.prototype._processBlock=function(it){this._incrementCounter(it);var ot=this._vtmp;ot.set(this._state),ot.set(j,16),ot[12*2+0]^=this._ctr[0],ot[12*2+1]^=this._ctr[1],ot[13*2+0]^=this._ctr[2],ot[13*2+1]^=this._ctr[3],ot[14*2+0]^=this._flag[0],ot[14*2+1]^=this._flag[1],ot[15*2+0]^=this._flag[2],ot[15*2+1]^=this._flag[3];for(var st=this._mtmp,at=0;at<32;at++)st[at]=a.readUint32LE(this._buffer,at*4);for(var ut=0;ut<12;ut++)this._G(ot,0,8,16,24,1,9,17,25,st[et[ut][0]],st[et[ut][0]+1],st[et[ut][1]],st[et[ut][1]+1]),this._G(ot,2,10,18,26,3,11,19,27,st[et[ut][2]],st[et[ut][2]+1],st[et[ut][3]],st[et[ut][3]+1]),this._G(ot,4,12,20,28,5,13,21,29,st[et[ut][4]],st[et[ut][4]+1],st[et[ut][5]],st[et[ut][5]+1]),this._G(ot,6,14,22,30,7,15,23,31,st[et[ut][6]],st[et[ut][6]+1],st[et[ut][7]],st[et[ut][7]+1]),this._G(ot,0,10,20,30,1,11,21,31,st[et[ut][8]],st[et[ut][8]+1],st[et[ut][9]],st[et[ut][9]+1]),this._G(ot,2,12,22,24,3,13,23,25,st[et[ut][10]],st[et[ut][10]+1],st[et[ut][11]],st[et[ut][11]+1]),this._G(ot,4,14,16,26,5,15,17,27,st[et[ut][12]],st[et[ut][12]+1],st[et[ut][13]],st[et[ut][13]+1]),this._G(ot,6,8,18,28,7,9,19,29,st[et[ut][14]],st[et[ut][14]+1],st[et[ut][15]],st[et[ut][15]+1]);for(var at=0;at<16;at++)this._state[at]^=ot[at]^ot[at+16]},nt}();_.BLAKE2b=tt;function rt(nt,it,ot){it===void 0&&(it=_.DIGEST_LENGTH);var st=new tt(it,ot);st.update(nt);var at=st.digest();return st.clean(),at}_.hash=rt})(blake2b$1);var ed25519={},sha512$2={};(function(_){Object.defineProperty(_,"__esModule",{value:!0});var a=binary,$=wipe$1;_.DIGEST_LENGTH=64,_.BLOCK_SIZE=128;var j=function(){function nt(){this.digestLength=_.DIGEST_LENGTH,this.blockSize=_.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return nt.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},nt.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},nt.prototype.clean=function(){$.wipe(this._buffer),$.wipe(this._tempHi),$.wipe(this._tempLo),this.reset()},nt.prototype.update=function(it,ot){if(ot===void 0&&(ot=it.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var st=0;if(this._bytesHashed+=ot,this._bufferLength>0){for(;this._bufferLength<_.BLOCK_SIZE&&ot>0;)this._buffer[this._bufferLength++]=it[st++],ot--;this._bufferLength===this.blockSize&&(tt(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(ot>=this.blockSize&&(st=tt(this._tempHi,this._tempLo,this._stateHi,this._stateLo,it,st,ot),ot%=this.blockSize);ot>0;)this._buffer[this._bufferLength++]=it[st++],ot--;return this},nt.prototype.finish=function(it){if(!this._finished){var ot=this._bytesHashed,st=this._bufferLength,at=ot/536870912|0,ut=ot<<3,ht=ot%128<112?128:256;this._buffer[st]=128;for(var bt=st+1;bt0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},nt.prototype.restoreState=function(it){return this._stateHi.set(it.stateHi),this._stateLo.set(it.stateLo),this._bufferLength=it.bufferLength,it.buffer&&this._buffer.set(it.buffer),this._bytesHashed=it.bytesHashed,this._finished=!1,this},nt.prototype.cleanSavedState=function(it){$.wipe(it.stateHi),$.wipe(it.stateLo),it.buffer&&$.wipe(it.buffer),it.bufferLength=0,it.bytesHashed=0},nt}();_.SHA512=j;var et=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function tt(nt,it,ot,st,at,ut,ht){for(var bt=ot[0],Et=ot[1],Ct=ot[2],Pt=ot[3],Tt=ot[4],It=ot[5],Lt=ot[6],Nt=ot[7],Ut=st[0],jt=st[1],Mt=st[2],Dt=st[3],Ft=st[4],Bt=st[5],yt=st[6],mt=st[7],ct,dt,vt,St,Rt,$t,xt,At;ht>=128;){for(var wt=0;wt<16;wt++){var Ot=8*wt+ut;nt[wt]=a.readUint32BE(at,Ot),it[wt]=a.readUint32BE(at,Ot+4)}for(var wt=0;wt<80;wt++){var tr=bt,nr=Et,ir=Ct,Wt=Pt,Kt=Tt,Jt=It,Ht=Lt,qt=Nt,Qt=Ut,dr=jt,xr=Mt,pr=Dt,kr=Ft,Ir=Bt,lr=yt,fr=mt;if(ct=Nt,dt=mt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=(Tt>>>14|Ft<<18)^(Tt>>>18|Ft<<14)^(Ft>>>9|Tt<<23),dt=(Ft>>>14|Tt<<18)^(Ft>>>18|Tt<<14)^(Tt>>>9|Ft<<23),Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,ct=Tt&It^~Tt&Lt,dt=Ft&Bt^~Ft&yt,Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,ct=et[wt*2],dt=et[wt*2+1],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,ct=nt[wt%16],dt=it[wt%16],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,vt=xt&65535|At<<16,St=Rt&65535|$t<<16,ct=vt,dt=St,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=(bt>>>28|Ut<<4)^(Ut>>>2|bt<<30)^(Ut>>>7|bt<<25),dt=(Ut>>>28|bt<<4)^(bt>>>2|Ut<<30)^(bt>>>7|Ut<<25),Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,ct=bt&Et^bt&Ct^Et&Ct,dt=Ut&jt^Ut&Mt^jt&Mt,Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,qt=xt&65535|At<<16,fr=Rt&65535|$t<<16,ct=Wt,dt=pr,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=vt,dt=St,Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,Wt=xt&65535|At<<16,pr=Rt&65535|$t<<16,Et=tr,Ct=nr,Pt=ir,Tt=Wt,It=Kt,Lt=Jt,Nt=Ht,bt=qt,jt=Qt,Mt=dr,Dt=xr,Ft=pr,Bt=kr,yt=Ir,mt=lr,Ut=fr,wt%16===15)for(var Ot=0;Ot<16;Ot++)ct=nt[Ot],dt=it[Ot],Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=nt[(Ot+9)%16],dt=it[(Ot+9)%16],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,vt=nt[(Ot+1)%16],St=it[(Ot+1)%16],ct=(vt>>>1|St<<31)^(vt>>>8|St<<24)^vt>>>7,dt=(St>>>1|vt<<31)^(St>>>8|vt<<24)^(St>>>7|vt<<25),Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,vt=nt[(Ot+14)%16],St=it[(Ot+14)%16],ct=(vt>>>19|St<<13)^(St>>>29|vt<<3)^vt>>>6,dt=(St>>>19|vt<<13)^(vt>>>29|St<<3)^(St>>>6|vt<<26),Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,nt[Ot]=xt&65535|At<<16,it[Ot]=Rt&65535|$t<<16}ct=bt,dt=Ut,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[0],dt=st[0],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[0]=bt=xt&65535|At<<16,st[0]=Ut=Rt&65535|$t<<16,ct=Et,dt=jt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[1],dt=st[1],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[1]=Et=xt&65535|At<<16,st[1]=jt=Rt&65535|$t<<16,ct=Ct,dt=Mt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[2],dt=st[2],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[2]=Ct=xt&65535|At<<16,st[2]=Mt=Rt&65535|$t<<16,ct=Pt,dt=Dt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[3],dt=st[3],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[3]=Pt=xt&65535|At<<16,st[3]=Dt=Rt&65535|$t<<16,ct=Tt,dt=Ft,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[4],dt=st[4],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[4]=Tt=xt&65535|At<<16,st[4]=Ft=Rt&65535|$t<<16,ct=It,dt=Bt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[5],dt=st[5],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[5]=It=xt&65535|At<<16,st[5]=Bt=Rt&65535|$t<<16,ct=Lt,dt=yt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[6],dt=st[6],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[6]=Lt=xt&65535|At<<16,st[6]=yt=Rt&65535|$t<<16,ct=Nt,dt=mt,Rt=dt&65535,$t=dt>>>16,xt=ct&65535,At=ct>>>16,ct=ot[7],dt=st[7],Rt+=dt&65535,$t+=dt>>>16,xt+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,xt+=$t>>>16,At+=xt>>>16,ot[7]=Nt=xt&65535|At<<16,st[7]=mt=Rt&65535|$t<<16,ut+=128,ht-=128}return ut}function rt(nt){var it=new j;it.update(nt);var ot=it.digest();return it.clean(),ot}_.hash=rt})(sha512$2);(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.convertSecretKeyToX25519=_.convertPublicKeyToX25519=_.verify=_.sign=_.extractPublicKeyFromSecretKey=_.generateKeyPair=_.generateKeyPairFromSeed=_.SEED_LENGTH=_.SECRET_KEY_LENGTH=_.PUBLIC_KEY_LENGTH=_.SIGNATURE_LENGTH=void 0;const a=random,$=sha512$2,j=wipe$1;_.SIGNATURE_LENGTH=64,_.PUBLIC_KEY_LENGTH=32,_.SECRET_KEY_LENGTH=64,_.SEED_LENGTH=32;function et(Wt){const Kt=new Float64Array(16);if(Wt)for(let Jt=0;Jt>16&1),Jt[dr-1]&=65535;Jt[15]=Ht[15]-32767-(Jt[14]>>16&1);const Qt=Jt[15]>>16&1;Jt[14]&=65535,Et(Ht,Jt,1-Qt)}for(let qt=0;qt<16;qt++)Wt[2*qt]=Ht[qt]&255,Wt[2*qt+1]=Ht[qt]>>8}function Pt(Wt,Kt){let Jt=0;for(let Ht=0;Ht<32;Ht++)Jt|=Wt[Ht]^Kt[Ht];return(1&Jt-1>>>8)-1}function Tt(Wt,Kt){const Jt=new Uint8Array(32),Ht=new Uint8Array(32);return Ct(Jt,Wt),Ct(Ht,Kt),Pt(Jt,Ht)}function It(Wt){const Kt=new Uint8Array(32);return Ct(Kt,Wt),Kt[0]&1}function Lt(Wt,Kt){for(let Jt=0;Jt<16;Jt++)Wt[Jt]=Kt[2*Jt]+(Kt[2*Jt+1]<<8);Wt[15]&=32767}function Nt(Wt,Kt,Jt){for(let Ht=0;Ht<16;Ht++)Wt[Ht]=Kt[Ht]+Jt[Ht]}function Ut(Wt,Kt,Jt){for(let Ht=0;Ht<16;Ht++)Wt[Ht]=Kt[Ht]-Jt[Ht]}function jt(Wt,Kt,Jt){let Ht,qt,Qt=0,dr=0,xr=0,pr=0,kr=0,Ir=0,lr=0,fr=0,Er=0,$r=0,Pr=0,Rr=0,Ar=0,Or=0,Lr=0,or=0,Yt=0,er=0,Zt=0,Vt=0,Gt=0,ar=0,br=0,wr=0,Sr=0,Wr=0,Hr=0,Fr=0,pn=0,Jr=0,Qr=0,mn=Jt[0],ln=Jt[1],qr=Jt[2],wn=Jt[3],un=Jt[4],Vr=Jt[5],hn=Jt[6],fn=Jt[7],Kr=Jt[8],$n=Jt[9],dn=Jt[10],Gr=Jt[11],gn=Jt[12],an=Jt[13],Zr=Jt[14],Rn=Jt[15];Ht=Kt[0],Qt+=Ht*mn,dr+=Ht*ln,xr+=Ht*qr,pr+=Ht*wn,kr+=Ht*un,Ir+=Ht*Vr,lr+=Ht*hn,fr+=Ht*fn,Er+=Ht*Kr,$r+=Ht*$n,Pr+=Ht*dn,Rr+=Ht*Gr,Ar+=Ht*gn,Or+=Ht*an,Lr+=Ht*Zr,or+=Ht*Rn,Ht=Kt[1],dr+=Ht*mn,xr+=Ht*ln,pr+=Ht*qr,kr+=Ht*wn,Ir+=Ht*un,lr+=Ht*Vr,fr+=Ht*hn,Er+=Ht*fn,$r+=Ht*Kr,Pr+=Ht*$n,Rr+=Ht*dn,Ar+=Ht*Gr,Or+=Ht*gn,Lr+=Ht*an,or+=Ht*Zr,Yt+=Ht*Rn,Ht=Kt[2],xr+=Ht*mn,pr+=Ht*ln,kr+=Ht*qr,Ir+=Ht*wn,lr+=Ht*un,fr+=Ht*Vr,Er+=Ht*hn,$r+=Ht*fn,Pr+=Ht*Kr,Rr+=Ht*$n,Ar+=Ht*dn,Or+=Ht*Gr,Lr+=Ht*gn,or+=Ht*an,Yt+=Ht*Zr,er+=Ht*Rn,Ht=Kt[3],pr+=Ht*mn,kr+=Ht*ln,Ir+=Ht*qr,lr+=Ht*wn,fr+=Ht*un,Er+=Ht*Vr,$r+=Ht*hn,Pr+=Ht*fn,Rr+=Ht*Kr,Ar+=Ht*$n,Or+=Ht*dn,Lr+=Ht*Gr,or+=Ht*gn,Yt+=Ht*an,er+=Ht*Zr,Zt+=Ht*Rn,Ht=Kt[4],kr+=Ht*mn,Ir+=Ht*ln,lr+=Ht*qr,fr+=Ht*wn,Er+=Ht*un,$r+=Ht*Vr,Pr+=Ht*hn,Rr+=Ht*fn,Ar+=Ht*Kr,Or+=Ht*$n,Lr+=Ht*dn,or+=Ht*Gr,Yt+=Ht*gn,er+=Ht*an,Zt+=Ht*Zr,Vt+=Ht*Rn,Ht=Kt[5],Ir+=Ht*mn,lr+=Ht*ln,fr+=Ht*qr,Er+=Ht*wn,$r+=Ht*un,Pr+=Ht*Vr,Rr+=Ht*hn,Ar+=Ht*fn,Or+=Ht*Kr,Lr+=Ht*$n,or+=Ht*dn,Yt+=Ht*Gr,er+=Ht*gn,Zt+=Ht*an,Vt+=Ht*Zr,Gt+=Ht*Rn,Ht=Kt[6],lr+=Ht*mn,fr+=Ht*ln,Er+=Ht*qr,$r+=Ht*wn,Pr+=Ht*un,Rr+=Ht*Vr,Ar+=Ht*hn,Or+=Ht*fn,Lr+=Ht*Kr,or+=Ht*$n,Yt+=Ht*dn,er+=Ht*Gr,Zt+=Ht*gn,Vt+=Ht*an,Gt+=Ht*Zr,ar+=Ht*Rn,Ht=Kt[7],fr+=Ht*mn,Er+=Ht*ln,$r+=Ht*qr,Pr+=Ht*wn,Rr+=Ht*un,Ar+=Ht*Vr,Or+=Ht*hn,Lr+=Ht*fn,or+=Ht*Kr,Yt+=Ht*$n,er+=Ht*dn,Zt+=Ht*Gr,Vt+=Ht*gn,Gt+=Ht*an,ar+=Ht*Zr,br+=Ht*Rn,Ht=Kt[8],Er+=Ht*mn,$r+=Ht*ln,Pr+=Ht*qr,Rr+=Ht*wn,Ar+=Ht*un,Or+=Ht*Vr,Lr+=Ht*hn,or+=Ht*fn,Yt+=Ht*Kr,er+=Ht*$n,Zt+=Ht*dn,Vt+=Ht*Gr,Gt+=Ht*gn,ar+=Ht*an,br+=Ht*Zr,wr+=Ht*Rn,Ht=Kt[9],$r+=Ht*mn,Pr+=Ht*ln,Rr+=Ht*qr,Ar+=Ht*wn,Or+=Ht*un,Lr+=Ht*Vr,or+=Ht*hn,Yt+=Ht*fn,er+=Ht*Kr,Zt+=Ht*$n,Vt+=Ht*dn,Gt+=Ht*Gr,ar+=Ht*gn,br+=Ht*an,wr+=Ht*Zr,Sr+=Ht*Rn,Ht=Kt[10],Pr+=Ht*mn,Rr+=Ht*ln,Ar+=Ht*qr,Or+=Ht*wn,Lr+=Ht*un,or+=Ht*Vr,Yt+=Ht*hn,er+=Ht*fn,Zt+=Ht*Kr,Vt+=Ht*$n,Gt+=Ht*dn,ar+=Ht*Gr,br+=Ht*gn,wr+=Ht*an,Sr+=Ht*Zr,Wr+=Ht*Rn,Ht=Kt[11],Rr+=Ht*mn,Ar+=Ht*ln,Or+=Ht*qr,Lr+=Ht*wn,or+=Ht*un,Yt+=Ht*Vr,er+=Ht*hn,Zt+=Ht*fn,Vt+=Ht*Kr,Gt+=Ht*$n,ar+=Ht*dn,br+=Ht*Gr,wr+=Ht*gn,Sr+=Ht*an,Wr+=Ht*Zr,Hr+=Ht*Rn,Ht=Kt[12],Ar+=Ht*mn,Or+=Ht*ln,Lr+=Ht*qr,or+=Ht*wn,Yt+=Ht*un,er+=Ht*Vr,Zt+=Ht*hn,Vt+=Ht*fn,Gt+=Ht*Kr,ar+=Ht*$n,br+=Ht*dn,wr+=Ht*Gr,Sr+=Ht*gn,Wr+=Ht*an,Hr+=Ht*Zr,Fr+=Ht*Rn,Ht=Kt[13],Or+=Ht*mn,Lr+=Ht*ln,or+=Ht*qr,Yt+=Ht*wn,er+=Ht*un,Zt+=Ht*Vr,Vt+=Ht*hn,Gt+=Ht*fn,ar+=Ht*Kr,br+=Ht*$n,wr+=Ht*dn,Sr+=Ht*Gr,Wr+=Ht*gn,Hr+=Ht*an,Fr+=Ht*Zr,pn+=Ht*Rn,Ht=Kt[14],Lr+=Ht*mn,or+=Ht*ln,Yt+=Ht*qr,er+=Ht*wn,Zt+=Ht*un,Vt+=Ht*Vr,Gt+=Ht*hn,ar+=Ht*fn,br+=Ht*Kr,wr+=Ht*$n,Sr+=Ht*dn,Wr+=Ht*Gr,Hr+=Ht*gn,Fr+=Ht*an,pn+=Ht*Zr,Jr+=Ht*Rn,Ht=Kt[15],or+=Ht*mn,Yt+=Ht*ln,er+=Ht*qr,Zt+=Ht*wn,Vt+=Ht*un,Gt+=Ht*Vr,ar+=Ht*hn,br+=Ht*fn,wr+=Ht*Kr,Sr+=Ht*$n,Wr+=Ht*dn,Hr+=Ht*Gr,Fr+=Ht*gn,pn+=Ht*an,Jr+=Ht*Zr,Qr+=Ht*Rn,Qt+=38*Yt,dr+=38*er,xr+=38*Zt,pr+=38*Vt,kr+=38*Gt,Ir+=38*ar,lr+=38*br,fr+=38*wr,Er+=38*Sr,$r+=38*Wr,Pr+=38*Hr,Rr+=38*Fr,Ar+=38*pn,Or+=38*Jr,Lr+=38*Qr,qt=1,Ht=Qt+qt+65535,qt=Math.floor(Ht/65536),Qt=Ht-qt*65536,Ht=dr+qt+65535,qt=Math.floor(Ht/65536),dr=Ht-qt*65536,Ht=xr+qt+65535,qt=Math.floor(Ht/65536),xr=Ht-qt*65536,Ht=pr+qt+65535,qt=Math.floor(Ht/65536),pr=Ht-qt*65536,Ht=kr+qt+65535,qt=Math.floor(Ht/65536),kr=Ht-qt*65536,Ht=Ir+qt+65535,qt=Math.floor(Ht/65536),Ir=Ht-qt*65536,Ht=lr+qt+65535,qt=Math.floor(Ht/65536),lr=Ht-qt*65536,Ht=fr+qt+65535,qt=Math.floor(Ht/65536),fr=Ht-qt*65536,Ht=Er+qt+65535,qt=Math.floor(Ht/65536),Er=Ht-qt*65536,Ht=$r+qt+65535,qt=Math.floor(Ht/65536),$r=Ht-qt*65536,Ht=Pr+qt+65535,qt=Math.floor(Ht/65536),Pr=Ht-qt*65536,Ht=Rr+qt+65535,qt=Math.floor(Ht/65536),Rr=Ht-qt*65536,Ht=Ar+qt+65535,qt=Math.floor(Ht/65536),Ar=Ht-qt*65536,Ht=Or+qt+65535,qt=Math.floor(Ht/65536),Or=Ht-qt*65536,Ht=Lr+qt+65535,qt=Math.floor(Ht/65536),Lr=Ht-qt*65536,Ht=or+qt+65535,qt=Math.floor(Ht/65536),or=Ht-qt*65536,Qt+=qt-1+37*(qt-1),qt=1,Ht=Qt+qt+65535,qt=Math.floor(Ht/65536),Qt=Ht-qt*65536,Ht=dr+qt+65535,qt=Math.floor(Ht/65536),dr=Ht-qt*65536,Ht=xr+qt+65535,qt=Math.floor(Ht/65536),xr=Ht-qt*65536,Ht=pr+qt+65535,qt=Math.floor(Ht/65536),pr=Ht-qt*65536,Ht=kr+qt+65535,qt=Math.floor(Ht/65536),kr=Ht-qt*65536,Ht=Ir+qt+65535,qt=Math.floor(Ht/65536),Ir=Ht-qt*65536,Ht=lr+qt+65535,qt=Math.floor(Ht/65536),lr=Ht-qt*65536,Ht=fr+qt+65535,qt=Math.floor(Ht/65536),fr=Ht-qt*65536,Ht=Er+qt+65535,qt=Math.floor(Ht/65536),Er=Ht-qt*65536,Ht=$r+qt+65535,qt=Math.floor(Ht/65536),$r=Ht-qt*65536,Ht=Pr+qt+65535,qt=Math.floor(Ht/65536),Pr=Ht-qt*65536,Ht=Rr+qt+65535,qt=Math.floor(Ht/65536),Rr=Ht-qt*65536,Ht=Ar+qt+65535,qt=Math.floor(Ht/65536),Ar=Ht-qt*65536,Ht=Or+qt+65535,qt=Math.floor(Ht/65536),Or=Ht-qt*65536,Ht=Lr+qt+65535,qt=Math.floor(Ht/65536),Lr=Ht-qt*65536,Ht=or+qt+65535,qt=Math.floor(Ht/65536),or=Ht-qt*65536,Qt+=qt-1+37*(qt-1),Wt[0]=Qt,Wt[1]=dr,Wt[2]=xr,Wt[3]=pr,Wt[4]=kr,Wt[5]=Ir,Wt[6]=lr,Wt[7]=fr,Wt[8]=Er,Wt[9]=$r,Wt[10]=Pr,Wt[11]=Rr,Wt[12]=Ar,Wt[13]=Or,Wt[14]=Lr,Wt[15]=or}function Mt(Wt,Kt){jt(Wt,Kt,Kt)}function Dt(Wt,Kt){const Jt=et();let Ht;for(Ht=0;Ht<16;Ht++)Jt[Ht]=Kt[Ht];for(Ht=253;Ht>=0;Ht--)Mt(Jt,Jt),Ht!==2&&Ht!==4&&jt(Jt,Jt,Kt);for(Ht=0;Ht<16;Ht++)Wt[Ht]=Jt[Ht]}function Ft(Wt,Kt){const Jt=et();let Ht;for(Ht=0;Ht<16;Ht++)Jt[Ht]=Kt[Ht];for(Ht=250;Ht>=0;Ht--)Mt(Jt,Jt),Ht!==1&&jt(Jt,Jt,Kt);for(Ht=0;Ht<16;Ht++)Wt[Ht]=Jt[Ht]}function Bt(Wt,Kt){const Jt=et(),Ht=et(),qt=et(),Qt=et(),dr=et(),xr=et(),pr=et(),kr=et(),Ir=et();Ut(Jt,Wt[1],Wt[0]),Ut(Ir,Kt[1],Kt[0]),jt(Jt,Jt,Ir),Nt(Ht,Wt[0],Wt[1]),Nt(Ir,Kt[0],Kt[1]),jt(Ht,Ht,Ir),jt(qt,Wt[3],Kt[3]),jt(qt,qt,ot),jt(Qt,Wt[2],Kt[2]),Nt(Qt,Qt,Qt),Ut(dr,Ht,Jt),Ut(xr,Qt,qt),Nt(pr,Qt,qt),Nt(kr,Ht,Jt),jt(Wt[0],dr,xr),jt(Wt[1],kr,pr),jt(Wt[2],pr,xr),jt(Wt[3],dr,kr)}function yt(Wt,Kt,Jt){for(let Ht=0;Ht<4;Ht++)Et(Wt[Ht],Kt[Ht],Jt)}function mt(Wt,Kt){const Jt=et(),Ht=et(),qt=et();Dt(qt,Kt[2]),jt(Jt,Kt[0],qt),jt(Ht,Kt[1],qt),Ct(Wt,Ht),Wt[31]^=It(Jt)<<7}function ct(Wt,Kt,Jt){ht(Wt[0],rt),ht(Wt[1],nt),ht(Wt[2],nt),ht(Wt[3],rt);for(let Ht=255;Ht>=0;--Ht){const qt=Jt[Ht/8|0]>>(Ht&7)&1;yt(Wt,Kt,qt),Bt(Kt,Wt),Bt(Wt,Wt),yt(Wt,Kt,qt)}}function dt(Wt,Kt){const Jt=[et(),et(),et(),et()];ht(Jt[0],st),ht(Jt[1],at),ht(Jt[2],nt),jt(Jt[3],st,at),ct(Wt,Jt,Kt)}function vt(Wt){if(Wt.length!==_.SEED_LENGTH)throw new Error(`ed25519: seed must be ${_.SEED_LENGTH} bytes`);const Kt=(0,$.hash)(Wt);Kt[0]&=248,Kt[31]&=127,Kt[31]|=64;const Jt=new Uint8Array(32),Ht=[et(),et(),et(),et()];dt(Ht,Kt),mt(Jt,Ht);const qt=new Uint8Array(64);return qt.set(Wt),qt.set(Jt,32),{publicKey:Jt,secretKey:qt}}_.generateKeyPairFromSeed=vt;function St(Wt){const Kt=(0,a.randomBytes)(32,Wt),Jt=vt(Kt);return(0,j.wipe)(Kt),Jt}_.generateKeyPair=St;function Rt(Wt){if(Wt.length!==_.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${_.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(Wt.subarray(32))}_.extractPublicKeyFromSecretKey=Rt;const $t=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function xt(Wt,Kt){let Jt,Ht,qt,Qt;for(Ht=63;Ht>=32;--Ht){for(Jt=0,qt=Ht-32,Qt=Ht-12;qt>4)*$t[qt],Jt=Kt[qt]>>8,Kt[qt]&=255;for(qt=0;qt<32;qt++)Kt[qt]-=Jt*$t[qt];for(Ht=0;Ht<32;Ht++)Kt[Ht+1]+=Kt[Ht]>>8,Wt[Ht]=Kt[Ht]&255}function At(Wt){const Kt=new Float64Array(64);for(let Jt=0;Jt<64;Jt++)Kt[Jt]=Wt[Jt];for(let Jt=0;Jt<64;Jt++)Wt[Jt]=0;xt(Wt,Kt)}function wt(Wt,Kt){const Jt=new Float64Array(64),Ht=[et(),et(),et(),et()],qt=(0,$.hash)(Wt.subarray(0,32));qt[0]&=248,qt[31]&=127,qt[31]|=64;const Qt=new Uint8Array(64);Qt.set(qt.subarray(32),32);const dr=new $.SHA512;dr.update(Qt.subarray(32)),dr.update(Kt);const xr=dr.digest();dr.clean(),At(xr),dt(Ht,xr),mt(Qt,Ht),dr.reset(),dr.update(Qt.subarray(0,32)),dr.update(Wt.subarray(32)),dr.update(Kt);const pr=dr.digest();At(pr);for(let kr=0;kr<32;kr++)Jt[kr]=xr[kr];for(let kr=0;kr<32;kr++)for(let Ir=0;Ir<32;Ir++)Jt[kr+Ir]+=pr[kr]*qt[Ir];return xt(Qt.subarray(32),Jt),Qt}_.sign=wt;function Ot(Wt,Kt){const Jt=et(),Ht=et(),qt=et(),Qt=et(),dr=et(),xr=et(),pr=et();return ht(Wt[2],nt),Lt(Wt[1],Kt),Mt(qt,Wt[1]),jt(Qt,qt,it),Ut(qt,qt,Wt[2]),Nt(Qt,Wt[2],Qt),Mt(dr,Qt),Mt(xr,dr),jt(pr,xr,dr),jt(Jt,pr,qt),jt(Jt,Jt,Qt),Ft(Jt,Jt),jt(Jt,Jt,qt),jt(Jt,Jt,Qt),jt(Jt,Jt,Qt),jt(Wt[0],Jt,Qt),Mt(Ht,Wt[0]),jt(Ht,Ht,Qt),Tt(Ht,qt)&&jt(Wt[0],Wt[0],ut),Mt(Ht,Wt[0]),jt(Ht,Ht,Qt),Tt(Ht,qt)?-1:(It(Wt[0])===Kt[31]>>7&&Ut(Wt[0],rt,Wt[0]),jt(Wt[3],Wt[0],Wt[1]),0)}function tr(Wt,Kt,Jt){const Ht=new Uint8Array(32),qt=[et(),et(),et(),et()],Qt=[et(),et(),et(),et()];if(Jt.length!==_.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${_.SIGNATURE_LENGTH} bytes`);if(Ot(Qt,Wt))return!1;const dr=new $.SHA512;dr.update(Jt.subarray(0,32)),dr.update(Wt),dr.update(Kt);const xr=dr.digest();return At(xr),ct(qt,Qt,xr),dt(Qt,Jt.subarray(32)),Bt(qt,Qt),mt(Ht,qt),!Pt(Jt,Ht)}_.verify=tr;function nr(Wt){let Kt=[et(),et(),et(),et()];if(Ot(Kt,Wt))throw new Error("Ed25519: invalid public key");let Jt=et(),Ht=et(),qt=Kt[1];Nt(Jt,nt,qt),Ut(Ht,nt,qt),Dt(Ht,Ht),jt(Jt,Jt,Ht);let Qt=new Uint8Array(32);return Ct(Qt,Jt),Qt}_.convertPublicKeyToX25519=nr;function ir(Wt){const Kt=(0,$.hash)(Wt.subarray(0,32));Kt[0]&=248,Kt[31]&=127,Kt[31]|=64;const Jt=new Uint8Array(Kt.subarray(0,32));return(0,j.wipe)(Kt),Jt}_.convertSecretKeyToX25519=ir})(ed25519);var bytes$3={};Object.defineProperty(bytes$3,"__esModule",{value:!0});function concat$1(){for(var _=0,a=0;a{if(!["tz1","tz2","tz3","tz4","KT1","txr1","sr1"].some($=>_.toLowerCase().startsWith($.toLowerCase())))return!1;try{bs58check$2.decode(_)}catch{return!1}return!0};async function generateGUID(){const _=random.randomBytes(16);return[_.slice(0,4),_.slice(4,6),_.slice(6,8),_.slice(8,10),_.slice(10,16)].map(function(a){return Buffer$g.from(a).toString("hex")}).join("-")}const CONTRACT_PREFIX="KT1",secretbox_NONCEBYTES=24,secretbox_MACBYTES=16;var BeaconMessageType;(function(_){_.BlockchainRequest="blockchain_request",_.PermissionRequest="permission_request",_.SignPayloadRequest="sign_payload_request",_.OperationRequest="operation_request",_.BroadcastRequest="broadcast_request",_.ChangeAccountRequest="change_account_request",_.BlockchainResponse="blockchain_response",_.PermissionResponse="permission_response",_.SignPayloadResponse="sign_payload_response",_.ProofOfEventChallengeRequest="proof_of_event_challenge_request",_.ProofOfEventChallengeResponse="proof_of_event_challenge_response",_.SimulatedProofOfEventChallengeRequest="simulated_proof_of_event_challenge_request",_.SimulatedProofOfEventChallengeResponse="simulated_proof_of_event_challenge_response",_.OperationResponse="operation_response",_.BroadcastResponse="broadcast_response",_.Acknowledge="acknowledge",_.Disconnect="disconnect",_.Error="error"})(BeaconMessageType||(BeaconMessageType={}));var PermissionScope;(function(_){_.SIGN="sign",_.OPERATION_REQUEST="operation_request",_.ENCRYPT="encrypt",_.NOTIFICATION="notification",_.THRESHOLD="threshold"})(PermissionScope||(PermissionScope={}));var NetworkType;(function(_){_.MAINNET="mainnet",_.GHOSTNET="ghostnet",_.WEEKLYNET="weeklynet",_.DAILYNET="dailynet",_.DELPHINET="delphinet",_.EDONET="edonet",_.FLORENCENET="florencenet",_.GRANADANET="granadanet",_.HANGZHOUNET="hangzhounet",_.ITHACANET="ithacanet",_.JAKARTANET="jakartanet",_.KATHMANDUNET="kathmandunet",_.LIMANET="limanet",_.MUMBAINET="mumbainet",_.NAIROBINET="nairobinet",_.OXFORDNET="oxfordnet",_.PARISNET="parisnet",_.CUSTOM="custom"})(NetworkType||(NetworkType={}));var TezosOperationType;(function(_){_.ORIGINATION="origination",_.DELEGATION="delegation",_.REVEAL="reveal",_.TRANSACTION="transaction",_.ACTIVATE_ACCOUNT="activate_account",_.ENDORSEMENT="endorsement",_.SEED_NONCE_REVELATION="seed_nonce_revelation",_.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",_.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",_.PROPOSALS="proposals",_.BALLOT="ballot",_.ATTESTATION="attestation",_.PREATTESTATION="preattestation",_.PREENDORSEMENT="preendorsement",_.SET_DEPOSITS_LIMIT="set_deposits_limit",_.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",_.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",_.ATTESTATION_WITH_SLOT="attestation_with_slot",_.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",_.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",_.FAILING_NOOP="failing_noop",_.REGISTER_GLOBAL_CONSTANT="register_global_constant",_.TRANSFER_TICKET="transfer_ticket",_.INCREASE_PAID_STORAGE="increase_paid_storage",_.UPDATE_CONSENSUS_KEY="update_consensus_key",_.DRAIN_DELEGATE="drain_delegate",_.VDF_REVELATION="vdf_revelation",_.EVENT="event",_.TICKET_UPDATES="ticket_updates",_.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",_.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",_.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",_.SMART_ROLLUP_PUBLISH="smart_rollup_publish",_.SMART_ROLLUP_CEMENT="smart_rollup_cement",_.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",_.SMART_ROLLUP_REFUTE="smart_rollup_refute",_.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout",_.DAL_PUBLISH_COMMITMENT="dal_publish_commitment"})(TezosOperationType||(TezosOperationType={}));var Origin;(function(_){_.WEBSITE="website",_.EXTENSION="extension",_.P2P="p2p",_.WALLETCONNECT="walletconnect"})(Origin||(Origin={}));var ExtensionMessageTarget;(function(_){_.BACKGROUND="toBackground",_.PAGE="toPage",_.EXTENSION="toExtension"})(ExtensionMessageTarget||(ExtensionMessageTarget={}));var BeaconErrorType;(function(_){_.BROADCAST_ERROR="BROADCAST_ERROR",_.NETWORK_NOT_SUPPORTED="NETWORK_NOT_SUPPORTED",_.NO_ADDRESS_ERROR="NO_ADDRESS_ERROR",_.NO_PRIVATE_KEY_FOUND_ERROR="NO_PRIVATE_KEY_FOUND_ERROR",_.NOT_GRANTED_ERROR="NOT_GRANTED_ERROR",_.PARAMETERS_INVALID_ERROR="PARAMETERS_INVALID_ERROR",_.TOO_MANY_OPERATIONS="TOO_MANY_OPERATIONS",_.TRANSACTION_INVALID_ERROR="TRANSACTION_INVALID_ERROR",_.SIGNATURE_TYPE_NOT_SUPPORTED="SIGNATURE_TYPE_NOT_SUPPORTED",_.ABORTED_ERROR="ABORTED_ERROR",_.UNKNOWN_ERROR="UNKNOWN_ERROR"})(BeaconErrorType||(BeaconErrorType={}));var TransportStatus;(function(_){_.NOT_CONNECTED="NOT_CONNECTED",_.CONNECTING="CONNECTING",_.CONNECTED="CONNECTED"})(TransportStatus||(TransportStatus={}));var TransportType;(function(_){_.CHROME_MESSAGE="chrome_message",_.WALLETCONNECT="walletconnect",_.POST_MESSAGE="post_message",_.LEDGER="ledger",_.P2P="p2p"})(TransportType||(TransportType={}));class Storage{static isSupported(){return Promise.resolve(!1)}}var StorageKey;(function(_){_.TRANSPORT_P2P_PEERS_DAPP="beacon:communication-peers-dapp",_.TRANSPORT_P2P_PEERS_WALLET="beacon:communication-peers-wallet",_.TRANSPORT_POSTMESSAGE_PEERS_DAPP="beacon:postmessage-peers-dapp",_.TRANSPORT_POSTMESSAGE_PEERS_WALLET="beacon:postmessage-peers-wallet",_.TRANSPORT_WALLETCONNECT_PEERS_DAPP="beacon:walletconnect-peers-dapp",_.LAST_SELECTED_WALLET="beacon:last-selected-wallet",_.ACCOUNTS="beacon:accounts",_.ACTIVE_ACCOUNT="beacon:active-account",_.PUSH_TOKENS="beacon:push-tokens",_.BEACON_SDK_SECRET_SEED="beacon:sdk-secret-seed",_.APP_METADATA_LIST="beacon:app-metadata-list",_.PERMISSION_LIST="beacon:permissions",_.ONGOING_PROOF_OF_EVENT_CHALLENGES="beacon:ongoing-proof-of-event-challenges",_.BEACON_SDK_VERSION="beacon:sdk_version",_.MATRIX_PRESERVED_STATE="beacon:sdk-matrix-preserved-state",_.MATRIX_PEER_ROOM_IDS="beacon:matrix-peer-rooms",_.MATRIX_SELECTED_NODE="beacon:matrix-selected-node",_.MULTI_NODE_SETUP_DONE="beacon:multi-node-setup",_.USER_ID="beacon:user-id",_.ENABLE_METRICS="beacon:enable_metrics",_.WC_2_CORE_PAIRING="wc@2:core:0.3:pairing",_.WC_2_CLIENT_SESSION="wc@2:client:0.3:session",_.WC_2_CORE_KEYCHAIN="wc@2:core:0.3:keychain",_.WC_2_CORE_MESSAGES="wc@2:core:0.3:messages",_.WC_2_CLIENT_PROPOSAL="wc@2:client:0.3:proposal",_.WC_2_CORE_SUBSCRIPTION="wc@2:core:0.3:subscription",_.WC_2_CORE_HISTORY="wc@2:core:0.3:history",_.WC_2_CORE_EXPIRER="wc@2:core:0.3:expirer"})(StorageKey||(StorageKey={}));const defaultValues={[StorageKey.TRANSPORT_P2P_PEERS_DAPP]:[],[StorageKey.TRANSPORT_P2P_PEERS_WALLET]:[],[StorageKey.TRANSPORT_POSTMESSAGE_PEERS_DAPP]:[],[StorageKey.TRANSPORT_POSTMESSAGE_PEERS_WALLET]:[],[StorageKey.TRANSPORT_WALLETCONNECT_PEERS_DAPP]:[],[StorageKey.LAST_SELECTED_WALLET]:void 0,[StorageKey.ACCOUNTS]:[],[StorageKey.ACTIVE_ACCOUNT]:void 0,[StorageKey.PUSH_TOKENS]:[],[StorageKey.BEACON_SDK_SECRET_SEED]:void 0,[StorageKey.APP_METADATA_LIST]:[],[StorageKey.PERMISSION_LIST]:[],[StorageKey.ONGOING_PROOF_OF_EVENT_CHALLENGES]:[],[StorageKey.BEACON_SDK_VERSION]:void 0,[StorageKey.MATRIX_PRESERVED_STATE]:{},[StorageKey.MATRIX_PEER_ROOM_IDS]:{},[StorageKey.MATRIX_SELECTED_NODE]:void 0,[StorageKey.MULTI_NODE_SETUP_DONE]:void 0,[StorageKey.WC_2_CLIENT_SESSION]:void 0,[StorageKey.USER_ID]:void 0,[StorageKey.ENABLE_METRICS]:void 0,[StorageKey.WC_2_CORE_PAIRING]:void 0,[StorageKey.WC_2_CORE_KEYCHAIN]:void 0,[StorageKey.WC_2_CORE_MESSAGES]:void 0,[StorageKey.WC_2_CLIENT_PROPOSAL]:void 0,[StorageKey.WC_2_CORE_SUBSCRIPTION]:void 0,[StorageKey.WC_2_CORE_HISTORY]:void 0,[StorageKey.WC_2_CORE_EXPIRER]:void 0};class P2PPairingRequest{constructor(a,$,j,et,tt,rt,nt){Yr(this,"type","p2p-pairing-request");Yr(this,"relayServer");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.relayServer=tt}}class ExtendedP2PPairingRequest extends P2PPairingRequest{constructor($,j,et,tt,rt,nt,it,ot){super($,j,et,tt,rt,it,ot);Yr(this,"senderId");this.senderId=nt}}var SigningType;(function(_){_.RAW="raw",_.OPERATION="operation",_.MICHELINE="micheline"})(SigningType||(SigningType={}));class P2PPairingResponse{constructor(a,$,j,et,tt,rt,nt){Yr(this,"type","p2p-pairing-request");Yr(this,"relayServer");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.relayServer=tt}}class PostMessagePairingRequest{constructor(a,$,j,et,tt,rt){Yr(this,"type","postmessage-pairing-request");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=tt,this.appUrl=rt,this.publicKey=j,this.version=et}}class ExtendedPostMessagePairingRequest extends PostMessagePairingRequest{constructor($,j,et,tt,rt,nt,it){super($,j,et,tt,nt,it);Yr(this,"senderId");this.senderId=rt}}class WalletConnectPairingRequest{constructor(a,$,j,et,tt,rt,nt){Yr(this,"type","walletconnect-pairing-request");Yr(this,"uri");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.uri=tt}}class ExtendedWalletConnectPairingRequest extends WalletConnectPairingRequest{constructor($,j,et,tt,rt,nt,it,ot){super($,j,et,tt,nt,it,ot);Yr(this,"senderId");this.senderId=rt}}var ColorMode;(function(_){_.LIGHT="light",_.DARK="dark"})(ColorMode||(ColorMode={}));var Regions;(function(_){_.EUROPE_EAST="europe-east",_.EUROPE_WEST="europe-west",_.NORTH_AMERICA_EAST="north-america-east",_.NORTH_AMERICA_WEST="north-america-west",_.CENTRAL_AMERICA="central-america",_.SOUTH_AMERICA="south-america",_.ASIA_EAST="asia-east",_.ASIA_WEST="asia-west",_.AFRICA="africa",_.AUSTRALIA="australia"})(Regions||(Regions={}));const SDK_VERSION="4.2.2",BEACON_VERSION="3",NOTIFICATION_ORACLE_URL="https://beacon-notification-oracle.dev.gke.papers.tech",cbs=[_=>{}];let windowRef={postMessage:(_,a)=>{console.log("GOT MOCK POST MESSAGE",_),cbs.forEach($=>{$({data:_})})},addEventListener:(_,a)=>{cbs.push(a)},removeEventListener:(_,a)=>{cbs.splice(cbs.indexOf($=>$===a),1)},location:{origin:"*"}};try{typeof window<"u"&&(windowRef=window)}catch(_){console.log(`not defined: ${_}`)}class MockAnalytics{track(a,$,j,et){}}class BeaconClient{constructor(a){Yr(this,"name");Yr(this,"iconUrl");Yr(this,"appUrl");Yr(this,"_beaconId",new ExposedPromise);Yr(this,"storage");Yr(this,"analytics");Yr(this,"_keyPair",new ExposedPromise);if(!a.name)throw new Error("Name not set");if(!a.storage)throw new Error("Storage not set");this.name=a.name,this.iconUrl=a.iconUrl,this.appUrl=a.appUrl??windowRef.location.origin,this.storage=a.storage,this.analytics=a.analytics??new MockAnalytics,windowRef.beaconCreatedClientInstance?console.error("[BEACON] It looks like you created multiple Beacon SDK Client instances. This can lead to problems. Only create one instance and re-use it everywhere."):windowRef.beaconCreatedClientInstance=!0,this.initSDK().catch(console.error)}get beaconId(){return this._beaconId.promise}get keyPair(){return this._keyPair.promise}async destroy(){await this.removeBeaconEntriesFromStorage(),windowRef.beaconCreatedClientInstance=!1}async initSDK(){return this.storage.set(StorageKey.BEACON_SDK_VERSION,SDK_VERSION).catch(console.error),this.loadOrCreateBeaconSecret().catch(console.error),this.keyPair.then(a=>{this._beaconId.resolve(toHex$1(a.publicKey))})}async removeBeaconEntriesFromStorage(){const a=Object.values(StorageKey);await Promise.all(a.map($=>this.storage.delete($)))}async loadOrCreateBeaconSecret(){const a=await this.storage.get(StorageKey.BEACON_SDK_SECRET_SEED);if(a&&typeof a=="string")this._keyPair.resolve(await getKeypairFromSeed(a));else{const $=await generateGUID();await this.storage.set(StorageKey.BEACON_SDK_SECRET_SEED,$),this._keyPair.resolve(await getKeypairFromSeed($))}}}function fixArrayType(_){return _}class StorageManager{constructor(a,$){Yr(this,"storage");Yr(this,"storageKey");this.storage=a,this.storageKey=$}async getAll(){return await this.storage.get(this.storageKey)??[]}async getOne(a){const $=await this.storage.get(this.storageKey);return $.find(a)}async addOne(a,$,j=!0){const et=await this.storage.get(this.storageKey);if(!et.some($))et.push(a);else if(j)for(let tt=0;tt!a(et));return this.storage.set(this.storageKey,j)}async removeAll(){return this.storage.delete(this.storageKey)}}const getAccountIdentifier=async(_,a)=>{const $=[_,a.type];a.name&&$.push(`name:${a.name}`),a.rpcUrl&&$.push(`rpc:${a.rpcUrl}`);const j=Buffer$g.from(blake2b$1.hash(encode_1($.join("-")),10));return bs58check$2.encode(j)};class PermissionValidator{static async hasPermission(a,$,j){switch(a.type){case BeaconMessageType.PermissionRequest:case BeaconMessageType.BroadcastRequest:return!0;case BeaconMessageType.OperationRequest:{const et=await getAccountIdentifier(a.sourceAddress,a.network),tt=await $(et);return tt?tt.scopes.includes(PermissionScope.OPERATION_REQUEST):!1}case BeaconMessageType.SignPayloadRequest:{const tt=(await j()).filter(rt=>rt.address===a.sourceAddress);return tt.length===0?!1:tt.some(rt=>rt.scopes.includes(PermissionScope.SIGN))}default:throw new Error("Message not handled")}}}class AccountManager{constructor(a){Yr(this,"storageManager");this.storageManager=new StorageManager(a,StorageKey.ACCOUNTS)}async getAccounts(){return await this.storageManager.getAll()??[]}async getAccount(a){return this.storageManager.getOne($=>$.accountIdentifier===a)}async addAccount(a){return this.storageManager.addOne(a,$=>$.accountIdentifier===a.accountIdentifier)}async updateAccount(a,$){const j=await this.getAccount(a);if(!j)return;const et={...j,...$};return await this.storageManager.addOne(et,tt=>tt.accountIdentifier===a,!0),et}async removeAccount(a){return this.storageManager.remove($=>$.accountIdentifier===a)}async removeAccounts(a){return this.storageManager.remove($=>a.includes($.accountIdentifier))}async removeAllAccounts(){return this.storageManager.removeAll()}async hasPermission(a){return PermissionValidator.hasPermission(a,this.getAccount.bind(this),this.getAccounts.bind(this))}}const isHex$1=_=>/^[A-F0-9]+$/i.test(_),getSenderId=async _=>{isHex$1(_)||console.error("PublicKey needs to be in hex format!");const a=Buffer$g.from(blake2b$1.hash(Buffer$g.from(_,"hex"),5));return bs58check$2.encode(a)};let debug$2=!!windowRef.beaconSdkDebugEnabled;debug$2&&console.log("[BEACON]: Debug mode is ON (turned on either by the developer or a browser extension)");const getDebugEnabled=()=>debug$2;class InternalLogger{constructor(){}debug(a,$,...j){this._log("debug",a,$,j)}log(a,$,...j){this._log("log",a,$,j)}warn(a,$,...j){this._log("warn",a,$,j)}error(a,$,...j){this._log("error",a,$,j)}time(a,$){a?console.time($):console.timeEnd($)}timeLog(a,$,...j){this._log("timeLog",a,$,j)}_log(a,$,j,et=[]){if(!getDebugEnabled())return;let tt=`[BEACON] ${new Date().toISOString()} [${$}](${j})`,rt=et;switch(et[0]&&typeof et[0]=="string"&&(tt+=` ${et[0]}`,rt=et.slice(1)),a){case"error":console.group(tt),console.error(...rt);break;case"warn":console.group(tt),console.warn(...rt);break;case"debug":console.groupCollapsed(tt),console.debug(...rt);break;case"timeLog":console.group(tt),console.timeLog(...rt);break;default:console.group(tt),console.log(...rt)}console.groupEnd()}}class Logger{constructor(a){Yr(this,"name");this.name=a}debug(a,...$){logger$9.debug(this.name,a,$)}log(a,...$){logger$9.log(this.name,a,$)}warn(a,...$){logger$9.warn(this.name,a,$)}error(a,...$){logger$9.error(this.name,a,$)}time(a,$){logger$9.time(a,$)}timeLog(a,...$){logger$9.timeLog(a,$)}}let logger$9=new InternalLogger;const logger$8=new Logger("Client");class Client extends BeaconClient{constructor($){super($);Yr(this,"accountManager");Yr(this,"handleResponse");Yr(this,"rateLimit",2);Yr(this,"rateLimitWindowInSeconds",5);Yr(this,"requestCounter",[]);Yr(this,"matrixNodes");Yr(this,"transportListeners",new Map);Yr(this,"_transport",new ExposedPromise);this.accountManager=new AccountManager($.storage),this.matrixNodes=$.matrixNodes??{},this.handleResponse=(j,et)=>{throw new Error(`not overwritten${JSON.stringify(j)} - ${JSON.stringify(et)}`)}}get transport(){return this._transport.promise}get connectionStatus(){var $;return(($=this._transport.promiseResult)==null?void 0:$.connectionStatus)??TransportStatus.NOT_CONNECTED}get ready(){return this.transport.then(()=>{})}async cleanup(){if(this.transportListeners.size&&this._transport.isResolved()){const $=await this.transport;await Promise.all(Array.from(this.transportListeners.values()).map(j=>$.removeListener(j))),this.transportListeners.clear()}}async getAccounts(){return this.accountManager.getAccounts()}async getAccount($){return this.accountManager.getAccount($)}async removeAccount($){return this.accountManager.removeAccount($)}async removeAllAccounts(){return this.accountManager.removeAllAccounts()}async addRequestAndCheckIfRateLimited(){const $=new Date().getTime();return this.requestCounter=this.requestCounter.filter(j=>j+this.rateLimitWindowInSeconds*1e3>$),this.requestCounter.push($),this.requestCounter.length>this.rateLimit}async init($){return this._transport.isResolved()?(await this.transport).type:(await this.setTransport($),$.type)}async getOwnAppMetadata(){return{senderId:await getSenderId(await this.beaconId),name:this.name,icon:this.iconUrl}}async getPeers(){return(await this.transport).getPeers()}async addPeer($){return(await this.transport).addPeer($)}async destroy(){if(this._transport.isResolved()){const $=await this.transport;await this.cleanup(),await $.disconnect(),$.type===TransportType.WALLETCONNECT&&await $.doClientCleanup()}await super.destroy()}async setTransport($){$?this._transport.isSettled()?this._transport=ExposedPromise.resolve($):this._transport.resolve($):this._transport.isSettled()&&(this._transport=new ExposedPromise)}async addListener($){this.transportListeners.has($.type)&&await $.removeListener(this.transportListeners.get($.type));const j=async(et,tt)=>{if(typeof et=="string"){const rt=await new Serializer().deserialize(et);this.handleResponse(rt,tt)}};this.transportListeners.set($.type,j),$.addListener(j).catch(et=>logger$8.error("addListener",et))}async sendDisconnectToPeer($,j){const et={id:await generateGUID(),version:$.version,senderId:await getSenderId(await this.beaconId),type:BeaconMessageType.Disconnect},tt=await new Serializer().serialize(et);await(j??await this.transport).send(tt,$)}}const logger$7=new Logger("Transport");let Transport$2=class{constructor(a,$,j){Yr(this,"type",TransportType.POST_MESSAGE);Yr(this,"name");Yr(this,"_isConnected",TransportStatus.NOT_CONNECTED);Yr(this,"peerManager");Yr(this,"client");Yr(this,"newPeerListener");Yr(this,"listeners",[]);this.name=a,this.client=$,this.peerManager=j}setEventHandler(a,$){this.client.eventHandlers.set(a,$)}get connectionStatus(){return this._isConnected}static async isAvailable(){return Promise.resolve(!1)}async connect(){logger$7.log("connect"),this._isConnected=TransportStatus.CONNECTED}async disconnect(){logger$7.log("disconnect"),this._isConnected=TransportStatus.NOT_CONNECTED}async send(a,$){if($)return this.client.sendMessage(a,$);{const et=(await this.getPeers()).map(tt=>this.client.sendMessage(a,tt));return(await Promise.all(et))[0]}}async addListener(a){logger$7.debug("addListener"),this.listeners.push(a)}async removeListener(a){logger$7.log("removeListener"),this.listeners=this.listeners.filter($=>$!==a)}async getPeers(){return this.peerManager.getPeers()}async addPeer(a,$=!0){logger$7.log("addPeer","adding peer",a),await this.peerManager.addPeer(a),await this.listen(a.publicKey)}async removePeer(a){logger$7.log("removePeer","removing peer",a),await this.peerManager.removePeer(a.publicKey),this.client&&await this.client.unsubscribeFromEncryptedMessage(a.publicKey)}async removeAllPeers(){logger$7.log("removeAllPeers"),await this.peerManager.removeAllPeers(),this.client&&await this.client.unsubscribeFromEncryptedMessages()}async notifyListeners(a,$){this.listeners.length===0?logger$7.warn("notifyListeners","0 listeners notified!",this):logger$7.log("notifyListeners",`Notifying ${this.listeners.length} listeners`,this),this.listeners.forEach(j=>{j(a,$)})}};class LocalStorage extends Storage{constructor($){super();Yr(this,"prefix");this.prefix=$}static async isSupported(){return Promise.resolve(typeof window<"u"&&!!window.localStorage)}async get($){const j=localStorage.getItem(this.getPrefixedKey($));if(j)try{return JSON.parse(j)}catch{return j}else return typeof defaultValues[$]=="object"?JSON.parse(JSON.stringify(defaultValues[$])):defaultValues[$]}async set($,j){return typeof j=="string"?localStorage.setItem(this.getPrefixedKey($),j):localStorage.setItem(this.getPrefixedKey($),JSON.stringify(j))}async delete($){return Promise.resolve(localStorage.removeItem(this.getPrefixedKey($)))}async subscribeToStorageChanged($){window.addEventListener("storage",j=>{j.key?$({eventType:"entryModified",key:this.getPrefixedKey(j.key),oldValue:j.oldValue,newValue:j.newValue}):$({eventType:"storageCleared",key:null,oldValue:null,newValue:null})},!1)}getPrefixedKey($){return this.prefix?`${this.prefix}-${$}`:$}}class Serializer{async serialize(a){const $=JSON.stringify(a);return bs58check$2.encode(Buffer$g.from($))}async deserialize(a){if(typeof a!="string")throw new Error("Encoded payload needs to be a string");return JSON.parse(bs58check$2.decode(a).toString())}}class AppMetadataManager{constructor(a){Yr(this,"storageManager");this.storageManager=new StorageManager(a,StorageKey.APP_METADATA_LIST)}async getAppMetadataList(){return await this.storageManager.getAll()??[]}async getAppMetadata(a){return this.storageManager.getOne($=>$.senderId===a)}async addAppMetadata(a){return this.storageManager.addOne(a,$=>$.senderId===a.senderId)}async removeAppMetadata(a){return this.storageManager.remove($=>$.senderId===a)}async removeAppMetadatas(a){return this.storageManager.remove($=>a.includes($.senderId))}async removeAllAppMetadata(){return this.storageManager.removeAll()}}class PermissionManager{constructor(a){Yr(this,"storageManager");this.storageManager=new StorageManager(a,StorageKey.PERMISSION_LIST)}async getPermissions(){return await this.storageManager.getAll()??[]}async getPermission(a){return this.storageManager.getOne($=>$.accountIdentifier===a)}async addPermission(a){return this.storageManager.addOne(a,$=>$.accountIdentifier===a.accountIdentifier&&$.senderId===a.senderId)}async removePermission(a){return this.storageManager.remove($=>$.accountIdentifier===a)}async removePermissions(a){return this.storageManager.remove($=>a.includes($.accountIdentifier))}async removeAllPermissions(){return this.storageManager.removeAll()}async hasPermission(a){return PermissionValidator.hasPermission(a,this.getPermission.bind(this),this.getPermissions.bind(this))}}class PeerManager{constructor(a,$){Yr(this,"storageManager");this.storageManager=new StorageManager(a,$)}async hasPeer(a){return!!await this.getPeer(a)}async getPeers(){return await this.storageManager.getAll()??[]}async getPeer(a){return this.storageManager.getOne($=>$.publicKey===a)}async addPeer(a){return this.storageManager.addOne(a,$=>$.publicKey===a.publicKey)}async removePeer(a){return this.storageManager.remove($=>$.publicKey===a)}async removePeers(a){return this.storageManager.remove($=>a.includes($.publicKey))}async removeAllPeers(){return this.storageManager.removeAll()}}var x25519Session={},keyagreement={},hasRequiredKeyagreement;function requireKeyagreement(){return hasRequiredKeyagreement||(hasRequiredKeyagreement=1,function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.X25519Session=_.SECRET_SEED_LENGTH=_.SAVED_STATE_LENGTH=_.ACCEPT_MESSAGE_LENGTH=_.OFFER_MESSAGE_LENGTH=void 0;const a=random,$=wipe$1,j=x25519,et=requireX25519Session();_.OFFER_MESSAGE_LENGTH=j.PUBLIC_KEY_LENGTH,_.ACCEPT_MESSAGE_LENGTH=j.PUBLIC_KEY_LENGTH,_.SAVED_STATE_LENGTH=j.SECRET_KEY_LENGTH,_.SECRET_SEED_LENGTH=j.SECRET_KEY_LENGTH;class tt{constructor(nt,it){this.offerMessageLength=_.OFFER_MESSAGE_LENGTH,this.acceptMessageLength=_.ACCEPT_MESSAGE_LENGTH,this.sharedKeyLength=j.SHARED_KEY_LENGTH,this.savedStateLength=_.SAVED_STATE_LENGTH,this._seed=nt||(0,a.randomBytes)(j.SECRET_KEY_LENGTH,it)}saveState(){return new Uint8Array(this._seed)}restoreState(nt){return this._seed=new Uint8Array(nt),this}clean(){this._seed&&(0,$.wipe)(this._seed),this._keyPair&&((0,$.wipe)(this._keyPair.secretKey),(0,$.wipe)(this._keyPair.publicKey)),this._sharedKey&&(0,$.wipe)(this._sharedKey),this._sessionKeys&&((0,$.wipe)(this._sessionKeys.receive),(0,$.wipe)(this._sessionKeys.send))}offer(){return this._keyPair=(0,j.generateKeyPairFromSeed)(this._seed),new Uint8Array(this._keyPair.publicKey)}accept(nt){if(this._keyPair)throw new Error("X25519Session: accept shouldn't be called by offering party");if(nt.length!==this.offerMessageLength)throw new Error("X25519Session: incorrect offer message length");if(this._sharedKey)throw new Error("X25519Session: accept was already called");const it=(0,j.generateKeyPairFromSeed)(this._seed);return this._sharedKey=(0,j.sharedKey)(it.secretKey,nt),this._sessionKeys=(0,et.clientSessionKeysFromSharedKey)(this._sharedKey,it.publicKey,nt),(0,$.wipe)(it.secretKey),it.publicKey}finish(nt){if(nt.length!==this.acceptMessageLength)throw new Error("X25519Session: incorrect accept message length");if(!this._keyPair)throw new Error("X25519Session: no offer state");if(this._sharedKey)throw new Error("X25519Session: finish was already called");return this._sharedKey=(0,j.sharedKey)(this._keyPair.secretKey,nt),this._sessionKeys=(0,et.serverSessionKeysFromSharedKey)(this._sharedKey,this._keyPair.publicKey,nt),this}getSharedKey(){if(!this._sharedKey)throw new Error("X25519Session: no shared key established");return new Uint8Array(this._sharedKey)}getSessionKeys(){if(!this._sessionKeys)throw new Error("X25519Session: no shared key established");return{receive:new Uint8Array(this._sessionKeys.receive),send:new Uint8Array(this._sessionKeys.send)}}}_.X25519Session=tt}(keyagreement)),keyagreement}var hasRequiredX25519Session;function requireX25519Session(){return hasRequiredX25519Session||(hasRequiredX25519Session=1,function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.clientSessionKeys=_.serverSessionKeys=_.clientSessionKeysFromSharedKey=_.serverSessionKeysFromSharedKey=_.X25519Session=void 0;const a=blake2b$1,$=x25519;var j=requireKeyagreement();Object.defineProperty(_,"X25519Session",{enumerable:!0,get:function(){return j.X25519Session}});const et=32;function tt(ot,st,at,ut=a.BLAKE2b){const ht=new ut;if(ht.digestLength!==et*2)throw new Error("X25519: incorrect digest length");const bt=ht.update(ot).update(at).update(st).digest();return{send:bt.subarray(0,et),receive:bt.subarray(et)}}_.serverSessionKeysFromSharedKey=tt;function rt(ot,st,at,ut=a.BLAKE2b){const ht=new ut;if(ht.digestLength!==et*2)throw new Error("X25519: incorrect digest length");const bt=ht.update(ot).update(st).update(at).digest();return{receive:bt.subarray(0,et),send:bt.subarray(et)}}_.clientSessionKeysFromSharedKey=rt;function nt(ot,st,at=a.BLAKE2b){const ut=(0,$.sharedKey)(ot.secretKey,st);return tt(ut,ot.publicKey,st,at)}_.serverSessionKeys=nt;function it(ot,st,at=a.BLAKE2b){const ut=(0,$.sharedKey)(ot.secretKey,st);return rt(ut,ot.publicKey,st,at)}_.clientSessionKeys=it}(x25519Session)),x25519Session}var x25519SessionExports=requireX25519Session();class CommunicationClient{constructor(a){Yr(this,"keyPair");Yr(this,"eventHandlers",new Map);Yr(this,"isMobileOS",()=>/(Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet|Windows Phone|SymbianOS|Kindle)/i.test(navigator.userAgent));this.keyPair=a}async getPublicKey(){var a;return toHex$1((a=this.keyPair)==null?void 0:a.publicKey)}async getPublicKeyHash(){return getHexHash(this.keyPair.publicKey)}async createCryptoBoxServer(a,$){return x25519SessionExports.serverSessionKeys({publicKey:ed25519.convertPublicKeyToX25519($.publicKey),secretKey:ed25519.convertSecretKeyToX25519($.secretKey)},ed25519.convertPublicKeyToX25519(Buffer$g.from(a,"hex")))}async createCryptoBoxClient(a,$){return x25519SessionExports.clientSessionKeys({publicKey:ed25519.convertPublicKeyToX25519($.publicKey),secretKey:ed25519.convertSecretKeyToX25519($.secretKey)},ed25519.convertPublicKeyToX25519(Buffer$g.from(a,"hex")))}async encryptMessageAsymmetric(a,$){return sealCryptobox($,Buffer$g.from(a,"hex"))}}function bind$5(_,a){return function(){return _.apply(a,arguments)}}const{toString:toString$3}=Object.prototype,{getPrototypeOf:getPrototypeOf$4}=Object,kindOf$1=(_=>a=>{const $=toString$3.call(a);return _[$]||(_[$]=$.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest$1=_=>(_=_.toLowerCase(),a=>kindOf$1(a)===_),typeOfTest$1=_=>a=>typeof a===_,{isArray:isArray$4}=Array,isUndefined$1=typeOfTest$1("undefined");function isBuffer$2(_){return _!==null&&!isUndefined$1(_)&&_.constructor!==null&&!isUndefined$1(_.constructor)&&isFunction$3(_.constructor.isBuffer)&&_.constructor.isBuffer(_)}const isArrayBuffer$1=kindOfTest$1("ArrayBuffer");function isArrayBufferView$1(_){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(_):a=_&&_.buffer&&isArrayBuffer$1(_.buffer),a}const isString$2=typeOfTest$1("string"),isFunction$3=typeOfTest$1("function"),isNumber$1=typeOfTest$1("number"),isObject$3=_=>_!==null&&typeof _=="object",isBoolean$2=_=>_===!0||_===!1,isPlainObject$5=_=>{if(kindOf$1(_)!=="object")return!1;const a=getPrototypeOf$4(_);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in _)&&!(Symbol.iterator in _)},isDate$2=kindOfTest$1("Date"),isFile$1=kindOfTest$1("File"),isBlob$1=kindOfTest$1("Blob"),isFileList$1=kindOfTest$1("FileList"),isStream$1=_=>isObject$3(_)&&isFunction$3(_.pipe),isFormData$1=_=>{let a;return _&&(typeof FormData=="function"&&_ instanceof FormData||isFunction$3(_.append)&&((a=kindOf$1(_))==="formdata"||a==="object"&&isFunction$3(_.toString)&&_.toString()==="[object FormData]"))},isURLSearchParams$1=kindOfTest$1("URLSearchParams"),trim$2=_=>_.trim?_.trim():_.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(_,a,{allOwnKeys:$=!1}={}){if(_===null||typeof _>"u")return;let j,et;if(typeof _!="object"&&(_=[_]),isArray$4(_))for(j=0,et=_.length;j0;)if(et=$[j],a===et.toLowerCase())return et;return null}const _global$1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined$1=_=>!isUndefined$1(_)&&_!==_global$1;function merge$1(){const{caseless:_}=isContextDefined$1(this)&&this||{},a={},$=(j,et)=>{const tt=_&&findKey$2(a,et)||et;isPlainObject$5(a[tt])&&isPlainObject$5(j)?a[tt]=merge$1(a[tt],j):isPlainObject$5(j)?a[tt]=merge$1({},j):isArray$4(j)?a[tt]=j.slice():a[tt]=j};for(let j=0,et=arguments.length;j(forEach$1(a,(et,tt)=>{$&&isFunction$3(et)?_[tt]=bind$5(et,$):_[tt]=et},{allOwnKeys:j}),_),stripBOM$1=_=>(_.charCodeAt(0)===65279&&(_=_.slice(1)),_),inherits$7=(_,a,$,j)=>{_.prototype=Object.create(a.prototype,j),_.prototype.constructor=_,Object.defineProperty(_,"super",{value:a.prototype}),$&&Object.assign(_.prototype,$)},toFlatObject$1=(_,a,$,j)=>{let et,tt,rt;const nt={};if(a=a||{},_==null)return a;do{for(et=Object.getOwnPropertyNames(_),tt=et.length;tt-- >0;)rt=et[tt],(!j||j(rt,_,a))&&!nt[rt]&&(a[rt]=_[rt],nt[rt]=!0);_=$!==!1&&getPrototypeOf$4(_)}while(_&&(!$||$(_,a))&&_!==Object.prototype);return a},endsWith$1=(_,a,$)=>{_=String(_),($===void 0||$>_.length)&&($=_.length),$-=a.length;const j=_.indexOf(a,$);return j!==-1&&j===$},toArray$2=_=>{if(!_)return null;if(isArray$4(_))return _;let a=_.length;if(!isNumber$1(a))return null;const $=new Array(a);for(;a-- >0;)$[a]=_[a];return $},isTypedArray$1=(_=>a=>_&&a instanceof _)(typeof Uint8Array<"u"&&getPrototypeOf$4(Uint8Array)),forEachEntry$1=(_,a)=>{const j=(_&&_[Symbol.iterator]).call(_);let et;for(;(et=j.next())&&!et.done;){const tt=et.value;a.call(_,tt[0],tt[1])}},matchAll$1=(_,a)=>{let $;const j=[];for(;($=_.exec(a))!==null;)j.push($);return j},isHTMLForm$1=kindOfTest$1("HTMLFormElement"),toCamelCase$1=_=>_.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function($,j,et){return j.toUpperCase()+et}),hasOwnProperty$1=(({hasOwnProperty:_})=>(a,$)=>_.call(a,$))(Object.prototype),isRegExp$1=kindOfTest$1("RegExp"),reduceDescriptors$1=(_,a)=>{const $=Object.getOwnPropertyDescriptors(_),j={};forEach$1($,(et,tt)=>{let rt;(rt=a(et,tt,_))!==!1&&(j[tt]=rt||et)}),Object.defineProperties(_,j)},freezeMethods$1=_=>{reduceDescriptors$1(_,(a,$)=>{if(isFunction$3(_)&&["arguments","caller","callee"].indexOf($)!==-1)return!1;const j=_[$];if(isFunction$3(j)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+$+"'")})}})},toObjectSet$1=(_,a)=>{const $={},j=et=>{et.forEach(tt=>{$[tt]=!0})};return isArray$4(_)?j(_):j(String(_).split(a)),$},noop$7=()=>{},toFiniteNumber$1=(_,a)=>(_=+_,Number.isFinite(_)?_:a),ALPHA$1="abcdefghijklmnopqrstuvwxyz",DIGIT$1="0123456789",ALPHABET$2={DIGIT:DIGIT$1,ALPHA:ALPHA$1,ALPHA_DIGIT:ALPHA$1+ALPHA$1.toUpperCase()+DIGIT$1},generateString$1=(_=16,a=ALPHABET$2.ALPHA_DIGIT)=>{let $="";const{length:j}=a;for(;_--;)$+=a[Math.random()*j|0];return $};function isSpecCompliantForm$1(_){return!!(_&&isFunction$3(_.append)&&_[Symbol.toStringTag]==="FormData"&&_[Symbol.iterator])}const toJSONObject$1=_=>{const a=new Array(10),$=(j,et)=>{if(isObject$3(j)){if(a.indexOf(j)>=0)return;if(!("toJSON"in j)){a[et]=j;const tt=isArray$4(j)?[]:{};return forEach$1(j,(rt,nt)=>{const it=$(rt,et+1);!isUndefined$1(it)&&(tt[nt]=it)}),a[et]=void 0,tt}}return j};return $(_,0)},isAsyncFn$1=kindOfTest$1("AsyncFunction"),isThenable$2=_=>_&&(isObject$3(_)||isFunction$3(_))&&isFunction$3(_.then)&&isFunction$3(_.catch),utils$t={isArray:isArray$4,isArrayBuffer:isArrayBuffer$1,isBuffer:isBuffer$2,isFormData:isFormData$1,isArrayBufferView:isArrayBufferView$1,isString:isString$2,isNumber:isNumber$1,isBoolean:isBoolean$2,isObject:isObject$3,isPlainObject:isPlainObject$5,isUndefined:isUndefined$1,isDate:isDate$2,isFile:isFile$1,isBlob:isBlob$1,isRegExp:isRegExp$1,isFunction:isFunction$3,isStream:isStream$1,isURLSearchParams:isURLSearchParams$1,isTypedArray:isTypedArray$1,isFileList:isFileList$1,forEach:forEach$1,merge:merge$1,extend:extend$1,trim:trim$2,stripBOM:stripBOM$1,inherits:inherits$7,toFlatObject:toFlatObject$1,kindOf:kindOf$1,kindOfTest:kindOfTest$1,endsWith:endsWith$1,toArray:toArray$2,forEachEntry:forEachEntry$1,matchAll:matchAll$1,isHTMLForm:isHTMLForm$1,hasOwnProperty:hasOwnProperty$1,hasOwnProp:hasOwnProperty$1,reduceDescriptors:reduceDescriptors$1,freezeMethods:freezeMethods$1,toObjectSet:toObjectSet$1,toCamelCase:toCamelCase$1,noop:noop$7,toFiniteNumber:toFiniteNumber$1,findKey:findKey$2,global:_global$1,isContextDefined:isContextDefined$1,ALPHABET:ALPHABET$2,generateString:generateString$1,isSpecCompliantForm:isSpecCompliantForm$1,toJSONObject:toJSONObject$1,isAsyncFn:isAsyncFn$1,isThenable:isThenable$2};function AxiosError$1(_,a,$,j,et){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=_,this.name="AxiosError",a&&(this.code=a),$&&(this.config=$),j&&(this.request=j),et&&(this.response=et)}utils$t.inherits(AxiosError$1,Error,{toJSON:function _(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$t.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$3=AxiosError$1.prototype,descriptors$1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(_=>{descriptors$1[_]={value:_}});Object.defineProperties(AxiosError$1,descriptors$1);Object.defineProperty(prototype$3,"isAxiosError",{value:!0});AxiosError$1.from=(_,a,$,j,et,tt)=>{const rt=Object.create(prototype$3);return utils$t.toFlatObject(_,rt,function(it){return it!==Error.prototype},nt=>nt!=="isAxiosError"),AxiosError$1.call(rt,_.message,a,$,j,et),rt.cause=_,rt.name=_.name,tt&&Object.assign(rt,tt),rt};const httpAdapter$1=null;function isVisitable$1(_){return utils$t.isPlainObject(_)||utils$t.isArray(_)}function removeBrackets$1(_){return utils$t.endsWith(_,"[]")?_.slice(0,-2):_}function renderKey$1(_,a,$){return _?_.concat(a).map(function(et,tt){return et=removeBrackets$1(et),!$&&tt?"["+et+"]":et}).join($?".":""):a}function isFlatArray$1(_){return utils$t.isArray(_)&&!_.some(isVisitable$1)}const predicates$1=utils$t.toFlatObject(utils$t,{},null,function _(a){return/^is[A-Z]/.test(a)});function toFormData$1(_,a,$){if(!utils$t.isObject(_))throw new TypeError("target must be an object");a=a||new FormData,$=utils$t.toFlatObject($,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Et,Ct){return!utils$t.isUndefined(Ct[Et])});const j=$.metaTokens,et=$.visitor||st,tt=$.dots,rt=$.indexes,it=($.Blob||typeof Blob<"u"&&Blob)&&utils$t.isSpecCompliantForm(a);if(!utils$t.isFunction(et))throw new TypeError("visitor must be a function");function ot(bt){if(bt===null)return"";if(utils$t.isDate(bt))return bt.toISOString();if(!it&&utils$t.isBlob(bt))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$t.isArrayBuffer(bt)||utils$t.isTypedArray(bt)?it&&typeof Blob=="function"?new Blob([bt]):Buffer$g.from(bt):bt}function st(bt,Et,Ct){let Pt=bt;if(bt&&!Ct&&typeof bt=="object"){if(utils$t.endsWith(Et,"{}"))Et=j?Et:Et.slice(0,-2),bt=JSON.stringify(bt);else if(utils$t.isArray(bt)&&isFlatArray$1(bt)||(utils$t.isFileList(bt)||utils$t.endsWith(Et,"[]"))&&(Pt=utils$t.toArray(bt)))return Et=removeBrackets$1(Et),Pt.forEach(function(It,Lt){!(utils$t.isUndefined(It)||It===null)&&a.append(rt===!0?renderKey$1([Et],Lt,tt):rt===null?Et:Et+"[]",ot(It))}),!1}return isVisitable$1(bt)?!0:(a.append(renderKey$1(Ct,Et,tt),ot(bt)),!1)}const at=[],ut=Object.assign(predicates$1,{defaultVisitor:st,convertValue:ot,isVisitable:isVisitable$1});function ht(bt,Et){if(!utils$t.isUndefined(bt)){if(at.indexOf(bt)!==-1)throw Error("Circular reference detected in "+Et.join("."));at.push(bt),utils$t.forEach(bt,function(Pt,Tt){(!(utils$t.isUndefined(Pt)||Pt===null)&&et.call(a,Pt,utils$t.isString(Tt)?Tt.trim():Tt,Et,ut))===!0&&ht(Pt,Et?Et.concat(Tt):[Tt])}),at.pop()}}if(!utils$t.isObject(_))throw new TypeError("data must be an object");return ht(_),a}function encode$7(_){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(_).replace(/[!'()~]|%20|%00/g,function(j){return a[j]})}function AxiosURLSearchParams$1(_,a){this._pairs=[],_&&toFormData$1(_,this,a)}const prototype$2=AxiosURLSearchParams$1.prototype;prototype$2.append=function _(a,$){this._pairs.push([a,$])};prototype$2.toString=function _(a){const $=a?function(j){return a.call(this,j,encode$7)}:encode$7;return this._pairs.map(function(et){return $(et[0])+"="+$(et[1])},"").join("&")};function encode$6(_){return encodeURIComponent(_).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL$1(_,a,$){if(!a)return _;const j=$&&$.encode||encode$6,et=$&&$.serialize;let tt;if(et?tt=et(a,$):tt=utils$t.isURLSearchParams(a)?a.toString():new AxiosURLSearchParams$1(a,$).toString(j),tt){const rt=_.indexOf("#");rt!==-1&&(_=_.slice(0,rt)),_+=(_.indexOf("?")===-1?"?":"&")+tt}return _}let InterceptorManager$1=class{constructor(){this.handlers=[]}use(a,$,j){return this.handlers.push({fulfilled:a,rejected:$,synchronous:j?j.synchronous:!1,runWhen:j?j.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){utils$t.forEach(this.handlers,function(j){j!==null&&a(j)})}};const transitionalDefaults$1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$2=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams$1,FormData$2=typeof FormData<"u"?FormData:null,Blob$2=typeof Blob<"u"?Blob:null,platform$3={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$2,FormData:FormData$2,Blob:Blob$2},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv$1=typeof window<"u"&&typeof document<"u",hasStandardBrowserEnv$1=(_=>hasBrowserEnv$1&&["ReactNative","NativeScript","NS"].indexOf(_)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv$1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",utils$s=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hasBrowserEnv$1,hasStandardBrowserEnv:hasStandardBrowserEnv$1,hasStandardBrowserWebWorkerEnv:hasStandardBrowserWebWorkerEnv$1},Symbol.toStringTag,{value:"Module"})),platform$2={...utils$s,...platform$3};function toURLEncodedForm$1(_,a){return toFormData$1(_,new platform$2.classes.URLSearchParams,Object.assign({visitor:function($,j,et,tt){return platform$2.isNode&&utils$t.isBuffer($)?(this.append(j,$.toString("base64")),!1):tt.defaultVisitor.apply(this,arguments)}},a))}function parsePropPath$1(_){return utils$t.matchAll(/\w+|\[(\w*)]/g,_).map(a=>a[0]==="[]"?"":a[1]||a[0])}function arrayToObject$1(_){const a={},$=Object.keys(_);let j;const et=$.length;let tt;for(j=0;j=$.length;return rt=!rt&&utils$t.isArray(et)?et.length:rt,it?(utils$t.hasOwnProp(et,rt)?et[rt]=[et[rt],j]:et[rt]=j,!nt):((!et[rt]||!utils$t.isObject(et[rt]))&&(et[rt]=[]),a($,j,et[rt],tt)&&utils$t.isArray(et[rt])&&(et[rt]=arrayToObject$1(et[rt])),!nt)}if(utils$t.isFormData(_)&&utils$t.isFunction(_.entries)){const $={};return utils$t.forEachEntry(_,(j,et)=>{a(parsePropPath$1(j),et,$,0)}),$}return null}function stringifySafely$1(_,a,$){if(utils$t.isString(_))try{return(a||JSON.parse)(_),utils$t.trim(_)}catch(j){if(j.name!=="SyntaxError")throw j}return($||JSON.stringify)(_)}const defaults$2={transitional:transitionalDefaults$1,adapter:["xhr","http"],transformRequest:[function _(a,$){const j=$.getContentType()||"",et=j.indexOf("application/json")>-1,tt=utils$t.isObject(a);if(tt&&utils$t.isHTMLForm(a)&&(a=new FormData(a)),utils$t.isFormData(a))return et&&et?JSON.stringify(formDataToJSON$1(a)):a;if(utils$t.isArrayBuffer(a)||utils$t.isBuffer(a)||utils$t.isStream(a)||utils$t.isFile(a)||utils$t.isBlob(a))return a;if(utils$t.isArrayBufferView(a))return a.buffer;if(utils$t.isURLSearchParams(a))return $.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let nt;if(tt){if(j.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm$1(a,this.formSerializer).toString();if((nt=utils$t.isFileList(a))||j.indexOf("multipart/form-data")>-1){const it=this.env&&this.env.FormData;return toFormData$1(nt?{"files[]":a}:a,it&&new it,this.formSerializer)}}return tt||et?($.setContentType("application/json",!1),stringifySafely$1(a)):a}],transformResponse:[function _(a){const $=this.transitional||defaults$2.transitional,j=$&&$.forcedJSONParsing,et=this.responseType==="json";if(a&&utils$t.isString(a)&&(j&&!this.responseType||et)){const rt=!($&&$.silentJSONParsing)&&et;try{return JSON.parse(a)}catch(nt){if(rt)throw nt.name==="SyntaxError"?AxiosError$1.from(nt,AxiosError$1.ERR_BAD_RESPONSE,this,null,this.response):nt}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform$2.classes.FormData,Blob:platform$2.classes.Blob},validateStatus:function _(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$t.forEach(["delete","get","head","post","put","patch"],_=>{defaults$2.headers[_]={}});const ignoreDuplicateOf$1=utils$t.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders$1=_=>{const a={};let $,j,et;return _&&_.split(` -`).forEach(function(rt){et=rt.indexOf(":"),$=rt.substring(0,et).trim().toLowerCase(),j=rt.substring(et+1).trim(),!(!$||a[$]&&ignoreDuplicateOf$1[$])&&($==="set-cookie"?a[$]?a[$].push(j):a[$]=[j]:a[$]=a[$]?a[$]+", "+j:j)}),a},$internals$1=Symbol("internals");function normalizeHeader$1(_){return _&&String(_).trim().toLowerCase()}function normalizeValue$1(_){return _===!1||_==null?_:utils$t.isArray(_)?_.map(normalizeValue$1):String(_)}function parseTokens$1(_){const a=Object.create(null),$=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let j;for(;j=$.exec(_);)a[j[1]]=j[2];return a}const isValidHeaderName$1=_=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_.trim());function matchHeaderValue$1(_,a,$,j,et){if(utils$t.isFunction(j))return j.call(this,a,$);if(et&&(a=$),!!utils$t.isString(a)){if(utils$t.isString(j))return a.indexOf(j)!==-1;if(utils$t.isRegExp(j))return j.test(a)}}function formatHeader$1(_){return _.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,$,j)=>$.toUpperCase()+j)}function buildAccessors$1(_,a){const $=utils$t.toCamelCase(" "+a);["get","set","has"].forEach(j=>{Object.defineProperty(_,j+$,{value:function(et,tt,rt){return this[j].call(this,a,et,tt,rt)},configurable:!0})})}let AxiosHeaders$1=class{constructor(a){a&&this.set(a)}set(a,$,j){const et=this;function tt(nt,it,ot){const st=normalizeHeader$1(it);if(!st)throw new Error("header name must be a non-empty string");const at=utils$t.findKey(et,st);(!at||et[at]===void 0||ot===!0||ot===void 0&&et[at]!==!1)&&(et[at||it]=normalizeValue$1(nt))}const rt=(nt,it)=>utils$t.forEach(nt,(ot,st)=>tt(ot,st,it));return utils$t.isPlainObject(a)||a instanceof this.constructor?rt(a,$):utils$t.isString(a)&&(a=a.trim())&&!isValidHeaderName$1(a)?rt(parseHeaders$1(a),$):a!=null&&tt($,a,j),this}get(a,$){if(a=normalizeHeader$1(a),a){const j=utils$t.findKey(this,a);if(j){const et=this[j];if(!$)return et;if($===!0)return parseTokens$1(et);if(utils$t.isFunction($))return $.call(this,et,j);if(utils$t.isRegExp($))return $.exec(et);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,$){if(a=normalizeHeader$1(a),a){const j=utils$t.findKey(this,a);return!!(j&&this[j]!==void 0&&(!$||matchHeaderValue$1(this,this[j],j,$)))}return!1}delete(a,$){const j=this;let et=!1;function tt(rt){if(rt=normalizeHeader$1(rt),rt){const nt=utils$t.findKey(j,rt);nt&&(!$||matchHeaderValue$1(j,j[nt],nt,$))&&(delete j[nt],et=!0)}}return utils$t.isArray(a)?a.forEach(tt):tt(a),et}clear(a){const $=Object.keys(this);let j=$.length,et=!1;for(;j--;){const tt=$[j];(!a||matchHeaderValue$1(this,this[tt],tt,a,!0))&&(delete this[tt],et=!0)}return et}normalize(a){const $=this,j={};return utils$t.forEach(this,(et,tt)=>{const rt=utils$t.findKey(j,tt);if(rt){$[rt]=normalizeValue$1(et),delete $[tt];return}const nt=a?formatHeader$1(tt):String(tt).trim();nt!==tt&&delete $[tt],$[nt]=normalizeValue$1(et),j[nt]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const $=Object.create(null);return utils$t.forEach(this,(j,et)=>{j!=null&&j!==!1&&($[et]=a&&utils$t.isArray(j)?j.join(", "):j)}),$}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,$])=>a+": "+$).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...$){const j=new this(a);return $.forEach(et=>j.set(et)),j}static accessor(a){const j=(this[$internals$1]=this[$internals$1]={accessors:{}}).accessors,et=this.prototype;function tt(rt){const nt=normalizeHeader$1(rt);j[nt]||(buildAccessors$1(et,rt),j[nt]=!0)}return utils$t.isArray(a)?a.forEach(tt):tt(a),this}};AxiosHeaders$1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$t.reduceDescriptors(AxiosHeaders$1.prototype,({value:_},a)=>{let $=a[0].toUpperCase()+a.slice(1);return{get:()=>_,set(j){this[$]=j}}});utils$t.freezeMethods(AxiosHeaders$1);function transformData$1(_,a){const $=this||defaults$2,j=a||$,et=AxiosHeaders$1.from(j.headers);let tt=j.data;return utils$t.forEach(_,function(nt){tt=nt.call($,tt,et.normalize(),a?a.status:void 0)}),et.normalize(),tt}function isCancel$1(_){return!!(_&&_.__CANCEL__)}function CanceledError$1(_,a,$){AxiosError$1.call(this,_??"canceled",AxiosError$1.ERR_CANCELED,a,$),this.name="CanceledError"}utils$t.inherits(CanceledError$1,AxiosError$1,{__CANCEL__:!0});function settle$1(_,a,$){const j=$.config.validateStatus;!$.status||!j||j($.status)?_($):a(new AxiosError$1("Request failed with status code "+$.status,[AxiosError$1.ERR_BAD_REQUEST,AxiosError$1.ERR_BAD_RESPONSE][Math.floor($.status/100)-4],$.config,$.request,$))}const cookies$1=platform$2.hasStandardBrowserEnv?{write(_,a,$,j,et,tt){const rt=[_+"="+encodeURIComponent(a)];utils$t.isNumber($)&&rt.push("expires="+new Date($).toGMTString()),utils$t.isString(j)&&rt.push("path="+j),utils$t.isString(et)&&rt.push("domain="+et),tt===!0&&rt.push("secure"),document.cookie=rt.join("; ")},read(_){const a=document.cookie.match(new RegExp("(^|;\\s*)("+_+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove(_){this.write(_,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL$1(_){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_)}function combineURLs$1(_,a){return a?_.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):_}function buildFullPath$1(_,a){return _&&!isAbsoluteURL$1(a)?combineURLs$1(_,a):a}const isURLSameOrigin$1=platform$2.hasStandardBrowserEnv?function _(){const a=/(msie|trident)/i.test(navigator.userAgent),$=document.createElement("a");let j;function et(tt){let rt=tt;return a&&($.setAttribute("href",rt),rt=$.href),$.setAttribute("href",rt),{href:$.href,protocol:$.protocol?$.protocol.replace(/:$/,""):"",host:$.host,search:$.search?$.search.replace(/^\?/,""):"",hash:$.hash?$.hash.replace(/^#/,""):"",hostname:$.hostname,port:$.port,pathname:$.pathname.charAt(0)==="/"?$.pathname:"/"+$.pathname}}return j=et(window.location.href),function(rt){const nt=utils$t.isString(rt)?et(rt):rt;return nt.protocol===j.protocol&&nt.host===j.host}}():function _(){return function(){return!0}}();function parseProtocol$1(_){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_);return a&&a[1]||""}function speedometer$1(_,a){_=_||10;const $=new Array(_),j=new Array(_);let et=0,tt=0,rt;return a=a!==void 0?a:1e3,function(it){const ot=Date.now(),st=j[tt];rt||(rt=ot),$[et]=it,j[et]=ot;let at=tt,ut=0;for(;at!==et;)ut+=$[at++],at=at%_;if(et=(et+1)%_,et===tt&&(tt=(tt+1)%_),ot-rt{const tt=et.loaded,rt=et.lengthComputable?et.total:void 0,nt=tt-$,it=j(nt),ot=tt<=rt;$=tt;const st={loaded:tt,total:rt,progress:rt?tt/rt:void 0,bytes:nt,rate:it||void 0,estimated:it&&rt&&ot?(rt-tt)/it:void 0,event:et};st[a?"download":"upload"]=!0,_(st)}}const isXHRAdapterSupported$1=typeof XMLHttpRequest<"u",xhrAdapter$1=isXHRAdapterSupported$1&&function(_){return new Promise(function($,j){let et=_.data;const tt=AxiosHeaders$1.from(_.headers).normalize();let{responseType:rt,withXSRFToken:nt}=_,it;function ot(){_.cancelToken&&_.cancelToken.unsubscribe(it),_.signal&&_.signal.removeEventListener("abort",it)}let st;if(utils$t.isFormData(et)){if(platform$2.hasStandardBrowserEnv||platform$2.hasStandardBrowserWebWorkerEnv)tt.setContentType(!1);else if((st=tt.getContentType())!==!1){const[Et,...Ct]=st?st.split(";").map(Pt=>Pt.trim()).filter(Boolean):[];tt.setContentType([Et||"multipart/form-data",...Ct].join("; "))}}let at=new XMLHttpRequest;if(_.auth){const Et=_.auth.username||"",Ct=_.auth.password?unescape(encodeURIComponent(_.auth.password)):"";tt.set("Authorization","Basic "+btoa(Et+":"+Ct))}const ut=buildFullPath$1(_.baseURL,_.url);at.open(_.method.toUpperCase(),buildURL$1(ut,_.params,_.paramsSerializer),!0),at.timeout=_.timeout;function ht(){if(!at)return;const Et=AxiosHeaders$1.from("getAllResponseHeaders"in at&&at.getAllResponseHeaders()),Pt={data:!rt||rt==="text"||rt==="json"?at.responseText:at.response,status:at.status,statusText:at.statusText,headers:Et,config:_,request:at};settle$1(function(It){$(It),ot()},function(It){j(It),ot()},Pt),at=null}if("onloadend"in at?at.onloadend=ht:at.onreadystatechange=function(){!at||at.readyState!==4||at.status===0&&!(at.responseURL&&at.responseURL.indexOf("file:")===0)||setTimeout(ht)},at.onabort=function(){at&&(j(new AxiosError$1("Request aborted",AxiosError$1.ECONNABORTED,_,at)),at=null)},at.onerror=function(){j(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,_,at)),at=null},at.ontimeout=function(){let Ct=_.timeout?"timeout of "+_.timeout+"ms exceeded":"timeout exceeded";const Pt=_.transitional||transitionalDefaults$1;_.timeoutErrorMessage&&(Ct=_.timeoutErrorMessage),j(new AxiosError$1(Ct,Pt.clarifyTimeoutError?AxiosError$1.ETIMEDOUT:AxiosError$1.ECONNABORTED,_,at)),at=null},platform$2.hasStandardBrowserEnv&&(nt&&utils$t.isFunction(nt)&&(nt=nt(_)),nt||nt!==!1&&isURLSameOrigin$1(ut))){const Et=_.xsrfHeaderName&&_.xsrfCookieName&&cookies$1.read(_.xsrfCookieName);Et&&tt.set(_.xsrfHeaderName,Et)}et===void 0&&tt.setContentType(null),"setRequestHeader"in at&&utils$t.forEach(tt.toJSON(),function(Ct,Pt){at.setRequestHeader(Pt,Ct)}),utils$t.isUndefined(_.withCredentials)||(at.withCredentials=!!_.withCredentials),rt&&rt!=="json"&&(at.responseType=_.responseType),typeof _.onDownloadProgress=="function"&&at.addEventListener("progress",progressEventReducer$1(_.onDownloadProgress,!0)),typeof _.onUploadProgress=="function"&&at.upload&&at.upload.addEventListener("progress",progressEventReducer$1(_.onUploadProgress)),(_.cancelToken||_.signal)&&(it=Et=>{at&&(j(!Et||Et.type?new CanceledError$1(null,_,at):Et),at.abort(),at=null)},_.cancelToken&&_.cancelToken.subscribe(it),_.signal&&(_.signal.aborted?it():_.signal.addEventListener("abort",it)));const bt=parseProtocol$1(ut);if(bt&&platform$2.protocols.indexOf(bt)===-1){j(new AxiosError$1("Unsupported protocol "+bt+":",AxiosError$1.ERR_BAD_REQUEST,_));return}at.send(et||null)})},knownAdapters$1={http:httpAdapter$1,xhr:xhrAdapter$1};utils$t.forEach(knownAdapters$1,(_,a)=>{if(_){try{Object.defineProperty(_,"name",{value:a})}catch{}Object.defineProperty(_,"adapterName",{value:a})}});const renderReason$1=_=>`- ${_}`,isResolvedHandle$1=_=>utils$t.isFunction(_)||_===null||_===!1,adapters$1={getAdapter:_=>{_=utils$t.isArray(_)?_:[_];const{length:a}=_;let $,j;const et={};for(let tt=0;tt`adapter ${nt} `+(it===!1?"is not supported by the environment":"is not available in the build"));let rt=a?tt.length>1?`since : +})`)}catch{nt=function(at){this._initNamed(at)}}return $(nt,rt),nt.prototype._initNamed=function(at){rt.call(this,at)},new nt(this)},et.prototype._getDecoder=function(rt){return rt=rt||"der",this.decoders.hasOwnProperty(rt)||(this.decoders[rt]=this._createNamed(a.decoders[rt])),this.decoders[rt]},et.prototype.decode=function(rt,nt,it){return this._getDecoder(nt).decode(rt,it)},et.prototype._getEncoder=function(rt){return rt=rt||"der",this.encoders.hasOwnProperty(rt)||(this.encoders[rt]=this._createNamed(a.encoders[rt])),this.encoders[rt]},et.prototype.encode=function(rt,nt,it){return this._getEncoder(nt).encode(rt,it)}}(api)),api}var base$6={},reporter={},hasRequiredReporter;function requireReporter(){if(hasRequiredReporter)return reporter;hasRequiredReporter=1;var _=inherits_browserExports;function a(j){this._reporterState={obj:null,path:[],options:j||{},errors:[]}}reporter.Reporter=a,a.prototype.isError=function(et){return et instanceof $},a.prototype.save=function(){var et=this._reporterState;return{obj:et.obj,pathLen:et.path.length}},a.prototype.restore=function(et){var tt=this._reporterState;tt.obj=et.obj,tt.path=tt.path.slice(0,et.pathLen)},a.prototype.enterKey=function(et){return this._reporterState.path.push(et)},a.prototype.exitKey=function(et){var tt=this._reporterState;tt.path=tt.path.slice(0,et-1)},a.prototype.leaveKey=function(et,tt,rt){var nt=this._reporterState;this.exitKey(et),nt.obj!==null&&(nt.obj[tt]=rt)},a.prototype.path=function(){return this._reporterState.path.join("/")},a.prototype.enterObject=function(){var et=this._reporterState,tt=et.obj;return et.obj={},tt},a.prototype.leaveObject=function(et){var tt=this._reporterState,rt=tt.obj;return tt.obj=et,rt},a.prototype.error=function(et){var tt,rt=this._reporterState,nt=et instanceof $;if(nt?tt=et:tt=new $(rt.path.map(function(it){return"["+JSON.stringify(it)+"]"}).join(""),et.message||et,et.stack),!rt.options.partial)throw tt;return nt||rt.errors.push(tt),tt},a.prototype.wrapResult=function(et){var tt=this._reporterState;return tt.options.partial?{result:this.isError(et)?null:et,errors:tt.errors}:et};function $(j,et){this.path=j,this.rethrow(et)}return _($,Error),$.prototype.rethrow=function(et){if(this.message=et+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,$),!this.stack)try{throw new Error(this.message)}catch(tt){this.stack=tt.stack}return this},reporter}var buffer={},hasRequiredBuffer;function requireBuffer(){if(hasRequiredBuffer)return buffer;hasRequiredBuffer=1;var _=inherits_browserExports,a=requireBase$1().Reporter,$=buffer$1.Buffer;function j(tt,rt){if(a.call(this,rt),!$.isBuffer(tt)){this.error("Input not Buffer");return}this.base=tt,this.offset=0,this.length=tt.length}_(j,a),buffer.DecoderBuffer=j,j.prototype.save=function(){return{offset:this.offset,reporter:a.prototype.save.call(this)}},j.prototype.restore=function(rt){var nt=new j(this.base);return nt.offset=rt.offset,nt.length=this.offset,this.offset=rt.offset,a.prototype.restore.call(this,rt.reporter),nt},j.prototype.isEmpty=function(){return this.offset===this.length},j.prototype.readUInt8=function(rt){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(rt||"DecoderBuffer overrun")},j.prototype.skip=function(rt,nt){if(!(this.offset+rt<=this.length))return this.error(nt||"DecoderBuffer overrun");var it=new j(this.base);return it._reporterState=this._reporterState,it.offset=this.offset,it.length=this.offset+rt,this.offset+=rt,it},j.prototype.raw=function(rt){return this.base.slice(rt?rt.offset:this.offset,this.length)};function et(tt,rt){if(Array.isArray(tt))this.length=0,this.value=tt.map(function(nt){return nt instanceof et||(nt=new et(nt,rt)),this.length+=nt.length,nt},this);else if(typeof tt=="number"){if(!(0<=tt&&tt<=255))return rt.error("non-byte EncoderBuffer value");this.value=tt,this.length=1}else if(typeof tt=="string")this.value=tt,this.length=$.byteLength(tt);else if($.isBuffer(tt))this.value=tt,this.length=tt.length;else return rt.error("Unsupported type: "+typeof tt)}return buffer.EncoderBuffer=et,et.prototype.join=function(rt,nt){return rt||(rt=new $(this.length)),nt||(nt=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(it){it.join(rt,nt),nt+=it.length}):(typeof this.value=="number"?rt[nt]=this.value:typeof this.value=="string"?rt.write(this.value,nt):$.isBuffer(this.value)&&this.value.copy(rt,nt),nt+=this.length)),rt},buffer}var node$1,hasRequiredNode;function requireNode(){if(hasRequiredNode)return node$1;hasRequiredNode=1;var _=requireBase$1().Reporter,a=requireBase$1().EncoderBuffer,$=requireBase$1().DecoderBuffer,j=minimalisticAssert,et=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],tt=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(et),rt=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function nt(at,st){var ot={};this._baseState=ot,ot.enc=at,ot.parent=st||null,ot.children=null,ot.tag=null,ot.args=null,ot.reverseArgs=null,ot.choice=null,ot.optional=!1,ot.any=!1,ot.obj=!1,ot.use=null,ot.useDecoder=null,ot.key=null,ot.default=null,ot.explicit=null,ot.implicit=null,ot.contains=null,ot.parent||(ot.children=[],this._wrap())}node$1=nt;var it=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return nt.prototype.clone=function(){var st=this._baseState,ot={};it.forEach(function(dt){ot[dt]=st[dt]});var ut=new this.constructor(ot.parent);return ut._baseState=ot,ut},nt.prototype._wrap=function(){var st=this._baseState;tt.forEach(function(ot){this[ot]=function(){var dt=new this.constructor(this);return st.children.push(dt),dt[ot].apply(dt,arguments)}},this)},nt.prototype._init=function(st){var ot=this._baseState;j(ot.parent===null),st.call(this),ot.children=ot.children.filter(function(ut){return ut._baseState.parent===this},this),j.equal(ot.children.length,1,"Root node can have only one child")},nt.prototype._useArgs=function(st){var ot=this._baseState,ut=st.filter(function(dt){return dt instanceof this.constructor},this);st=st.filter(function(dt){return!(dt instanceof this.constructor)},this),ut.length!==0&&(j(ot.children===null),ot.children=ut,ut.forEach(function(dt){dt._baseState.parent=this},this)),st.length!==0&&(j(ot.args===null),ot.args=st,ot.reverseArgs=st.map(function(dt){if(typeof dt!="object"||dt.constructor!==Object)return dt;var mt={};return Object.keys(dt).forEach(function(xt){xt==(xt|0)&&(xt|=0);var Ct=dt[xt];mt[Ct]=xt}),mt}))},rt.forEach(function(at){nt.prototype[at]=function(){var ot=this._baseState;throw new Error(at+" not implemented for encoding: "+ot.enc)}}),et.forEach(function(at){nt.prototype[at]=function(){var ot=this._baseState,ut=Array.prototype.slice.call(arguments);return j(ot.tag===null),ot.tag=at,this._useArgs(ut),this}}),nt.prototype.use=function(st){j(st);var ot=this._baseState;return j(ot.use===null),ot.use=st,this},nt.prototype.optional=function(){var st=this._baseState;return st.optional=!0,this},nt.prototype.def=function(st){var ot=this._baseState;return j(ot.default===null),ot.default=st,ot.optional=!0,this},nt.prototype.explicit=function(st){var ot=this._baseState;return j(ot.explicit===null&&ot.implicit===null),ot.explicit=st,this},nt.prototype.implicit=function(st){var ot=this._baseState;return j(ot.explicit===null&&ot.implicit===null),ot.implicit=st,this},nt.prototype.obj=function(){var st=this._baseState,ot=Array.prototype.slice.call(arguments);return st.obj=!0,ot.length!==0&&this._useArgs(ot),this},nt.prototype.key=function(st){var ot=this._baseState;return j(ot.key===null),ot.key=st,this},nt.prototype.any=function(){var st=this._baseState;return st.any=!0,this},nt.prototype.choice=function(st){var ot=this._baseState;return j(ot.choice===null),ot.choice=st,this._useArgs(Object.keys(st).map(function(ut){return st[ut]})),this},nt.prototype.contains=function(st){var ot=this._baseState;return j(ot.use===null),ot.contains=st,this},nt.prototype._decode=function(st,ot){var ut=this._baseState;if(ut.parent===null)return st.wrapResult(ut.children[0]._decode(st,ot));var dt=ut.default,mt=!0,xt=null;if(ut.key!==null&&(xt=st.enterKey(ut.key)),ut.optional){var Ct=null;if(ut.explicit!==null?Ct=ut.explicit:ut.implicit!==null?Ct=ut.implicit:ut.tag!==null&&(Ct=ut.tag),Ct===null&&!ut.any){var Pt=st.save();try{ut.choice===null?this._decodeGeneric(ut.tag,st,ot):this._decodeChoice(st,ot),mt=!0}catch{mt=!1}st.restore(Pt)}else if(mt=this._peekTag(st,Ct,ut.any),st.isError(mt))return mt}var Tt;if(ut.obj&&mt&&(Tt=st.enterObject()),mt){if(ut.explicit!==null){var kt=this._decodeTag(st,ut.explicit);if(st.isError(kt))return kt;st=kt}var Lt=st.offset;if(ut.use===null&&ut.choice===null){if(ut.any)var Pt=st.save();var Nt=this._decodeTag(st,ut.implicit!==null?ut.implicit:ut.tag,ut.any);if(st.isError(Nt))return Nt;ut.any?dt=st.raw(Pt):st=Nt}if(ot&&ot.track&&ut.tag!==null&&ot.track(st.path(),Lt,st.length,"tagged"),ot&&ot.track&&ut.tag!==null&&ot.track(st.path(),st.offset,st.length,"content"),ut.any?dt=dt:ut.choice===null?dt=this._decodeGeneric(ut.tag,st,ot):dt=this._decodeChoice(st,ot),st.isError(dt))return dt;if(!ut.any&&ut.choice===null&&ut.children!==null&&ut.children.forEach(function(Mt){Mt._decode(st,ot)}),ut.contains&&(ut.tag==="octstr"||ut.tag==="bitstr")){var zt=new $(dt);dt=this._getUse(ut.contains,st._reporterState.obj)._decode(zt,ot)}}return ut.obj&&mt&&(dt=st.leaveObject(Tt)),ut.key!==null&&(dt!==null||mt===!0)?st.leaveKey(xt,ut.key,dt):xt!==null&&st.exitKey(xt),dt},nt.prototype._decodeGeneric=function(st,ot,ut){var dt=this._baseState;return st==="seq"||st==="set"?null:st==="seqof"||st==="setof"?this._decodeList(ot,st,dt.args[0],ut):/str$/.test(st)?this._decodeStr(ot,st,ut):st==="objid"&&dt.args?this._decodeObjid(ot,dt.args[0],dt.args[1],ut):st==="objid"?this._decodeObjid(ot,null,null,ut):st==="gentime"||st==="utctime"?this._decodeTime(ot,st,ut):st==="null_"?this._decodeNull(ot,ut):st==="bool"?this._decodeBool(ot,ut):st==="objDesc"?this._decodeStr(ot,st,ut):st==="int"||st==="enum"?this._decodeInt(ot,dt.args&&dt.args[0],ut):dt.use!==null?this._getUse(dt.use,ot._reporterState.obj)._decode(ot,ut):ot.error("unknown tag: "+st)},nt.prototype._getUse=function(st,ot){var ut=this._baseState;return ut.useDecoder=this._use(st,ot),j(ut.useDecoder._baseState.parent===null),ut.useDecoder=ut.useDecoder._baseState.children[0],ut.implicit!==ut.useDecoder._baseState.implicit&&(ut.useDecoder=ut.useDecoder.clone(),ut.useDecoder._baseState.implicit=ut.implicit),ut.useDecoder},nt.prototype._decodeChoice=function(st,ot){var ut=this._baseState,dt=null,mt=!1;return Object.keys(ut.choice).some(function(xt){var Ct=st.save(),Pt=ut.choice[xt];try{var Tt=Pt._decode(st,ot);if(st.isError(Tt))return!1;dt={type:xt,value:Tt},mt=!0}catch{return st.restore(Ct),!1}return!0},this),mt?dt:st.error("Choice not matched")},nt.prototype._createEncoderBuffer=function(st){return new a(st,this.reporter)},nt.prototype._encode=function(st,ot,ut){var dt=this._baseState;if(!(dt.default!==null&&dt.default===st)){var mt=this._encodeValue(st,ot,ut);if(mt!==void 0&&!this._skipDefault(mt,ot,ut))return mt}},nt.prototype._encodeValue=function(st,ot,ut){var dt=this._baseState;if(dt.parent===null)return dt.children[0]._encode(st,ot||new _);var Pt=null;if(this.reporter=ot,dt.optional&&st===void 0)if(dt.default!==null)st=dt.default;else return;var mt=null,xt=!1;if(dt.any)Pt=this._createEncoderBuffer(st);else if(dt.choice)Pt=this._encodeChoice(st,ot);else if(dt.contains)mt=this._getUse(dt.contains,ut)._encode(st,ot),xt=!0;else if(dt.children)mt=dt.children.map(function(Lt){if(Lt._baseState.tag==="null_")return Lt._encode(null,ot,st);if(Lt._baseState.key===null)return ot.error("Child should have a key");var Nt=ot.enterKey(Lt._baseState.key);if(typeof st!="object")return ot.error("Child expected, but input is not object");var zt=Lt._encode(st[Lt._baseState.key],ot,st);return ot.leaveKey(Nt),zt},this).filter(function(Lt){return Lt}),mt=this._createEncoderBuffer(mt);else if(dt.tag==="seqof"||dt.tag==="setof"){if(!(dt.args&&dt.args.length===1))return ot.error("Too many args for : "+dt.tag);if(!Array.isArray(st))return ot.error("seqof/setof, but data is not Array");var Ct=this.clone();Ct._baseState.implicit=null,mt=this._createEncoderBuffer(st.map(function(Lt){var Nt=this._baseState;return this._getUse(Nt.args[0],st)._encode(Lt,ot)},Ct))}else dt.use!==null?Pt=this._getUse(dt.use,ut)._encode(st,ot):(mt=this._encodePrimitive(dt.tag,st),xt=!0);var Pt;if(!dt.any&&dt.choice===null){var Tt=dt.implicit!==null?dt.implicit:dt.tag,kt=dt.implicit===null?"universal":"context";Tt===null?dt.use===null&&ot.error("Tag could be omitted only for .use()"):dt.use===null&&(Pt=this._encodeComposite(Tt,xt,kt,mt))}return dt.explicit!==null&&(Pt=this._encodeComposite(dt.explicit,!1,"context",Pt)),Pt},nt.prototype._encodeChoice=function(st,ot){var ut=this._baseState,dt=ut.choice[st.type];return dt||j(!1,st.type+" not found in "+JSON.stringify(Object.keys(ut.choice))),dt._encode(st.value,ot)},nt.prototype._encodePrimitive=function(st,ot){var ut=this._baseState;if(/str$/.test(st))return this._encodeStr(ot,st);if(st==="objid"&&ut.args)return this._encodeObjid(ot,ut.reverseArgs[0],ut.args[1]);if(st==="objid")return this._encodeObjid(ot,null,null);if(st==="gentime"||st==="utctime")return this._encodeTime(ot,st);if(st==="null_")return this._encodeNull();if(st==="int"||st==="enum")return this._encodeInt(ot,ut.args&&ut.reverseArgs[0]);if(st==="bool")return this._encodeBool(ot);if(st==="objDesc")return this._encodeStr(ot,st);throw new Error("Unsupported tag: "+st)},nt.prototype._isNumstr=function(st){return/^[0-9 ]*$/.test(st)},nt.prototype._isPrintstr=function(st){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(st)},node$1}var hasRequiredBase$1;function requireBase$1(){return hasRequiredBase$1||(hasRequiredBase$1=1,function(_){var a=_;a.Reporter=requireReporter().Reporter,a.DecoderBuffer=requireBuffer().DecoderBuffer,a.EncoderBuffer=requireBuffer().EncoderBuffer,a.Node=requireNode()}(base$6)),base$6}var constants$2={},der={},hasRequiredDer$2;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(_){var a=requireConstants();_.tagClass={0:"universal",1:"application",2:"context",3:"private"},_.tagClassByName=a._reverse(_.tagClass),_.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},_.tagByName=a._reverse(_.tag)}(der)),der}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(_){var a=_;a._reverse=function(j){var et={};return Object.keys(j).forEach(function(tt){(tt|0)==tt&&(tt=tt|0);var rt=j[tt];et[rt]=tt}),et},a.der=requireDer$2()}(constants$2)),constants$2}var decoders$1={},der_1$1,hasRequiredDer$1;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var _=inherits_browserExports,a=requireAsn1$1(),$=a.base,j=a.bignum,et=a.constants.der;function tt(at){this.enc="der",this.name=at.name,this.entity=at,this.tree=new rt,this.tree._init(at.body)}der_1$1=tt,tt.prototype.decode=function(st,ot){return st instanceof $.DecoderBuffer||(st=new $.DecoderBuffer(st,ot)),this.tree._decode(st,ot)};function rt(at){$.Node.call(this,"der",at)}_(rt,$.Node),rt.prototype._peekTag=function(st,ot,ut){if(st.isEmpty())return!1;var dt=st.save(),mt=nt(st,'Failed to peek tag: "'+ot+'"');return st.isError(mt)?mt:(st.restore(dt),mt.tag===ot||mt.tagStr===ot||mt.tagStr+"of"===ot||ut)},rt.prototype._decodeTag=function(st,ot,ut){var dt=nt(st,'Failed to decode tag of "'+ot+'"');if(st.isError(dt))return dt;var mt=it(st,dt.primitive,'Failed to get length of "'+ot+'"');if(st.isError(mt))return mt;if(!ut&&dt.tag!==ot&&dt.tagStr!==ot&&dt.tagStr+"of"!==ot)return st.error('Failed to match tag: "'+ot+'"');if(dt.primitive||mt!==null)return st.skip(mt,'Failed to match body of: "'+ot+'"');var xt=st.save(),Ct=this._skipUntilEnd(st,'Failed to skip indefinite length body: "'+this.tag+'"');return st.isError(Ct)?Ct:(mt=st.offset-xt.offset,st.restore(xt),st.skip(mt,'Failed to match body of: "'+ot+'"'))},rt.prototype._skipUntilEnd=function(st,ot){for(;;){var ut=nt(st,ot);if(st.isError(ut))return ut;var dt=it(st,ut.primitive,ot);if(st.isError(dt))return dt;var mt;if(ut.primitive||dt!==null?mt=st.skip(dt):mt=this._skipUntilEnd(st,ot),st.isError(mt))return mt;if(ut.tagStr==="end")break}},rt.prototype._decodeList=function(st,ot,ut,dt){for(var mt=[];!st.isEmpty();){var xt=this._peekTag(st,"end");if(st.isError(xt))return xt;var Ct=ut.decode(st,"der",dt);if(st.isError(Ct)&&xt)break;mt.push(Ct)}return mt},rt.prototype._decodeStr=function(st,ot){if(ot==="bitstr"){var ut=st.readUInt8();return st.isError(ut)?ut:{unused:ut,data:st.raw()}}else if(ot==="bmpstr"){var dt=st.raw();if(dt.length%2===1)return st.error("Decoding of string type: bmpstr length mismatch");for(var mt="",xt=0;xt>6],dt=(ot&32)===0;if((ot&31)===31){var mt=ot;for(ot=0;(mt&128)===128;){if(mt=at.readUInt8(st),at.isError(mt))return mt;ot<<=7,ot|=mt&127}}else ot&=31;var xt=et.tag[ot];return{cls:ut,primitive:dt,tag:ot,tagStr:xt}}function it(at,st,ot){var ut=at.readUInt8(ot);if(at.isError(ut))return ut;if(!st&&ut===128)return null;if(!(ut&128))return ut;var dt=ut&127;if(dt>4)return at.error("length octect is too long");ut=0;for(var mt=0;mt=256;Ct>>=8)xt++;var Pt=new a(2+xt);Pt[0]=mt,Pt[1]=128|xt;for(var Ct=1+xt,Tt=dt.length;Tt>0;Ct--,Tt>>=8)Pt[Ct]=Tt&255;return this._createEncoderBuffer([Pt,dt])},rt.prototype._encodeStr=function(st,ot){if(ot==="bitstr")return this._createEncoderBuffer([st.unused|0,st.data]);if(ot==="bmpstr"){for(var ut=new a(st.length*2),dt=0;dt=40)return this.reporter.error("Second objid identifier OOB");st.splice(0,2,st[0]*40+st[1])}for(var mt=0,dt=0;dt=128;xt>>=7)mt++}for(var Ct=new a(mt),Pt=Ct.length-1,dt=st.length-1;dt>=0;dt--){var xt=st[dt];for(Ct[Pt--]=xt&127;(xt>>=7)>0;)Ct[Pt--]=128|xt&127}return this._createEncoderBuffer(Ct)};function nt(at){return at<10?"0"+at:at}rt.prototype._encodeTime=function(st,ot){var ut,dt=new Date(st);return ot==="gentime"?ut=[nt(dt.getFullYear()),nt(dt.getUTCMonth()+1),nt(dt.getUTCDate()),nt(dt.getUTCHours()),nt(dt.getUTCMinutes()),nt(dt.getUTCSeconds()),"Z"].join(""):ot==="utctime"?ut=[nt(dt.getFullYear()%100),nt(dt.getUTCMonth()+1),nt(dt.getUTCDate()),nt(dt.getUTCHours()),nt(dt.getUTCMinutes()),nt(dt.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+ot+" time is not supported yet"),this._encodeStr(ut,"octstr")},rt.prototype._encodeNull=function(){return this._createEncoderBuffer("")},rt.prototype._encodeInt=function(st,ot){if(typeof st=="string"){if(!ot)return this.reporter.error("String int or enum given, but no values map");if(!ot.hasOwnProperty(st))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(st));st=ot[st]}if(typeof st!="number"&&!a.isBuffer(st)){var ut=st.toArray();!st.sign&&ut[0]&128&&ut.unshift(0),st=new a(ut)}if(a.isBuffer(st)){var dt=st.length;st.length===0&&dt++;var xt=new a(dt);return st.copy(xt),st.length===0&&(xt[0]=0),this._createEncoderBuffer(xt)}if(st<128)return this._createEncoderBuffer(st);if(st<256)return this._createEncoderBuffer([0,st]);for(var dt=1,mt=st;mt>=256;mt>>=8)dt++;for(var xt=new Array(dt),mt=xt.length-1;mt>=0;mt--)xt[mt]=st&255,st>>=8;return xt[0]&128&&xt.unshift(0),this._createEncoderBuffer(new a(xt))},rt.prototype._encodeBool=function(st){return this._createEncoderBuffer(st?255:0)},rt.prototype._use=function(st,ot){return typeof st=="function"&&(st=st(ot)),st._getEncoder("der").tree},rt.prototype._skipDefault=function(st,ot,ut){var dt=this._baseState,mt;if(dt.default===null)return!1;var xt=st.join();if(dt.defaultBuffer===void 0&&(dt.defaultBuffer=this._encodeValue(dt.default,ot,ut).join()),xt.length!==dt.defaultBuffer.length)return!1;for(mt=0;mt=31?ut.error("Multi-octet tag encoding unsupported"):(st||(dt|=32),dt|=et.tagClassByName[ot||"universal"]<<6,dt)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var _=inherits_browserExports,a=requireDer();function $(j){a.call(this,j),this.enc="pem"}return _($,a),pem=$,$.prototype.encode=function(et,tt){for(var rt=a.prototype.encode.call(this,et),nt=rt.toString("base64"),it=["-----BEGIN "+tt.label+"-----"],at=0;at0&&kt.ishrn(Lt),kt}function mt(Pt,Tt){Pt=dt(Pt,Tt),Pt=Pt.mod(Tt);var kt=_.from(Pt.toArray());if(kt.length=0)throw new Error("invalid sig")}return verify_1=tt,verify_1}var browser$3,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$3;hasRequiredBrowser$3=1;var _=safeBufferExports.Buffer,a=browser$b,$=requireReadableBrowser(),j=inherits_browserExports,et=requireSign(),tt=requireVerify(),rt=require$$6$1;Object.keys(rt).forEach(function(ot){rt[ot].id=_.from(rt[ot].id,"hex"),rt[ot.toLowerCase()]=rt[ot]});function nt(ot){$.Writable.call(this);var ut=rt[ot];if(!ut)throw new Error("Unknown message digest");this._hashType=ut.hash,this._hash=a(ut.hash),this._tag=ut.id,this._signType=ut.sign}j(nt,$.Writable),nt.prototype._write=function(ut,dt,mt){this._hash.update(ut),mt()},nt.prototype.update=function(ut,dt){return this._hash.update(typeof ut=="string"?_.from(ut,dt):ut),this},nt.prototype.sign=function(ut,dt){this.end();var mt=this._hash.digest(),xt=et(mt,ut,this._hashType,this._signType,this._tag);return dt?xt.toString(dt):xt};function it(ot){$.Writable.call(this);var ut=rt[ot];if(!ut)throw new Error("Unknown message digest");this._hash=a(ut.hash),this._tag=ut.id,this._signType=ut.sign}j(it,$.Writable),it.prototype._write=function(ut,dt,mt){this._hash.update(ut),mt()},it.prototype.update=function(ut,dt){return this._hash.update(typeof ut=="string"?_.from(ut,dt):ut),this},it.prototype.verify=function(ut,dt,mt){var xt=typeof dt=="string"?_.from(dt,mt):dt;this.end();var Ct=this._hash.digest();return tt(xt,Ct,ut,this._signType,this._tag)};function at(ot){return new nt(ot)}function st(ot){return new it(ot)}return browser$3={Sign:at,Verify:st,createSign:at,createVerify:st},browser$3}var elliptic$4={};const name$4="elliptic",version$4="6.5.5",description$4="EC cryptography",main$4="lib/elliptic.js",files$3=["lib"],scripts$4={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository$4={type:"git",url:"git@github.com:indutny/elliptic"},keywords$3=["EC","Elliptic","curve","Cryptography"],author$4="Fedor Indutny ",license$4="MIT",bugs$3={url:"https://github.com/indutny/elliptic/issues"},homepage$4="https://github.com/indutny/elliptic",devDependencies$4={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$4={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$4={name:name$4,version:version$4,description:description$4,main:main$4,files:files$3,scripts:scripts$4,repository:repository$4,keywords:keywords$3,author:author$4,license:license$4,bugs:bugs$3,homepage:homepage$4,devDependencies:devDependencies$4,dependencies:dependencies$4};var utils$F={},hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$R;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,ot,ut){var dt=new Array(Math.max(st.bitLength(),ut)+1),mt;for(mt=0;mt(xt>>1)-1?Pt=(xt>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,dt[mt]=Pt,Ct.iushrn(1)}return dt}a.getNAF=tt;function rt(st,ot){var ut=[[],[]];st=st.clone(),ot=ot.clone();for(var dt=0,mt=0,xt;st.cmpn(-dt)>0||ot.cmpn(-mt)>0;){var Ct=st.andln(3)+dt&3,Pt=ot.andln(3)+mt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(xt=st.andln(7)+dt&7,(xt===3||xt===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var kt;Pt&1?(xt=ot.andln(7)+mt&7,(xt===3||xt===5)&&Ct===2?kt=-Pt:kt=Pt):kt=0,ut[1].push(kt),2*dt===Tt+1&&(dt=1-dt),2*mt===kt+1&&(mt=1-mt),st.iushrn(1),ot.iushrn(1)}return ut}a.getJSF=rt;function nt(st,ot,ut){var dt="_"+ot;st.prototype[ot]=function(){return this[dt]!==void 0?this[dt]:this[dt]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function at(st){return new $(st,"hex","le")}a.intFromLE=at}(utils$F)),utils$F}var curve$3={},base$5,hasRequiredBase;function requireBase(){if(hasRequiredBase)return base$5;hasRequiredBase=1;var _=bnExports$1,a=requireUtils(),$=a.getNAF,j=a.getJSF,et=a.assert;function tt(nt,it){this.type=nt,this.p=new _(it.p,16),this.red=it.prime?_.red(it.prime):_.mont(this.p),this.zero=new _(0).toRed(this.red),this.one=new _(1).toRed(this.red),this.two=new _(2).toRed(this.red),this.n=it.n&&new _(it.n,16),this.g=it.g&&this.pointFromJSON(it.g,it.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var at=this.n&&this.p.div(this.n);!at||at.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$5=tt,tt.prototype.point=function(){throw new Error("Not implemented")},tt.prototype.validate=function(){throw new Error("Not implemented")},tt.prototype._fixedNafMul=function(it,at){et(it.precomputed);var st=it._getDoubles(),ot=$(at,1,this._bitLength),ut=(1<=mt;Ct--)xt=(xt<<1)+ot[Ct];dt.push(xt)}for(var Pt=this.jpoint(null,null,null),Tt=this.jpoint(null,null,null),kt=ut;kt>0;kt--){for(mt=0;mt=0;xt--){for(var Ct=0;xt>=0&&dt[xt]===0;xt--)Ct++;if(xt>=0&&Ct++,mt=mt.dblp(Ct),xt<0)break;var Pt=dt[xt];et(Pt!==0),it.type==="affine"?Pt>0?mt=mt.mixedAdd(ut[Pt-1>>1]):mt=mt.mixedAdd(ut[-Pt-1>>1].neg()):Pt>0?mt=mt.add(ut[Pt-1>>1]):mt=mt.add(ut[-Pt-1>>1].neg())}return it.type==="affine"?mt.toP():mt},tt.prototype._wnafMulAdd=function(it,at,st,ot,ut){var dt=this._wnafT1,mt=this._wnafT2,xt=this._wnafT3,Ct=0,Pt,Tt,kt;for(Pt=0;Pt=1;Pt-=2){var Nt=Pt-1,zt=Pt;if(dt[Nt]!==1||dt[zt]!==1){xt[Nt]=$(st[Nt],dt[Nt],this._bitLength),xt[zt]=$(st[zt],dt[zt],this._bitLength),Ct=Math.max(xt[Nt].length,Ct),Ct=Math.max(xt[zt].length,Ct);continue}var jt=[at[Nt],null,null,at[zt]];at[Nt].y.cmp(at[zt].y)===0?(jt[1]=at[Nt].add(at[zt]),jt[2]=at[Nt].toJ().mixedAdd(at[zt].neg())):at[Nt].y.cmp(at[zt].y.redNeg())===0?(jt[1]=at[Nt].toJ().mixedAdd(at[zt]),jt[2]=at[Nt].add(at[zt].neg())):(jt[1]=at[Nt].toJ().mixedAdd(at[zt]),jt[2]=at[Nt].toJ().mixedAdd(at[zt].neg()));var Mt=[-3,-1,-5,-7,0,7,5,1,3],Dt=j(st[Nt],st[zt]);for(Ct=Math.max(Dt[0].length,Ct),xt[Nt]=new Array(Ct),xt[zt]=new Array(Ct),Tt=0;Tt=0;Pt--){for(var ct=0;Pt>=0;){var ht=!0;for(Tt=0;Tt=0&&ct++,yt=yt.dblp(ct),Pt<0)break;for(Tt=0;Tt0?kt=mt[Tt][vt-1>>1]:vt<0&&(kt=mt[Tt][-vt-1>>1].neg()),kt.type==="affine"?yt=yt.mixedAdd(kt):yt=yt.add(kt))}}for(Pt=0;Pt=Math.ceil((it.bitLength()+1)/at.step):!1},rt.prototype._getDoubles=function(it,at){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var st=[this],ot=this,ut=0;ut=0&&(Nt=Pt,zt=Tt),kt.negative&&(kt=kt.neg(),Lt=Lt.neg()),Nt.negative&&(Nt=Nt.neg(),zt=zt.neg()),[{a:kt,b:Lt},{a:Nt,b:zt}]},tt.prototype._endoSplit=function(at){var st=this.endo.basis,ot=st[0],ut=st[1],dt=ut.b.mul(at).divRound(this.n),mt=ot.b.neg().mul(at).divRound(this.n),xt=dt.mul(ot.a),Ct=mt.mul(ut.a),Pt=dt.mul(ot.b),Tt=mt.mul(ut.b),kt=at.sub(xt).sub(Ct),Lt=Pt.add(Tt).neg();return{k1:kt,k2:Lt}},tt.prototype.pointFromX=function(at,st){at=new a(at,16),at.red||(at=at.toRed(this.red));var ot=at.redSqr().redMul(at).redIAdd(at.redMul(this.a)).redIAdd(this.b),ut=ot.redSqrt();if(ut.redSqr().redSub(ot).cmp(this.zero)!==0)throw new Error("invalid point");var dt=ut.fromRed().isOdd();return(st&&!dt||!st&&dt)&&(ut=ut.redNeg()),this.point(at,ut)},tt.prototype.validate=function(at){if(at.inf)return!0;var st=at.x,ot=at.y,ut=this.a.redMul(st),dt=st.redSqr().redMul(st).redIAdd(ut).redIAdd(this.b);return ot.redSqr().redISub(dt).cmpn(0)===0},tt.prototype._endoWnafMulAdd=function(at,st,ot){for(var ut=this._endoWnafT1,dt=this._endoWnafT2,mt=0;mt":""},rt.prototype.isInfinity=function(){return this.inf},rt.prototype.add=function(at){if(this.inf)return at;if(at.inf)return this;if(this.eq(at))return this.dbl();if(this.neg().eq(at))return this.curve.point(null,null);if(this.x.cmp(at.x)===0)return this.curve.point(null,null);var st=this.y.redSub(at.y);st.cmpn(0)!==0&&(st=st.redMul(this.x.redSub(at.x).redInvm()));var ot=st.redSqr().redISub(this.x).redISub(at.x),ut=st.redMul(this.x.redSub(ot)).redISub(this.y);return this.curve.point(ot,ut)},rt.prototype.dbl=function(){if(this.inf)return this;var at=this.y.redAdd(this.y);if(at.cmpn(0)===0)return this.curve.point(null,null);var st=this.curve.a,ot=this.x.redSqr(),ut=at.redInvm(),dt=ot.redAdd(ot).redIAdd(ot).redIAdd(st).redMul(ut),mt=dt.redSqr().redISub(this.x.redAdd(this.x)),xt=dt.redMul(this.x.redSub(mt)).redISub(this.y);return this.curve.point(mt,xt)},rt.prototype.getX=function(){return this.x.fromRed()},rt.prototype.getY=function(){return this.y.fromRed()},rt.prototype.mul=function(at){return at=new a(at,16),this.isInfinity()?this:this._hasDoubles(at)?this.curve._fixedNafMul(this,at):this.curve.endo?this.curve._endoWnafMulAdd([this],[at]):this.curve._wnafMul(this,at)},rt.prototype.mulAdd=function(at,st,ot){var ut=[this,st],dt=[at,ot];return this.curve.endo?this.curve._endoWnafMulAdd(ut,dt):this.curve._wnafMulAdd(1,ut,dt,2)},rt.prototype.jmulAdd=function(at,st,ot){var ut=[this,st],dt=[at,ot];return this.curve.endo?this.curve._endoWnafMulAdd(ut,dt,!0):this.curve._wnafMulAdd(1,ut,dt,2,!0)},rt.prototype.eq=function(at){return this===at||this.inf===at.inf&&(this.inf||this.x.cmp(at.x)===0&&this.y.cmp(at.y)===0)},rt.prototype.neg=function(at){if(this.inf)return this;var st=this.curve.point(this.x,this.y.redNeg());if(at&&this.precomputed){var ot=this.precomputed,ut=function(dt){return dt.neg()};st.precomputed={naf:ot.naf&&{wnd:ot.naf.wnd,points:ot.naf.points.map(ut)},doubles:ot.doubles&&{step:ot.doubles.step,points:ot.doubles.points.map(ut)}}}return st},rt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var at=this.curve.jpoint(this.x,this.y,this.curve.one);return at};function nt(it,at,st,ot){j.BasePoint.call(this,it,"jacobian"),at===null&&st===null&&ot===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new a(0)):(this.x=new a(at,16),this.y=new a(st,16),this.z=new a(ot,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return $(nt,j.BasePoint),tt.prototype.jpoint=function(at,st,ot){return new nt(this,at,st,ot)},nt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var at=this.z.redInvm(),st=at.redSqr(),ot=this.x.redMul(st),ut=this.y.redMul(st).redMul(at);return this.curve.point(ot,ut)},nt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},nt.prototype.add=function(at){if(this.isInfinity())return at;if(at.isInfinity())return this;var st=at.z.redSqr(),ot=this.z.redSqr(),ut=this.x.redMul(st),dt=at.x.redMul(ot),mt=this.y.redMul(st.redMul(at.z)),xt=at.y.redMul(ot.redMul(this.z)),Ct=ut.redSub(dt),Pt=mt.redSub(xt);if(Ct.cmpn(0)===0)return Pt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Tt=Ct.redSqr(),kt=Tt.redMul(Ct),Lt=ut.redMul(Tt),Nt=Pt.redSqr().redIAdd(kt).redISub(Lt).redISub(Lt),zt=Pt.redMul(Lt.redISub(Nt)).redISub(mt.redMul(kt)),jt=this.z.redMul(at.z).redMul(Ct);return this.curve.jpoint(Nt,zt,jt)},nt.prototype.mixedAdd=function(at){if(this.isInfinity())return at.toJ();if(at.isInfinity())return this;var st=this.z.redSqr(),ot=this.x,ut=at.x.redMul(st),dt=this.y,mt=at.y.redMul(st).redMul(this.z),xt=ot.redSub(ut),Ct=dt.redSub(mt);if(xt.cmpn(0)===0)return Ct.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Pt=xt.redSqr(),Tt=Pt.redMul(xt),kt=ot.redMul(Pt),Lt=Ct.redSqr().redIAdd(Tt).redISub(kt).redISub(kt),Nt=Ct.redMul(kt.redISub(Lt)).redISub(dt.redMul(Tt)),zt=this.z.redMul(xt);return this.curve.jpoint(Lt,Nt,zt)},nt.prototype.dblp=function(at){if(at===0)return this;if(this.isInfinity())return this;if(!at)return this.dbl();var st;if(this.curve.zeroA||this.curve.threeA){var ot=this;for(st=0;st=0)return!1;if(ot.redIAdd(dt),this.x.cmp(ot)===0)return!0}},nt.prototype.inspect=function(){return this.isInfinity()?"":""},nt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short$3}var mont$3,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont$3;hasRequiredMont=1;var _=bnExports$1,a=inherits_browserExports,$=requireBase(),j=requireUtils();function et(rt){$.call(this,"mont",rt),this.a=new _(rt.a,16).toRed(this.red),this.b=new _(rt.b,16).toRed(this.red),this.i4=new _(4).toRed(this.red).redInvm(),this.two=new _(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}a(et,$),mont$3=et,et.prototype.validate=function(nt){var it=nt.normalize().x,at=it.redSqr(),st=at.redMul(it).redAdd(at.redMul(this.a)).redAdd(it),ot=st.redSqrt();return ot.redSqr().cmp(st)===0};function tt(rt,nt,it){$.BasePoint.call(this,rt,"projective"),nt===null&&it===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _(nt,16),this.z=new _(it,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return a(tt,$.BasePoint),et.prototype.decodePoint=function(nt,it){return this.point(j.toArray(nt,it),1)},et.prototype.point=function(nt,it){return new tt(this,nt,it)},et.prototype.pointFromJSON=function(nt){return tt.fromJSON(this,nt)},tt.prototype.precompute=function(){},tt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},tt.fromJSON=function(nt,it){return new tt(nt,it[0],it[1]||nt.one)},tt.prototype.inspect=function(){return this.isInfinity()?"":""},tt.prototype.isInfinity=function(){return this.z.cmpn(0)===0},tt.prototype.dbl=function(){var nt=this.x.redAdd(this.z),it=nt.redSqr(),at=this.x.redSub(this.z),st=at.redSqr(),ot=it.redSub(st),ut=it.redMul(st),dt=ot.redMul(st.redAdd(this.curve.a24.redMul(ot)));return this.curve.point(ut,dt)},tt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.diffAdd=function(nt,it){var at=this.x.redAdd(this.z),st=this.x.redSub(this.z),ot=nt.x.redAdd(nt.z),ut=nt.x.redSub(nt.z),dt=ut.redMul(at),mt=ot.redMul(st),xt=it.z.redMul(dt.redAdd(mt).redSqr()),Ct=it.x.redMul(dt.redISub(mt).redSqr());return this.curve.point(xt,Ct)},tt.prototype.mul=function(nt){for(var it=nt.clone(),at=this,st=this.curve.point(null,null),ot=this,ut=[];it.cmpn(0)!==0;it.iushrn(1))ut.push(it.andln(1));for(var dt=ut.length-1;dt>=0;dt--)ut[dt]===0?(at=at.diffAdd(st,ot),st=st.dbl()):(st=at.diffAdd(st,ot),at=at.dbl());return st},tt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},tt.prototype.eq=function(nt){return this.getX().cmp(nt.getX())===0},tt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},tt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont$3}var edwards$3,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards$3;hasRequiredEdwards=1;var _=requireUtils(),a=bnExports$1,$=inherits_browserExports,j=requireBase(),et=_.assert;function tt(nt){this.twisted=(nt.a|0)!==1,this.mOneA=this.twisted&&(nt.a|0)===-1,this.extended=this.mOneA,j.call(this,"edwards",nt),this.a=new a(nt.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(nt.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(nt.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),et(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(nt.c|0)===1}$(tt,j),edwards$3=tt,tt.prototype._mulA=function(it){return this.mOneA?it.redNeg():this.a.redMul(it)},tt.prototype._mulC=function(it){return this.oneC?it:this.c.redMul(it)},tt.prototype.jpoint=function(it,at,st,ot){return this.point(it,at,st,ot)},tt.prototype.pointFromX=function(it,at){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),ot=this.c2.redSub(this.a.redMul(st)),ut=this.one.redSub(this.c2.redMul(this.d).redMul(st)),dt=ot.redMul(ut.redInvm()),mt=dt.redSqrt();if(mt.redSqr().redSub(dt).cmp(this.zero)!==0)throw new Error("invalid point");var xt=mt.fromRed().isOdd();return(at&&!xt||!at&&xt)&&(mt=mt.redNeg()),this.point(it,mt)},tt.prototype.pointFromY=function(it,at){it=new a(it,16),it.red||(it=it.toRed(this.red));var st=it.redSqr(),ot=st.redSub(this.c2),ut=st.redMul(this.d).redMul(this.c2).redSub(this.a),dt=ot.redMul(ut.redInvm());if(dt.cmp(this.zero)===0){if(at)throw new Error("invalid point");return this.point(this.zero,it)}var mt=dt.redSqrt();if(mt.redSqr().redSub(dt).cmp(this.zero)!==0)throw new Error("invalid point");return mt.fromRed().isOdd()!==at&&(mt=mt.redNeg()),this.point(mt,it)},tt.prototype.validate=function(it){if(it.isInfinity())return!0;it.normalize();var at=it.x.redSqr(),st=it.y.redSqr(),ot=at.redMul(this.a).redAdd(st),ut=this.c2.redMul(this.one.redAdd(this.d.redMul(at).redMul(st)));return ot.cmp(ut)===0};function rt(nt,it,at,st,ot){j.BasePoint.call(this,nt,"projective"),it===null&&at===null&&st===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new a(it,16),this.y=new a(at,16),this.z=st?new a(st,16):this.curve.one,this.t=ot&&new a(ot,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return $(rt,j.BasePoint),tt.prototype.pointFromJSON=function(it){return rt.fromJSON(this,it)},tt.prototype.point=function(it,at,st,ot){return new rt(this,it,at,st,ot)},rt.fromJSON=function(it,at){return new rt(it,at[0],at[1],at[2])},rt.prototype.inspect=function(){return this.isInfinity()?"":""},rt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},rt.prototype._extDbl=function(){var it=this.x.redSqr(),at=this.y.redSqr(),st=this.z.redSqr();st=st.redIAdd(st);var ot=this.curve._mulA(it),ut=this.x.redAdd(this.y).redSqr().redISub(it).redISub(at),dt=ot.redAdd(at),mt=dt.redSub(st),xt=ot.redSub(at),Ct=ut.redMul(mt),Pt=dt.redMul(xt),Tt=ut.redMul(xt),kt=mt.redMul(dt);return this.curve.point(Ct,Pt,kt,Tt)},rt.prototype._projDbl=function(){var it=this.x.redAdd(this.y).redSqr(),at=this.x.redSqr(),st=this.y.redSqr(),ot,ut,dt,mt,xt,Ct;if(this.curve.twisted){mt=this.curve._mulA(at);var Pt=mt.redAdd(st);this.zOne?(ot=it.redSub(at).redSub(st).redMul(Pt.redSub(this.curve.two)),ut=Pt.redMul(mt.redSub(st)),dt=Pt.redSqr().redSub(Pt).redSub(Pt)):(xt=this.z.redSqr(),Ct=Pt.redSub(xt).redISub(xt),ot=it.redSub(at).redISub(st).redMul(Ct),ut=Pt.redMul(mt.redSub(st)),dt=Pt.redMul(Ct))}else mt=at.redAdd(st),xt=this.curve._mulC(this.z).redSqr(),Ct=mt.redSub(xt).redSub(xt),ot=this.curve._mulC(it.redISub(mt)).redMul(Ct),ut=this.curve._mulC(mt).redMul(at.redISub(st)),dt=mt.redMul(Ct);return this.curve.point(ot,ut,dt)},rt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},rt.prototype._extAdd=function(it){var at=this.y.redSub(this.x).redMul(it.y.redSub(it.x)),st=this.y.redAdd(this.x).redMul(it.y.redAdd(it.x)),ot=this.t.redMul(this.curve.dd).redMul(it.t),ut=this.z.redMul(it.z.redAdd(it.z)),dt=st.redSub(at),mt=ut.redSub(ot),xt=ut.redAdd(ot),Ct=st.redAdd(at),Pt=dt.redMul(mt),Tt=xt.redMul(Ct),kt=dt.redMul(Ct),Lt=mt.redMul(xt);return this.curve.point(Pt,Tt,Lt,kt)},rt.prototype._projAdd=function(it){var at=this.z.redMul(it.z),st=at.redSqr(),ot=this.x.redMul(it.x),ut=this.y.redMul(it.y),dt=this.curve.d.redMul(ot).redMul(ut),mt=st.redSub(dt),xt=st.redAdd(dt),Ct=this.x.redAdd(this.y).redMul(it.x.redAdd(it.y)).redISub(ot).redISub(ut),Pt=at.redMul(mt).redMul(Ct),Tt,kt;return this.curve.twisted?(Tt=at.redMul(xt).redMul(ut.redSub(this.curve._mulA(ot))),kt=mt.redMul(xt)):(Tt=at.redMul(xt).redMul(ut.redSub(ot)),kt=this.curve._mulC(mt).redMul(xt)),this.curve.point(Pt,Tt,kt)},rt.prototype.add=function(it){return this.isInfinity()?it:it.isInfinity()?this:this.curve.extended?this._extAdd(it):this._projAdd(it)},rt.prototype.mul=function(it){return this._hasDoubles(it)?this.curve._fixedNafMul(this,it):this.curve._wnafMul(this,it)},rt.prototype.mulAdd=function(it,at,st){return this.curve._wnafMulAdd(1,[this,at],[it,st],2,!1)},rt.prototype.jmulAdd=function(it,at,st){return this.curve._wnafMulAdd(1,[this,at],[it,st],2,!0)},rt.prototype.normalize=function(){if(this.zOne)return this;var it=this.z.redInvm();return this.x=this.x.redMul(it),this.y=this.y.redMul(it),this.t&&(this.t=this.t.redMul(it)),this.z=this.curve.one,this.zOne=!0,this},rt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},rt.prototype.getX=function(){return this.normalize(),this.x.fromRed()},rt.prototype.getY=function(){return this.normalize(),this.y.fromRed()},rt.prototype.eq=function(it){return this===it||this.getX().cmp(it.getX())===0&&this.getY().cmp(it.getY())===0},rt.prototype.eqXToP=function(it){var at=it.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(at)===0)return!0;for(var st=it.clone(),ot=this.curve.redN.redMul(this.z);;){if(st.iadd(this.curve.n),st.cmp(this.curve.p)>=0)return!1;if(at.redIAdd(ot),this.x.cmp(at)===0)return!0}},rt.prototype.toP=rt.prototype.normalize,rt.prototype.mixedAdd=rt.prototype.add,edwards$3}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(_){var a=_;a.base=requireBase(),a.short=requireShort(),a.mont=requireMont(),a.edwards=requireEdwards()}(curve$3)),curve$3}var curves$9={},secp256k1$3,hasRequiredSecp256k1$3;function requireSecp256k1$3(){return hasRequiredSecp256k1$3||(hasRequiredSecp256k1$3=1,secp256k1$3={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1$3}var hasRequiredCurves;function requireCurves(){return hasRequiredCurves||(hasRequiredCurves=1,function(_){var a=_,$=hash$8,j=requireCurve(),et=requireUtils(),tt=et.assert;function rt(at){at.type==="short"?this.curve=new j.short(at):at.type==="edwards"?this.curve=new j.edwards(at):this.curve=new j.mont(at),this.g=this.curve.g,this.n=this.curve.n,this.hash=at.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(at,st){Object.defineProperty(a,at,{configurable:!0,enumerable:!0,get:function(){var ot=new rt(st);return Object.defineProperty(a,at,{configurable:!0,enumerable:!0,value:ot}),ot}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1$3()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})}(curves$9)),curves$9}var key$7,hasRequiredKey$1;function requireKey$1(){if(hasRequiredKey$1)return key$7;hasRequiredKey$1=1;var _=bnExports$1,a=requireUtils(),$=a.assert;function j(et,tt){this.ec=et,this.priv=null,this.pub=null,tt.priv&&this._importPrivate(tt.priv,tt.privEnc),tt.pub&&this._importPublic(tt.pub,tt.pubEnc)}return key$7=j,j.fromPublic=function(tt,rt,nt){return rt instanceof j?rt:new j(tt,{pub:rt,pubEnc:nt})},j.fromPrivate=function(tt,rt,nt){return rt instanceof j?rt:new j(tt,{priv:rt,privEnc:nt})},j.prototype.validate=function(){var tt=this.getPublic();return tt.isInfinity()?{result:!1,reason:"Invalid public key"}:tt.validate()?tt.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},j.prototype.getPublic=function(tt,rt){return typeof tt=="string"&&(rt=tt,tt=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),rt?this.pub.encode(rt,tt):this.pub},j.prototype.getPrivate=function(tt){return tt==="hex"?this.priv.toString(16,2):this.priv},j.prototype._importPrivate=function(tt,rt){this.priv=new _(tt,rt||16),this.priv=this.priv.umod(this.ec.curve.n)},j.prototype._importPublic=function(tt,rt){if(tt.x||tt.y){this.ec.curve.type==="mont"?$(tt.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&$(tt.x&&tt.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(tt.x,tt.y);return}this.pub=this.ec.curve.decodePoint(tt,rt)},j.prototype.derive=function(tt){return tt.validate()||$(tt.validate(),"public point not validated"),tt.mul(this.priv).getX()},j.prototype.sign=function(tt,rt,nt){return this.ec.sign(tt,this,rt,nt)},j.prototype.verify=function(tt,rt){return this.ec.verify(tt,rt,this)},j.prototype.inspect=function(){return""},key$7}var signature$7,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$7;hasRequiredSignature$1=1;var _=bnExports$1,a=requireUtils(),$=a.assert;function j(it,at){if(it instanceof j)return it;this._importDER(it,at)||($(it.r&&it.s,"Signature without r or s"),this.r=new _(it.r,16),this.s=new _(it.s,16),it.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=it.recoveryParam)}signature$7=j;function et(){this.place=0}function tt(it,at){var st=it[at.place++];if(!(st&128))return st;var ot=st&15;if(ot===0||ot>4)return!1;for(var ut=0,dt=0,mt=at.place;dt>>=0;return ut<=127?!1:(at.place=mt,ut)}function rt(it){for(var at=0,st=it.length-1;!it[at]&&!(it[at+1]&128)&&at>>3);for(it.push(st|128);--st;)it.push(at>>>(st<<3)&255);it.push(at)}return j.prototype.toDER=function(at){var st=this.r.toArray(),ot=this.s.toArray();for(st[0]&128&&(st=[0].concat(st)),ot[0]&128&&(ot=[0].concat(ot)),st=rt(st),ot=rt(ot);!ot[0]&&!(ot[1]&128);)ot=ot.slice(1);var ut=[2];nt(ut,st.length),ut=ut.concat(st),ut.push(2),nt(ut,ot.length);var dt=ut.concat(ot),mt=[48];return nt(mt,dt.length),mt=mt.concat(dt),a.encode(mt,at)},signature$7}var ec$6,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec$6;hasRequiredEc=1;var _=bnExports$1,a=hmacDrbg,$=requireUtils(),j=requireCurves(),et=requireBrorand(),tt=$.assert,rt=requireKey$1(),nt=requireSignature$1();function it(at){if(!(this instanceof it))return new it(at);typeof at=="string"&&(tt(Object.prototype.hasOwnProperty.call(j,at),"Unknown curve "+at),at=j[at]),at instanceof j.PresetCurve&&(at={curve:at}),this.curve=at.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=at.curve.g,this.g.precompute(at.curve.n.bitLength()+1),this.hash=at.hash||at.curve.hash}return ec$6=it,it.prototype.keyPair=function(st){return new rt(this,st)},it.prototype.keyFromPrivate=function(st,ot){return rt.fromPrivate(this,st,ot)},it.prototype.keyFromPublic=function(st,ot){return rt.fromPublic(this,st,ot)},it.prototype.genKeyPair=function(st){st||(st={});for(var ot=new a({hash:this.hash,pers:st.pers,persEnc:st.persEnc||"utf8",entropy:st.entropy||et(this.hash.hmacStrength),entropyEnc:st.entropy&&st.entropyEnc||"utf8",nonce:this.n.toArray()}),ut=this.n.byteLength(),dt=this.n.sub(new _(2));;){var mt=new _(ot.generate(ut));if(!(mt.cmp(dt)>0))return mt.iaddn(1),this.keyFromPrivate(mt)}},it.prototype._truncateToN=function(st,ot){var ut=st.byteLength()*8-this.n.bitLength();return ut>0&&(st=st.ushrn(ut)),!ot&&st.cmp(this.n)>=0?st.sub(this.n):st},it.prototype.sign=function(st,ot,ut,dt){typeof ut=="object"&&(dt=ut,ut=null),dt||(dt={}),ot=this.keyFromPrivate(ot,ut),st=this._truncateToN(new _(st,16));for(var mt=this.n.byteLength(),xt=ot.getPrivate().toArray("be",mt),Ct=st.toArray("be",mt),Pt=new a({hash:this.hash,entropy:xt,nonce:Ct,pers:dt.pers,persEnc:dt.persEnc||"utf8"}),Tt=this.n.sub(new _(1)),kt=0;;kt++){var Lt=dt.k?dt.k(kt):new _(Pt.generate(this.n.byteLength()));if(Lt=this._truncateToN(Lt,!0),!(Lt.cmpn(1)<=0||Lt.cmp(Tt)>=0)){var Nt=this.g.mul(Lt);if(!Nt.isInfinity()){var zt=Nt.getX(),jt=zt.umod(this.n);if(jt.cmpn(0)!==0){var Mt=Lt.invm(this.n).mul(jt.mul(ot.getPrivate()).iadd(st));if(Mt=Mt.umod(this.n),Mt.cmpn(0)!==0){var Dt=(Nt.getY().isOdd()?1:0)|(zt.cmp(jt)!==0?2:0);return dt.canonical&&Mt.cmp(this.nh)>0&&(Mt=this.n.sub(Mt),Dt^=1),new nt({r:jt,s:Mt,recoveryParam:Dt})}}}}}},it.prototype.verify=function(st,ot,ut,dt){st=this._truncateToN(new _(st,16)),ut=this.keyFromPublic(ut,dt),ot=new nt(ot,"hex");var mt=ot.r,xt=ot.s;if(mt.cmpn(1)<0||mt.cmp(this.n)>=0||xt.cmpn(1)<0||xt.cmp(this.n)>=0)return!1;var Ct=xt.invm(this.n),Pt=Ct.mul(st).umod(this.n),Tt=Ct.mul(mt).umod(this.n),kt;return this.curve._maxwellTrick?(kt=this.g.jmulAdd(Pt,ut.getPublic(),Tt),kt.isInfinity()?!1:kt.eqXToP(mt)):(kt=this.g.mulAdd(Pt,ut.getPublic(),Tt),kt.isInfinity()?!1:kt.getX().umod(this.n).cmp(mt)===0)},it.prototype.recoverPubKey=function(at,st,ot,ut){tt((3&ot)===ot,"The recovery param is more than two bits"),st=new nt(st,ut);var dt=this.n,mt=new _(at),xt=st.r,Ct=st.s,Pt=ot&1,Tt=ot>>1;if(xt.cmp(this.curve.p.umod(this.curve.n))>=0&&Tt)throw new Error("Unable to find sencond key candinate");Tt?xt=this.curve.pointFromX(xt.add(this.curve.n),Pt):xt=this.curve.pointFromX(xt,Pt);var kt=st.r.invm(dt),Lt=dt.sub(mt).mul(kt).umod(dt),Nt=Ct.mul(kt).umod(dt);return this.g.mulAdd(Lt,xt,Nt)},it.prototype.getKeyRecoveryParam=function(at,st,ot,ut){if(st=new nt(st,ut),st.recoveryParam!==null)return st.recoveryParam;for(var dt=0;dt<4;dt++){var mt;try{mt=this.recoverPubKey(at,st,dt)}catch{continue}if(mt.eq(ot))return dt}throw new Error("Unable to find valid recovery factor")},ec$6}var key$6,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key$6;hasRequiredKey=1;var _=requireUtils(),a=_.assert,$=_.parseBytes,j=_.cachedProperty;function et(tt,rt){this.eddsa=tt,this._secret=$(rt.secret),tt.isPoint(rt.pub)?this._pub=rt.pub:this._pubBytes=$(rt.pub)}return et.fromPublic=function(rt,nt){return nt instanceof et?nt:new et(rt,{pub:nt})},et.fromSecret=function(rt,nt){return nt instanceof et?nt:new et(rt,{secret:nt})},et.prototype.secret=function(){return this._secret},j(et,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),j(et,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),j(et,"privBytes",function(){var rt=this.eddsa,nt=this.hash(),it=rt.encodingLength-1,at=nt.slice(0,rt.encodingLength);return at[0]&=248,at[it]&=127,at[it]|=64,at}),j(et,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),j(et,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),j(et,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),et.prototype.sign=function(rt){return a(this._secret,"KeyPair can only verify"),this.eddsa.sign(rt,this)},et.prototype.verify=function(rt,nt){return this.eddsa.verify(rt,nt,this)},et.prototype.getSecret=function(rt){return a(this._secret,"KeyPair is public only"),_.encode(this.secret(),rt)},et.prototype.getPublic=function(rt){return _.encode(this.pubBytes(),rt)},key$6=et,key$6}var signature$6,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$6;hasRequiredSignature=1;var _=bnExports$1,a=requireUtils(),$=a.assert,j=a.cachedProperty,et=a.parseBytes;function tt(rt,nt){this.eddsa=rt,typeof nt!="object"&&(nt=et(nt)),Array.isArray(nt)&&(nt={R:nt.slice(0,rt.encodingLength),S:nt.slice(rt.encodingLength)}),$(nt.R&&nt.S,"Signature without R or S"),rt.isPoint(nt.R)&&(this._R=nt.R),nt.S instanceof _&&(this._S=nt.S),this._Rencoded=Array.isArray(nt.R)?nt.R:nt.Rencoded,this._Sencoded=Array.isArray(nt.S)?nt.S:nt.Sencoded}return j(tt,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),j(tt,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),j(tt,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),j(tt,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),tt.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},tt.prototype.toHex=function(){return a.encode(this.toBytes(),"hex").toUpperCase()},signature$6=tt,signature$6}var eddsa$3,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa$3;hasRequiredEddsa=1;var _=hash$8,a=requireCurves(),$=requireUtils(),j=$.assert,et=$.parseBytes,tt=requireKey(),rt=requireSignature();function nt(it){if(j(it==="ed25519","only tested with ed25519 so far"),!(this instanceof nt))return new nt(it);it=a[it].curve,this.curve=it,this.g=it.g,this.g.precompute(it.n.bitLength()+1),this.pointClass=it.point().constructor,this.encodingLength=Math.ceil(it.n.bitLength()/8),this.hash=_.sha512}return eddsa$3=nt,nt.prototype.sign=function(at,st){at=et(at);var ot=this.keyFromSecret(st),ut=this.hashInt(ot.messagePrefix(),at),dt=this.g.mul(ut),mt=this.encodePoint(dt),xt=this.hashInt(mt,ot.pubBytes(),at).mul(ot.priv()),Ct=ut.add(xt).umod(this.curve.n);return this.makeSignature({R:dt,S:Ct,Rencoded:mt})},nt.prototype.verify=function(at,st,ot){at=et(at),st=this.makeSignature(st);var ut=this.keyFromPublic(ot),dt=this.hashInt(st.Rencoded(),ut.pubBytes(),at),mt=this.g.mul(st.S()),xt=st.R().add(ut.pub().mul(dt));return xt.eq(mt)},nt.prototype.hashInt=function(){for(var at=this.hash(),st=0;st=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return xt?nt(Tt,Pt):rt(Tt,Pt)};function at(ut,dt){var mt=ut.modulus.byteLength(),xt=dt.length,Ct=$("sha1").update(it.alloc(0)).digest(),Pt=Ct.length,Tt=2*Pt;if(xt>mt-Tt-2)throw new Error("message too long");var kt=it.alloc(mt-xt-Tt-2),Lt=mt-Pt-1,Nt=a(Pt),zt=et(it.concat([Ct,kt,it.alloc(1,1),dt],Lt),j(Nt,Lt)),jt=et(Nt,j(zt,Pt));return new tt(it.concat([it.alloc(1),jt,zt],mt))}function st(ut,dt,mt){var xt=dt.length,Ct=ut.modulus.byteLength();if(xt>Ct-11)throw new Error("message too long");var Pt;return mt?Pt=it.alloc(Ct-xt-3,255):Pt=ot(Ct-xt-3),new tt(it.concat([it.from([0,mt?1:2]),Pt,it.alloc(1),dt],Ct))}function ot(ut){for(var dt=it.allocUnsafe(ut),mt=0,xt=a(ut*2),Ct=0,Pt;mtPt||new j(dt).cmp(Ct.modulus)>=0)throw new Error("decryption error");var Tt;mt?Tt=rt(new j(dt),Ct):Tt=et(dt,Ct);var kt=nt.alloc(Pt-Tt.length);if(Tt=nt.concat([kt,Tt],Pt),xt===4)return it(Ct,Tt);if(xt===1)return at(Ct,Tt,mt);if(xt===3)return Tt;throw new Error("unknown padding")};function it(ot,ut){var dt=ot.modulus.byteLength(),mt=tt("sha1").update(nt.alloc(0)).digest(),xt=mt.length;if(ut[0]!==0)throw new Error("decryption error");var Ct=ut.slice(1,xt+1),Pt=ut.slice(xt+1),Tt=$(Ct,a(Pt,xt)),kt=$(Pt,a(Tt,dt-xt-1));if(st(mt,kt.slice(0,xt)))throw new Error("decryption error");for(var Lt=xt;kt[Lt]===0;)Lt++;if(kt[Lt++]!==1)throw new Error("decryption error");return kt.slice(Lt)}function at(ot,ut,dt){for(var mt=ut.slice(0,2),xt=2,Ct=0;ut[xt++]!==0;)if(xt>=ut.length){Ct++;break}var Pt=ut.slice(2,xt-1);if((mt.toString("hex")!=="0002"&&!dt||mt.toString("hex")!=="0001"&&dt)&&Ct++,Pt.length<8&&Ct++,Ct)throw new Error("decryption error");return ut.slice(xt)}function st(ot,ut){ot=nt.from(ot),ut=nt.from(ut);var dt=0,mt=ot.length;ot.length!==ut.length&&(dt++,mt=Math.min(ot.length,ut.length));for(var xt=-1;++xtrt||ut<0)throw new TypeError("offset must be a uint32");if(ut>et||ut>dt)throw new RangeError("offset out of range")}function it(ut,dt,mt){if(typeof ut!="number"||ut!==ut)throw new TypeError("size must be a number");if(ut>rt||ut<0)throw new TypeError("size must be a uint32");if(ut+dt>mt||ut>et)throw new RangeError("buffer too small")}tt&&tt.getRandomValues||!process$1$1.browser?(browser.randomFill=at,browser.randomFillSync=ot):(browser.randomFill=_,browser.randomFillSync=_);function at(ut,dt,mt,xt){if(!j.isBuffer(ut)&&!(ut instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof dt=="function")xt=dt,dt=0,mt=ut.length;else if(typeof mt=="function")xt=mt,mt=ut.length-dt;else if(typeof xt!="function")throw new TypeError('"cb" argument must be a function');return nt(dt,ut.length),it(mt,dt,ut.length),st(ut,dt,mt,xt)}function st(ut,dt,mt,xt){if(process$1$1.browser){var Ct=ut.buffer,Pt=new Uint8Array(Ct,dt,mt);if(tt.getRandomValues(Pt),xt){process$1$1.nextTick(function(){xt(null,ut)});return}return ut}if(xt){$(mt,function(kt,Lt){if(kt)return xt(kt);Lt.copy(ut,dt),xt(null,ut)});return}var Tt=$(mt);return Tt.copy(ut,dt),ut}function ot(ut,dt,mt){if(typeof dt>"u"&&(dt=0),!j.isBuffer(ut)&&!(ut instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return nt(dt,ut.length),mt===void 0&&(mt=ut.length-dt),it(mt,dt,ut.length),st(ut,dt,mt)}return browser}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$8(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=browser$b,cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$7();var _=requireAlgos(),a=Object.keys(_),$=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(a);cryptoBrowserify.getHashes=function(){return $};var j=browser$7;cryptoBrowserify.pbkdf2=j.pbkdf2,cryptoBrowserify.pbkdf2Sync=j.pbkdf2Sync;var et=requireBrowser$5();cryptoBrowserify.Cipher=et.Cipher,cryptoBrowserify.createCipher=et.createCipher,cryptoBrowserify.Cipheriv=et.Cipheriv,cryptoBrowserify.createCipheriv=et.createCipheriv,cryptoBrowserify.Decipher=et.Decipher,cryptoBrowserify.createDecipher=et.createDecipher,cryptoBrowserify.Decipheriv=et.Decipheriv,cryptoBrowserify.createDecipheriv=et.createDecipheriv,cryptoBrowserify.getCiphers=et.getCiphers,cryptoBrowserify.listCiphers=et.listCiphers;var tt=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=tt.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=tt.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=tt.getDiffieHellman,cryptoBrowserify.createDiffieHellman=tt.createDiffieHellman,cryptoBrowserify.DiffieHellman=tt.DiffieHellman;var rt=requireBrowser$3();cryptoBrowserify.createSign=rt.createSign,cryptoBrowserify.Sign=rt.Sign,cryptoBrowserify.createVerify=rt.createVerify,cryptoBrowserify.Verify=rt.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var nt=requireBrowser$1();cryptoBrowserify.publicEncrypt=nt.publicEncrypt,cryptoBrowserify.privateEncrypt=nt.privateEncrypt,cryptoBrowserify.publicDecrypt=nt.publicDecrypt,cryptoBrowserify.privateDecrypt=nt.privateDecrypt;var it=requireBrowser();return cryptoBrowserify.randomFill=it.randomFill,cryptoBrowserify.randomFillSync=it.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` +`))},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}Object.defineProperty(node$2,"__esModule",{value:!0});node$2.NodeRandomSource=void 0;const wipe_1$4=wipe$1;class NodeRandomSource{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof commonjsRequire<"u"){const a=requireCryptoBrowserify();a&&a.randomBytes&&(this._crypto=a,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(a){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let $=this._crypto.randomBytes(a);if($.length!==a)throw new Error("NodeRandomSource: got fewer bytes than requested");const j=new Uint8Array(a);for(let et=0;et>>16&65535,st=nt&65535,ot=it>>>16&65535,ut=it&65535;return st*ut+(at*ut+st*ot<<16>>>0)|0}_.mul=Math.imul||a;function $(nt,it){return nt+it|0}_.add=$;function j(nt,it){return nt-it|0}_.sub=j;function et(nt,it){return nt<>>32-it}_.rotl=et;function tt(nt,it){return nt<<32-it|nt>>>it}_.rotr=tt;function rt(nt){return typeof nt=="number"&&isFinite(nt)&&Math.floor(nt)===nt}_.isInteger=Number.isInteger||rt,_.MAX_SAFE_INTEGER=9007199254740991,_.isSafeInteger=function(nt){return _.isInteger(nt)&&nt>=-_.MAX_SAFE_INTEGER&&nt<=_.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(_,a){return a===void 0&&(a=0),(_[a+0]<<8|_[a+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(_,a){return a===void 0&&(a=0),(_[a+0]<<8|_[a+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(_,a){return a===void 0&&(a=0),(_[a+1]<<8|_[a])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(_,a){return a===void 0&&(a=0),(_[a+1]<<8|_[a])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(_,a,$){return a===void 0&&(a=new Uint8Array(2)),$===void 0&&($=0),a[$+0]=_>>>8,a[$+1]=_>>>0,a}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(_,a,$){return a===void 0&&(a=new Uint8Array(2)),$===void 0&&($=0),a[$+0]=_>>>0,a[$+1]=_>>>8,a}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(_,a){return a===void 0&&(a=0),_[a]<<24|_[a+1]<<16|_[a+2]<<8|_[a+3]}binary.readInt32BE=readInt32BE;function readUint32BE(_,a){return a===void 0&&(a=0),(_[a]<<24|_[a+1]<<16|_[a+2]<<8|_[a+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(_,a){return a===void 0&&(a=0),_[a+3]<<24|_[a+2]<<16|_[a+1]<<8|_[a]}binary.readInt32LE=readInt32LE;function readUint32LE(_,a){return a===void 0&&(a=0),(_[a+3]<<24|_[a+2]<<16|_[a+1]<<8|_[a])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(_,a,$){return a===void 0&&(a=new Uint8Array(4)),$===void 0&&($=0),a[$+0]=_>>>24,a[$+1]=_>>>16,a[$+2]=_>>>8,a[$+3]=_>>>0,a}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(_,a,$){return a===void 0&&(a=new Uint8Array(4)),$===void 0&&($=0),a[$+0]=_>>>0,a[$+1]=_>>>8,a[$+2]=_>>>16,a[$+3]=_>>>24,a}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(_,a){a===void 0&&(a=0);var $=readInt32BE(_,a),j=readInt32BE(_,a+4);return $*4294967296+j-(j>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(_,a){a===void 0&&(a=0);var $=readUint32BE(_,a),j=readUint32BE(_,a+4);return $*4294967296+j}binary.readUint64BE=readUint64BE;function readInt64LE(_,a){a===void 0&&(a=0);var $=readInt32LE(_,a),j=readInt32LE(_,a+4);return j*4294967296+$-($>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(_,a){a===void 0&&(a=0);var $=readUint32LE(_,a),j=readUint32LE(_,a+4);return j*4294967296+$}binary.readUint64LE=readUint64LE;function writeUint64BE(_,a,$){return a===void 0&&(a=new Uint8Array(8)),$===void 0&&($=0),writeUint32BE(_/4294967296>>>0,a,$),writeUint32BE(_>>>0,a,$+4),a}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(_,a,$){return a===void 0&&(a=new Uint8Array(8)),$===void 0&&($=0),writeUint32LE(_>>>0,a,$),writeUint32LE(_/4294967296>>>0,a,$+4),a}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(_,a,$){if($===void 0&&($=0),_%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(_/8>a.length-$)throw new Error("readUintBE: array is too short for the given bitLength");for(var j=0,et=1,tt=_/8+$-1;tt>=$;tt--)j+=a[tt]*et,et*=256;return j}binary.readUintBE=readUintBE;function readUintLE(_,a,$){if($===void 0&&($=0),_%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(_/8>a.length-$)throw new Error("readUintLE: array is too short for the given bitLength");for(var j=0,et=1,tt=$;tt<$+_/8;tt++)j+=a[tt]*et,et*=256;return j}binary.readUintLE=readUintLE;function writeUintBE(_,a,$,j){if($===void 0&&($=new Uint8Array(_/8)),j===void 0&&(j=0),_%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(a))throw new Error("writeUintBE value must be an integer");for(var et=1,tt=_/8+j-1;tt>=j;tt--)$[tt]=a/et&255,et*=256;return $}binary.writeUintBE=writeUintBE;function writeUintLE(_,a,$,j){if($===void 0&&($=new Uint8Array(_/8)),j===void 0&&(j=0),_%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(a))throw new Error("writeUintLE value must be an integer");for(var et=1,tt=j;tt256)throw new Error("randomString charset is too long");let ut="";const dt=st.length,mt=256-256%dt;for(;at>0;){const xt=et(Math.ceil(at*256/mt),ot);for(let Ct=0;Ct0;Ct++){const Pt=xt[Ct];Pt>16&1),zt[Ft-1]&=65535;zt[15]=jt[15]-32767-(zt[14]>>16&1);const Dt=zt[15]>>16&1;zt[14]&=65535,nt(jt,zt,1-Dt)}for(let Mt=0;Mt<16;Mt++)Lt[2*Mt]=jt[Mt]&255,Lt[2*Mt+1]=jt[Mt]>>8}function at(Lt,Nt){for(let zt=0;zt<16;zt++)Lt[zt]=Nt[2*zt]+(Nt[2*zt+1]<<8);Lt[15]&=32767}function st(Lt,Nt,zt){for(let jt=0;jt<16;jt++)Lt[jt]=Nt[jt]+zt[jt]}function ot(Lt,Nt,zt){for(let jt=0;jt<16;jt++)Lt[jt]=Nt[jt]-zt[jt]}function ut(Lt,Nt,zt){let jt,Mt,Dt=0,Ft=0,Bt=0,yt=0,bt=0,ct=0,ht=0,vt=0,St=0,Rt=0,$t=0,Et=0,At=0,wt=0,Ot=0,tr=0,nr=0,ir=0,Wt=0,Kt=0,Jt=0,Ht=0,Vt=0,Qt=0,dr=0,xr=0,pr=0,Ir=0,kr=0,lr=0,fr=0,Er=zt[0],$r=zt[1],Pr=zt[2],Rr=zt[3],Ar=zt[4],Or=zt[5],Lr=zt[6],ar=zt[7],Yt=zt[8],er=zt[9],Zt=zt[10],qt=zt[11],Gt=zt[12],or=zt[13],vr=zt[14],wr=zt[15];jt=Nt[0],Dt+=jt*Er,Ft+=jt*$r,Bt+=jt*Pr,yt+=jt*Rr,bt+=jt*Ar,ct+=jt*Or,ht+=jt*Lr,vt+=jt*ar,St+=jt*Yt,Rt+=jt*er,$t+=jt*Zt,Et+=jt*qt,At+=jt*Gt,wt+=jt*or,Ot+=jt*vr,tr+=jt*wr,jt=Nt[1],Ft+=jt*Er,Bt+=jt*$r,yt+=jt*Pr,bt+=jt*Rr,ct+=jt*Ar,ht+=jt*Or,vt+=jt*Lr,St+=jt*ar,Rt+=jt*Yt,$t+=jt*er,Et+=jt*Zt,At+=jt*qt,wt+=jt*Gt,Ot+=jt*or,tr+=jt*vr,nr+=jt*wr,jt=Nt[2],Bt+=jt*Er,yt+=jt*$r,bt+=jt*Pr,ct+=jt*Rr,ht+=jt*Ar,vt+=jt*Or,St+=jt*Lr,Rt+=jt*ar,$t+=jt*Yt,Et+=jt*er,At+=jt*Zt,wt+=jt*qt,Ot+=jt*Gt,tr+=jt*or,nr+=jt*vr,ir+=jt*wr,jt=Nt[3],yt+=jt*Er,bt+=jt*$r,ct+=jt*Pr,ht+=jt*Rr,vt+=jt*Ar,St+=jt*Or,Rt+=jt*Lr,$t+=jt*ar,Et+=jt*Yt,At+=jt*er,wt+=jt*Zt,Ot+=jt*qt,tr+=jt*Gt,nr+=jt*or,ir+=jt*vr,Wt+=jt*wr,jt=Nt[4],bt+=jt*Er,ct+=jt*$r,ht+=jt*Pr,vt+=jt*Rr,St+=jt*Ar,Rt+=jt*Or,$t+=jt*Lr,Et+=jt*ar,At+=jt*Yt,wt+=jt*er,Ot+=jt*Zt,tr+=jt*qt,nr+=jt*Gt,ir+=jt*or,Wt+=jt*vr,Kt+=jt*wr,jt=Nt[5],ct+=jt*Er,ht+=jt*$r,vt+=jt*Pr,St+=jt*Rr,Rt+=jt*Ar,$t+=jt*Or,Et+=jt*Lr,At+=jt*ar,wt+=jt*Yt,Ot+=jt*er,tr+=jt*Zt,nr+=jt*qt,ir+=jt*Gt,Wt+=jt*or,Kt+=jt*vr,Jt+=jt*wr,jt=Nt[6],ht+=jt*Er,vt+=jt*$r,St+=jt*Pr,Rt+=jt*Rr,$t+=jt*Ar,Et+=jt*Or,At+=jt*Lr,wt+=jt*ar,Ot+=jt*Yt,tr+=jt*er,nr+=jt*Zt,ir+=jt*qt,Wt+=jt*Gt,Kt+=jt*or,Jt+=jt*vr,Ht+=jt*wr,jt=Nt[7],vt+=jt*Er,St+=jt*$r,Rt+=jt*Pr,$t+=jt*Rr,Et+=jt*Ar,At+=jt*Or,wt+=jt*Lr,Ot+=jt*ar,tr+=jt*Yt,nr+=jt*er,ir+=jt*Zt,Wt+=jt*qt,Kt+=jt*Gt,Jt+=jt*or,Ht+=jt*vr,Vt+=jt*wr,jt=Nt[8],St+=jt*Er,Rt+=jt*$r,$t+=jt*Pr,Et+=jt*Rr,At+=jt*Ar,wt+=jt*Or,Ot+=jt*Lr,tr+=jt*ar,nr+=jt*Yt,ir+=jt*er,Wt+=jt*Zt,Kt+=jt*qt,Jt+=jt*Gt,Ht+=jt*or,Vt+=jt*vr,Qt+=jt*wr,jt=Nt[9],Rt+=jt*Er,$t+=jt*$r,Et+=jt*Pr,At+=jt*Rr,wt+=jt*Ar,Ot+=jt*Or,tr+=jt*Lr,nr+=jt*ar,ir+=jt*Yt,Wt+=jt*er,Kt+=jt*Zt,Jt+=jt*qt,Ht+=jt*Gt,Vt+=jt*or,Qt+=jt*vr,dr+=jt*wr,jt=Nt[10],$t+=jt*Er,Et+=jt*$r,At+=jt*Pr,wt+=jt*Rr,Ot+=jt*Ar,tr+=jt*Or,nr+=jt*Lr,ir+=jt*ar,Wt+=jt*Yt,Kt+=jt*er,Jt+=jt*Zt,Ht+=jt*qt,Vt+=jt*Gt,Qt+=jt*or,dr+=jt*vr,xr+=jt*wr,jt=Nt[11],Et+=jt*Er,At+=jt*$r,wt+=jt*Pr,Ot+=jt*Rr,tr+=jt*Ar,nr+=jt*Or,ir+=jt*Lr,Wt+=jt*ar,Kt+=jt*Yt,Jt+=jt*er,Ht+=jt*Zt,Vt+=jt*qt,Qt+=jt*Gt,dr+=jt*or,xr+=jt*vr,pr+=jt*wr,jt=Nt[12],At+=jt*Er,wt+=jt*$r,Ot+=jt*Pr,tr+=jt*Rr,nr+=jt*Ar,ir+=jt*Or,Wt+=jt*Lr,Kt+=jt*ar,Jt+=jt*Yt,Ht+=jt*er,Vt+=jt*Zt,Qt+=jt*qt,dr+=jt*Gt,xr+=jt*or,pr+=jt*vr,Ir+=jt*wr,jt=Nt[13],wt+=jt*Er,Ot+=jt*$r,tr+=jt*Pr,nr+=jt*Rr,ir+=jt*Ar,Wt+=jt*Or,Kt+=jt*Lr,Jt+=jt*ar,Ht+=jt*Yt,Vt+=jt*er,Qt+=jt*Zt,dr+=jt*qt,xr+=jt*Gt,pr+=jt*or,Ir+=jt*vr,kr+=jt*wr,jt=Nt[14],Ot+=jt*Er,tr+=jt*$r,nr+=jt*Pr,ir+=jt*Rr,Wt+=jt*Ar,Kt+=jt*Or,Jt+=jt*Lr,Ht+=jt*ar,Vt+=jt*Yt,Qt+=jt*er,dr+=jt*Zt,xr+=jt*qt,pr+=jt*Gt,Ir+=jt*or,kr+=jt*vr,lr+=jt*wr,jt=Nt[15],tr+=jt*Er,nr+=jt*$r,ir+=jt*Pr,Wt+=jt*Rr,Kt+=jt*Ar,Jt+=jt*Or,Ht+=jt*Lr,Vt+=jt*ar,Qt+=jt*Yt,dr+=jt*er,xr+=jt*Zt,pr+=jt*qt,Ir+=jt*Gt,kr+=jt*or,lr+=jt*vr,fr+=jt*wr,Dt+=38*nr,Ft+=38*ir,Bt+=38*Wt,yt+=38*Kt,bt+=38*Jt,ct+=38*Ht,ht+=38*Vt,vt+=38*Qt,St+=38*dr,Rt+=38*xr,$t+=38*pr,Et+=38*Ir,At+=38*kr,wt+=38*lr,Ot+=38*fr,Mt=1,jt=Dt+Mt+65535,Mt=Math.floor(jt/65536),Dt=jt-Mt*65536,jt=Ft+Mt+65535,Mt=Math.floor(jt/65536),Ft=jt-Mt*65536,jt=Bt+Mt+65535,Mt=Math.floor(jt/65536),Bt=jt-Mt*65536,jt=yt+Mt+65535,Mt=Math.floor(jt/65536),yt=jt-Mt*65536,jt=bt+Mt+65535,Mt=Math.floor(jt/65536),bt=jt-Mt*65536,jt=ct+Mt+65535,Mt=Math.floor(jt/65536),ct=jt-Mt*65536,jt=ht+Mt+65535,Mt=Math.floor(jt/65536),ht=jt-Mt*65536,jt=vt+Mt+65535,Mt=Math.floor(jt/65536),vt=jt-Mt*65536,jt=St+Mt+65535,Mt=Math.floor(jt/65536),St=jt-Mt*65536,jt=Rt+Mt+65535,Mt=Math.floor(jt/65536),Rt=jt-Mt*65536,jt=$t+Mt+65535,Mt=Math.floor(jt/65536),$t=jt-Mt*65536,jt=Et+Mt+65535,Mt=Math.floor(jt/65536),Et=jt-Mt*65536,jt=At+Mt+65535,Mt=Math.floor(jt/65536),At=jt-Mt*65536,jt=wt+Mt+65535,Mt=Math.floor(jt/65536),wt=jt-Mt*65536,jt=Ot+Mt+65535,Mt=Math.floor(jt/65536),Ot=jt-Mt*65536,jt=tr+Mt+65535,Mt=Math.floor(jt/65536),tr=jt-Mt*65536,Dt+=Mt-1+37*(Mt-1),Mt=1,jt=Dt+Mt+65535,Mt=Math.floor(jt/65536),Dt=jt-Mt*65536,jt=Ft+Mt+65535,Mt=Math.floor(jt/65536),Ft=jt-Mt*65536,jt=Bt+Mt+65535,Mt=Math.floor(jt/65536),Bt=jt-Mt*65536,jt=yt+Mt+65535,Mt=Math.floor(jt/65536),yt=jt-Mt*65536,jt=bt+Mt+65535,Mt=Math.floor(jt/65536),bt=jt-Mt*65536,jt=ct+Mt+65535,Mt=Math.floor(jt/65536),ct=jt-Mt*65536,jt=ht+Mt+65535,Mt=Math.floor(jt/65536),ht=jt-Mt*65536,jt=vt+Mt+65535,Mt=Math.floor(jt/65536),vt=jt-Mt*65536,jt=St+Mt+65535,Mt=Math.floor(jt/65536),St=jt-Mt*65536,jt=Rt+Mt+65535,Mt=Math.floor(jt/65536),Rt=jt-Mt*65536,jt=$t+Mt+65535,Mt=Math.floor(jt/65536),$t=jt-Mt*65536,jt=Et+Mt+65535,Mt=Math.floor(jt/65536),Et=jt-Mt*65536,jt=At+Mt+65535,Mt=Math.floor(jt/65536),At=jt-Mt*65536,jt=wt+Mt+65535,Mt=Math.floor(jt/65536),wt=jt-Mt*65536,jt=Ot+Mt+65535,Mt=Math.floor(jt/65536),Ot=jt-Mt*65536,jt=tr+Mt+65535,Mt=Math.floor(jt/65536),tr=jt-Mt*65536,Dt+=Mt-1+37*(Mt-1),Lt[0]=Dt,Lt[1]=Ft,Lt[2]=Bt,Lt[3]=yt,Lt[4]=bt,Lt[5]=ct,Lt[6]=ht,Lt[7]=vt,Lt[8]=St,Lt[9]=Rt,Lt[10]=$t,Lt[11]=Et,Lt[12]=At,Lt[13]=wt,Lt[14]=Ot,Lt[15]=tr}function dt(Lt,Nt){ut(Lt,Nt,Nt)}function mt(Lt,Nt){const zt=j();for(let jt=0;jt<16;jt++)zt[jt]=Nt[jt];for(let jt=253;jt>=0;jt--)dt(zt,zt),jt!==2&&jt!==4&&ut(zt,zt,Nt);for(let jt=0;jt<16;jt++)Lt[jt]=zt[jt]}function xt(Lt,Nt){const zt=new Uint8Array(32),jt=new Float64Array(80),Mt=j(),Dt=j(),Ft=j(),Bt=j(),yt=j(),bt=j();for(let St=0;St<31;St++)zt[St]=Lt[St];zt[31]=Lt[31]&127|64,zt[0]&=248,at(jt,Nt);for(let St=0;St<16;St++)Dt[St]=jt[St];Mt[0]=Bt[0]=1;for(let St=254;St>=0;--St){const Rt=zt[St>>>3]>>>(St&7)&1;nt(Mt,Dt,Rt),nt(Ft,Bt,Rt),st(yt,Mt,Ft),ot(Mt,Mt,Ft),st(Ft,Dt,Bt),ot(Dt,Dt,Bt),dt(Bt,yt),dt(bt,Mt),ut(Mt,Ft,Mt),ut(Ft,Dt,yt),st(yt,Mt,Ft),ot(Mt,Mt,Ft),dt(Dt,Mt),ot(Ft,Bt,bt),ut(Mt,Ft,tt),st(Mt,Mt,Bt),ut(Ft,Ft,Mt),ut(Mt,Bt,bt),ut(Bt,Dt,jt),dt(Dt,yt),nt(Mt,Dt,Rt),nt(Ft,Bt,Rt)}for(let St=0;St<16;St++)jt[St+16]=Mt[St],jt[St+32]=Ft[St],jt[St+48]=Dt[St],jt[St+64]=Bt[St];const ct=jt.subarray(32),ht=jt.subarray(16);mt(ct,ct),ut(ht,ht,ct);const vt=new Uint8Array(32);return it(vt,ht),vt}_.scalarMult=xt;function Ct(Lt){return xt(Lt,et)}_.scalarMultBase=Ct;function Pt(Lt){if(Lt.length!==_.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${_.SECRET_KEY_LENGTH} bytes`);const Nt=new Uint8Array(Lt);return{publicKey:Ct(Nt),secretKey:Nt}}_.generateKeyPairFromSeed=Pt;function Tt(Lt){const Nt=(0,a.randomBytes)(32,Lt),zt=Pt(Nt);return(0,$.wipe)(Nt),zt}_.generateKeyPair=Tt;function kt(Lt,Nt,zt=!1){if(Lt.length!==_.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(Nt.length!==_.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const jt=xt(Lt,Nt);if(zt){let Mt=0;for(let Dt=0;Dt>>25,$t=jt+kt|0,Bt^=$t<<9|$t>>>23,$t=Bt+jt|0,ht^=$t<<13|$t>>>19,$t=ht+Bt|0,kt^=$t<<18|$t>>>14,$t=Mt+Lt|0,yt^=$t<<7|$t>>>25,$t=yt+Mt|0,vt^=$t<<9|$t>>>23,$t=vt+yt|0,Lt^=$t<<13|$t>>>19,$t=Lt+vt|0,Mt^=$t<<18|$t>>>14,$t=bt+Dt|0,St^=$t<<7|$t>>>25,$t=St+bt|0,Nt^=$t<<9|$t>>>23,$t=Nt+St|0,Dt^=$t<<13|$t>>>19,$t=Dt+Nt|0,bt^=$t<<18|$t>>>14,$t=Rt+ct|0,zt^=$t<<7|$t>>>25,$t=zt+Rt|0,Ft^=$t<<9|$t>>>23,$t=Ft+zt|0,ct^=$t<<13|$t>>>19,$t=ct+Ft|0,Rt^=$t<<18|$t>>>14,$t=kt+zt|0,Lt^=$t<<7|$t>>>25,$t=Lt+kt|0,Nt^=$t<<9|$t>>>23,$t=Nt+Lt|0,zt^=$t<<13|$t>>>19,$t=zt+Nt|0,kt^=$t<<18|$t>>>14,$t=Mt+jt|0,Dt^=$t<<7|$t>>>25,$t=Dt+Mt|0,Ft^=$t<<9|$t>>>23,$t=Ft+Dt|0,jt^=$t<<13|$t>>>19,$t=jt+Ft|0,Mt^=$t<<18|$t>>>14,$t=bt+yt|0,ct^=$t<<7|$t>>>25,$t=ct+bt|0,Bt^=$t<<9|$t>>>23,$t=Bt+ct|0,yt^=$t<<13|$t>>>19,$t=yt+Bt|0,bt^=$t<<18|$t>>>14,$t=Rt+St|0,ht^=$t<<7|$t>>>25,$t=ht+Rt|0,vt^=$t<<9|$t>>>23,$t=vt+ht|0,St^=$t<<13|$t>>>19,$t=St+vt|0,Rt^=$t<<18|$t>>>14;binary_1$1.writeUint32LE(kt+j|0,_,0),binary_1$1.writeUint32LE(Lt+et|0,_,4),binary_1$1.writeUint32LE(Nt+tt|0,_,8),binary_1$1.writeUint32LE(zt+rt|0,_,12),binary_1$1.writeUint32LE(jt+nt|0,_,16),binary_1$1.writeUint32LE(Mt+it|0,_,20),binary_1$1.writeUint32LE(Dt+at|0,_,24),binary_1$1.writeUint32LE(Ft+st|0,_,28),binary_1$1.writeUint32LE(Bt+ot|0,_,32),binary_1$1.writeUint32LE(yt+ut|0,_,36),binary_1$1.writeUint32LE(bt+dt|0,_,40),binary_1$1.writeUint32LE(ct+mt|0,_,44),binary_1$1.writeUint32LE(ht+xt|0,_,48),binary_1$1.writeUint32LE(vt+Ct|0,_,52),binary_1$1.writeUint32LE(St+Pt|0,_,56),binary_1$1.writeUint32LE(Rt+Tt|0,_,60)}function streamXOR$1(_,a,$,j,et){if(et===void 0&&(et=0),_.length!==32)throw new Error("Salsa20: key size must be 32 bytes");if(j.length<$.length)throw new Error("Salsa20: destination is shorter than source");var tt,rt;if(et===0){if(a.length!==8)throw new Error("Salsa20 nonce must be 8 bytes");tt=new Uint8Array(16),tt.set(a),rt=a.length}else{if(a.length!==16)throw new Error("Salsa20 nonce with counter must be 16 bytes");tt=a,rt=16-et}for(var nt=new Uint8Array(64),it=0;it<$.length;it+=64){core(nt,tt,_);for(var at=it;at>>=8,a++;if(j>0)throw new Error("Salsa20: counter overflow")}Object.defineProperty(xsalsa20,"__esModule",{value:!0});var binary_1=binary,salsa20_1=salsa20,wipe_1$2=wipe$1;function streamXOR(_,a,$,j,et){if(et===void 0&&(et=0),et===0){if(a.length!==24)throw new Error("XSalsa20 nonce must be 24 bytes")}else if(a.length!==32)throw new Error("XSalsa20 nonce with counter must be 32 bytes");var tt=hsalsa(_,a.subarray(0,16),new Uint8Array(32)),rt=salsa20_1.streamXOR(tt,a.subarray(16),$,j,et);return wipe_1$2.wipe(tt),rt}xsalsa20.streamXOR=streamXOR;function stream(_,a,$,j){return j===void 0&&(j=0),wipe_1$2.wipe($),streamXOR(_,a,$,$,j)}xsalsa20.stream=stream;var ROUNDS=20;function hsalsa(_,a,$){for(var j=1634760805,et=_[3]<<24|_[2]<<16|_[1]<<8|_[0],tt=_[7]<<24|_[6]<<16|_[5]<<8|_[4],rt=_[11]<<24|_[10]<<16|_[9]<<8|_[8],nt=_[15]<<24|_[14]<<16|_[13]<<8|_[12],it=857760878,at=a[3]<<24|a[2]<<16|a[1]<<8|a[0],st=a[7]<<24|a[6]<<16|a[5]<<8|a[4],ot=a[11]<<24|a[10]<<16|a[9]<<8|a[8],ut=a[15]<<24|a[14]<<16|a[13]<<8|a[12],dt=2036477234,mt=_[19]<<24|_[18]<<16|_[17]<<8|_[16],xt=_[23]<<24|_[22]<<16|_[21]<<8|_[20],Ct=_[27]<<24|_[26]<<16|_[25]<<8|_[24],Pt=_[31]<<24|_[30]<<16|_[29]<<8|_[28],Tt=1797285236,kt,Lt=0;Lt>>25,kt=nt+j|0,ot^=kt<<9|kt>>>23,kt=ot+nt|0,xt^=kt<<13|kt>>>19,kt=xt+ot|0,j^=kt<<18|kt>>>14,kt=it+et|0,ut^=kt<<7|kt>>>25,kt=ut+it|0,Ct^=kt<<9|kt>>>23,kt=Ct+ut|0,et^=kt<<13|kt>>>19,kt=et+Ct|0,it^=kt<<18|kt>>>14,kt=dt+at|0,Pt^=kt<<7|kt>>>25,kt=Pt+dt|0,tt^=kt<<9|kt>>>23,kt=tt+Pt|0,at^=kt<<13|kt>>>19,kt=at+tt|0,dt^=kt<<18|kt>>>14,kt=Tt+mt|0,rt^=kt<<7|kt>>>25,kt=rt+Tt|0,st^=kt<<9|kt>>>23,kt=st+rt|0,mt^=kt<<13|kt>>>19,kt=mt+st|0,Tt^=kt<<18|kt>>>14,kt=j+rt|0,et^=kt<<7|kt>>>25,kt=et+j|0,tt^=kt<<9|kt>>>23,kt=tt+et|0,rt^=kt<<13|kt>>>19,kt=rt+tt|0,j^=kt<<18|kt>>>14,kt=it+nt|0,at^=kt<<7|kt>>>25,kt=at+it|0,st^=kt<<9|kt>>>23,kt=st+at|0,nt^=kt<<13|kt>>>19,kt=nt+st|0,it^=kt<<18|kt>>>14,kt=dt+ut|0,mt^=kt<<7|kt>>>25,kt=mt+dt|0,ot^=kt<<9|kt>>>23,kt=ot+mt|0,ut^=kt<<13|kt>>>19,kt=ut+ot|0,dt^=kt<<18|kt>>>14,kt=Tt+Pt|0,xt^=kt<<7|kt>>>25,kt=xt+Tt|0,Ct^=kt<<9|kt>>>23,kt=Ct+xt|0,Pt^=kt<<13|kt>>>19,kt=Pt+Ct|0,Tt^=kt<<18|kt>>>14;return binary_1.writeUint32LE(j,$,0),binary_1.writeUint32LE(it,$,4),binary_1.writeUint32LE(dt,$,8),binary_1.writeUint32LE(Tt,$,12),binary_1.writeUint32LE(at,$,16),binary_1.writeUint32LE(st,$,20),binary_1.writeUint32LE(ot,$,24),binary_1.writeUint32LE(ut,$,28),$}xsalsa20.hsalsa=hsalsa;var secretbox={},poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(_,a,$){return~(_-1)&a|_-1&$}constantTime.select=select;function lessOrEqual(_,a){return(_|0)-(a|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare$d(_,a){if(_.length!==a.length)return 0;for(var $=0,j=0;j<_.length;j++)$|=_[j]^a[j];return 1&$-1>>>8}constantTime.compare=compare$d;function equal(_,a){return _.length===0||a.length===0?!1:compare$d(_,a)!==0}constantTime.equal=equal;(function(_){Object.defineProperty(_,"__esModule",{value:!0});var a=constantTime,$=wipe$1;_.DIGEST_LENGTH=16;var j=function(){function rt(nt){this.digestLength=_.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var it=nt[0]|nt[1]<<8;this._r[0]=it&8191;var at=nt[2]|nt[3]<<8;this._r[1]=(it>>>13|at<<3)&8191;var st=nt[4]|nt[5]<<8;this._r[2]=(at>>>10|st<<6)&7939;var ot=nt[6]|nt[7]<<8;this._r[3]=(st>>>7|ot<<9)&8191;var ut=nt[8]|nt[9]<<8;this._r[4]=(ot>>>4|ut<<12)&255,this._r[5]=ut>>>1&8190;var dt=nt[10]|nt[11]<<8;this._r[6]=(ut>>>14|dt<<2)&8191;var mt=nt[12]|nt[13]<<8;this._r[7]=(dt>>>11|mt<<5)&8065;var xt=nt[14]|nt[15]<<8;this._r[8]=(mt>>>8|xt<<8)&8191,this._r[9]=xt>>>5&127,this._pad[0]=nt[16]|nt[17]<<8,this._pad[1]=nt[18]|nt[19]<<8,this._pad[2]=nt[20]|nt[21]<<8,this._pad[3]=nt[22]|nt[23]<<8,this._pad[4]=nt[24]|nt[25]<<8,this._pad[5]=nt[26]|nt[27]<<8,this._pad[6]=nt[28]|nt[29]<<8,this._pad[7]=nt[30]|nt[31]<<8}return rt.prototype._blocks=function(nt,it,at){for(var st=this._fin?0:2048,ot=this._h[0],ut=this._h[1],dt=this._h[2],mt=this._h[3],xt=this._h[4],Ct=this._h[5],Pt=this._h[6],Tt=this._h[7],kt=this._h[8],Lt=this._h[9],Nt=this._r[0],zt=this._r[1],jt=this._r[2],Mt=this._r[3],Dt=this._r[4],Ft=this._r[5],Bt=this._r[6],yt=this._r[7],bt=this._r[8],ct=this._r[9];at>=16;){var ht=nt[it+0]|nt[it+1]<<8;ot+=ht&8191;var vt=nt[it+2]|nt[it+3]<<8;ut+=(ht>>>13|vt<<3)&8191;var St=nt[it+4]|nt[it+5]<<8;dt+=(vt>>>10|St<<6)&8191;var Rt=nt[it+6]|nt[it+7]<<8;mt+=(St>>>7|Rt<<9)&8191;var $t=nt[it+8]|nt[it+9]<<8;xt+=(Rt>>>4|$t<<12)&8191,Ct+=$t>>>1&8191;var Et=nt[it+10]|nt[it+11]<<8;Pt+=($t>>>14|Et<<2)&8191;var At=nt[it+12]|nt[it+13]<<8;Tt+=(Et>>>11|At<<5)&8191;var wt=nt[it+14]|nt[it+15]<<8;kt+=(At>>>8|wt<<8)&8191,Lt+=wt>>>5|st;var Ot=0,tr=Ot;tr+=ot*Nt,tr+=ut*(5*ct),tr+=dt*(5*bt),tr+=mt*(5*yt),tr+=xt*(5*Bt),Ot=tr>>>13,tr&=8191,tr+=Ct*(5*Ft),tr+=Pt*(5*Dt),tr+=Tt*(5*Mt),tr+=kt*(5*jt),tr+=Lt*(5*zt),Ot+=tr>>>13,tr&=8191;var nr=Ot;nr+=ot*zt,nr+=ut*Nt,nr+=dt*(5*ct),nr+=mt*(5*bt),nr+=xt*(5*yt),Ot=nr>>>13,nr&=8191,nr+=Ct*(5*Bt),nr+=Pt*(5*Ft),nr+=Tt*(5*Dt),nr+=kt*(5*Mt),nr+=Lt*(5*jt),Ot+=nr>>>13,nr&=8191;var ir=Ot;ir+=ot*jt,ir+=ut*zt,ir+=dt*Nt,ir+=mt*(5*ct),ir+=xt*(5*bt),Ot=ir>>>13,ir&=8191,ir+=Ct*(5*yt),ir+=Pt*(5*Bt),ir+=Tt*(5*Ft),ir+=kt*(5*Dt),ir+=Lt*(5*Mt),Ot+=ir>>>13,ir&=8191;var Wt=Ot;Wt+=ot*Mt,Wt+=ut*jt,Wt+=dt*zt,Wt+=mt*Nt,Wt+=xt*(5*ct),Ot=Wt>>>13,Wt&=8191,Wt+=Ct*(5*bt),Wt+=Pt*(5*yt),Wt+=Tt*(5*Bt),Wt+=kt*(5*Ft),Wt+=Lt*(5*Dt),Ot+=Wt>>>13,Wt&=8191;var Kt=Ot;Kt+=ot*Dt,Kt+=ut*Mt,Kt+=dt*jt,Kt+=mt*zt,Kt+=xt*Nt,Ot=Kt>>>13,Kt&=8191,Kt+=Ct*(5*ct),Kt+=Pt*(5*bt),Kt+=Tt*(5*yt),Kt+=kt*(5*Bt),Kt+=Lt*(5*Ft),Ot+=Kt>>>13,Kt&=8191;var Jt=Ot;Jt+=ot*Ft,Jt+=ut*Dt,Jt+=dt*Mt,Jt+=mt*jt,Jt+=xt*zt,Ot=Jt>>>13,Jt&=8191,Jt+=Ct*Nt,Jt+=Pt*(5*ct),Jt+=Tt*(5*bt),Jt+=kt*(5*yt),Jt+=Lt*(5*Bt),Ot+=Jt>>>13,Jt&=8191;var Ht=Ot;Ht+=ot*Bt,Ht+=ut*Ft,Ht+=dt*Dt,Ht+=mt*Mt,Ht+=xt*jt,Ot=Ht>>>13,Ht&=8191,Ht+=Ct*zt,Ht+=Pt*Nt,Ht+=Tt*(5*ct),Ht+=kt*(5*bt),Ht+=Lt*(5*yt),Ot+=Ht>>>13,Ht&=8191;var Vt=Ot;Vt+=ot*yt,Vt+=ut*Bt,Vt+=dt*Ft,Vt+=mt*Dt,Vt+=xt*Mt,Ot=Vt>>>13,Vt&=8191,Vt+=Ct*jt,Vt+=Pt*zt,Vt+=Tt*Nt,Vt+=kt*(5*ct),Vt+=Lt*(5*bt),Ot+=Vt>>>13,Vt&=8191;var Qt=Ot;Qt+=ot*bt,Qt+=ut*yt,Qt+=dt*Bt,Qt+=mt*Ft,Qt+=xt*Dt,Ot=Qt>>>13,Qt&=8191,Qt+=Ct*Mt,Qt+=Pt*jt,Qt+=Tt*zt,Qt+=kt*Nt,Qt+=Lt*(5*ct),Ot+=Qt>>>13,Qt&=8191;var dr=Ot;dr+=ot*ct,dr+=ut*bt,dr+=dt*yt,dr+=mt*Bt,dr+=xt*Ft,Ot=dr>>>13,dr&=8191,dr+=Ct*Dt,dr+=Pt*Mt,dr+=Tt*jt,dr+=kt*zt,dr+=Lt*Nt,Ot+=dr>>>13,dr&=8191,Ot=(Ot<<2)+Ot|0,Ot=Ot+tr|0,tr=Ot&8191,Ot=Ot>>>13,nr+=Ot,ot=tr,ut=nr,dt=ir,mt=Wt,xt=Kt,Ct=Jt,Pt=Ht,Tt=Vt,kt=Qt,Lt=dr,it+=16,at-=16}this._h[0]=ot,this._h[1]=ut,this._h[2]=dt,this._h[3]=mt,this._h[4]=xt,this._h[5]=Ct,this._h[6]=Pt,this._h[7]=Tt,this._h[8]=kt,this._h[9]=Lt},rt.prototype.finish=function(nt,it){it===void 0&&(it=0);var at=new Uint16Array(10),st,ot,ut,dt;if(this._leftover){for(dt=this._leftover,this._buffer[dt++]=1;dt<16;dt++)this._buffer[dt]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(st=this._h[1]>>>13,this._h[1]&=8191,dt=2;dt<10;dt++)this._h[dt]+=st,st=this._h[dt]>>>13,this._h[dt]&=8191;for(this._h[0]+=st*5,st=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=st,st=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=st,at[0]=this._h[0]+5,st=at[0]>>>13,at[0]&=8191,dt=1;dt<10;dt++)at[dt]=this._h[dt]+st,st=at[dt]>>>13,at[dt]&=8191;for(at[9]-=8192,ot=(st^1)-1,dt=0;dt<10;dt++)at[dt]&=ot;for(ot=~ot,dt=0;dt<10;dt++)this._h[dt]=this._h[dt]&ot|at[dt];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,ut=this._h[0]+this._pad[0],this._h[0]=ut&65535,dt=1;dt<8;dt++)ut=(this._h[dt]+this._pad[dt]|0)+(ut>>>16)|0,this._h[dt]=ut&65535;return nt[it+0]=this._h[0]>>>0,nt[it+1]=this._h[0]>>>8,nt[it+2]=this._h[1]>>>0,nt[it+3]=this._h[1]>>>8,nt[it+4]=this._h[2]>>>0,nt[it+5]=this._h[2]>>>8,nt[it+6]=this._h[3]>>>0,nt[it+7]=this._h[3]>>>8,nt[it+8]=this._h[4]>>>0,nt[it+9]=this._h[4]>>>8,nt[it+10]=this._h[5]>>>0,nt[it+11]=this._h[5]>>>8,nt[it+12]=this._h[6]>>>0,nt[it+13]=this._h[6]>>>8,nt[it+14]=this._h[7]>>>0,nt[it+15]=this._h[7]>>>8,this._finished=!0,this},rt.prototype.update=function(nt){var it=0,at=nt.length,st;if(this._leftover){st=16-this._leftover,st>at&&(st=at);for(var ot=0;ot=16&&(st=at-at%16,this._blocks(nt,it,st),it+=st,at-=st),at){for(var ot=0;ot32&&(0,xsalsa20_1.streamXOR)(_,et,$.subarray(32),tt.subarray(48),8);const rt=(0,poly1305_1.oneTimeAuth)(j.subarray(0,32),tt.subarray(16));for(let nt=0;nt32&&(0,xsalsa20_1.streamXOR)(_,et,rt.subarray(32),nt.subarray(32),8),(0,wipe_1$1.wipe)(tt),(0,wipe_1$1.wipe)(j),(0,wipe_1$1.wipe)(et),nt}secretbox.openSecretBox=openSecretBox;function generateKey(_){return(0,random_1.randomBytes)(32,_)}secretbox.generateKey=generateKey;(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.openBox=_.box=_.precomputeSharedKey=_.generateKeyPair=void 0;const a=x25519,$=xsalsa20,j=secretbox,et=wipe$1;var tt=x25519;Object.defineProperty(_,"generateKeyPair",{enumerable:!0,get:function(){return tt.generateKeyPair}});const rt=new Uint8Array(16);function nt(st,ot){const ut=(0,a.scalarMult)(ot,st);return(0,$.hsalsa)(ut,rt,ut),ut}_.precomputeSharedKey=nt;function it(st,ot,ut,dt){const mt=nt(st,ot),xt=(0,j.secretBox)(mt,ut,dt);return(0,et.wipe)(mt),xt}_.box=it;function at(st,ot,ut,dt){const mt=nt(st,ot),xt=(0,j.openSecretBox)(mt,ut,dt);return(0,et.wipe)(mt),xt}_.openBox=at})(box);(function(_){var a=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(j,et,tt,rt){rt===void 0&&(rt=tt);var nt=Object.getOwnPropertyDescriptor(et,tt);(!nt||("get"in nt?!et.__esModule:nt.writable||nt.configurable))&&(nt={enumerable:!0,get:function(){return et[tt]}}),Object.defineProperty(j,rt,nt)}:function(j,et,tt,rt){rt===void 0&&(rt=tt),j[rt]=et[tt]}),$=commonjsGlobal&&commonjsGlobal.__exportStar||function(j,et){for(var tt in j)tt!=="default"&&!Object.prototype.hasOwnProperty.call(et,tt)&&a(et,j,tt)};Object.defineProperty(_,"__esModule",{value:!0}),$(box,_),$(secretbox,_)})(nacl);var utf8={};Object.defineProperty(utf8,"__esModule",{value:!0});var INVALID_UTF16="utf8: invalid string",INVALID_UTF8="utf8: invalid source encoding";function encode$8(_){for(var a=new Uint8Array(encodedLength(_)),$=0,j=0;j<_.length;j++){var et=_.charCodeAt(j);et<128?a[$++]=et:et<2048?(a[$++]=192|et>>6,a[$++]=128|et&63):et<55296?(a[$++]=224|et>>12,a[$++]=128|et>>6&63,a[$++]=128|et&63):(j++,et=(et&1023)<<10,et|=_.charCodeAt(j)&1023,et+=65536,a[$++]=240|et>>18,a[$++]=128|et>>12&63,a[$++]=128|et>>6&63,a[$++]=128|et&63)}return a}var encode_1=utf8.encode=encode$8;function encodedLength(_){for(var a=0,$=0;$<_.length;$++){var j=_.charCodeAt($);if(j<128)a+=1;else if(j<2048)a+=2;else if(j<55296)a+=3;else if(j<=57343){if($>=_.length-1)throw new Error(INVALID_UTF16);$++,a+=4}else throw new Error(INVALID_UTF16)}return a}utf8.encodedLength=encodedLength;function decode$4(_){for(var a=[],$=0;$<_.length;$++){var j=_[$];if(j&128){var et=void 0;if(j<224){if($>=_.length)throw new Error(INVALID_UTF8);var tt=_[++$];if((tt&192)!==128)throw new Error(INVALID_UTF8);j=(j&31)<<6|tt&63,et=128}else if(j<240){if($>=_.length-1)throw new Error(INVALID_UTF8);var tt=_[++$],rt=_[++$];if((tt&192)!==128||(rt&192)!==128)throw new Error(INVALID_UTF8);j=(j&15)<<12|(tt&63)<<6|rt&63,et=2048}else if(j<248){if($>=_.length-2)throw new Error(INVALID_UTF8);var tt=_[++$],rt=_[++$],nt=_[++$];if((tt&192)!==128||(rt&192)!==128||(nt&192)!==128)throw new Error(INVALID_UTF8);j=(j&15)<<18|(tt&63)<<12|(rt&63)<<6|nt&63,et=65536}else throw new Error(INVALID_UTF8);if(j=55296&&j<=57343)throw new Error(INVALID_UTF8);if(j>=65536){if(j>1114111)throw new Error(INVALID_UTF8);j-=65536,a.push(String.fromCharCode(55296|j>>10)),j=56320|j&1023}}a.push(String.fromCharCode(j))}return a.join("")}utf8.decode=decode$4;var blake2b$1={};(function(_){Object.defineProperty(_,"__esModule",{value:!0});var a=binary,$=wipe$1;_.BLOCK_SIZE=128,_.DIGEST_LENGTH=64,_.KEY_LENGTH=64,_.PERSONALIZATION_LENGTH=16,_.SALT_LENGTH=16,_.MAX_LEAF_SIZE=Math.pow(2,32)-1,_.MAX_FANOUT=255,_.MAX_MAX_DEPTH=255;var j=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),et=[[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6],[22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8],[14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16],[18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26],[4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18],[24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22],[26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20],[12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10],[20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0],[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6]],tt=function(){function nt(it,at){if(it===void 0&&(it=64),this.digestLength=it,this.blockSize=_.BLOCK_SIZE,this._state=new Int32Array(j),this._buffer=new Uint8Array(_.BLOCK_SIZE),this._bufferLength=0,this._ctr=new Uint32Array(4),this._flag=new Uint32Array(4),this._lastNode=!1,this._finished=!1,this._vtmp=new Uint32Array(32),this._mtmp=new Uint32Array(32),it<1||it>_.DIGEST_LENGTH)throw new Error("blake2b: wrong digest length");at&&this.validateConfig(at);var st=0;at&&at.key&&(st=at.key.length);var ot=1,ut=1;at&&at.tree&&(ot=at.tree.fanout,ut=at.tree.maxDepth),this._state[0]^=it|st<<8|ot<<16|ut<<24,at&&at.tree&&(this._state[1]^=at.tree.leafSize,this._state[2]^=at.tree.nodeOffsetLowBits,this._state[3]^=at.tree.nodeOffsetHighBits,this._state[4]^=at.tree.nodeDepth|at.tree.innerDigestLength<<8,this._lastNode=at.tree.lastNode),at&&at.salt&&(this._state[8]^=a.readUint32LE(at.salt,0),this._state[9]^=a.readUint32LE(at.salt,4),this._state[10]^=a.readUint32LE(at.salt,8),this._state[11]^=a.readUint32LE(at.salt,12)),at&&at.personalization&&(this._state[12]^=a.readUint32LE(at.personalization,0),this._state[13]^=a.readUint32LE(at.personalization,4),this._state[14]^=a.readUint32LE(at.personalization,8),this._state[15]^=a.readUint32LE(at.personalization,12)),this._initialState=new Uint32Array(this._state),at&&at.key&&st>0&&(this._paddedKey=new Uint8Array(_.BLOCK_SIZE),this._paddedKey.set(at.key),this._buffer.set(this._paddedKey),this._bufferLength=_.BLOCK_SIZE)}return nt.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=_.BLOCK_SIZE):this._bufferLength=0,$.wipe(this._ctr),$.wipe(this._flag),this._finished=!1,this},nt.prototype.validateConfig=function(it){if(it.key&&it.key.length>_.KEY_LENGTH)throw new Error("blake2b: wrong key length");if(it.salt&&it.salt.length!==_.SALT_LENGTH)throw new Error("blake2b: wrong salt length");if(it.personalization&&it.personalization.length!==_.PERSONALIZATION_LENGTH)throw new Error("blake2b: wrong personalization length");if(it.tree){if(it.tree.fanout<0||it.tree.fanout>_.MAX_FANOUT)throw new Error("blake2b: wrong tree fanout");if(it.tree.maxDepth<0||it.tree.maxDepth>_.MAX_MAX_DEPTH)throw new Error("blake2b: wrong tree depth");if(it.tree.leafSize<0||it.tree.leafSize>_.MAX_LEAF_SIZE)throw new Error("blake2b: wrong leaf size");if(it.tree.innerDigestLength<0||it.tree.innerDigestLength>_.DIGEST_LENGTH)throw new Error("blake2b: wrong tree inner digest length")}},nt.prototype.update=function(it,at){if(at===void 0&&(at=it.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var st=_.BLOCK_SIZE-this._bufferLength,ot=0;if(at===0)return this;if(at>st){for(var ut=0;ut_.BLOCK_SIZE;){for(var ut=0;ut<_.BLOCK_SIZE;ut++)this._buffer[ut]=it[ot+ut];this._processBlock(_.BLOCK_SIZE),ot+=_.BLOCK_SIZE,at-=_.BLOCK_SIZE,this._bufferLength=0}for(var ut=0;ut>>16,ht=zt&65535,vt=zt>>>16;bt+=jt&65535,ct+=jt>>>16,ht+=Mt&65535,vt+=Mt>>>16,ct+=bt>>>16,ht+=ct>>>16,vt+=ht>>>16,zt=ht&65535|vt<<16,Nt=bt&65535|ct<<16,bt=Nt&65535,ct=Nt>>>16,ht=zt&65535,vt=zt>>>16,bt+=Pt&65535,ct+=Pt>>>16,ht+=Tt&65535,vt+=Tt>>>16,ct+=bt>>>16,ht+=ct>>>16,vt+=ht>>>16,zt=ht&65535|vt<<16,Nt=bt&65535|ct<<16,Bt^=Nt,yt^=zt,bt=yt,yt=Bt,Bt=bt,bt=Dt&65535,ct=Dt>>>16,ht=Ft&65535,vt=Ft>>>16,bt+=Bt&65535,ct+=Bt>>>16,ht+=yt&65535,vt+=yt>>>16,ct+=bt>>>16,ht+=ct>>>16,vt+=ht>>>16,Ft=ht&65535|vt<<16,Dt=bt&65535|ct<<16,jt^=Dt,Mt^=Ft,bt=jt<<8|Mt>>>24,jt=Mt<<8|jt>>>24,Mt=bt,bt=Nt&65535,ct=Nt>>>16,ht=zt&65535,vt=zt>>>16,bt+=jt&65535,ct+=jt>>>16,ht+=Mt&65535,vt+=Mt>>>16,ct+=bt>>>16,ht+=ct>>>16,vt+=ht>>>16,zt=ht&65535|vt<<16,Nt=bt&65535|ct<<16,bt=Nt&65535,ct=Nt>>>16,ht=zt&65535,vt=zt>>>16,bt+=kt&65535,ct+=kt>>>16,ht+=Lt&65535,vt+=Lt>>>16,ct+=bt>>>16,ht+=ct>>>16,vt+=ht>>>16,zt=ht&65535|vt<<16,Nt=bt&65535|ct<<16,Bt^=Nt,yt^=zt,bt=Bt<<16|yt>>>16,Bt=yt<<16|Bt>>>16,yt=bt,bt=Dt&65535,ct=Dt>>>16,ht=Ft&65535,vt=Ft>>>16,bt+=Bt&65535,ct+=Bt>>>16,ht+=yt&65535,vt+=yt>>>16,ct+=bt>>>16,ht+=ct>>>16,vt+=ht>>>16,Ft=ht&65535|vt<<16,Dt=bt&65535|ct<<16,jt^=Dt,Mt^=Ft,bt=Mt<<1|jt>>>31,jt=jt<<1|Mt>>>31,Mt=bt,it[at]=Nt,it[dt]=zt,it[st]=jt,it[mt]=Mt,it[ot]=Dt,it[xt]=Ft,it[ut]=Bt,it[Ct]=yt},nt.prototype._incrementCounter=function(it){for(var at=0;at<3;at++){var st=this._ctr[at]+it;if(this._ctr[at]=st>>>0,this._ctr[at]===st)return;it=1}},nt.prototype._processBlock=function(it){this._incrementCounter(it);var at=this._vtmp;at.set(this._state),at.set(j,16),at[12*2+0]^=this._ctr[0],at[12*2+1]^=this._ctr[1],at[13*2+0]^=this._ctr[2],at[13*2+1]^=this._ctr[3],at[14*2+0]^=this._flag[0],at[14*2+1]^=this._flag[1],at[15*2+0]^=this._flag[2],at[15*2+1]^=this._flag[3];for(var st=this._mtmp,ot=0;ot<32;ot++)st[ot]=a.readUint32LE(this._buffer,ot*4);for(var ut=0;ut<12;ut++)this._G(at,0,8,16,24,1,9,17,25,st[et[ut][0]],st[et[ut][0]+1],st[et[ut][1]],st[et[ut][1]+1]),this._G(at,2,10,18,26,3,11,19,27,st[et[ut][2]],st[et[ut][2]+1],st[et[ut][3]],st[et[ut][3]+1]),this._G(at,4,12,20,28,5,13,21,29,st[et[ut][4]],st[et[ut][4]+1],st[et[ut][5]],st[et[ut][5]+1]),this._G(at,6,14,22,30,7,15,23,31,st[et[ut][6]],st[et[ut][6]+1],st[et[ut][7]],st[et[ut][7]+1]),this._G(at,0,10,20,30,1,11,21,31,st[et[ut][8]],st[et[ut][8]+1],st[et[ut][9]],st[et[ut][9]+1]),this._G(at,2,12,22,24,3,13,23,25,st[et[ut][10]],st[et[ut][10]+1],st[et[ut][11]],st[et[ut][11]+1]),this._G(at,4,14,16,26,5,15,17,27,st[et[ut][12]],st[et[ut][12]+1],st[et[ut][13]],st[et[ut][13]+1]),this._G(at,6,8,18,28,7,9,19,29,st[et[ut][14]],st[et[ut][14]+1],st[et[ut][15]],st[et[ut][15]+1]);for(var ot=0;ot<16;ot++)this._state[ot]^=at[ot]^at[ot+16]},nt}();_.BLAKE2b=tt;function rt(nt,it,at){it===void 0&&(it=_.DIGEST_LENGTH);var st=new tt(it,at);st.update(nt);var ot=st.digest();return st.clean(),ot}_.hash=rt})(blake2b$1);var ed25519={},sha512$2={};(function(_){Object.defineProperty(_,"__esModule",{value:!0});var a=binary,$=wipe$1;_.DIGEST_LENGTH=64,_.BLOCK_SIZE=128;var j=function(){function nt(){this.digestLength=_.DIGEST_LENGTH,this.blockSize=_.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return nt.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},nt.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},nt.prototype.clean=function(){$.wipe(this._buffer),$.wipe(this._tempHi),$.wipe(this._tempLo),this.reset()},nt.prototype.update=function(it,at){if(at===void 0&&(at=it.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var st=0;if(this._bytesHashed+=at,this._bufferLength>0){for(;this._bufferLength<_.BLOCK_SIZE&&at>0;)this._buffer[this._bufferLength++]=it[st++],at--;this._bufferLength===this.blockSize&&(tt(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(at>=this.blockSize&&(st=tt(this._tempHi,this._tempLo,this._stateHi,this._stateLo,it,st,at),at%=this.blockSize);at>0;)this._buffer[this._bufferLength++]=it[st++],at--;return this},nt.prototype.finish=function(it){if(!this._finished){var at=this._bytesHashed,st=this._bufferLength,ot=at/536870912|0,ut=at<<3,dt=at%128<112?128:256;this._buffer[st]=128;for(var mt=st+1;mt0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},nt.prototype.restoreState=function(it){return this._stateHi.set(it.stateHi),this._stateLo.set(it.stateLo),this._bufferLength=it.bufferLength,it.buffer&&this._buffer.set(it.buffer),this._bytesHashed=it.bytesHashed,this._finished=!1,this},nt.prototype.cleanSavedState=function(it){$.wipe(it.stateHi),$.wipe(it.stateLo),it.buffer&&$.wipe(it.buffer),it.bufferLength=0,it.bytesHashed=0},nt}();_.SHA512=j;var et=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function tt(nt,it,at,st,ot,ut,dt){for(var mt=at[0],xt=at[1],Ct=at[2],Pt=at[3],Tt=at[4],kt=at[5],Lt=at[6],Nt=at[7],zt=st[0],jt=st[1],Mt=st[2],Dt=st[3],Ft=st[4],Bt=st[5],yt=st[6],bt=st[7],ct,ht,vt,St,Rt,$t,Et,At;dt>=128;){for(var wt=0;wt<16;wt++){var Ot=8*wt+ut;nt[wt]=a.readUint32BE(ot,Ot),it[wt]=a.readUint32BE(ot,Ot+4)}for(var wt=0;wt<80;wt++){var tr=mt,nr=xt,ir=Ct,Wt=Pt,Kt=Tt,Jt=kt,Ht=Lt,Vt=Nt,Qt=zt,dr=jt,xr=Mt,pr=Dt,Ir=Ft,kr=Bt,lr=yt,fr=bt;if(ct=Nt,ht=bt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=(Tt>>>14|Ft<<18)^(Tt>>>18|Ft<<14)^(Ft>>>9|Tt<<23),ht=(Ft>>>14|Tt<<18)^(Ft>>>18|Tt<<14)^(Tt>>>9|Ft<<23),Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,ct=Tt&kt^~Tt&Lt,ht=Ft&Bt^~Ft&yt,Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,ct=et[wt*2],ht=et[wt*2+1],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,ct=nt[wt%16],ht=it[wt%16],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,vt=Et&65535|At<<16,St=Rt&65535|$t<<16,ct=vt,ht=St,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=(mt>>>28|zt<<4)^(zt>>>2|mt<<30)^(zt>>>7|mt<<25),ht=(zt>>>28|mt<<4)^(mt>>>2|zt<<30)^(mt>>>7|zt<<25),Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,ct=mt&xt^mt&Ct^xt&Ct,ht=zt&jt^zt&Mt^jt&Mt,Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,Vt=Et&65535|At<<16,fr=Rt&65535|$t<<16,ct=Wt,ht=pr,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=vt,ht=St,Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,Wt=Et&65535|At<<16,pr=Rt&65535|$t<<16,xt=tr,Ct=nr,Pt=ir,Tt=Wt,kt=Kt,Lt=Jt,Nt=Ht,mt=Vt,jt=Qt,Mt=dr,Dt=xr,Ft=pr,Bt=Ir,yt=kr,bt=lr,zt=fr,wt%16===15)for(var Ot=0;Ot<16;Ot++)ct=nt[Ot],ht=it[Ot],Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=nt[(Ot+9)%16],ht=it[(Ot+9)%16],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,vt=nt[(Ot+1)%16],St=it[(Ot+1)%16],ct=(vt>>>1|St<<31)^(vt>>>8|St<<24)^vt>>>7,ht=(St>>>1|vt<<31)^(St>>>8|vt<<24)^(St>>>7|vt<<25),Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,vt=nt[(Ot+14)%16],St=it[(Ot+14)%16],ct=(vt>>>19|St<<13)^(St>>>29|vt<<3)^vt>>>6,ht=(St>>>19|vt<<13)^(vt>>>29|St<<3)^(St>>>6|vt<<26),Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,nt[Ot]=Et&65535|At<<16,it[Ot]=Rt&65535|$t<<16}ct=mt,ht=zt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[0],ht=st[0],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[0]=mt=Et&65535|At<<16,st[0]=zt=Rt&65535|$t<<16,ct=xt,ht=jt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[1],ht=st[1],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[1]=xt=Et&65535|At<<16,st[1]=jt=Rt&65535|$t<<16,ct=Ct,ht=Mt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[2],ht=st[2],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[2]=Ct=Et&65535|At<<16,st[2]=Mt=Rt&65535|$t<<16,ct=Pt,ht=Dt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[3],ht=st[3],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[3]=Pt=Et&65535|At<<16,st[3]=Dt=Rt&65535|$t<<16,ct=Tt,ht=Ft,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[4],ht=st[4],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[4]=Tt=Et&65535|At<<16,st[4]=Ft=Rt&65535|$t<<16,ct=kt,ht=Bt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[5],ht=st[5],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[5]=kt=Et&65535|At<<16,st[5]=Bt=Rt&65535|$t<<16,ct=Lt,ht=yt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[6],ht=st[6],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[6]=Lt=Et&65535|At<<16,st[6]=yt=Rt&65535|$t<<16,ct=Nt,ht=bt,Rt=ht&65535,$t=ht>>>16,Et=ct&65535,At=ct>>>16,ct=at[7],ht=st[7],Rt+=ht&65535,$t+=ht>>>16,Et+=ct&65535,At+=ct>>>16,$t+=Rt>>>16,Et+=$t>>>16,At+=Et>>>16,at[7]=Nt=Et&65535|At<<16,st[7]=bt=Rt&65535|$t<<16,ut+=128,dt-=128}return ut}function rt(nt){var it=new j;it.update(nt);var at=it.digest();return it.clean(),at}_.hash=rt})(sha512$2);(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.convertSecretKeyToX25519=_.convertPublicKeyToX25519=_.verify=_.sign=_.extractPublicKeyFromSecretKey=_.generateKeyPair=_.generateKeyPairFromSeed=_.SEED_LENGTH=_.SECRET_KEY_LENGTH=_.PUBLIC_KEY_LENGTH=_.SIGNATURE_LENGTH=void 0;const a=random,$=sha512$2,j=wipe$1;_.SIGNATURE_LENGTH=64,_.PUBLIC_KEY_LENGTH=32,_.SECRET_KEY_LENGTH=64,_.SEED_LENGTH=32;function et(Wt){const Kt=new Float64Array(16);if(Wt)for(let Jt=0;Jt>16&1),Jt[dr-1]&=65535;Jt[15]=Ht[15]-32767-(Jt[14]>>16&1);const Qt=Jt[15]>>16&1;Jt[14]&=65535,xt(Ht,Jt,1-Qt)}for(let Vt=0;Vt<16;Vt++)Wt[2*Vt]=Ht[Vt]&255,Wt[2*Vt+1]=Ht[Vt]>>8}function Pt(Wt,Kt){let Jt=0;for(let Ht=0;Ht<32;Ht++)Jt|=Wt[Ht]^Kt[Ht];return(1&Jt-1>>>8)-1}function Tt(Wt,Kt){const Jt=new Uint8Array(32),Ht=new Uint8Array(32);return Ct(Jt,Wt),Ct(Ht,Kt),Pt(Jt,Ht)}function kt(Wt){const Kt=new Uint8Array(32);return Ct(Kt,Wt),Kt[0]&1}function Lt(Wt,Kt){for(let Jt=0;Jt<16;Jt++)Wt[Jt]=Kt[2*Jt]+(Kt[2*Jt+1]<<8);Wt[15]&=32767}function Nt(Wt,Kt,Jt){for(let Ht=0;Ht<16;Ht++)Wt[Ht]=Kt[Ht]+Jt[Ht]}function zt(Wt,Kt,Jt){for(let Ht=0;Ht<16;Ht++)Wt[Ht]=Kt[Ht]-Jt[Ht]}function jt(Wt,Kt,Jt){let Ht,Vt,Qt=0,dr=0,xr=0,pr=0,Ir=0,kr=0,lr=0,fr=0,Er=0,$r=0,Pr=0,Rr=0,Ar=0,Or=0,Lr=0,ar=0,Yt=0,er=0,Zt=0,qt=0,Gt=0,or=0,vr=0,wr=0,Sr=0,Wr=0,Hr=0,Fr=0,pn=0,Jr=0,Qr=0,mn=Jt[0],ln=Jt[1],Vr=Jt[2],wn=Jt[3],un=Jt[4],qr=Jt[5],hn=Jt[6],fn=Jt[7],Kr=Jt[8],$n=Jt[9],dn=Jt[10],Gr=Jt[11],gn=Jt[12],an=Jt[13],Zr=Jt[14],Rn=Jt[15];Ht=Kt[0],Qt+=Ht*mn,dr+=Ht*ln,xr+=Ht*Vr,pr+=Ht*wn,Ir+=Ht*un,kr+=Ht*qr,lr+=Ht*hn,fr+=Ht*fn,Er+=Ht*Kr,$r+=Ht*$n,Pr+=Ht*dn,Rr+=Ht*Gr,Ar+=Ht*gn,Or+=Ht*an,Lr+=Ht*Zr,ar+=Ht*Rn,Ht=Kt[1],dr+=Ht*mn,xr+=Ht*ln,pr+=Ht*Vr,Ir+=Ht*wn,kr+=Ht*un,lr+=Ht*qr,fr+=Ht*hn,Er+=Ht*fn,$r+=Ht*Kr,Pr+=Ht*$n,Rr+=Ht*dn,Ar+=Ht*Gr,Or+=Ht*gn,Lr+=Ht*an,ar+=Ht*Zr,Yt+=Ht*Rn,Ht=Kt[2],xr+=Ht*mn,pr+=Ht*ln,Ir+=Ht*Vr,kr+=Ht*wn,lr+=Ht*un,fr+=Ht*qr,Er+=Ht*hn,$r+=Ht*fn,Pr+=Ht*Kr,Rr+=Ht*$n,Ar+=Ht*dn,Or+=Ht*Gr,Lr+=Ht*gn,ar+=Ht*an,Yt+=Ht*Zr,er+=Ht*Rn,Ht=Kt[3],pr+=Ht*mn,Ir+=Ht*ln,kr+=Ht*Vr,lr+=Ht*wn,fr+=Ht*un,Er+=Ht*qr,$r+=Ht*hn,Pr+=Ht*fn,Rr+=Ht*Kr,Ar+=Ht*$n,Or+=Ht*dn,Lr+=Ht*Gr,ar+=Ht*gn,Yt+=Ht*an,er+=Ht*Zr,Zt+=Ht*Rn,Ht=Kt[4],Ir+=Ht*mn,kr+=Ht*ln,lr+=Ht*Vr,fr+=Ht*wn,Er+=Ht*un,$r+=Ht*qr,Pr+=Ht*hn,Rr+=Ht*fn,Ar+=Ht*Kr,Or+=Ht*$n,Lr+=Ht*dn,ar+=Ht*Gr,Yt+=Ht*gn,er+=Ht*an,Zt+=Ht*Zr,qt+=Ht*Rn,Ht=Kt[5],kr+=Ht*mn,lr+=Ht*ln,fr+=Ht*Vr,Er+=Ht*wn,$r+=Ht*un,Pr+=Ht*qr,Rr+=Ht*hn,Ar+=Ht*fn,Or+=Ht*Kr,Lr+=Ht*$n,ar+=Ht*dn,Yt+=Ht*Gr,er+=Ht*gn,Zt+=Ht*an,qt+=Ht*Zr,Gt+=Ht*Rn,Ht=Kt[6],lr+=Ht*mn,fr+=Ht*ln,Er+=Ht*Vr,$r+=Ht*wn,Pr+=Ht*un,Rr+=Ht*qr,Ar+=Ht*hn,Or+=Ht*fn,Lr+=Ht*Kr,ar+=Ht*$n,Yt+=Ht*dn,er+=Ht*Gr,Zt+=Ht*gn,qt+=Ht*an,Gt+=Ht*Zr,or+=Ht*Rn,Ht=Kt[7],fr+=Ht*mn,Er+=Ht*ln,$r+=Ht*Vr,Pr+=Ht*wn,Rr+=Ht*un,Ar+=Ht*qr,Or+=Ht*hn,Lr+=Ht*fn,ar+=Ht*Kr,Yt+=Ht*$n,er+=Ht*dn,Zt+=Ht*Gr,qt+=Ht*gn,Gt+=Ht*an,or+=Ht*Zr,vr+=Ht*Rn,Ht=Kt[8],Er+=Ht*mn,$r+=Ht*ln,Pr+=Ht*Vr,Rr+=Ht*wn,Ar+=Ht*un,Or+=Ht*qr,Lr+=Ht*hn,ar+=Ht*fn,Yt+=Ht*Kr,er+=Ht*$n,Zt+=Ht*dn,qt+=Ht*Gr,Gt+=Ht*gn,or+=Ht*an,vr+=Ht*Zr,wr+=Ht*Rn,Ht=Kt[9],$r+=Ht*mn,Pr+=Ht*ln,Rr+=Ht*Vr,Ar+=Ht*wn,Or+=Ht*un,Lr+=Ht*qr,ar+=Ht*hn,Yt+=Ht*fn,er+=Ht*Kr,Zt+=Ht*$n,qt+=Ht*dn,Gt+=Ht*Gr,or+=Ht*gn,vr+=Ht*an,wr+=Ht*Zr,Sr+=Ht*Rn,Ht=Kt[10],Pr+=Ht*mn,Rr+=Ht*ln,Ar+=Ht*Vr,Or+=Ht*wn,Lr+=Ht*un,ar+=Ht*qr,Yt+=Ht*hn,er+=Ht*fn,Zt+=Ht*Kr,qt+=Ht*$n,Gt+=Ht*dn,or+=Ht*Gr,vr+=Ht*gn,wr+=Ht*an,Sr+=Ht*Zr,Wr+=Ht*Rn,Ht=Kt[11],Rr+=Ht*mn,Ar+=Ht*ln,Or+=Ht*Vr,Lr+=Ht*wn,ar+=Ht*un,Yt+=Ht*qr,er+=Ht*hn,Zt+=Ht*fn,qt+=Ht*Kr,Gt+=Ht*$n,or+=Ht*dn,vr+=Ht*Gr,wr+=Ht*gn,Sr+=Ht*an,Wr+=Ht*Zr,Hr+=Ht*Rn,Ht=Kt[12],Ar+=Ht*mn,Or+=Ht*ln,Lr+=Ht*Vr,ar+=Ht*wn,Yt+=Ht*un,er+=Ht*qr,Zt+=Ht*hn,qt+=Ht*fn,Gt+=Ht*Kr,or+=Ht*$n,vr+=Ht*dn,wr+=Ht*Gr,Sr+=Ht*gn,Wr+=Ht*an,Hr+=Ht*Zr,Fr+=Ht*Rn,Ht=Kt[13],Or+=Ht*mn,Lr+=Ht*ln,ar+=Ht*Vr,Yt+=Ht*wn,er+=Ht*un,Zt+=Ht*qr,qt+=Ht*hn,Gt+=Ht*fn,or+=Ht*Kr,vr+=Ht*$n,wr+=Ht*dn,Sr+=Ht*Gr,Wr+=Ht*gn,Hr+=Ht*an,Fr+=Ht*Zr,pn+=Ht*Rn,Ht=Kt[14],Lr+=Ht*mn,ar+=Ht*ln,Yt+=Ht*Vr,er+=Ht*wn,Zt+=Ht*un,qt+=Ht*qr,Gt+=Ht*hn,or+=Ht*fn,vr+=Ht*Kr,wr+=Ht*$n,Sr+=Ht*dn,Wr+=Ht*Gr,Hr+=Ht*gn,Fr+=Ht*an,pn+=Ht*Zr,Jr+=Ht*Rn,Ht=Kt[15],ar+=Ht*mn,Yt+=Ht*ln,er+=Ht*Vr,Zt+=Ht*wn,qt+=Ht*un,Gt+=Ht*qr,or+=Ht*hn,vr+=Ht*fn,wr+=Ht*Kr,Sr+=Ht*$n,Wr+=Ht*dn,Hr+=Ht*Gr,Fr+=Ht*gn,pn+=Ht*an,Jr+=Ht*Zr,Qr+=Ht*Rn,Qt+=38*Yt,dr+=38*er,xr+=38*Zt,pr+=38*qt,Ir+=38*Gt,kr+=38*or,lr+=38*vr,fr+=38*wr,Er+=38*Sr,$r+=38*Wr,Pr+=38*Hr,Rr+=38*Fr,Ar+=38*pn,Or+=38*Jr,Lr+=38*Qr,Vt=1,Ht=Qt+Vt+65535,Vt=Math.floor(Ht/65536),Qt=Ht-Vt*65536,Ht=dr+Vt+65535,Vt=Math.floor(Ht/65536),dr=Ht-Vt*65536,Ht=xr+Vt+65535,Vt=Math.floor(Ht/65536),xr=Ht-Vt*65536,Ht=pr+Vt+65535,Vt=Math.floor(Ht/65536),pr=Ht-Vt*65536,Ht=Ir+Vt+65535,Vt=Math.floor(Ht/65536),Ir=Ht-Vt*65536,Ht=kr+Vt+65535,Vt=Math.floor(Ht/65536),kr=Ht-Vt*65536,Ht=lr+Vt+65535,Vt=Math.floor(Ht/65536),lr=Ht-Vt*65536,Ht=fr+Vt+65535,Vt=Math.floor(Ht/65536),fr=Ht-Vt*65536,Ht=Er+Vt+65535,Vt=Math.floor(Ht/65536),Er=Ht-Vt*65536,Ht=$r+Vt+65535,Vt=Math.floor(Ht/65536),$r=Ht-Vt*65536,Ht=Pr+Vt+65535,Vt=Math.floor(Ht/65536),Pr=Ht-Vt*65536,Ht=Rr+Vt+65535,Vt=Math.floor(Ht/65536),Rr=Ht-Vt*65536,Ht=Ar+Vt+65535,Vt=Math.floor(Ht/65536),Ar=Ht-Vt*65536,Ht=Or+Vt+65535,Vt=Math.floor(Ht/65536),Or=Ht-Vt*65536,Ht=Lr+Vt+65535,Vt=Math.floor(Ht/65536),Lr=Ht-Vt*65536,Ht=ar+Vt+65535,Vt=Math.floor(Ht/65536),ar=Ht-Vt*65536,Qt+=Vt-1+37*(Vt-1),Vt=1,Ht=Qt+Vt+65535,Vt=Math.floor(Ht/65536),Qt=Ht-Vt*65536,Ht=dr+Vt+65535,Vt=Math.floor(Ht/65536),dr=Ht-Vt*65536,Ht=xr+Vt+65535,Vt=Math.floor(Ht/65536),xr=Ht-Vt*65536,Ht=pr+Vt+65535,Vt=Math.floor(Ht/65536),pr=Ht-Vt*65536,Ht=Ir+Vt+65535,Vt=Math.floor(Ht/65536),Ir=Ht-Vt*65536,Ht=kr+Vt+65535,Vt=Math.floor(Ht/65536),kr=Ht-Vt*65536,Ht=lr+Vt+65535,Vt=Math.floor(Ht/65536),lr=Ht-Vt*65536,Ht=fr+Vt+65535,Vt=Math.floor(Ht/65536),fr=Ht-Vt*65536,Ht=Er+Vt+65535,Vt=Math.floor(Ht/65536),Er=Ht-Vt*65536,Ht=$r+Vt+65535,Vt=Math.floor(Ht/65536),$r=Ht-Vt*65536,Ht=Pr+Vt+65535,Vt=Math.floor(Ht/65536),Pr=Ht-Vt*65536,Ht=Rr+Vt+65535,Vt=Math.floor(Ht/65536),Rr=Ht-Vt*65536,Ht=Ar+Vt+65535,Vt=Math.floor(Ht/65536),Ar=Ht-Vt*65536,Ht=Or+Vt+65535,Vt=Math.floor(Ht/65536),Or=Ht-Vt*65536,Ht=Lr+Vt+65535,Vt=Math.floor(Ht/65536),Lr=Ht-Vt*65536,Ht=ar+Vt+65535,Vt=Math.floor(Ht/65536),ar=Ht-Vt*65536,Qt+=Vt-1+37*(Vt-1),Wt[0]=Qt,Wt[1]=dr,Wt[2]=xr,Wt[3]=pr,Wt[4]=Ir,Wt[5]=kr,Wt[6]=lr,Wt[7]=fr,Wt[8]=Er,Wt[9]=$r,Wt[10]=Pr,Wt[11]=Rr,Wt[12]=Ar,Wt[13]=Or,Wt[14]=Lr,Wt[15]=ar}function Mt(Wt,Kt){jt(Wt,Kt,Kt)}function Dt(Wt,Kt){const Jt=et();let Ht;for(Ht=0;Ht<16;Ht++)Jt[Ht]=Kt[Ht];for(Ht=253;Ht>=0;Ht--)Mt(Jt,Jt),Ht!==2&&Ht!==4&&jt(Jt,Jt,Kt);for(Ht=0;Ht<16;Ht++)Wt[Ht]=Jt[Ht]}function Ft(Wt,Kt){const Jt=et();let Ht;for(Ht=0;Ht<16;Ht++)Jt[Ht]=Kt[Ht];for(Ht=250;Ht>=0;Ht--)Mt(Jt,Jt),Ht!==1&&jt(Jt,Jt,Kt);for(Ht=0;Ht<16;Ht++)Wt[Ht]=Jt[Ht]}function Bt(Wt,Kt){const Jt=et(),Ht=et(),Vt=et(),Qt=et(),dr=et(),xr=et(),pr=et(),Ir=et(),kr=et();zt(Jt,Wt[1],Wt[0]),zt(kr,Kt[1],Kt[0]),jt(Jt,Jt,kr),Nt(Ht,Wt[0],Wt[1]),Nt(kr,Kt[0],Kt[1]),jt(Ht,Ht,kr),jt(Vt,Wt[3],Kt[3]),jt(Vt,Vt,at),jt(Qt,Wt[2],Kt[2]),Nt(Qt,Qt,Qt),zt(dr,Ht,Jt),zt(xr,Qt,Vt),Nt(pr,Qt,Vt),Nt(Ir,Ht,Jt),jt(Wt[0],dr,xr),jt(Wt[1],Ir,pr),jt(Wt[2],pr,xr),jt(Wt[3],dr,Ir)}function yt(Wt,Kt,Jt){for(let Ht=0;Ht<4;Ht++)xt(Wt[Ht],Kt[Ht],Jt)}function bt(Wt,Kt){const Jt=et(),Ht=et(),Vt=et();Dt(Vt,Kt[2]),jt(Jt,Kt[0],Vt),jt(Ht,Kt[1],Vt),Ct(Wt,Ht),Wt[31]^=kt(Jt)<<7}function ct(Wt,Kt,Jt){dt(Wt[0],rt),dt(Wt[1],nt),dt(Wt[2],nt),dt(Wt[3],rt);for(let Ht=255;Ht>=0;--Ht){const Vt=Jt[Ht/8|0]>>(Ht&7)&1;yt(Wt,Kt,Vt),Bt(Kt,Wt),Bt(Wt,Wt),yt(Wt,Kt,Vt)}}function ht(Wt,Kt){const Jt=[et(),et(),et(),et()];dt(Jt[0],st),dt(Jt[1],ot),dt(Jt[2],nt),jt(Jt[3],st,ot),ct(Wt,Jt,Kt)}function vt(Wt){if(Wt.length!==_.SEED_LENGTH)throw new Error(`ed25519: seed must be ${_.SEED_LENGTH} bytes`);const Kt=(0,$.hash)(Wt);Kt[0]&=248,Kt[31]&=127,Kt[31]|=64;const Jt=new Uint8Array(32),Ht=[et(),et(),et(),et()];ht(Ht,Kt),bt(Jt,Ht);const Vt=new Uint8Array(64);return Vt.set(Wt),Vt.set(Jt,32),{publicKey:Jt,secretKey:Vt}}_.generateKeyPairFromSeed=vt;function St(Wt){const Kt=(0,a.randomBytes)(32,Wt),Jt=vt(Kt);return(0,j.wipe)(Kt),Jt}_.generateKeyPair=St;function Rt(Wt){if(Wt.length!==_.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${_.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(Wt.subarray(32))}_.extractPublicKeyFromSecretKey=Rt;const $t=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Et(Wt,Kt){let Jt,Ht,Vt,Qt;for(Ht=63;Ht>=32;--Ht){for(Jt=0,Vt=Ht-32,Qt=Ht-12;Vt>4)*$t[Vt],Jt=Kt[Vt]>>8,Kt[Vt]&=255;for(Vt=0;Vt<32;Vt++)Kt[Vt]-=Jt*$t[Vt];for(Ht=0;Ht<32;Ht++)Kt[Ht+1]+=Kt[Ht]>>8,Wt[Ht]=Kt[Ht]&255}function At(Wt){const Kt=new Float64Array(64);for(let Jt=0;Jt<64;Jt++)Kt[Jt]=Wt[Jt];for(let Jt=0;Jt<64;Jt++)Wt[Jt]=0;Et(Wt,Kt)}function wt(Wt,Kt){const Jt=new Float64Array(64),Ht=[et(),et(),et(),et()],Vt=(0,$.hash)(Wt.subarray(0,32));Vt[0]&=248,Vt[31]&=127,Vt[31]|=64;const Qt=new Uint8Array(64);Qt.set(Vt.subarray(32),32);const dr=new $.SHA512;dr.update(Qt.subarray(32)),dr.update(Kt);const xr=dr.digest();dr.clean(),At(xr),ht(Ht,xr),bt(Qt,Ht),dr.reset(),dr.update(Qt.subarray(0,32)),dr.update(Wt.subarray(32)),dr.update(Kt);const pr=dr.digest();At(pr);for(let Ir=0;Ir<32;Ir++)Jt[Ir]=xr[Ir];for(let Ir=0;Ir<32;Ir++)for(let kr=0;kr<32;kr++)Jt[Ir+kr]+=pr[Ir]*Vt[kr];return Et(Qt.subarray(32),Jt),Qt}_.sign=wt;function Ot(Wt,Kt){const Jt=et(),Ht=et(),Vt=et(),Qt=et(),dr=et(),xr=et(),pr=et();return dt(Wt[2],nt),Lt(Wt[1],Kt),Mt(Vt,Wt[1]),jt(Qt,Vt,it),zt(Vt,Vt,Wt[2]),Nt(Qt,Wt[2],Qt),Mt(dr,Qt),Mt(xr,dr),jt(pr,xr,dr),jt(Jt,pr,Vt),jt(Jt,Jt,Qt),Ft(Jt,Jt),jt(Jt,Jt,Vt),jt(Jt,Jt,Qt),jt(Jt,Jt,Qt),jt(Wt[0],Jt,Qt),Mt(Ht,Wt[0]),jt(Ht,Ht,Qt),Tt(Ht,Vt)&&jt(Wt[0],Wt[0],ut),Mt(Ht,Wt[0]),jt(Ht,Ht,Qt),Tt(Ht,Vt)?-1:(kt(Wt[0])===Kt[31]>>7&&zt(Wt[0],rt,Wt[0]),jt(Wt[3],Wt[0],Wt[1]),0)}function tr(Wt,Kt,Jt){const Ht=new Uint8Array(32),Vt=[et(),et(),et(),et()],Qt=[et(),et(),et(),et()];if(Jt.length!==_.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${_.SIGNATURE_LENGTH} bytes`);if(Ot(Qt,Wt))return!1;const dr=new $.SHA512;dr.update(Jt.subarray(0,32)),dr.update(Wt),dr.update(Kt);const xr=dr.digest();return At(xr),ct(Vt,Qt,xr),ht(Qt,Jt.subarray(32)),Bt(Vt,Qt),bt(Ht,Vt),!Pt(Jt,Ht)}_.verify=tr;function nr(Wt){let Kt=[et(),et(),et(),et()];if(Ot(Kt,Wt))throw new Error("Ed25519: invalid public key");let Jt=et(),Ht=et(),Vt=Kt[1];Nt(Jt,nt,Vt),zt(Ht,nt,Vt),Dt(Ht,Ht),jt(Jt,Jt,Ht);let Qt=new Uint8Array(32);return Ct(Qt,Jt),Qt}_.convertPublicKeyToX25519=nr;function ir(Wt){const Kt=(0,$.hash)(Wt.subarray(0,32));Kt[0]&=248,Kt[31]&=127,Kt[31]|=64;const Jt=new Uint8Array(Kt.subarray(0,32));return(0,j.wipe)(Kt),Jt}_.convertSecretKeyToX25519=ir})(ed25519);var bytes$3={};Object.defineProperty(bytes$3,"__esModule",{value:!0});function concat$1(){for(var _=0,a=0;a{if(!["tz1","tz2","tz3","tz4","KT1","txr1","sr1"].some($=>_.toLowerCase().startsWith($.toLowerCase())))return!1;try{bs58check$2.decode(_)}catch{return!1}return!0};async function generateGUID(){const _=random.randomBytes(16);return[_.slice(0,4),_.slice(4,6),_.slice(6,8),_.slice(8,10),_.slice(10,16)].map(function(a){return Buffer$g.from(a).toString("hex")}).join("-")}const CONTRACT_PREFIX="KT1",secretbox_NONCEBYTES=24,secretbox_MACBYTES=16;var BeaconMessageType;(function(_){_.BlockchainRequest="blockchain_request",_.PermissionRequest="permission_request",_.SignPayloadRequest="sign_payload_request",_.OperationRequest="operation_request",_.BroadcastRequest="broadcast_request",_.ChangeAccountRequest="change_account_request",_.BlockchainResponse="blockchain_response",_.PermissionResponse="permission_response",_.SignPayloadResponse="sign_payload_response",_.ProofOfEventChallengeRequest="proof_of_event_challenge_request",_.ProofOfEventChallengeResponse="proof_of_event_challenge_response",_.SimulatedProofOfEventChallengeRequest="simulated_proof_of_event_challenge_request",_.SimulatedProofOfEventChallengeResponse="simulated_proof_of_event_challenge_response",_.OperationResponse="operation_response",_.BroadcastResponse="broadcast_response",_.Acknowledge="acknowledge",_.Disconnect="disconnect",_.Error="error"})(BeaconMessageType||(BeaconMessageType={}));var PermissionScope;(function(_){_.SIGN="sign",_.OPERATION_REQUEST="operation_request",_.ENCRYPT="encrypt",_.NOTIFICATION="notification",_.THRESHOLD="threshold"})(PermissionScope||(PermissionScope={}));var NetworkType;(function(_){_.MAINNET="mainnet",_.GHOSTNET="ghostnet",_.WEEKLYNET="weeklynet",_.DAILYNET="dailynet",_.DELPHINET="delphinet",_.EDONET="edonet",_.FLORENCENET="florencenet",_.GRANADANET="granadanet",_.HANGZHOUNET="hangzhounet",_.ITHACANET="ithacanet",_.JAKARTANET="jakartanet",_.KATHMANDUNET="kathmandunet",_.LIMANET="limanet",_.MUMBAINET="mumbainet",_.NAIROBINET="nairobinet",_.OXFORDNET="oxfordnet",_.PARISNET="parisnet",_.CUSTOM="custom"})(NetworkType||(NetworkType={}));var TezosOperationType;(function(_){_.ORIGINATION="origination",_.DELEGATION="delegation",_.REVEAL="reveal",_.TRANSACTION="transaction",_.ACTIVATE_ACCOUNT="activate_account",_.ENDORSEMENT="endorsement",_.SEED_NONCE_REVELATION="seed_nonce_revelation",_.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",_.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",_.PROPOSALS="proposals",_.BALLOT="ballot",_.ATTESTATION="attestation",_.PREATTESTATION="preattestation",_.PREENDORSEMENT="preendorsement",_.SET_DEPOSITS_LIMIT="set_deposits_limit",_.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",_.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",_.ATTESTATION_WITH_SLOT="attestation_with_slot",_.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",_.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",_.FAILING_NOOP="failing_noop",_.REGISTER_GLOBAL_CONSTANT="register_global_constant",_.TRANSFER_TICKET="transfer_ticket",_.INCREASE_PAID_STORAGE="increase_paid_storage",_.UPDATE_CONSENSUS_KEY="update_consensus_key",_.DRAIN_DELEGATE="drain_delegate",_.VDF_REVELATION="vdf_revelation",_.EVENT="event",_.TICKET_UPDATES="ticket_updates",_.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",_.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",_.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",_.SMART_ROLLUP_PUBLISH="smart_rollup_publish",_.SMART_ROLLUP_CEMENT="smart_rollup_cement",_.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",_.SMART_ROLLUP_REFUTE="smart_rollup_refute",_.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout",_.DAL_PUBLISH_COMMITMENT="dal_publish_commitment"})(TezosOperationType||(TezosOperationType={}));var Origin;(function(_){_.WEBSITE="website",_.EXTENSION="extension",_.P2P="p2p",_.WALLETCONNECT="walletconnect"})(Origin||(Origin={}));var ExtensionMessageTarget;(function(_){_.BACKGROUND="toBackground",_.PAGE="toPage",_.EXTENSION="toExtension"})(ExtensionMessageTarget||(ExtensionMessageTarget={}));var BeaconErrorType;(function(_){_.BROADCAST_ERROR="BROADCAST_ERROR",_.NETWORK_NOT_SUPPORTED="NETWORK_NOT_SUPPORTED",_.NO_ADDRESS_ERROR="NO_ADDRESS_ERROR",_.NO_PRIVATE_KEY_FOUND_ERROR="NO_PRIVATE_KEY_FOUND_ERROR",_.NOT_GRANTED_ERROR="NOT_GRANTED_ERROR",_.PARAMETERS_INVALID_ERROR="PARAMETERS_INVALID_ERROR",_.TOO_MANY_OPERATIONS="TOO_MANY_OPERATIONS",_.TRANSACTION_INVALID_ERROR="TRANSACTION_INVALID_ERROR",_.SIGNATURE_TYPE_NOT_SUPPORTED="SIGNATURE_TYPE_NOT_SUPPORTED",_.ABORTED_ERROR="ABORTED_ERROR",_.UNKNOWN_ERROR="UNKNOWN_ERROR"})(BeaconErrorType||(BeaconErrorType={}));var TransportStatus;(function(_){_.NOT_CONNECTED="NOT_CONNECTED",_.CONNECTING="CONNECTING",_.CONNECTED="CONNECTED"})(TransportStatus||(TransportStatus={}));var TransportType;(function(_){_.CHROME_MESSAGE="chrome_message",_.WALLETCONNECT="walletconnect",_.POST_MESSAGE="post_message",_.LEDGER="ledger",_.P2P="p2p"})(TransportType||(TransportType={}));class Storage{static isSupported(){return Promise.resolve(!1)}}var StorageKey;(function(_){_.TRANSPORT_P2P_PEERS_DAPP="beacon:communication-peers-dapp",_.TRANSPORT_P2P_PEERS_WALLET="beacon:communication-peers-wallet",_.TRANSPORT_POSTMESSAGE_PEERS_DAPP="beacon:postmessage-peers-dapp",_.TRANSPORT_POSTMESSAGE_PEERS_WALLET="beacon:postmessage-peers-wallet",_.TRANSPORT_WALLETCONNECT_PEERS_DAPP="beacon:walletconnect-peers-dapp",_.LAST_SELECTED_WALLET="beacon:last-selected-wallet",_.ACCOUNTS="beacon:accounts",_.ACTIVE_ACCOUNT="beacon:active-account",_.PUSH_TOKENS="beacon:push-tokens",_.BEACON_SDK_SECRET_SEED="beacon:sdk-secret-seed",_.APP_METADATA_LIST="beacon:app-metadata-list",_.PERMISSION_LIST="beacon:permissions",_.ONGOING_PROOF_OF_EVENT_CHALLENGES="beacon:ongoing-proof-of-event-challenges",_.BEACON_SDK_VERSION="beacon:sdk_version",_.MATRIX_PRESERVED_STATE="beacon:sdk-matrix-preserved-state",_.MATRIX_PEER_ROOM_IDS="beacon:matrix-peer-rooms",_.MATRIX_SELECTED_NODE="beacon:matrix-selected-node",_.MULTI_NODE_SETUP_DONE="beacon:multi-node-setup",_.USER_ID="beacon:user-id",_.ENABLE_METRICS="beacon:enable_metrics",_.WC_2_CORE_PAIRING="wc@2:core:0.3:pairing",_.WC_2_CLIENT_SESSION="wc@2:client:0.3:session",_.WC_2_CORE_KEYCHAIN="wc@2:core:0.3:keychain",_.WC_2_CORE_MESSAGES="wc@2:core:0.3:messages",_.WC_2_CLIENT_PROPOSAL="wc@2:client:0.3:proposal",_.WC_2_CORE_SUBSCRIPTION="wc@2:core:0.3:subscription",_.WC_2_CORE_HISTORY="wc@2:core:0.3:history",_.WC_2_CORE_EXPIRER="wc@2:core:0.3:expirer"})(StorageKey||(StorageKey={}));const defaultValues={[StorageKey.TRANSPORT_P2P_PEERS_DAPP]:[],[StorageKey.TRANSPORT_P2P_PEERS_WALLET]:[],[StorageKey.TRANSPORT_POSTMESSAGE_PEERS_DAPP]:[],[StorageKey.TRANSPORT_POSTMESSAGE_PEERS_WALLET]:[],[StorageKey.TRANSPORT_WALLETCONNECT_PEERS_DAPP]:[],[StorageKey.LAST_SELECTED_WALLET]:void 0,[StorageKey.ACCOUNTS]:[],[StorageKey.ACTIVE_ACCOUNT]:void 0,[StorageKey.PUSH_TOKENS]:[],[StorageKey.BEACON_SDK_SECRET_SEED]:void 0,[StorageKey.APP_METADATA_LIST]:[],[StorageKey.PERMISSION_LIST]:[],[StorageKey.ONGOING_PROOF_OF_EVENT_CHALLENGES]:[],[StorageKey.BEACON_SDK_VERSION]:void 0,[StorageKey.MATRIX_PRESERVED_STATE]:{},[StorageKey.MATRIX_PEER_ROOM_IDS]:{},[StorageKey.MATRIX_SELECTED_NODE]:void 0,[StorageKey.MULTI_NODE_SETUP_DONE]:void 0,[StorageKey.WC_2_CLIENT_SESSION]:void 0,[StorageKey.USER_ID]:void 0,[StorageKey.ENABLE_METRICS]:void 0,[StorageKey.WC_2_CORE_PAIRING]:void 0,[StorageKey.WC_2_CORE_KEYCHAIN]:void 0,[StorageKey.WC_2_CORE_MESSAGES]:void 0,[StorageKey.WC_2_CLIENT_PROPOSAL]:void 0,[StorageKey.WC_2_CORE_SUBSCRIPTION]:void 0,[StorageKey.WC_2_CORE_HISTORY]:void 0,[StorageKey.WC_2_CORE_EXPIRER]:void 0};class P2PPairingRequest{constructor(a,$,j,et,tt,rt,nt){Yr(this,"type","p2p-pairing-request");Yr(this,"relayServer");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.relayServer=tt}}class ExtendedP2PPairingRequest extends P2PPairingRequest{constructor($,j,et,tt,rt,nt,it,at){super($,j,et,tt,rt,it,at);Yr(this,"senderId");this.senderId=nt}}var SigningType;(function(_){_.RAW="raw",_.OPERATION="operation",_.MICHELINE="micheline"})(SigningType||(SigningType={}));class P2PPairingResponse{constructor(a,$,j,et,tt,rt,nt){Yr(this,"type","p2p-pairing-request");Yr(this,"relayServer");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.relayServer=tt}}class PostMessagePairingRequest{constructor(a,$,j,et,tt,rt){Yr(this,"type","postmessage-pairing-request");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=tt,this.appUrl=rt,this.publicKey=j,this.version=et}}class ExtendedPostMessagePairingRequest extends PostMessagePairingRequest{constructor($,j,et,tt,rt,nt,it){super($,j,et,tt,nt,it);Yr(this,"senderId");this.senderId=rt}}class WalletConnectPairingRequest{constructor(a,$,j,et,tt,rt,nt){Yr(this,"type","walletconnect-pairing-request");Yr(this,"uri");Yr(this,"id");Yr(this,"name");Yr(this,"icon");Yr(this,"appUrl");Yr(this,"publicKey");Yr(this,"version");this.id=a,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.uri=tt}}class ExtendedWalletConnectPairingRequest extends WalletConnectPairingRequest{constructor($,j,et,tt,rt,nt,it,at){super($,j,et,tt,nt,it,at);Yr(this,"senderId");this.senderId=rt}}var ColorMode;(function(_){_.LIGHT="light",_.DARK="dark"})(ColorMode||(ColorMode={}));var Regions;(function(_){_.EUROPE_EAST="europe-east",_.EUROPE_WEST="europe-west",_.NORTH_AMERICA_EAST="north-america-east",_.NORTH_AMERICA_WEST="north-america-west",_.CENTRAL_AMERICA="central-america",_.SOUTH_AMERICA="south-america",_.ASIA_EAST="asia-east",_.ASIA_WEST="asia-west",_.AFRICA="africa",_.AUSTRALIA="australia"})(Regions||(Regions={}));const SDK_VERSION="4.2.2",BEACON_VERSION="3",NOTIFICATION_ORACLE_URL="https://beacon-notification-oracle.dev.gke.papers.tech",cbs=[_=>{}];let windowRef={postMessage:(_,a)=>{console.log("GOT MOCK POST MESSAGE",_),cbs.forEach($=>{$({data:_})})},addEventListener:(_,a)=>{cbs.push(a)},removeEventListener:(_,a)=>{cbs.splice(cbs.indexOf($=>$===a),1)},location:{origin:"*"}};try{typeof window<"u"&&(windowRef=window)}catch(_){console.log(`not defined: ${_}`)}class MockAnalytics{track(a,$,j,et){}}class BeaconClient{constructor(a){Yr(this,"name");Yr(this,"iconUrl");Yr(this,"appUrl");Yr(this,"_beaconId",new ExposedPromise);Yr(this,"storage");Yr(this,"analytics");Yr(this,"_keyPair",new ExposedPromise);if(!a.name)throw new Error("Name not set");if(!a.storage)throw new Error("Storage not set");this.name=a.name,this.iconUrl=a.iconUrl,this.appUrl=a.appUrl??windowRef.location.origin,this.storage=a.storage,this.analytics=a.analytics??new MockAnalytics,windowRef.beaconCreatedClientInstance?console.error("[BEACON] It looks like you created multiple Beacon SDK Client instances. This can lead to problems. Only create one instance and re-use it everywhere."):windowRef.beaconCreatedClientInstance=!0,this.initSDK().catch(console.error)}get beaconId(){return this._beaconId.promise}get keyPair(){return this._keyPair.promise}async destroy(){await this.removeBeaconEntriesFromStorage(),windowRef.beaconCreatedClientInstance=!1}async initSDK(){return this.storage.set(StorageKey.BEACON_SDK_VERSION,SDK_VERSION).catch(console.error),this.loadOrCreateBeaconSecret().catch(console.error),this.keyPair.then(a=>{this._beaconId.resolve(toHex$1(a.publicKey))})}async removeBeaconEntriesFromStorage(){const a=Object.values(StorageKey);await Promise.all(a.map($=>this.storage.delete($)))}async loadOrCreateBeaconSecret(){const a=await this.storage.get(StorageKey.BEACON_SDK_SECRET_SEED);if(a&&typeof a=="string")this._keyPair.resolve(await getKeypairFromSeed(a));else{const $=await generateGUID();await this.storage.set(StorageKey.BEACON_SDK_SECRET_SEED,$),this._keyPair.resolve(await getKeypairFromSeed($))}}}function fixArrayType(_){return _}class StorageManager{constructor(a,$){Yr(this,"storage");Yr(this,"storageKey");this.storage=a,this.storageKey=$}async getAll(){return await this.storage.get(this.storageKey)??[]}async getOne(a){const $=await this.storage.get(this.storageKey);return $.find(a)}async addOne(a,$,j=!0){const et=await this.storage.get(this.storageKey);if(!et.some($))et.push(a);else if(j)for(let tt=0;tt!a(et));return this.storage.set(this.storageKey,j)}async removeAll(){return this.storage.delete(this.storageKey)}}const getAccountIdentifier=async(_,a)=>{const $=[_,a.type];a.name&&$.push(`name:${a.name}`),a.rpcUrl&&$.push(`rpc:${a.rpcUrl}`);const j=Buffer$g.from(blake2b$1.hash(encode_1($.join("-")),10));return bs58check$2.encode(j)};class PermissionValidator{static async hasPermission(a,$,j){switch(a.type){case BeaconMessageType.PermissionRequest:case BeaconMessageType.BroadcastRequest:return!0;case BeaconMessageType.OperationRequest:{const et=await getAccountIdentifier(a.sourceAddress,a.network),tt=await $(et);return tt?tt.scopes.includes(PermissionScope.OPERATION_REQUEST):!1}case BeaconMessageType.SignPayloadRequest:{const tt=(await j()).filter(rt=>rt.address===a.sourceAddress);return tt.length===0?!1:tt.some(rt=>rt.scopes.includes(PermissionScope.SIGN))}default:throw new Error("Message not handled")}}}class AccountManager{constructor(a){Yr(this,"storageManager");this.storageManager=new StorageManager(a,StorageKey.ACCOUNTS)}async getAccounts(){return await this.storageManager.getAll()??[]}async getAccount(a){return this.storageManager.getOne($=>$.accountIdentifier===a)}async addAccount(a){return this.storageManager.addOne(a,$=>$.accountIdentifier===a.accountIdentifier)}async updateAccount(a,$){const j=await this.getAccount(a);if(!j)return;const et={...j,...$};return await this.storageManager.addOne(et,tt=>tt.accountIdentifier===a,!0),et}async removeAccount(a){return this.storageManager.remove($=>$.accountIdentifier===a)}async removeAccounts(a){return this.storageManager.remove($=>a.includes($.accountIdentifier))}async removeAllAccounts(){return this.storageManager.removeAll()}async hasPermission(a){return PermissionValidator.hasPermission(a,this.getAccount.bind(this),this.getAccounts.bind(this))}}const isHex$1=_=>/^[A-F0-9]+$/i.test(_),getSenderId=async _=>{isHex$1(_)||console.error("PublicKey needs to be in hex format!");const a=Buffer$g.from(blake2b$1.hash(Buffer$g.from(_,"hex"),5));return bs58check$2.encode(a)};let debug$2=!!windowRef.beaconSdkDebugEnabled;debug$2&&console.log("[BEACON]: Debug mode is ON (turned on either by the developer or a browser extension)");const getDebugEnabled=()=>debug$2;class InternalLogger{constructor(){}debug(a,$,...j){this._log("debug",a,$,j)}log(a,$,...j){this._log("log",a,$,j)}warn(a,$,...j){this._log("warn",a,$,j)}error(a,$,...j){this._log("error",a,$,j)}time(a,$){a?console.time($):console.timeEnd($)}timeLog(a,$,...j){this._log("timeLog",a,$,j)}_log(a,$,j,et=[]){if(!getDebugEnabled())return;let tt=`[BEACON] ${new Date().toISOString()} [${$}](${j})`,rt=et;switch(et[0]&&typeof et[0]=="string"&&(tt+=` ${et[0]}`,rt=et.slice(1)),a){case"error":console.group(tt),console.error(...rt);break;case"warn":console.group(tt),console.warn(...rt);break;case"debug":console.groupCollapsed(tt),console.debug(...rt);break;case"timeLog":console.group(tt),console.timeLog(...rt);break;default:console.group(tt),console.log(...rt)}console.groupEnd()}}class Logger{constructor(a){Yr(this,"name");this.name=a}debug(a,...$){logger$9.debug(this.name,a,$)}log(a,...$){logger$9.log(this.name,a,$)}warn(a,...$){logger$9.warn(this.name,a,$)}error(a,...$){logger$9.error(this.name,a,$)}time(a,$){logger$9.time(a,$)}timeLog(a,...$){logger$9.timeLog(a,$)}}let logger$9=new InternalLogger;const logger$8=new Logger("Client");class Client extends BeaconClient{constructor($){super($);Yr(this,"accountManager");Yr(this,"handleResponse");Yr(this,"rateLimit",2);Yr(this,"rateLimitWindowInSeconds",5);Yr(this,"requestCounter",[]);Yr(this,"matrixNodes");Yr(this,"transportListeners",new Map);Yr(this,"_transport",new ExposedPromise);this.accountManager=new AccountManager($.storage),this.matrixNodes=$.matrixNodes??{},this.handleResponse=(j,et)=>{throw new Error(`not overwritten${JSON.stringify(j)} - ${JSON.stringify(et)}`)}}get transport(){return this._transport.promise}get connectionStatus(){var $;return(($=this._transport.promiseResult)==null?void 0:$.connectionStatus)??TransportStatus.NOT_CONNECTED}get ready(){return this.transport.then(()=>{})}async cleanup(){if(this.transportListeners.size&&this._transport.isResolved()){const $=await this.transport;await Promise.all(Array.from(this.transportListeners.values()).map(j=>$.removeListener(j))),this.transportListeners.clear()}}async getAccounts(){return this.accountManager.getAccounts()}async getAccount($){return this.accountManager.getAccount($)}async removeAccount($){return this.accountManager.removeAccount($)}async removeAllAccounts(){return this.accountManager.removeAllAccounts()}async addRequestAndCheckIfRateLimited(){const $=new Date().getTime();return this.requestCounter=this.requestCounter.filter(j=>j+this.rateLimitWindowInSeconds*1e3>$),this.requestCounter.push($),this.requestCounter.length>this.rateLimit}async init($){return this._transport.isResolved()?(await this.transport).type:(await this.setTransport($),$.type)}async getOwnAppMetadata(){return{senderId:await getSenderId(await this.beaconId),name:this.name,icon:this.iconUrl}}async getPeers(){return(await this.transport).getPeers()}async addPeer($){return(await this.transport).addPeer($)}async destroy(){if(this._transport.isResolved()){const $=await this.transport;await this.cleanup(),await $.disconnect(),$.type===TransportType.WALLETCONNECT&&await $.doClientCleanup()}await super.destroy()}async setTransport($){$?this._transport.isSettled()?this._transport=ExposedPromise.resolve($):this._transport.resolve($):this._transport.isSettled()&&(this._transport=new ExposedPromise)}async addListener($){this.transportListeners.has($.type)&&await $.removeListener(this.transportListeners.get($.type));const j=async(et,tt)=>{if(typeof et=="string"){const rt=await new Serializer().deserialize(et);this.handleResponse(rt,tt)}};this.transportListeners.set($.type,j),$.addListener(j).catch(et=>logger$8.error("addListener",et))}async sendDisconnectToPeer($,j){const et={id:await generateGUID(),version:$.version,senderId:await getSenderId(await this.beaconId),type:BeaconMessageType.Disconnect},tt=await new Serializer().serialize(et);await(j??await this.transport).send(tt,$)}}const logger$7=new Logger("Transport");let Transport$2=class{constructor(a,$,j){Yr(this,"type",TransportType.POST_MESSAGE);Yr(this,"name");Yr(this,"_isConnected",TransportStatus.NOT_CONNECTED);Yr(this,"peerManager");Yr(this,"client");Yr(this,"newPeerListener");Yr(this,"listeners",[]);this.name=a,this.client=$,this.peerManager=j}setEventHandler(a,$){this.client.eventHandlers.set(a,$)}get connectionStatus(){return this._isConnected}static async isAvailable(){return Promise.resolve(!1)}async connect(){logger$7.log("connect"),this._isConnected=TransportStatus.CONNECTED}async disconnect(){logger$7.log("disconnect"),this._isConnected=TransportStatus.NOT_CONNECTED}async send(a,$){if($)return this.client.sendMessage(a,$);{const et=(await this.getPeers()).map(tt=>this.client.sendMessage(a,tt));return(await Promise.all(et))[0]}}async addListener(a){logger$7.debug("addListener"),this.listeners.push(a)}async removeListener(a){logger$7.log("removeListener"),this.listeners=this.listeners.filter($=>$!==a)}async getPeers(){return this.peerManager.getPeers()}async addPeer(a,$=!0){logger$7.log("addPeer","adding peer",a),await this.peerManager.addPeer(a),await this.listen(a.publicKey)}async removePeer(a){logger$7.log("removePeer","removing peer",a),await this.peerManager.removePeer(a.publicKey),this.client&&await this.client.unsubscribeFromEncryptedMessage(a.publicKey)}async removeAllPeers(){logger$7.log("removeAllPeers"),await this.peerManager.removeAllPeers(),this.client&&await this.client.unsubscribeFromEncryptedMessages()}async notifyListeners(a,$){this.listeners.length===0?logger$7.warn("notifyListeners","0 listeners notified!",this):logger$7.log("notifyListeners",`Notifying ${this.listeners.length} listeners`,this),this.listeners.forEach(j=>{j(a,$)})}};class LocalStorage extends Storage{constructor($){super();Yr(this,"prefix");this.prefix=$}static async isSupported(){return Promise.resolve(typeof window<"u"&&!!window.localStorage)}async get($){const j=localStorage.getItem(this.getPrefixedKey($));if(j)try{return JSON.parse(j)}catch{return j}else return typeof defaultValues[$]=="object"?JSON.parse(JSON.stringify(defaultValues[$])):defaultValues[$]}async set($,j){return typeof j=="string"?localStorage.setItem(this.getPrefixedKey($),j):localStorage.setItem(this.getPrefixedKey($),JSON.stringify(j))}async delete($){return Promise.resolve(localStorage.removeItem(this.getPrefixedKey($)))}async subscribeToStorageChanged($){window.addEventListener("storage",j=>{j.key?$({eventType:"entryModified",key:this.getPrefixedKey(j.key),oldValue:j.oldValue,newValue:j.newValue}):$({eventType:"storageCleared",key:null,oldValue:null,newValue:null})},!1)}getPrefixedKey($){return this.prefix?`${this.prefix}-${$}`:$}}class Serializer{async serialize(a){const $=JSON.stringify(a);return bs58check$2.encode(Buffer$g.from($))}async deserialize(a){if(typeof a!="string")throw new Error("Encoded payload needs to be a string");return JSON.parse(bs58check$2.decode(a).toString())}}class AppMetadataManager{constructor(a){Yr(this,"storageManager");this.storageManager=new StorageManager(a,StorageKey.APP_METADATA_LIST)}async getAppMetadataList(){return await this.storageManager.getAll()??[]}async getAppMetadata(a){return this.storageManager.getOne($=>$.senderId===a)}async addAppMetadata(a){return this.storageManager.addOne(a,$=>$.senderId===a.senderId)}async removeAppMetadata(a){return this.storageManager.remove($=>$.senderId===a)}async removeAppMetadatas(a){return this.storageManager.remove($=>a.includes($.senderId))}async removeAllAppMetadata(){return this.storageManager.removeAll()}}class PermissionManager{constructor(a){Yr(this,"storageManager");this.storageManager=new StorageManager(a,StorageKey.PERMISSION_LIST)}async getPermissions(){return await this.storageManager.getAll()??[]}async getPermission(a){return this.storageManager.getOne($=>$.accountIdentifier===a)}async addPermission(a){return this.storageManager.addOne(a,$=>$.accountIdentifier===a.accountIdentifier&&$.senderId===a.senderId)}async removePermission(a){return this.storageManager.remove($=>$.accountIdentifier===a)}async removePermissions(a){return this.storageManager.remove($=>a.includes($.accountIdentifier))}async removeAllPermissions(){return this.storageManager.removeAll()}async hasPermission(a){return PermissionValidator.hasPermission(a,this.getPermission.bind(this),this.getPermissions.bind(this))}}class PeerManager{constructor(a,$){Yr(this,"storageManager");this.storageManager=new StorageManager(a,$)}async hasPeer(a){return!!await this.getPeer(a)}async getPeers(){return await this.storageManager.getAll()??[]}async getPeer(a){return this.storageManager.getOne($=>$.publicKey===a)}async addPeer(a){return this.storageManager.addOne(a,$=>$.publicKey===a.publicKey)}async removePeer(a){return this.storageManager.remove($=>$.publicKey===a)}async removePeers(a){return this.storageManager.remove($=>a.includes($.publicKey))}async removeAllPeers(){return this.storageManager.removeAll()}}var x25519Session={},keyagreement={},hasRequiredKeyagreement;function requireKeyagreement(){return hasRequiredKeyagreement||(hasRequiredKeyagreement=1,function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.X25519Session=_.SECRET_SEED_LENGTH=_.SAVED_STATE_LENGTH=_.ACCEPT_MESSAGE_LENGTH=_.OFFER_MESSAGE_LENGTH=void 0;const a=random,$=wipe$1,j=x25519,et=requireX25519Session();_.OFFER_MESSAGE_LENGTH=j.PUBLIC_KEY_LENGTH,_.ACCEPT_MESSAGE_LENGTH=j.PUBLIC_KEY_LENGTH,_.SAVED_STATE_LENGTH=j.SECRET_KEY_LENGTH,_.SECRET_SEED_LENGTH=j.SECRET_KEY_LENGTH;class tt{constructor(nt,it){this.offerMessageLength=_.OFFER_MESSAGE_LENGTH,this.acceptMessageLength=_.ACCEPT_MESSAGE_LENGTH,this.sharedKeyLength=j.SHARED_KEY_LENGTH,this.savedStateLength=_.SAVED_STATE_LENGTH,this._seed=nt||(0,a.randomBytes)(j.SECRET_KEY_LENGTH,it)}saveState(){return new Uint8Array(this._seed)}restoreState(nt){return this._seed=new Uint8Array(nt),this}clean(){this._seed&&(0,$.wipe)(this._seed),this._keyPair&&((0,$.wipe)(this._keyPair.secretKey),(0,$.wipe)(this._keyPair.publicKey)),this._sharedKey&&(0,$.wipe)(this._sharedKey),this._sessionKeys&&((0,$.wipe)(this._sessionKeys.receive),(0,$.wipe)(this._sessionKeys.send))}offer(){return this._keyPair=(0,j.generateKeyPairFromSeed)(this._seed),new Uint8Array(this._keyPair.publicKey)}accept(nt){if(this._keyPair)throw new Error("X25519Session: accept shouldn't be called by offering party");if(nt.length!==this.offerMessageLength)throw new Error("X25519Session: incorrect offer message length");if(this._sharedKey)throw new Error("X25519Session: accept was already called");const it=(0,j.generateKeyPairFromSeed)(this._seed);return this._sharedKey=(0,j.sharedKey)(it.secretKey,nt),this._sessionKeys=(0,et.clientSessionKeysFromSharedKey)(this._sharedKey,it.publicKey,nt),(0,$.wipe)(it.secretKey),it.publicKey}finish(nt){if(nt.length!==this.acceptMessageLength)throw new Error("X25519Session: incorrect accept message length");if(!this._keyPair)throw new Error("X25519Session: no offer state");if(this._sharedKey)throw new Error("X25519Session: finish was already called");return this._sharedKey=(0,j.sharedKey)(this._keyPair.secretKey,nt),this._sessionKeys=(0,et.serverSessionKeysFromSharedKey)(this._sharedKey,this._keyPair.publicKey,nt),this}getSharedKey(){if(!this._sharedKey)throw new Error("X25519Session: no shared key established");return new Uint8Array(this._sharedKey)}getSessionKeys(){if(!this._sessionKeys)throw new Error("X25519Session: no shared key established");return{receive:new Uint8Array(this._sessionKeys.receive),send:new Uint8Array(this._sessionKeys.send)}}}_.X25519Session=tt}(keyagreement)),keyagreement}var hasRequiredX25519Session;function requireX25519Session(){return hasRequiredX25519Session||(hasRequiredX25519Session=1,function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.clientSessionKeys=_.serverSessionKeys=_.clientSessionKeysFromSharedKey=_.serverSessionKeysFromSharedKey=_.X25519Session=void 0;const a=blake2b$1,$=x25519;var j=requireKeyagreement();Object.defineProperty(_,"X25519Session",{enumerable:!0,get:function(){return j.X25519Session}});const et=32;function tt(at,st,ot,ut=a.BLAKE2b){const dt=new ut;if(dt.digestLength!==et*2)throw new Error("X25519: incorrect digest length");const mt=dt.update(at).update(ot).update(st).digest();return{send:mt.subarray(0,et),receive:mt.subarray(et)}}_.serverSessionKeysFromSharedKey=tt;function rt(at,st,ot,ut=a.BLAKE2b){const dt=new ut;if(dt.digestLength!==et*2)throw new Error("X25519: incorrect digest length");const mt=dt.update(at).update(st).update(ot).digest();return{receive:mt.subarray(0,et),send:mt.subarray(et)}}_.clientSessionKeysFromSharedKey=rt;function nt(at,st,ot=a.BLAKE2b){const ut=(0,$.sharedKey)(at.secretKey,st);return tt(ut,at.publicKey,st,ot)}_.serverSessionKeys=nt;function it(at,st,ot=a.BLAKE2b){const ut=(0,$.sharedKey)(at.secretKey,st);return rt(ut,at.publicKey,st,ot)}_.clientSessionKeys=it}(x25519Session)),x25519Session}var x25519SessionExports=requireX25519Session();class CommunicationClient{constructor(a){Yr(this,"keyPair");Yr(this,"eventHandlers",new Map);Yr(this,"isMobileOS",()=>/(Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet|Windows Phone|SymbianOS|Kindle)/i.test(navigator.userAgent));this.keyPair=a}async getPublicKey(){var a;return toHex$1((a=this.keyPair)==null?void 0:a.publicKey)}async getPublicKeyHash(){return getHexHash(this.keyPair.publicKey)}async createCryptoBoxServer(a,$){return x25519SessionExports.serverSessionKeys({publicKey:ed25519.convertPublicKeyToX25519($.publicKey),secretKey:ed25519.convertSecretKeyToX25519($.secretKey)},ed25519.convertPublicKeyToX25519(Buffer$g.from(a,"hex")))}async createCryptoBoxClient(a,$){return x25519SessionExports.clientSessionKeys({publicKey:ed25519.convertPublicKeyToX25519($.publicKey),secretKey:ed25519.convertSecretKeyToX25519($.secretKey)},ed25519.convertPublicKeyToX25519(Buffer$g.from(a,"hex")))}async encryptMessageAsymmetric(a,$){return sealCryptobox($,Buffer$g.from(a,"hex"))}}function bind$5(_,a){return function(){return _.apply(a,arguments)}}const{toString:toString$3}=Object.prototype,{getPrototypeOf:getPrototypeOf$4}=Object,kindOf$1=(_=>a=>{const $=toString$3.call(a);return _[$]||(_[$]=$.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest$1=_=>(_=_.toLowerCase(),a=>kindOf$1(a)===_),typeOfTest$1=_=>a=>typeof a===_,{isArray:isArray$4}=Array,isUndefined$1=typeOfTest$1("undefined");function isBuffer$2(_){return _!==null&&!isUndefined$1(_)&&_.constructor!==null&&!isUndefined$1(_.constructor)&&isFunction$3(_.constructor.isBuffer)&&_.constructor.isBuffer(_)}const isArrayBuffer$1=kindOfTest$1("ArrayBuffer");function isArrayBufferView$1(_){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(_):a=_&&_.buffer&&isArrayBuffer$1(_.buffer),a}const isString$2=typeOfTest$1("string"),isFunction$3=typeOfTest$1("function"),isNumber$1=typeOfTest$1("number"),isObject$3=_=>_!==null&&typeof _=="object",isBoolean$2=_=>_===!0||_===!1,isPlainObject$5=_=>{if(kindOf$1(_)!=="object")return!1;const a=getPrototypeOf$4(_);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in _)&&!(Symbol.iterator in _)},isDate$2=kindOfTest$1("Date"),isFile$1=kindOfTest$1("File"),isBlob$1=kindOfTest$1("Blob"),isFileList$1=kindOfTest$1("FileList"),isStream$1=_=>isObject$3(_)&&isFunction$3(_.pipe),isFormData$1=_=>{let a;return _&&(typeof FormData=="function"&&_ instanceof FormData||isFunction$3(_.append)&&((a=kindOf$1(_))==="formdata"||a==="object"&&isFunction$3(_.toString)&&_.toString()==="[object FormData]"))},isURLSearchParams$1=kindOfTest$1("URLSearchParams"),trim$2=_=>_.trim?_.trim():_.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(_,a,{allOwnKeys:$=!1}={}){if(_===null||typeof _>"u")return;let j,et;if(typeof _!="object"&&(_=[_]),isArray$4(_))for(j=0,et=_.length;j0;)if(et=$[j],a===et.toLowerCase())return et;return null}const _global$1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined$1=_=>!isUndefined$1(_)&&_!==_global$1;function merge$1(){const{caseless:_}=isContextDefined$1(this)&&this||{},a={},$=(j,et)=>{const tt=_&&findKey$2(a,et)||et;isPlainObject$5(a[tt])&&isPlainObject$5(j)?a[tt]=merge$1(a[tt],j):isPlainObject$5(j)?a[tt]=merge$1({},j):isArray$4(j)?a[tt]=j.slice():a[tt]=j};for(let j=0,et=arguments.length;j(forEach$1(a,(et,tt)=>{$&&isFunction$3(et)?_[tt]=bind$5(et,$):_[tt]=et},{allOwnKeys:j}),_),stripBOM$1=_=>(_.charCodeAt(0)===65279&&(_=_.slice(1)),_),inherits$a=(_,a,$,j)=>{_.prototype=Object.create(a.prototype,j),_.prototype.constructor=_,Object.defineProperty(_,"super",{value:a.prototype}),$&&Object.assign(_.prototype,$)},toFlatObject$1=(_,a,$,j)=>{let et,tt,rt;const nt={};if(a=a||{},_==null)return a;do{for(et=Object.getOwnPropertyNames(_),tt=et.length;tt-- >0;)rt=et[tt],(!j||j(rt,_,a))&&!nt[rt]&&(a[rt]=_[rt],nt[rt]=!0);_=$!==!1&&getPrototypeOf$4(_)}while(_&&(!$||$(_,a))&&_!==Object.prototype);return a},endsWith$1=(_,a,$)=>{_=String(_),($===void 0||$>_.length)&&($=_.length),$-=a.length;const j=_.indexOf(a,$);return j!==-1&&j===$},toArray$2=_=>{if(!_)return null;if(isArray$4(_))return _;let a=_.length;if(!isNumber$1(a))return null;const $=new Array(a);for(;a-- >0;)$[a]=_[a];return $},isTypedArray$1=(_=>a=>_&&a instanceof _)(typeof Uint8Array<"u"&&getPrototypeOf$4(Uint8Array)),forEachEntry$1=(_,a)=>{const j=(_&&_[Symbol.iterator]).call(_);let et;for(;(et=j.next())&&!et.done;){const tt=et.value;a.call(_,tt[0],tt[1])}},matchAll$1=(_,a)=>{let $;const j=[];for(;($=_.exec(a))!==null;)j.push($);return j},isHTMLForm$1=kindOfTest$1("HTMLFormElement"),toCamelCase$1=_=>_.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function($,j,et){return j.toUpperCase()+et}),hasOwnProperty$1=(({hasOwnProperty:_})=>(a,$)=>_.call(a,$))(Object.prototype),isRegExp$1=kindOfTest$1("RegExp"),reduceDescriptors$1=(_,a)=>{const $=Object.getOwnPropertyDescriptors(_),j={};forEach$1($,(et,tt)=>{let rt;(rt=a(et,tt,_))!==!1&&(j[tt]=rt||et)}),Object.defineProperties(_,j)},freezeMethods$1=_=>{reduceDescriptors$1(_,(a,$)=>{if(isFunction$3(_)&&["arguments","caller","callee"].indexOf($)!==-1)return!1;const j=_[$];if(isFunction$3(j)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+$+"'")})}})},toObjectSet$1=(_,a)=>{const $={},j=et=>{et.forEach(tt=>{$[tt]=!0})};return isArray$4(_)?j(_):j(String(_).split(a)),$},noop$7=()=>{},toFiniteNumber$1=(_,a)=>(_=+_,Number.isFinite(_)?_:a),ALPHA$1="abcdefghijklmnopqrstuvwxyz",DIGIT$1="0123456789",ALPHABET$2={DIGIT:DIGIT$1,ALPHA:ALPHA$1,ALPHA_DIGIT:ALPHA$1+ALPHA$1.toUpperCase()+DIGIT$1},generateString$1=(_=16,a=ALPHABET$2.ALPHA_DIGIT)=>{let $="";const{length:j}=a;for(;_--;)$+=a[Math.random()*j|0];return $};function isSpecCompliantForm$1(_){return!!(_&&isFunction$3(_.append)&&_[Symbol.toStringTag]==="FormData"&&_[Symbol.iterator])}const toJSONObject$1=_=>{const a=new Array(10),$=(j,et)=>{if(isObject$3(j)){if(a.indexOf(j)>=0)return;if(!("toJSON"in j)){a[et]=j;const tt=isArray$4(j)?[]:{};return forEach$1(j,(rt,nt)=>{const it=$(rt,et+1);!isUndefined$1(it)&&(tt[nt]=it)}),a[et]=void 0,tt}}return j};return $(_,0)},isAsyncFn$1=kindOfTest$1("AsyncFunction"),isThenable$2=_=>_&&(isObject$3(_)||isFunction$3(_))&&isFunction$3(_.then)&&isFunction$3(_.catch),utils$E={isArray:isArray$4,isArrayBuffer:isArrayBuffer$1,isBuffer:isBuffer$2,isFormData:isFormData$1,isArrayBufferView:isArrayBufferView$1,isString:isString$2,isNumber:isNumber$1,isBoolean:isBoolean$2,isObject:isObject$3,isPlainObject:isPlainObject$5,isUndefined:isUndefined$1,isDate:isDate$2,isFile:isFile$1,isBlob:isBlob$1,isRegExp:isRegExp$1,isFunction:isFunction$3,isStream:isStream$1,isURLSearchParams:isURLSearchParams$1,isTypedArray:isTypedArray$1,isFileList:isFileList$1,forEach:forEach$1,merge:merge$1,extend:extend$1,trim:trim$2,stripBOM:stripBOM$1,inherits:inherits$a,toFlatObject:toFlatObject$1,kindOf:kindOf$1,kindOfTest:kindOfTest$1,endsWith:endsWith$1,toArray:toArray$2,forEachEntry:forEachEntry$1,matchAll:matchAll$1,isHTMLForm:isHTMLForm$1,hasOwnProperty:hasOwnProperty$1,hasOwnProp:hasOwnProperty$1,reduceDescriptors:reduceDescriptors$1,freezeMethods:freezeMethods$1,toObjectSet:toObjectSet$1,toCamelCase:toCamelCase$1,noop:noop$7,toFiniteNumber:toFiniteNumber$1,findKey:findKey$2,global:_global$1,isContextDefined:isContextDefined$1,ALPHABET:ALPHABET$2,generateString:generateString$1,isSpecCompliantForm:isSpecCompliantForm$1,toJSONObject:toJSONObject$1,isAsyncFn:isAsyncFn$1,isThenable:isThenable$2};function AxiosError$1(_,a,$,j,et){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=_,this.name="AxiosError",a&&(this.code=a),$&&(this.config=$),j&&(this.request=j),et&&(this.response=et)}utils$E.inherits(AxiosError$1,Error,{toJSON:function _(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$E.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$3=AxiosError$1.prototype,descriptors$1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(_=>{descriptors$1[_]={value:_}});Object.defineProperties(AxiosError$1,descriptors$1);Object.defineProperty(prototype$3,"isAxiosError",{value:!0});AxiosError$1.from=(_,a,$,j,et,tt)=>{const rt=Object.create(prototype$3);return utils$E.toFlatObject(_,rt,function(it){return it!==Error.prototype},nt=>nt!=="isAxiosError"),AxiosError$1.call(rt,_.message,a,$,j,et),rt.cause=_,rt.name=_.name,tt&&Object.assign(rt,tt),rt};const httpAdapter$1=null;function isVisitable$1(_){return utils$E.isPlainObject(_)||utils$E.isArray(_)}function removeBrackets$1(_){return utils$E.endsWith(_,"[]")?_.slice(0,-2):_}function renderKey$1(_,a,$){return _?_.concat(a).map(function(et,tt){return et=removeBrackets$1(et),!$&&tt?"["+et+"]":et}).join($?".":""):a}function isFlatArray$1(_){return utils$E.isArray(_)&&!_.some(isVisitable$1)}const predicates$1=utils$E.toFlatObject(utils$E,{},null,function _(a){return/^is[A-Z]/.test(a)});function toFormData$1(_,a,$){if(!utils$E.isObject(_))throw new TypeError("target must be an object");a=a||new FormData,$=utils$E.toFlatObject($,{metaTokens:!0,dots:!1,indexes:!1},!1,function(xt,Ct){return!utils$E.isUndefined(Ct[xt])});const j=$.metaTokens,et=$.visitor||st,tt=$.dots,rt=$.indexes,it=($.Blob||typeof Blob<"u"&&Blob)&&utils$E.isSpecCompliantForm(a);if(!utils$E.isFunction(et))throw new TypeError("visitor must be a function");function at(mt){if(mt===null)return"";if(utils$E.isDate(mt))return mt.toISOString();if(!it&&utils$E.isBlob(mt))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$E.isArrayBuffer(mt)||utils$E.isTypedArray(mt)?it&&typeof Blob=="function"?new Blob([mt]):Buffer$g.from(mt):mt}function st(mt,xt,Ct){let Pt=mt;if(mt&&!Ct&&typeof mt=="object"){if(utils$E.endsWith(xt,"{}"))xt=j?xt:xt.slice(0,-2),mt=JSON.stringify(mt);else if(utils$E.isArray(mt)&&isFlatArray$1(mt)||(utils$E.isFileList(mt)||utils$E.endsWith(xt,"[]"))&&(Pt=utils$E.toArray(mt)))return xt=removeBrackets$1(xt),Pt.forEach(function(kt,Lt){!(utils$E.isUndefined(kt)||kt===null)&&a.append(rt===!0?renderKey$1([xt],Lt,tt):rt===null?xt:xt+"[]",at(kt))}),!1}return isVisitable$1(mt)?!0:(a.append(renderKey$1(Ct,xt,tt),at(mt)),!1)}const ot=[],ut=Object.assign(predicates$1,{defaultVisitor:st,convertValue:at,isVisitable:isVisitable$1});function dt(mt,xt){if(!utils$E.isUndefined(mt)){if(ot.indexOf(mt)!==-1)throw Error("Circular reference detected in "+xt.join("."));ot.push(mt),utils$E.forEach(mt,function(Pt,Tt){(!(utils$E.isUndefined(Pt)||Pt===null)&&et.call(a,Pt,utils$E.isString(Tt)?Tt.trim():Tt,xt,ut))===!0&&dt(Pt,xt?xt.concat(Tt):[Tt])}),ot.pop()}}if(!utils$E.isObject(_))throw new TypeError("data must be an object");return dt(_),a}function encode$7(_){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(_).replace(/[!'()~]|%20|%00/g,function(j){return a[j]})}function AxiosURLSearchParams$1(_,a){this._pairs=[],_&&toFormData$1(_,this,a)}const prototype$2=AxiosURLSearchParams$1.prototype;prototype$2.append=function _(a,$){this._pairs.push([a,$])};prototype$2.toString=function _(a){const $=a?function(j){return a.call(this,j,encode$7)}:encode$7;return this._pairs.map(function(et){return $(et[0])+"="+$(et[1])},"").join("&")};function encode$6(_){return encodeURIComponent(_).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL$1(_,a,$){if(!a)return _;const j=$&&$.encode||encode$6,et=$&&$.serialize;let tt;if(et?tt=et(a,$):tt=utils$E.isURLSearchParams(a)?a.toString():new AxiosURLSearchParams$1(a,$).toString(j),tt){const rt=_.indexOf("#");rt!==-1&&(_=_.slice(0,rt)),_+=(_.indexOf("?")===-1?"?":"&")+tt}return _}let InterceptorManager$1=class{constructor(){this.handlers=[]}use(a,$,j){return this.handlers.push({fulfilled:a,rejected:$,synchronous:j?j.synchronous:!1,runWhen:j?j.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){utils$E.forEach(this.handlers,function(j){j!==null&&a(j)})}};const transitionalDefaults$1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$2=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams$1,FormData$2=typeof FormData<"u"?FormData:null,Blob$2=typeof Blob<"u"?Blob:null,platform$3={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$2,FormData:FormData$2,Blob:Blob$2},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv$1=typeof window<"u"&&typeof document<"u",hasStandardBrowserEnv$1=(_=>hasBrowserEnv$1&&["ReactNative","NativeScript","NS"].indexOf(_)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv$1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",utils$D=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hasBrowserEnv$1,hasStandardBrowserEnv:hasStandardBrowserEnv$1,hasStandardBrowserWebWorkerEnv:hasStandardBrowserWebWorkerEnv$1},Symbol.toStringTag,{value:"Module"})),platform$2={...utils$D,...platform$3};function toURLEncodedForm$1(_,a){return toFormData$1(_,new platform$2.classes.URLSearchParams,Object.assign({visitor:function($,j,et,tt){return platform$2.isNode&&utils$E.isBuffer($)?(this.append(j,$.toString("base64")),!1):tt.defaultVisitor.apply(this,arguments)}},a))}function parsePropPath$1(_){return utils$E.matchAll(/\w+|\[(\w*)]/g,_).map(a=>a[0]==="[]"?"":a[1]||a[0])}function arrayToObject$1(_){const a={},$=Object.keys(_);let j;const et=$.length;let tt;for(j=0;j=$.length;return rt=!rt&&utils$E.isArray(et)?et.length:rt,it?(utils$E.hasOwnProp(et,rt)?et[rt]=[et[rt],j]:et[rt]=j,!nt):((!et[rt]||!utils$E.isObject(et[rt]))&&(et[rt]=[]),a($,j,et[rt],tt)&&utils$E.isArray(et[rt])&&(et[rt]=arrayToObject$1(et[rt])),!nt)}if(utils$E.isFormData(_)&&utils$E.isFunction(_.entries)){const $={};return utils$E.forEachEntry(_,(j,et)=>{a(parsePropPath$1(j),et,$,0)}),$}return null}function stringifySafely$1(_,a,$){if(utils$E.isString(_))try{return(a||JSON.parse)(_),utils$E.trim(_)}catch(j){if(j.name!=="SyntaxError")throw j}return($||JSON.stringify)(_)}const defaults$2={transitional:transitionalDefaults$1,adapter:["xhr","http"],transformRequest:[function _(a,$){const j=$.getContentType()||"",et=j.indexOf("application/json")>-1,tt=utils$E.isObject(a);if(tt&&utils$E.isHTMLForm(a)&&(a=new FormData(a)),utils$E.isFormData(a))return et&&et?JSON.stringify(formDataToJSON$1(a)):a;if(utils$E.isArrayBuffer(a)||utils$E.isBuffer(a)||utils$E.isStream(a)||utils$E.isFile(a)||utils$E.isBlob(a))return a;if(utils$E.isArrayBufferView(a))return a.buffer;if(utils$E.isURLSearchParams(a))return $.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let nt;if(tt){if(j.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm$1(a,this.formSerializer).toString();if((nt=utils$E.isFileList(a))||j.indexOf("multipart/form-data")>-1){const it=this.env&&this.env.FormData;return toFormData$1(nt?{"files[]":a}:a,it&&new it,this.formSerializer)}}return tt||et?($.setContentType("application/json",!1),stringifySafely$1(a)):a}],transformResponse:[function _(a){const $=this.transitional||defaults$2.transitional,j=$&&$.forcedJSONParsing,et=this.responseType==="json";if(a&&utils$E.isString(a)&&(j&&!this.responseType||et)){const rt=!($&&$.silentJSONParsing)&&et;try{return JSON.parse(a)}catch(nt){if(rt)throw nt.name==="SyntaxError"?AxiosError$1.from(nt,AxiosError$1.ERR_BAD_RESPONSE,this,null,this.response):nt}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform$2.classes.FormData,Blob:platform$2.classes.Blob},validateStatus:function _(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$E.forEach(["delete","get","head","post","put","patch"],_=>{defaults$2.headers[_]={}});const ignoreDuplicateOf$1=utils$E.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders$1=_=>{const a={};let $,j,et;return _&&_.split(` +`).forEach(function(rt){et=rt.indexOf(":"),$=rt.substring(0,et).trim().toLowerCase(),j=rt.substring(et+1).trim(),!(!$||a[$]&&ignoreDuplicateOf$1[$])&&($==="set-cookie"?a[$]?a[$].push(j):a[$]=[j]:a[$]=a[$]?a[$]+", "+j:j)}),a},$internals$1=Symbol("internals");function normalizeHeader$1(_){return _&&String(_).trim().toLowerCase()}function normalizeValue$1(_){return _===!1||_==null?_:utils$E.isArray(_)?_.map(normalizeValue$1):String(_)}function parseTokens$1(_){const a=Object.create(null),$=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let j;for(;j=$.exec(_);)a[j[1]]=j[2];return a}const isValidHeaderName$1=_=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_.trim());function matchHeaderValue$1(_,a,$,j,et){if(utils$E.isFunction(j))return j.call(this,a,$);if(et&&(a=$),!!utils$E.isString(a)){if(utils$E.isString(j))return a.indexOf(j)!==-1;if(utils$E.isRegExp(j))return j.test(a)}}function formatHeader$1(_){return _.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,$,j)=>$.toUpperCase()+j)}function buildAccessors$1(_,a){const $=utils$E.toCamelCase(" "+a);["get","set","has"].forEach(j=>{Object.defineProperty(_,j+$,{value:function(et,tt,rt){return this[j].call(this,a,et,tt,rt)},configurable:!0})})}let AxiosHeaders$1=class{constructor(a){a&&this.set(a)}set(a,$,j){const et=this;function tt(nt,it,at){const st=normalizeHeader$1(it);if(!st)throw new Error("header name must be a non-empty string");const ot=utils$E.findKey(et,st);(!ot||et[ot]===void 0||at===!0||at===void 0&&et[ot]!==!1)&&(et[ot||it]=normalizeValue$1(nt))}const rt=(nt,it)=>utils$E.forEach(nt,(at,st)=>tt(at,st,it));return utils$E.isPlainObject(a)||a instanceof this.constructor?rt(a,$):utils$E.isString(a)&&(a=a.trim())&&!isValidHeaderName$1(a)?rt(parseHeaders$1(a),$):a!=null&&tt($,a,j),this}get(a,$){if(a=normalizeHeader$1(a),a){const j=utils$E.findKey(this,a);if(j){const et=this[j];if(!$)return et;if($===!0)return parseTokens$1(et);if(utils$E.isFunction($))return $.call(this,et,j);if(utils$E.isRegExp($))return $.exec(et);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,$){if(a=normalizeHeader$1(a),a){const j=utils$E.findKey(this,a);return!!(j&&this[j]!==void 0&&(!$||matchHeaderValue$1(this,this[j],j,$)))}return!1}delete(a,$){const j=this;let et=!1;function tt(rt){if(rt=normalizeHeader$1(rt),rt){const nt=utils$E.findKey(j,rt);nt&&(!$||matchHeaderValue$1(j,j[nt],nt,$))&&(delete j[nt],et=!0)}}return utils$E.isArray(a)?a.forEach(tt):tt(a),et}clear(a){const $=Object.keys(this);let j=$.length,et=!1;for(;j--;){const tt=$[j];(!a||matchHeaderValue$1(this,this[tt],tt,a,!0))&&(delete this[tt],et=!0)}return et}normalize(a){const $=this,j={};return utils$E.forEach(this,(et,tt)=>{const rt=utils$E.findKey(j,tt);if(rt){$[rt]=normalizeValue$1(et),delete $[tt];return}const nt=a?formatHeader$1(tt):String(tt).trim();nt!==tt&&delete $[tt],$[nt]=normalizeValue$1(et),j[nt]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const $=Object.create(null);return utils$E.forEach(this,(j,et)=>{j!=null&&j!==!1&&($[et]=a&&utils$E.isArray(j)?j.join(", "):j)}),$}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,$])=>a+": "+$).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...$){const j=new this(a);return $.forEach(et=>j.set(et)),j}static accessor(a){const j=(this[$internals$1]=this[$internals$1]={accessors:{}}).accessors,et=this.prototype;function tt(rt){const nt=normalizeHeader$1(rt);j[nt]||(buildAccessors$1(et,rt),j[nt]=!0)}return utils$E.isArray(a)?a.forEach(tt):tt(a),this}};AxiosHeaders$1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$E.reduceDescriptors(AxiosHeaders$1.prototype,({value:_},a)=>{let $=a[0].toUpperCase()+a.slice(1);return{get:()=>_,set(j){this[$]=j}}});utils$E.freezeMethods(AxiosHeaders$1);function transformData$1(_,a){const $=this||defaults$2,j=a||$,et=AxiosHeaders$1.from(j.headers);let tt=j.data;return utils$E.forEach(_,function(nt){tt=nt.call($,tt,et.normalize(),a?a.status:void 0)}),et.normalize(),tt}function isCancel$1(_){return!!(_&&_.__CANCEL__)}function CanceledError$1(_,a,$){AxiosError$1.call(this,_??"canceled",AxiosError$1.ERR_CANCELED,a,$),this.name="CanceledError"}utils$E.inherits(CanceledError$1,AxiosError$1,{__CANCEL__:!0});function settle$1(_,a,$){const j=$.config.validateStatus;!$.status||!j||j($.status)?_($):a(new AxiosError$1("Request failed with status code "+$.status,[AxiosError$1.ERR_BAD_REQUEST,AxiosError$1.ERR_BAD_RESPONSE][Math.floor($.status/100)-4],$.config,$.request,$))}const cookies$1=platform$2.hasStandardBrowserEnv?{write(_,a,$,j,et,tt){const rt=[_+"="+encodeURIComponent(a)];utils$E.isNumber($)&&rt.push("expires="+new Date($).toGMTString()),utils$E.isString(j)&&rt.push("path="+j),utils$E.isString(et)&&rt.push("domain="+et),tt===!0&&rt.push("secure"),document.cookie=rt.join("; ")},read(_){const a=document.cookie.match(new RegExp("(^|;\\s*)("+_+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove(_){this.write(_,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL$1(_){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_)}function combineURLs$1(_,a){return a?_.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):_}function buildFullPath$1(_,a){return _&&!isAbsoluteURL$1(a)?combineURLs$1(_,a):a}const isURLSameOrigin$1=platform$2.hasStandardBrowserEnv?function _(){const a=/(msie|trident)/i.test(navigator.userAgent),$=document.createElement("a");let j;function et(tt){let rt=tt;return a&&($.setAttribute("href",rt),rt=$.href),$.setAttribute("href",rt),{href:$.href,protocol:$.protocol?$.protocol.replace(/:$/,""):"",host:$.host,search:$.search?$.search.replace(/^\?/,""):"",hash:$.hash?$.hash.replace(/^#/,""):"",hostname:$.hostname,port:$.port,pathname:$.pathname.charAt(0)==="/"?$.pathname:"/"+$.pathname}}return j=et(window.location.href),function(rt){const nt=utils$E.isString(rt)?et(rt):rt;return nt.protocol===j.protocol&&nt.host===j.host}}():function _(){return function(){return!0}}();function parseProtocol$1(_){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_);return a&&a[1]||""}function speedometer$1(_,a){_=_||10;const $=new Array(_),j=new Array(_);let et=0,tt=0,rt;return a=a!==void 0?a:1e3,function(it){const at=Date.now(),st=j[tt];rt||(rt=at),$[et]=it,j[et]=at;let ot=tt,ut=0;for(;ot!==et;)ut+=$[ot++],ot=ot%_;if(et=(et+1)%_,et===tt&&(tt=(tt+1)%_),at-rt{const tt=et.loaded,rt=et.lengthComputable?et.total:void 0,nt=tt-$,it=j(nt),at=tt<=rt;$=tt;const st={loaded:tt,total:rt,progress:rt?tt/rt:void 0,bytes:nt,rate:it||void 0,estimated:it&&rt&&at?(rt-tt)/it:void 0,event:et};st[a?"download":"upload"]=!0,_(st)}}const isXHRAdapterSupported$1=typeof XMLHttpRequest<"u",xhrAdapter$1=isXHRAdapterSupported$1&&function(_){return new Promise(function($,j){let et=_.data;const tt=AxiosHeaders$1.from(_.headers).normalize();let{responseType:rt,withXSRFToken:nt}=_,it;function at(){_.cancelToken&&_.cancelToken.unsubscribe(it),_.signal&&_.signal.removeEventListener("abort",it)}let st;if(utils$E.isFormData(et)){if(platform$2.hasStandardBrowserEnv||platform$2.hasStandardBrowserWebWorkerEnv)tt.setContentType(!1);else if((st=tt.getContentType())!==!1){const[xt,...Ct]=st?st.split(";").map(Pt=>Pt.trim()).filter(Boolean):[];tt.setContentType([xt||"multipart/form-data",...Ct].join("; "))}}let ot=new XMLHttpRequest;if(_.auth){const xt=_.auth.username||"",Ct=_.auth.password?unescape(encodeURIComponent(_.auth.password)):"";tt.set("Authorization","Basic "+btoa(xt+":"+Ct))}const ut=buildFullPath$1(_.baseURL,_.url);ot.open(_.method.toUpperCase(),buildURL$1(ut,_.params,_.paramsSerializer),!0),ot.timeout=_.timeout;function dt(){if(!ot)return;const xt=AxiosHeaders$1.from("getAllResponseHeaders"in ot&&ot.getAllResponseHeaders()),Pt={data:!rt||rt==="text"||rt==="json"?ot.responseText:ot.response,status:ot.status,statusText:ot.statusText,headers:xt,config:_,request:ot};settle$1(function(kt){$(kt),at()},function(kt){j(kt),at()},Pt),ot=null}if("onloadend"in ot?ot.onloadend=dt:ot.onreadystatechange=function(){!ot||ot.readyState!==4||ot.status===0&&!(ot.responseURL&&ot.responseURL.indexOf("file:")===0)||setTimeout(dt)},ot.onabort=function(){ot&&(j(new AxiosError$1("Request aborted",AxiosError$1.ECONNABORTED,_,ot)),ot=null)},ot.onerror=function(){j(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,_,ot)),ot=null},ot.ontimeout=function(){let Ct=_.timeout?"timeout of "+_.timeout+"ms exceeded":"timeout exceeded";const Pt=_.transitional||transitionalDefaults$1;_.timeoutErrorMessage&&(Ct=_.timeoutErrorMessage),j(new AxiosError$1(Ct,Pt.clarifyTimeoutError?AxiosError$1.ETIMEDOUT:AxiosError$1.ECONNABORTED,_,ot)),ot=null},platform$2.hasStandardBrowserEnv&&(nt&&utils$E.isFunction(nt)&&(nt=nt(_)),nt||nt!==!1&&isURLSameOrigin$1(ut))){const xt=_.xsrfHeaderName&&_.xsrfCookieName&&cookies$1.read(_.xsrfCookieName);xt&&tt.set(_.xsrfHeaderName,xt)}et===void 0&&tt.setContentType(null),"setRequestHeader"in ot&&utils$E.forEach(tt.toJSON(),function(Ct,Pt){ot.setRequestHeader(Pt,Ct)}),utils$E.isUndefined(_.withCredentials)||(ot.withCredentials=!!_.withCredentials),rt&&rt!=="json"&&(ot.responseType=_.responseType),typeof _.onDownloadProgress=="function"&&ot.addEventListener("progress",progressEventReducer$1(_.onDownloadProgress,!0)),typeof _.onUploadProgress=="function"&&ot.upload&&ot.upload.addEventListener("progress",progressEventReducer$1(_.onUploadProgress)),(_.cancelToken||_.signal)&&(it=xt=>{ot&&(j(!xt||xt.type?new CanceledError$1(null,_,ot):xt),ot.abort(),ot=null)},_.cancelToken&&_.cancelToken.subscribe(it),_.signal&&(_.signal.aborted?it():_.signal.addEventListener("abort",it)));const mt=parseProtocol$1(ut);if(mt&&platform$2.protocols.indexOf(mt)===-1){j(new AxiosError$1("Unsupported protocol "+mt+":",AxiosError$1.ERR_BAD_REQUEST,_));return}ot.send(et||null)})},knownAdapters$1={http:httpAdapter$1,xhr:xhrAdapter$1};utils$E.forEach(knownAdapters$1,(_,a)=>{if(_){try{Object.defineProperty(_,"name",{value:a})}catch{}Object.defineProperty(_,"adapterName",{value:a})}});const renderReason$1=_=>`- ${_}`,isResolvedHandle$1=_=>utils$E.isFunction(_)||_===null||_===!1,adapters$1={getAdapter:_=>{_=utils$E.isArray(_)?_:[_];const{length:a}=_;let $,j;const et={};for(let tt=0;tt`adapter ${nt} `+(it===!1?"is not supported by the environment":"is not available in the build"));let rt=a?tt.length>1?`since : `+tt.map(renderReason$1).join(` -`):" "+renderReason$1(tt[0]):"as no adapter specified";throw new AxiosError$1("There is no suitable adapter to dispatch the request "+rt,"ERR_NOT_SUPPORT")}return j},adapters:knownAdapters$1};function throwIfCancellationRequested$1(_){if(_.cancelToken&&_.cancelToken.throwIfRequested(),_.signal&&_.signal.aborted)throw new CanceledError$1(null,_)}function dispatchRequest$1(_){return throwIfCancellationRequested$1(_),_.headers=AxiosHeaders$1.from(_.headers),_.data=transformData$1.call(_,_.transformRequest),["post","put","patch"].indexOf(_.method)!==-1&&_.headers.setContentType("application/x-www-form-urlencoded",!1),adapters$1.getAdapter(_.adapter||defaults$2.adapter)(_).then(function(j){return throwIfCancellationRequested$1(_),j.data=transformData$1.call(_,_.transformResponse,j),j.headers=AxiosHeaders$1.from(j.headers),j},function(j){return isCancel$1(j)||(throwIfCancellationRequested$1(_),j&&j.response&&(j.response.data=transformData$1.call(_,_.transformResponse,j.response),j.response.headers=AxiosHeaders$1.from(j.response.headers))),Promise.reject(j)})}const headersToObject$1=_=>_ instanceof AxiosHeaders$1?_.toJSON():_;function mergeConfig$1(_,a){a=a||{};const $={};function j(ot,st,at){return utils$t.isPlainObject(ot)&&utils$t.isPlainObject(st)?utils$t.merge.call({caseless:at},ot,st):utils$t.isPlainObject(st)?utils$t.merge({},st):utils$t.isArray(st)?st.slice():st}function et(ot,st,at){if(utils$t.isUndefined(st)){if(!utils$t.isUndefined(ot))return j(void 0,ot,at)}else return j(ot,st,at)}function tt(ot,st){if(!utils$t.isUndefined(st))return j(void 0,st)}function rt(ot,st){if(utils$t.isUndefined(st)){if(!utils$t.isUndefined(ot))return j(void 0,ot)}else return j(void 0,st)}function nt(ot,st,at){if(at in a)return j(ot,st);if(at in _)return j(void 0,ot)}const it={url:tt,method:tt,data:tt,baseURL:rt,transformRequest:rt,transformResponse:rt,paramsSerializer:rt,timeout:rt,timeoutMessage:rt,withCredentials:rt,withXSRFToken:rt,adapter:rt,responseType:rt,xsrfCookieName:rt,xsrfHeaderName:rt,onUploadProgress:rt,onDownloadProgress:rt,decompress:rt,maxContentLength:rt,maxBodyLength:rt,beforeRedirect:rt,transport:rt,httpAgent:rt,httpsAgent:rt,cancelToken:rt,socketPath:rt,responseEncoding:rt,validateStatus:nt,headers:(ot,st)=>et(headersToObject$1(ot),headersToObject$1(st),!0)};return utils$t.forEach(Object.keys(Object.assign({},_,a)),function(st){const at=it[st]||et,ut=at(_[st],a[st],st);utils$t.isUndefined(ut)&&at!==nt||($[st]=ut)}),$}const VERSION$3="1.6.5",validators$3={};["object","boolean","number","function","string","symbol"].forEach((_,a)=>{validators$3[_]=function(j){return typeof j===_||"a"+(a<1?"n ":" ")+_}});const deprecatedWarnings$1={};validators$3.transitional=function _(a,$,j){function et(tt,rt){return"[Axios v"+VERSION$3+"] Transitional option '"+tt+"'"+rt+(j?". "+j:"")}return(tt,rt,nt)=>{if(a===!1)throw new AxiosError$1(et(rt," has been removed"+($?" in "+$:"")),AxiosError$1.ERR_DEPRECATED);return $&&!deprecatedWarnings$1[rt]&&(deprecatedWarnings$1[rt]=!0,console.warn(et(rt," has been deprecated since v"+$+" and will be removed in the near future"))),a?a(tt,rt,nt):!0}};function assertOptions$1(_,a,$){if(typeof _!="object")throw new AxiosError$1("options must be an object",AxiosError$1.ERR_BAD_OPTION_VALUE);const j=Object.keys(_);let et=j.length;for(;et-- >0;){const tt=j[et],rt=a[tt];if(rt){const nt=_[tt],it=nt===void 0||rt(nt,tt,_);if(it!==!0)throw new AxiosError$1("option "+tt+" must be "+it,AxiosError$1.ERR_BAD_OPTION_VALUE);continue}if($!==!0)throw new AxiosError$1("Unknown option "+tt,AxiosError$1.ERR_BAD_OPTION)}}const validator$1={assertOptions:assertOptions$1,validators:validators$3},validators$2=validator$1.validators;let Axios$1=class{constructor(a){this.defaults=a,this.interceptors={request:new InterceptorManager$1,response:new InterceptorManager$1}}request(a,$){typeof a=="string"?($=$||{},$.url=a):$=a||{},$=mergeConfig$1(this.defaults,$);const{transitional:j,paramsSerializer:et,headers:tt}=$;j!==void 0&&validator$1.assertOptions(j,{silentJSONParsing:validators$2.transitional(validators$2.boolean),forcedJSONParsing:validators$2.transitional(validators$2.boolean),clarifyTimeoutError:validators$2.transitional(validators$2.boolean)},!1),et!=null&&(utils$t.isFunction(et)?$.paramsSerializer={serialize:et}:validator$1.assertOptions(et,{encode:validators$2.function,serialize:validators$2.function},!0)),$.method=($.method||this.defaults.method||"get").toLowerCase();let rt=tt&&utils$t.merge(tt.common,tt[$.method]);tt&&utils$t.forEach(["delete","get","head","post","put","patch","common"],bt=>{delete tt[bt]}),$.headers=AxiosHeaders$1.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(Et){typeof Et.runWhen=="function"&&Et.runWhen($)===!1||(it=it&&Et.synchronous,nt.unshift(Et.fulfilled,Et.rejected))});const ot=[];this.interceptors.response.forEach(function(Et){ot.push(Et.fulfilled,Et.rejected)});let st,at=0,ut;if(!it){const bt=[dispatchRequest$1.bind(this),void 0];for(bt.unshift.apply(bt,nt),bt.push.apply(bt,ot),ut=bt.length,st=Promise.resolve($);at{if(!j._listeners)return;let tt=j._listeners.length;for(;tt-- >0;)j._listeners[tt](et);j._listeners=null}),this.promise.then=et=>{let tt;const rt=new Promise(nt=>{j.subscribe(nt),tt=nt}).then(et);return rt.cancel=function(){j.unsubscribe(tt)},rt},a(function(tt,rt,nt){j.reason||(j.reason=new CanceledError$1(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const $=this._listeners.indexOf(a);$!==-1&&this._listeners.splice($,1)}static source(){let a;return{token:new Rv(function(et){a=et}),cancel:a}}};function spread$1(_){return function($){return _.apply(null,$)}}function isAxiosError$1(_){return utils$t.isObject(_)&&_.isAxiosError===!0}const HttpStatusCode$1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode$1).forEach(([_,a])=>{HttpStatusCode$1[a]=_});function createInstance$1(_){const a=new Axios$1(_),$=bind$5(Axios$1.prototype.request,a);return utils$t.extend($,Axios$1.prototype,a,{allOwnKeys:!0}),utils$t.extend($,a,null,{allOwnKeys:!0}),$.create=function(et){return createInstance$1(mergeConfig$1(_,et))},$}const axios$1=createInstance$1(defaults$2);axios$1.Axios=Axios$1;axios$1.CanceledError=CanceledError$1;axios$1.CancelToken=CancelToken$1;axios$1.isCancel=isCancel$1;axios$1.VERSION=VERSION$3;axios$1.toFormData=toFormData$1;axios$1.AxiosError=AxiosError$1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function _(a){return Promise.all(a)};axios$1.spread=spread$1;axios$1.isAxiosError=isAxiosError$1;axios$1.mergeConfig=mergeConfig$1;axios$1.AxiosHeaders=AxiosHeaders$1;axios$1.formToJSON=_=>formDataToJSON$1(utils$t.isHTMLForm(_)?new FormData(_):_);axios$1.getAdapter=adapters$1.getAdapter;axios$1.HttpStatusCode=HttpStatusCode$1;axios$1.default=axios$1;var MatrixMessageType;(function(_){_.TEXT="m.text"})(MatrixMessageType||(MatrixMessageType={}));class MatrixMessage{constructor(a,$,j,et){Yr(this,"type");Yr(this,"sender");Yr(this,"content");Yr(this,"timestamp");this.type=a,this.sender=$,this.content=j,this.timestamp=et}static from(a){if(isTextMessageEvent(a))return new MatrixMessage(a.content.msgtype,a.sender,a.content.body,a.origin_server_ts)}}const isCreateEvent=_=>_.type==="m.room.create"&&_.content instanceof Object&&"creator"in _.content,isJoinEvent=_=>_.type==="m.room.member"&&_.content instanceof Object&&"membership"in _.content&&_.content.membership==="join",isMessageEvent=_=>_.type==="m.room.message",isTextMessageEvent=_=>isMessageEvent(_)&&_.content instanceof Object&&"msgtype"in _.content&&_.content.msgtype===MatrixMessageType.TEXT;var MatrixRoomStatus;(function(_){_[_.UNKNOWN=0]="UNKNOWN",_[_.JOINED=1]="JOINED",_[_.INVITED=2]="INVITED",_[_.LEFT=3]="LEFT"})(MatrixRoomStatus||(MatrixRoomStatus={}));class MatrixRoom{constructor(a,$=MatrixRoomStatus.UNKNOWN,j=[],et=[]){Yr(this,"id");Yr(this,"status");Yr(this,"members");Yr(this,"messages");this.id=a,this.status=$,this.members=j,this.messages=et}static fromSync(a){if(!a)return[];function $(j,et){return Object.entries(j).map(([tt,rt])=>et(tt,rt))}return[...$(a.join??{},MatrixRoom.fromJoined),...$(a.invite??{},MatrixRoom.fromInvited),...$(a.leave??{},MatrixRoom.fromLeft)]}static from(a,$){return typeof a=="string"?new MatrixRoom(a,$||MatrixRoomStatus.UNKNOWN):$!==void 0?new MatrixRoom(a.id,$,a.members,a.messages):a}static merge(a,$){return!$||$.id!==a.id?MatrixRoom.from(a):new MatrixRoom(a.id,a.status,[...$.members,...a.members].filter((j,et,tt)=>tt.indexOf(j)===et),[...$.messages,...a.messages])}static fromJoined(a,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(a,MatrixRoomStatus.JOINED,et,tt)}static fromInvited(a,$){const j=MatrixRoom.getMembersFromEvents($.invite_state.events);return new MatrixRoom(a,MatrixRoomStatus.INVITED,j)}static fromLeft(a,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(a,MatrixRoomStatus.LEFT,et,tt)}static getMembersFromEvents(a){return MatrixRoom.getUniqueEvents(a.filter($=>isCreateEvent($)||isJoinEvent($))).map($=>$.sender).filter(($,j,et)=>et.indexOf($)===j)}static getMessagesFromEvents(a){return MatrixRoom.getUniqueEvents(a.filter(isMessageEvent)).map($=>MatrixMessage.from($)).filter(Boolean)}static getUniqueEvents(a){const $={},j=[];return a.forEach((et,tt)=>{const rt=et.event_id;(rt===void 0||!(rt in $))&&(rt!==void 0&&($[rt]=tt),j.push(et))}),j}}const PRESERVED_FIELDS=["syncToken","rooms"];class MatrixClientStore{constructor(a){Yr(this,"storage");Yr(this,"state",{isRunning:!1,userId:void 0,deviceId:void 0,txnNo:0,accessToken:void 0,syncToken:void 0,pollingTimeout:void 0,pollingRetries:0,rooms:{}});Yr(this,"onStateChangedListeners",new Map);Yr(this,"waitReadyPromise");this.storage=a,this.waitReadyPromise=new Promise(async($,j)=>{try{await this.initFromStorage(),$()}catch(et){j(et)}})}get(a){return this.state[a]}getRoom(a){const $=MatrixRoom.from(a,MatrixRoomStatus.UNKNOWN);return this.state.rooms[$.id]||$}async update(a){await this.waitReady();const $=Object.assign({},this.state);this.setState(a),this.updateStorage(a),this.notifyListeners($,this.state,a)}onStateChanged(a,...$){$.length>0?$.forEach(j=>{this.onStateChangedListeners.set(j,a)}):this.onStateChangedListeners.set("all",a)}async waitReady(){return this.waitReadyPromise}async initFromStorage(){const a=await this.storage.get(StorageKey.MATRIX_PRESERVED_STATE);this.setState(a)}prepareData(a){const j=["rooms"].some(et=>a[et]!==void 0)?JSON.parse(JSON.stringify(a)):a;return Object.values(j.rooms||{}).forEach(et=>{et.messages=[]}),j}updateStorage(a){if(Object.entries(a).filter(([j,et])=>PRESERVED_FIELDS.includes(j)&&!!et).length>0){const j={};PRESERVED_FIELDS.forEach(et=>{j[et]=this.state[et]}),this.storage.set(StorageKey.MATRIX_PRESERVED_STATE,this.prepareData(j))}}setState(a){this.state={isRunning:a.isRunning||this.state.isRunning,userId:a.userId||this.state.userId,deviceId:a.deviceId||this.state.deviceId,txnNo:a.txnNo||this.state.txnNo,accessToken:a.accessToken||this.state.accessToken,syncToken:a.syncToken||this.state.syncToken,pollingTimeout:a.pollingTimeout||this.state.pollingTimeout,pollingRetries:a.pollingRetries||this.state.pollingRetries,rooms:this.mergeRooms(this.state.rooms,a.rooms)}}mergeRooms(a,$){if(!$)return a;const j=Array.isArray($)?$:Object.values($),et=Object.assign({},a);return j.forEach(tt=>{et[tt.id]=MatrixRoom.merge(tt,a[tt.id])}),et}notifyListeners(a,$,j){const et=this.onStateChangedListeners.get("all");et&&et(a,$,j),keys(j).filter(tt=>j[tt]!==void 0).forEach(tt=>{const rt=this.onStateChangedListeners.get(tt);rt&&rt(a,$,j)})}}const logger$6=new Logger("MatrixHttpClient"),CLIENT_API_R0="/_matrix/client/r0";class MatrixHttpClient{constructor(a){Yr(this,"baseUrl");Yr(this,"cancelTokenSource");this.baseUrl=a,this.cancelTokenSource=axios$1.CancelToken.source()}async get(a,$,j){return this.send("GET",a,j,$)}async post(a,$,j,et){return this.send("POST",a,j,et,$)}async put(a,$,j,et){return this.send("PUT",a,j,et,$)}async cancelAllRequests(){return this.cancelTokenSource.cancel("Manually cancelled")}async send(a,$,j,et,tt){const rt=j?this.getHeaders(j):void 0,nt=et?this.getParams(et):void 0;let it;try{it=await axios$1.request({method:a,url:$,baseURL:this.apiUrl(CLIENT_API_R0),headers:rt,data:tt,params:nt,cancelToken:this.cancelTokenSource.token})}catch(ot){const st=ot;throw logger$6.error("send",st.code,st.message,st.response.data),ot.response.data}return it.data}getHeaders(a){const $={},j=[];if(a.accessToken&&j.push(["Authorization",`Bearer ${a.accessToken}`]),j.length!==0){for(const[et,tt]of j)$[et]=tt;return $}}getParams(a){if(!a)return;const $=Object.assign(a,{});return keys($).forEach(j=>$[j]===void 0&&delete $[j]),$}apiUrl(...a){const $=this.baseUrl.endsWith("/")?this.baseUrl.substr(0,this.baseUrl.length-1):this.baseUrl,j=a.map(et=>et.startsWith("/")?et.substr(1):et);return[$,...j].join("/")}}class MatrixRoomService{constructor(a){Yr(this,"httpClient");this.httpClient=a}async createRoom(a,$={}){return this.httpClient.post("/createRoom",$,{accessToken:a})}async inviteToRoom(a,$,j){return j.status!==MatrixRoomStatus.JOINED&&j.status!==MatrixRoomStatus.UNKNOWN?Promise.reject(`User is not a member of room ${j.id}.`):this.httpClient.post(`/rooms/${encodeURIComponent(j.id)}/invite`,{user_id:$},{accessToken:a})}async joinRoom(a,$){return $.status===MatrixRoomStatus.JOINED?Promise.resolve({room_id:$.id}):this.httpClient.post(`/rooms/${encodeURIComponent($.id)}/join`,{},{accessToken:a})}async getJoinedRooms(a){return this.httpClient.get("/joined_rooms",void 0,{accessToken:a})}}class MatrixUserService{constructor(a){Yr(this,"httpClient");this.httpClient=a}async login(a,$,j){return this.httpClient.post("/login",{type:"m.login.password",identifier:{type:"m.id.user",user:a},password:$,device_id:j})}}class MatrixEventService{constructor(a){Yr(this,"httpClient");Yr(this,"cachedPromises",new Map);this.httpClient=a}async sync(a,$){return this.withCache("sync",()=>this.httpClient.get("/sync",{timeout:$?$.pollingTimeout:void 0,since:$?$.syncToken:void 0},{accessToken:a}))}async sendMessage(a,$,j,et){return new Promise((tt,rt)=>this.scheduleEvent({accessToken:a,roomId:$,type:"m.room.message",content:j,txnId:et,onSuccess:tt,onError:rt}))}scheduleEvent(a){this.sendEvent(a)}async sendEvent(a){const{roomId:$,type:j,txnId:et,content:tt,accessToken:rt}=a;try{const nt=await this.httpClient.put(`/rooms/${encodeURIComponent($)}/send/${j}/${encodeURIComponent(et)}`,tt,{accessToken:rt});a.onSuccess(nt)}catch(nt){a.onError(nt)}}withCache(a,$){let j=this.cachedPromises.get(a);return j||(j=$().finally(()=>{this.cachedPromises.delete(a)}),this.cachedPromises.set(a,j)),j}}class EventEmitter{constructor(){Yr(this,"events",{})}on(a,$){return typeof this.events[a]!="object"&&(this.events[a]=[]),this.events[a].push($),()=>this.removeListener(a,$)}removeListener(a,$){if(typeof this.events[a]!="object")return;if(!$){this.events[a]=[];return}const j=this.events[a].indexOf($);j>-1&&this.events[a].splice(j,1)}removeAllListeners(){Object.keys(this.events).forEach(a=>this.events[a].splice(0,this.events[a].length))}emit(a,...$){typeof this.events[a]=="object"&&[...this.events[a]].forEach(j=>j.apply(this,$))}once(a,$){const j=this.on(a,(...et)=>{j(),$.apply(this,et)});return j}}var MatrixClientEventType;(function(_){_.INVITE="invite",_.MESSAGE="message"})(MatrixClientEventType||(MatrixClientEventType={}));class MatrixClientEventEmitter extends EventEmitter{constructor(){super(...arguments);Yr(this,"eventEmitProviders",new Map([[MatrixClientEventType.INVITE,()=>[this.isInvite,this.emitInvite.bind(this)]],[MatrixClientEventType.MESSAGE,()=>[this.isMessage,this.emitMessage.bind(this)]]]))}onStateChanged($,j,et){for(const tt of keys(MatrixClientEventType))this.emitIfEvent(MatrixClientEventType[tt],et)}emitIfEvent($,j){const et=this.eventEmitProviders.get($);if(et){const[tt,rt]=et();tt(j)&&rt($,j)}}emitClientEvent($,j,et){this.emit($,{type:$,content:j,timestamp:et})}isInvite($){return $.rooms?$.rooms.some(j=>j.status===MatrixRoomStatus.INVITED):!1}emitInvite($,j){j.rooms.filter(et=>et.status===MatrixRoomStatus.INVITED).map(et=>[et.id,et.members]).forEach(([et,tt])=>{this.emitClientEvent($,{roomId:et,members:tt})})}isMessage($){return $.rooms?$.rooms.some(j=>j.messages.length>0):!1}emitMessage($,j){j.rooms.filter(et=>et.messages.length>0).map(et=>et.messages.map(tt=>[et.id,tt,tt.timestamp])).reduce((et,tt)=>et.concat(tt),[]).forEach(([et,tt,rt])=>{this.emitClientEvent($,{roomId:et,message:tt},rt)})}}const logger$5=new Logger("MatrixClient"),IMMEDIATE_POLLING_RETRIES=3,RETRY_INTERVAL=5e3;class MatrixClient{constructor(a,$,j,et,tt,rt){Yr(this,"store");Yr(this,"eventEmitter");Yr(this,"userService");Yr(this,"roomService");Yr(this,"eventService");Yr(this,"httpClient");Yr(this,"isActive",!0);Yr(this,"_isReady",new ExposedPromise);this.store=a,this.eventEmitter=$,this.userService=j,this.roomService=et,this.eventService=tt,this.httpClient=rt,this.store.onStateChanged((nt,it,ot)=>{this.eventEmitter.onStateChanged(nt,it,ot)},"rooms")}static create(a){const $=new MatrixClientStore(a.storage),j=new MatrixClientEventEmitter,et=new MatrixHttpClient(a.baseUrl),tt=new MatrixUserService(et),rt=new MatrixRoomService(et),nt=new MatrixEventService(et);return new MatrixClient($,j,tt,rt,nt,et)}get joinedRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.JOINED))})}get invitedRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.INVITED))})}get leftRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.LEFT))})}async start(a){const $=await this.userService.login(a.id,a.password,a.deviceId);await this.store.update({accessToken:$.access_token});const j=new Promise(async(et,tt)=>{await this.poll(0,async rt=>{this.store.get("isRunning")||et(),await this.store.update({isRunning:!0,syncToken:rt.next_batch,pollingTimeout:3e4,pollingRetries:0,rooms:MatrixRoom.fromSync(rt.rooms)})},async rt=>{this.store.get("isRunning")||tt(rt),await this.store.update({isRunning:!1,pollingRetries:this.store.get("pollingRetries")+1})})});return j.then(()=>{this._isReady.resolve()}).catch(console.error),j}async isConnected(){return this._isReady.promise}async stop(){return logger$5.log("MATRIX CLIENT STOPPED"),this.isActive=!1,this._isReady=new ExposedPromise,this.httpClient.cancelAllRequests()}subscribe(a,$){this.eventEmitter.on(a,$)}unsubscribe(a,$){$&&this.eventEmitter.removeListener(a,$)}unsubscribeAll(a){this.eventEmitter.removeListener(a)}async getRoomById(a){return await this.isConnected(),this.store.getRoom(a)}async createTrustedPrivateRoom(...a){return await this.isConnected(),this.requiresAuthorization("createRoom",async $=>(await this.roomService.createRoom($,{room_version:"5",invite:a,preset:"public_chat",is_direct:!0})).room_id)}async inviteToRooms(a,...$){await this.isConnected(),await this.requiresAuthorization("invite",j=>Promise.all($.map(et=>{const tt=this.store.getRoom(et);this.roomService.inviteToRoom(j,a,tt).catch(rt=>logger$5.warn("inviteToRooms",rt))})))}async joinRooms(...a){await this.isConnected(),await this.requiresAuthorization("join",$=>Promise.all(a.map(j=>{const et=this.store.getRoom(j);return this.roomService.joinRoom($,et)})))}async sendTextMessage(a,$){await this.isConnected(),await this.requiresAuthorization("send",async j=>{const et=await this.createTxnId();return this.eventService.sendMessage(j,a,{msgtype:"m.text",body:$},et)})}async poll(a,$,j){const et=this.store,tt=this.sync.bind(this),rt=async(nt,it)=>{let ot=0;try{const st=await tt();$(st)}catch(st){j(st),ot=et.get("pollingRetries"),this.isActive&&logger$5.log(`Retry syncing... ${ot} retries so far`)}finally{this.isActive?setTimeout(async()=>{await rt(nt,it)},ot>IMMEDIATE_POLLING_RETRIES?RETRY_INTERVAL+a:a):it(new Error("Syncing stopped manually."))}};return new Promise(rt)}async sync(){return this.requiresAuthorization("sync",async a=>this.eventService.sync(a,{pollingTimeout:this.store.get("pollingTimeout"),syncToken:this.store.get("syncToken")}))}async requiresAuthorization(a,$){const j=this.store.get("accessToken");return j?$(j):Promise.reject(`${a} requires authorization but no access token has been provided.`)}async createTxnId(){const a=new Date().getTime(),$=this.store.get("txnNo");return await this.store.update({txnNo:$+1}),`m${a}.${$}`}}const logger$4=new Logger("P2PCommunicationClient"),RESPONSE_WAIT_TIME_MS=1e3,REGIONS_AND_SERVERS={[Regions.EUROPE_WEST]:["beacon-node-1.diamond.papers.tech","beacon-node-1.sky.papers.tech","beacon-node-2.sky.papers.tech","beacon-node-1.hope.papers.tech","beacon-node-1.hope-2.papers.tech","beacon-node-1.hope-3.papers.tech","beacon-node-1.hope-4.papers.tech","beacon-node-1.hope-5.papers.tech"],[Regions.NORTH_AMERICA_EAST]:["beacon-node-1.beacon-server-1.papers.tech"],[Regions.NORTH_AMERICA_WEST]:["beacon-node-1.beacon-server-2.papers.tech"],[Regions.ASIA_EAST]:["beacon-node-1.beacon-server-3.papers.tech"],[Regions.AUSTRALIA]:["beacon-node-1.beacon-server-4.papers.tech"]},sleep$2=_=>new Promise(a=>setTimeout(a,_));class P2PCommunicationClient extends CommunicationClient{constructor($,j,et,tt,rt,nt,it){super(j);Yr(this,"name");Yr(this,"replicationCount");Yr(this,"storage");Yr(this,"iconUrl");Yr(this,"appUrl");Yr(this,"client",new ExposedPromise);Yr(this,"initialEvent");Yr(this,"initialListener");Yr(this,"selectedRegion");Yr(this,"ENABLED_RELAY_SERVERS");Yr(this,"relayServer");Yr(this,"activeListeners",new Map);Yr(this,"ignoredRooms",[]);Yr(this,"loginCounter",0);this.name=$,this.replicationCount=et,this.storage=tt,this.iconUrl=nt,this.appUrl=it,logger$4.log("constructor","P2PCommunicationClient created"),this.ENABLED_RELAY_SERVERS=REGIONS_AND_SERVERS,rt&&(this.ENABLED_RELAY_SERVERS={...REGIONS_AND_SERVERS,...rt})}async getPairingRequestInfo(){const $=new P2PPairingRequest(await generateGUID(),this.name,await this.getPublicKey(),BEACON_VERSION,(await this.getRelayServer()).server);return this.iconUrl&&($.icon=this.iconUrl),this.appUrl&&($.appUrl=this.appUrl),$}async getPairingResponseInfo($){const j=new P2PPairingResponse($.id,this.name,await this.getPublicKey(),$.version,(await this.getRelayServer()).server);return this.iconUrl&&(j.icon=this.iconUrl),this.appUrl&&(j.appUrl=this.appUrl),j}async findBestRegionAndGetServer(){var ot;if(this.selectedRegion)return(ot=this.relayServer)==null?void 0:ot.promiseResult;const $=Object.keys(this.ENABLED_RELAY_SERVERS),j=[],et=new ExposedPromise;let tt=0;const rt=new ExposedPromise;$.forEach(st=>{const at=this.ENABLED_RELAY_SERVERS[st]??[];if(at.length===0)return;tt+=2;const ut=(Et=!0)=>{const Ct=Date.now();Promise.race([this.getBeaconInfo(bt),rt.promise]).then(Pt=>{typeof Pt!="boolean"&&(j.push({time:Date.now()-Ct,server:bt,region:st,result:Pt}),j.length>=tt&&et.resolve(void 0),Et||ut(!0))})},ht=Math.floor(Math.random()*at.length),bt=at[ht];ut(!1)}),await Promise.race([et.promise,sleep$2(RESPONSE_WAIT_TIME_MS)]);let nt=0;for(;j.length<=0;){if(nt>=100)throw new Error("No server responded.");await sleep$2(50),nt++}rt.resolve(!0);const it=j.reduce((st,at)=>st.time0){const et=await this.getBeaconInfo($);return this.relayServer.resolve({server:$,timestamp:et.timestamp,localTimestamp:new Date().getTime()}),{server:$,timestamp:et.timestamp}}const j=await this.findBestRegionAndGetServer();if(!j)throw new Error("No servers found");return this.storage.set(StorageKey.MATRIX_SELECTED_NODE,j.server).catch(et=>logger$4.log(et)),this.relayServer.resolve({server:j.server,timestamp:j.timestamp,localTimestamp:new Date().getTime()}),{server:j.server,timestamp:j.timestamp}}async getBeaconInfo($){return axios$1.get(`https://${$}/_synapse/client/beacon/info`).then(j=>({region:j.data.region,known_servers:j.data.known_servers,timestamp:Math.floor(j.data.timestamp)}))}async tryJoinRooms($,j=1){try{await(await this.client.promise).joinRooms($)}catch(et){j<=10&&et.errcode==="M_FORBIDDEN"?(logger$4.log("Retrying to join...",et),setTimeout(async()=>{await this.tryJoinRooms($,j+1)},200)):logger$4.log(`Failed to join after ${j} tries.`,et)}}async start(){logger$4.log("start","starting client"),logger$4.log("start","connecting to server");const $=await this.getRelayServer(),j=MatrixClient.create({baseUrl:`https://${$.server}`,storage:this.storage});if(this.initialListener=async ot=>{this.initialEvent&&this.initialEvent.timestamp&&ot&&ot.timestamp?this.initialEvent.timestamp{let st;ot.content.members.length===1&&(st=ot.content.members[0]),await this.tryJoinRooms(ot.content.roomId),st&&(await this.updateRelayServer(st),await this.updatePeerRoom(st,ot.content.roomId))}),!$.timestamp)throw new Error("No timestamp received from relay server");const et=Math.floor($.timestamp),tt=`login:${Math.floor(et/(5*60))}`;logger$4.log("start",`login ${tt}, ${await this.getPublicKeyHash()} on ${$.server}`);const rt=blake2b$1.hash(encode_1(tt),32),nt=this.keyPair.secretKey??this.keyPair.privateKey,it=ed25519.sign(nt,rt);try{await j.start({id:await this.getPublicKeyHash(),password:`ed:${toHex$1(it)}:${await this.getPublicKey()}`,deviceId:toHex$1(this.keyPair.publicKey)})}catch{if(logger$4.error("start","Could not log in, retrying"),await this.reset(),!this.selectedRegion)throw new Error("No region selected.");if(this.loginCounter<=(this.ENABLED_RELAY_SERVERS[this.selectedRegion]??[]).length){this.loginCounter++,this.start();return}else throw logger$4.error("start","Tried to log in to every known beacon node, but no login was successful."),new Error("Could not connect to any beacon nodes. Try again later.")}logger$4.log("start","login successful, client is ready"),this.client.resolve(j)}async stop(){logger$4.log("stop","stopping client"),this.client.isResolved()&&await(await this.client.promise).stop().catch($=>logger$4.error($)),await this.reset()}async reset(){logger$4.log("reset","resetting connection"),await this.storage.delete(StorageKey.MATRIX_PEER_ROOM_IDS).catch($=>logger$4.log($)),await this.storage.delete(StorageKey.MATRIX_PRESERVED_STATE).catch($=>logger$4.log($)),await this.storage.delete(StorageKey.MATRIX_SELECTED_NODE).catch($=>logger$4.log($)),this.relayServer=void 0,this.client=new ExposedPromise,this.initialEvent=void 0,this.initialListener=void 0}async listenForEncryptedMessage($,j){if(this.activeListeners.has($))return;logger$4.log("listenForEncryptedMessage",`start listening for encrypted messages from publicKey ${$}`);const et=await this.createCryptoBoxServer($,this.keyPair),tt=async it=>{if(this.isTextMessage(it.content)&&await this.isSender(it,$)){let ot;await this.updateRelayServer(it.content.message.sender),await this.updatePeerRoom(it.content.message.sender,it.content.roomId);try{ot=Buffer$g.from(it.content.message.content,"hex")}catch{}if(ot&&ot.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const st=await decryptCryptoboxPayload(ot,et.receive);logger$4.log("listenForEncryptedMessage",`received a message from ${$}`,st),j(st)}catch{}}};this.activeListeners.set($,tt),(await this.client.promise).subscribe(MatrixClientEventType.MESSAGE,tt);const rt=this.initialEvent;rt&&rt.timestamp&&new Date().getTime()-rt.timestamp<5*60*1e3?(logger$4.log("listenForEncryptedMessage","Handling previous event"),await tt(rt)):logger$4.log("listenForEncryptedMessage","No previous event found");const nt=this.initialListener;nt&&(await this.client.promise).unsubscribe(MatrixClientEventType.MESSAGE,nt),this.initialListener=void 0,this.initialEvent=void 0}async unsubscribeFromEncryptedMessage($){const j=this.activeListeners.get($);j&&((await this.client.promise).unsubscribe(MatrixClientEventType.MESSAGE,j),this.activeListeners.delete($))}async unsubscribeFromEncryptedMessages(){(await this.client.promise).unsubscribeAll(MatrixClientEventType.MESSAGE),this.activeListeners.clear()}async sendMessage($,j){const et=await this.createCryptoBoxClient(j.publicKey,this.keyPair),tt=await getHexHash(Buffer$g.from(j.publicKey,"hex")),rt=recipientString(tt,j.relayServer),nt=await this.getRelevantRoom(rt),it=await encryptCryptoboxPayload($,et.send);logger$4.log("sendMessage","sending encrypted message",j.publicKey,nt,$),(await this.client.promise).sendTextMessage(nt,it).catch(async ot=>{if(ot.errcode==="M_FORBIDDEN"){logger$4.log("sendMessage","M_FORBIDDEN",nt,ot),await this.deleteRoomIdFromRooms(nt);const st=await this.getRelevantRoom(rt);logger$4.log("sendMessage","Old room deleted, new room created",st),(await this.client.promise).sendTextMessage(st,it).catch(async at=>{logger$4.log("sendMessage","inner error",st,at)})}else logger$4.log("sendMessage","unexpected error",ot)})}async updatePeerRoom($,j){logger$4.log("updatePeerRoom",$,j);const et=$.split(":");if(et.length<2||!et[0].startsWith("@"))throw new Error("Invalid sender");const tt=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS),rt=tt[$];rt===j&&logger$4.debug("updatePeerRoom","rooms are the same, not updating"),logger$4.debug("updatePeerRoom","current room",rt,"new room",j),rt&&rt[1]&&(logger$4.log("updatePeerRoom",`adding room "${rt[1]}" to ignored array`),this.ignoredRooms.push(rt[1])),tt[$]=j,await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,tt)}async deleteRoomIdFromRooms($){const j=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS),et=Object.entries(j).filter(tt=>tt[1]!==$).reduce((tt,rt)=>({...tt,[rt[0]]:rt[1]}),{});await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,et),this.ignoredRooms.push($)}async listenForChannelOpening($){logger$4.debug("listenForChannelOpening"),(await this.client.promise).subscribe(MatrixClientEventType.MESSAGE,async j=>{if(this.isTextMessage(j.content)&&await this.isChannelOpenMessage(j.content)){logger$4.log("listenForChannelOpening","channel opening received, trying to decrypt",JSON.stringify(j)),await this.updateRelayServer(j.content.message.sender),await this.updatePeerRoom(j.content.message.sender,j.content.roomId);const et=j.content.message.content.split(":"),tt=Buffer$g.from(et[et.length-1],"hex");if(tt.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const rt=JSON.parse(await openCryptobox(tt,this.keyPair.publicKey,this.keyPair.secretKey));logger$4.log("listenForChannelOpening","channel opening received and decrypted",JSON.stringify(rt)),$({...rt,senderId:await getSenderId(rt.publicKey)})}catch{}}})}async waitForJoin($,j=0){const et=await(await this.client.promise).getRoomById($);if(logger$4.log("waitForJoin",`Currently ${et.members.length} members, we need at least 2`),!(et.members.length>=2)){if(j<=200)return logger$4.log(`Waiting for join... Try: ${j}`),new Promise(tt=>{setTimeout(()=>{tt(this.waitForJoin($,j+1))},100*(j>50?10:1))});throw new Error(`No one joined after ${j} tries.`)}}async sendPairingResponse($){logger$4.log("sendPairingResponse");const j=await getHexHash(Buffer$g.from($.publicKey,"hex")),et=recipientString(j,$.relayServer),tt=await(await this.client.promise).createTrustedPrivateRoom(et);logger$4.debug("sendPairingResponse",`Connecting to room "${tt}"`),await this.updatePeerRoom(et,tt),await this.waitForJoin(tt),logger$4.debug("sendPairingResponse","Successfully joined room.");const rt=typeof $.version>"u"?await this.getPublicKey():JSON.stringify(await this.getPairingResponseInfo($));logger$4.debug("sendPairingResponse","Sending pairing response",rt);const nt=await this.encryptMessageAsymmetric($.publicKey,rt),it=["@channel-open",et,nt].join(":");(await this.client.promise).sendTextMessage(tt,it).catch(async ot=>{if(ot.errcode==="M_FORBIDDEN"){logger$4.log("sendPairingResponse","M_FORBIDDEN",tt,ot),await this.deleteRoomIdFromRooms(tt);const st=await this.getRelevantRoom(et);logger$4.log("sendPairingResponse","Old room deleted, new room created",st),(await this.client.promise).sendTextMessage(st,it).catch(async at=>{logger$4.log("sendPairingResponse","inner error",st,at)})}else logger$4.log("sendPairingResponse","unexpected error",ot)})}isTextMessage($){return $.message.type===MatrixMessageType.TEXT}async updateRelayServer($){logger$4.log("updateRelayServer",$);const j=$.split(":");if(j.length<2||!j[0].startsWith("@"))throw new Error("Invalid sender");const et=j.shift(),tt=j.join(":"),rt=localStorage.getItem("beacon:communication-peers-dapp")?new PeerManager(this.storage,StorageKey.TRANSPORT_P2P_PEERS_DAPP):new PeerManager(this.storage,StorageKey.TRANSPORT_P2P_PEERS_WALLET),it=(await rt.getPeers()).map(async ot=>{`@${await getHexHash(Buffer$g.from(ot.publicKey,"hex"))}`===et&&ot.relayServer!==tt&&(ot.relayServer=tt,await rt.addPeer(ot))});await Promise.all(it)}async isChannelOpenMessage($){return $.message.content.startsWith(`@channel-open:@${await getHexHash(Buffer$g.from(await this.getPublicKey(),"hex"))}`)}async isSender($,j){return $.content.message.sender.startsWith(`@${await getHexHash(Buffer$g.from(j,"hex"))}`)}async getRelevantRoom($){const j=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS);let et=j[$];if(!et){logger$4.log("getRelevantRoom",`No room found for peer ${$}, checking joined ones.`);const tt=await this.getRelevantJoinedRoom($);et=tt.id,j[$]=tt.id,await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,j)}return logger$4.log("getRelevantRoom",`Using room ${et}`),et}async getRelevantJoinedRoom($){const j=await(await this.client.promise).joinedRooms;logger$4.log("checking joined rooms",j,$);const et=j.filter(rt=>!this.ignoredRooms.some(nt=>rt.id===nt)).filter(rt=>rt.members.some(nt=>nt===$));let tt;if(et.length===0||this.ignoredRooms.length>0){logger$4.log("getRelevantJoinedRoom","no relevant rooms found, creating new one");const rt=await(await this.client.promise).createTrustedPrivateRoom($);tt=await(await this.client.promise).getRoomById(rt),logger$4.log("getRelevantJoinedRoom",`waiting for other party to join room: ${tt.id}`),await this.waitForJoin(rt),logger$4.log("getRelevantJoinedRoom",`new room created and peer invited: ${tt.id}`)}else tt=et[0],logger$4.log("getRelevantJoinedRoom",`channel already open, reusing room ${tt.id}`);return tt}}const logger$3=new Logger("P2PTransport");class P2PTransport extends Transport$2{constructor($,j,et,tt,rt,nt,it){super($,new P2PCommunicationClient($,j,1,et,tt,nt,it),new PeerManager(et,rt));Yr(this,"type",TransportType.P2P)}static async isAvailable(){return Promise.resolve(!0)}async connect(){if(this._isConnected!==TransportStatus.NOT_CONNECTED)return;logger$3.log("connect"),this._isConnected=TransportStatus.CONNECTING,await this.client.start();const $=await this.getPeers();if($.length>0){logger$3.log("connect",`connecting to ${$.length} peers`);const j=$.map(async et=>this.listen(et.publicKey));Promise.all(j).catch(et=>logger$3.error("connect",et))}return await this.startOpenChannelListener(),super.connect()}async disconnect(){return await this.client.stop(),super.disconnect()}async startOpenChannelListener(){}async getPairingRequestInfo(){return this.client.getPairingRequestInfo()}async listen($){await this.client.listenForEncryptedMessage($,j=>{const et={origin:Origin.P2P,id:$};this.notifyListeners(j,et).catch(tt=>{throw tt})}).catch(j=>{throw j})}}function bind$4(_,a){return function(){return _.apply(a,arguments)}}const{toString:toString$2}=Object.prototype,{getPrototypeOf:getPrototypeOf$3}=Object,kindOf=(_=>a=>{const $=toString$2.call(a);return _[$]||(_[$]=$.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=_=>(_=_.toLowerCase(),a=>kindOf(a)===_),typeOfTest=_=>a=>typeof a===_,{isArray:isArray$3}=Array,isUndefined=typeOfTest("undefined");function isBuffer$1(_){return _!==null&&!isUndefined(_)&&_.constructor!==null&&!isUndefined(_.constructor)&&isFunction$2(_.constructor.isBuffer)&&_.constructor.isBuffer(_)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(_){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(_):a=_&&_.buffer&&isArrayBuffer(_.buffer),a}const isString$1=typeOfTest("string"),isFunction$2=typeOfTest("function"),isNumber=typeOfTest("number"),isObject$2=_=>_!==null&&typeof _=="object",isBoolean$1=_=>_===!0||_===!1,isPlainObject$4=_=>{if(kindOf(_)!=="object")return!1;const a=getPrototypeOf$3(_);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in _)&&!(Symbol.iterator in _)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=_=>isObject$2(_)&&isFunction$2(_.pipe),isFormData=_=>{let a;return _&&(typeof FormData=="function"&&_ instanceof FormData||isFunction$2(_.append)&&((a=kindOf(_))==="formdata"||a==="object"&&isFunction$2(_.toString)&&_.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$1=_=>_.trim?_.trim():_.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(_,a,{allOwnKeys:$=!1}={}){if(_===null||typeof _>"u")return;let j,et;if(typeof _!="object"&&(_=[_]),isArray$3(_))for(j=0,et=_.length;j0;)if(et=$[j],a===et.toLowerCase())return et;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=_=>!isUndefined(_)&&_!==_global;function merge(){const{caseless:_}=isContextDefined(this)&&this||{},a={},$=(j,et)=>{const tt=_&&findKey$1(a,et)||et;isPlainObject$4(a[tt])&&isPlainObject$4(j)?a[tt]=merge(a[tt],j):isPlainObject$4(j)?a[tt]=merge({},j):isArray$3(j)?a[tt]=j.slice():a[tt]=j};for(let j=0,et=arguments.length;j(forEach(a,(et,tt)=>{$&&isFunction$2(et)?_[tt]=bind$4(et,$):_[tt]=et},{allOwnKeys:j}),_),stripBOM=_=>(_.charCodeAt(0)===65279&&(_=_.slice(1)),_),inherits$6=(_,a,$,j)=>{_.prototype=Object.create(a.prototype,j),_.prototype.constructor=_,Object.defineProperty(_,"super",{value:a.prototype}),$&&Object.assign(_.prototype,$)},toFlatObject=(_,a,$,j)=>{let et,tt,rt;const nt={};if(a=a||{},_==null)return a;do{for(et=Object.getOwnPropertyNames(_),tt=et.length;tt-- >0;)rt=et[tt],(!j||j(rt,_,a))&&!nt[rt]&&(a[rt]=_[rt],nt[rt]=!0);_=$!==!1&&getPrototypeOf$3(_)}while(_&&(!$||$(_,a))&&_!==Object.prototype);return a},endsWith=(_,a,$)=>{_=String(_),($===void 0||$>_.length)&&($=_.length),$-=a.length;const j=_.indexOf(a,$);return j!==-1&&j===$},toArray$1=_=>{if(!_)return null;if(isArray$3(_))return _;let a=_.length;if(!isNumber(a))return null;const $=new Array(a);for(;a-- >0;)$[a]=_[a];return $},isTypedArray=(_=>a=>_&&a instanceof _)(typeof Uint8Array<"u"&&getPrototypeOf$3(Uint8Array)),forEachEntry=(_,a)=>{const j=(_&&_[Symbol.iterator]).call(_);let et;for(;(et=j.next())&&!et.done;){const tt=et.value;a.call(_,tt[0],tt[1])}},matchAll=(_,a)=>{let $;const j=[];for(;($=_.exec(a))!==null;)j.push($);return j},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=_=>_.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function($,j,et){return j.toUpperCase()+et}),hasOwnProperty=(({hasOwnProperty:_})=>(a,$)=>_.call(a,$))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(_,a)=>{const $=Object.getOwnPropertyDescriptors(_),j={};forEach($,(et,tt)=>{let rt;(rt=a(et,tt,_))!==!1&&(j[tt]=rt||et)}),Object.defineProperties(_,j)},freezeMethods=_=>{reduceDescriptors(_,(a,$)=>{if(isFunction$2(_)&&["arguments","caller","callee"].indexOf($)!==-1)return!1;const j=_[$];if(isFunction$2(j)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+$+"'")})}})},toObjectSet=(_,a)=>{const $={},j=et=>{et.forEach(tt=>{$[tt]=!0})};return isArray$3(_)?j(_):j(String(_).split(a)),$},noop$6=()=>{},toFiniteNumber=(_,a)=>_!=null&&Number.isFinite(_=+_)?_:a,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$1={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(_=16,a=ALPHABET$1.ALPHA_DIGIT)=>{let $="";const{length:j}=a;for(;_--;)$+=a[Math.random()*j|0];return $};function isSpecCompliantForm(_){return!!(_&&isFunction$2(_.append)&&_[Symbol.toStringTag]==="FormData"&&_[Symbol.iterator])}const toJSONObject=_=>{const a=new Array(10),$=(j,et)=>{if(isObject$2(j)){if(a.indexOf(j)>=0)return;if(!("toJSON"in j)){a[et]=j;const tt=isArray$3(j)?[]:{};return forEach(j,(rt,nt)=>{const it=$(rt,et+1);!isUndefined(it)&&(tt[nt]=it)}),a[et]=void 0,tt}}return j};return $(_,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable$1=_=>_&&(isObject$2(_)||isFunction$2(_))&&isFunction$2(_.then)&&isFunction$2(_.catch),utils$r={isArray:isArray$3,isArrayBuffer,isBuffer:isBuffer$1,isFormData,isArrayBufferView,isString:isString$1,isNumber,isBoolean:isBoolean$1,isObject:isObject$2,isPlainObject:isPlainObject$4,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate:isDate$1,isFile,isBlob,isRegExp,isFunction:isFunction$2,isStream,isURLSearchParams,isTypedArray,isFileList,forEach,merge,extend,trim:trim$1,stripBOM,inherits:inherits$6,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$1,forEachEntry,matchAll,isHTMLForm,hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$6,toFiniteNumber,findKey:findKey$1,global:_global,isContextDefined,ALPHABET:ALPHABET$1,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable:isThenable$1};function AxiosError(_,a,$,j,et){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=_,this.name="AxiosError",a&&(this.code=a),$&&(this.config=$),j&&(this.request=j),et&&(this.response=et)}utils$r.inherits(AxiosError,Error,{toJSON:function _(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$r.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$1=AxiosError.prototype,descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(_=>{descriptors[_]={value:_}});Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype$1,"isAxiosError",{value:!0});AxiosError.from=(_,a,$,j,et,tt)=>{const rt=Object.create(prototype$1);return utils$r.toFlatObject(_,rt,function(it){return it!==Error.prototype},nt=>nt!=="isAxiosError"),AxiosError.call(rt,_.message,a,$,j,et),rt.cause=_,rt.name=_.name,tt&&Object.assign(rt,tt),rt};const httpAdapter=null;function isVisitable(_){return utils$r.isPlainObject(_)||utils$r.isArray(_)}function removeBrackets(_){return utils$r.endsWith(_,"[]")?_.slice(0,-2):_}function renderKey(_,a,$){return _?_.concat(a).map(function(et,tt){return et=removeBrackets(et),!$&&tt?"["+et+"]":et}).join($?".":""):a}function isFlatArray(_){return utils$r.isArray(_)&&!_.some(isVisitable)}const predicates=utils$r.toFlatObject(utils$r,{},null,function _(a){return/^is[A-Z]/.test(a)});function toFormData(_,a,$){if(!utils$r.isObject(_))throw new TypeError("target must be an object");a=a||new FormData,$=utils$r.toFlatObject($,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Et,Ct){return!utils$r.isUndefined(Ct[Et])});const j=$.metaTokens,et=$.visitor||st,tt=$.dots,rt=$.indexes,it=($.Blob||typeof Blob<"u"&&Blob)&&utils$r.isSpecCompliantForm(a);if(!utils$r.isFunction(et))throw new TypeError("visitor must be a function");function ot(bt){if(bt===null)return"";if(utils$r.isDate(bt))return bt.toISOString();if(!it&&utils$r.isBlob(bt))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$r.isArrayBuffer(bt)||utils$r.isTypedArray(bt)?it&&typeof Blob=="function"?new Blob([bt]):Buffer$g.from(bt):bt}function st(bt,Et,Ct){let Pt=bt;if(bt&&!Ct&&typeof bt=="object"){if(utils$r.endsWith(Et,"{}"))Et=j?Et:Et.slice(0,-2),bt=JSON.stringify(bt);else if(utils$r.isArray(bt)&&isFlatArray(bt)||(utils$r.isFileList(bt)||utils$r.endsWith(Et,"[]"))&&(Pt=utils$r.toArray(bt)))return Et=removeBrackets(Et),Pt.forEach(function(It,Lt){!(utils$r.isUndefined(It)||It===null)&&a.append(rt===!0?renderKey([Et],Lt,tt):rt===null?Et:Et+"[]",ot(It))}),!1}return isVisitable(bt)?!0:(a.append(renderKey(Ct,Et,tt),ot(bt)),!1)}const at=[],ut=Object.assign(predicates,{defaultVisitor:st,convertValue:ot,isVisitable});function ht(bt,Et){if(!utils$r.isUndefined(bt)){if(at.indexOf(bt)!==-1)throw Error("Circular reference detected in "+Et.join("."));at.push(bt),utils$r.forEach(bt,function(Pt,Tt){(!(utils$r.isUndefined(Pt)||Pt===null)&&et.call(a,Pt,utils$r.isString(Tt)?Tt.trim():Tt,Et,ut))===!0&&ht(Pt,Et?Et.concat(Tt):[Tt])}),at.pop()}}if(!utils$r.isObject(_))throw new TypeError("data must be an object");return ht(_),a}function encode$5(_){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(_).replace(/[!'()~]|%20|%00/g,function(j){return a[j]})}function AxiosURLSearchParams(_,a){this._pairs=[],_&&toFormData(_,this,a)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function _(a,$){this._pairs.push([a,$])};prototype.toString=function _(a){const $=a?function(j){return a.call(this,j,encode$5)}:encode$5;return this._pairs.map(function(et){return $(et[0])+"="+$(et[1])},"").join("&")};function encode$4(_){return encodeURIComponent(_).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(_,a,$){if(!a)return _;const j=$&&$.encode||encode$4,et=$&&$.serialize;let tt;if(et?tt=et(a,$):tt=utils$r.isURLSearchParams(a)?a.toString():new AxiosURLSearchParams(a,$).toString(j),tt){const rt=_.indexOf("#");rt!==-1&&(_=_.slice(0,rt)),_+=(_.indexOf("?")===-1?"?":"&")+tt}return _}class InterceptorManager{constructor(){this.handlers=[]}use(a,$,j){return this.handlers.push({fulfilled:a,rejected:$,synchronous:j?j.synchronous:!1,runWhen:j?j.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){utils$r.forEach(this.handlers,function(j){j!==null&&a(j)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$1=typeof Blob<"u"?Blob:null,platform$1={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",hasStandardBrowserEnv=(_=>hasBrowserEnv&&["ReactNative","NativeScript","NS"].indexOf(_)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$q=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,origin},Symbol.toStringTag,{value:"Module"})),platform={...utils$q,...platform$1};function toURLEncodedForm(_,a){return toFormData(_,new platform.classes.URLSearchParams,Object.assign({visitor:function($,j,et,tt){return platform.isNode&&utils$r.isBuffer($)?(this.append(j,$.toString("base64")),!1):tt.defaultVisitor.apply(this,arguments)}},a))}function parsePropPath(_){return utils$r.matchAll(/\w+|\[(\w*)]/g,_).map(a=>a[0]==="[]"?"":a[1]||a[0])}function arrayToObject(_){const a={},$=Object.keys(_);let j;const et=$.length;let tt;for(j=0;j=$.length;return rt=!rt&&utils$r.isArray(et)?et.length:rt,it?(utils$r.hasOwnProp(et,rt)?et[rt]=[et[rt],j]:et[rt]=j,!nt):((!et[rt]||!utils$r.isObject(et[rt]))&&(et[rt]=[]),a($,j,et[rt],tt)&&utils$r.isArray(et[rt])&&(et[rt]=arrayToObject(et[rt])),!nt)}if(utils$r.isFormData(_)&&utils$r.isFunction(_.entries)){const $={};return utils$r.forEachEntry(_,(j,et)=>{a(parsePropPath(j),et,$,0)}),$}return null}function stringifySafely(_,a,$){if(utils$r.isString(_))try{return(a||JSON.parse)(_),utils$r.trim(_)}catch(j){if(j.name!=="SyntaxError")throw j}return($||JSON.stringify)(_)}const defaults$1={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function _(a,$){const j=$.getContentType()||"",et=j.indexOf("application/json")>-1,tt=utils$r.isObject(a);if(tt&&utils$r.isHTMLForm(a)&&(a=new FormData(a)),utils$r.isFormData(a))return et?JSON.stringify(formDataToJSON(a)):a;if(utils$r.isArrayBuffer(a)||utils$r.isBuffer(a)||utils$r.isStream(a)||utils$r.isFile(a)||utils$r.isBlob(a)||utils$r.isReadableStream(a))return a;if(utils$r.isArrayBufferView(a))return a.buffer;if(utils$r.isURLSearchParams(a))return $.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let nt;if(tt){if(j.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(a,this.formSerializer).toString();if((nt=utils$r.isFileList(a))||j.indexOf("multipart/form-data")>-1){const it=this.env&&this.env.FormData;return toFormData(nt?{"files[]":a}:a,it&&new it,this.formSerializer)}}return tt||et?($.setContentType("application/json",!1),stringifySafely(a)):a}],transformResponse:[function _(a){const $=this.transitional||defaults$1.transitional,j=$&&$.forcedJSONParsing,et=this.responseType==="json";if(utils$r.isResponse(a)||utils$r.isReadableStream(a))return a;if(a&&utils$r.isString(a)&&(j&&!this.responseType||et)){const rt=!($&&$.silentJSONParsing)&&et;try{return JSON.parse(a)}catch(nt){if(rt)throw nt.name==="SyntaxError"?AxiosError.from(nt,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):nt}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function _(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$r.forEach(["delete","get","head","post","put","patch"],_=>{defaults$1.headers[_]={}});const ignoreDuplicateOf=utils$r.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=_=>{const a={};let $,j,et;return _&&_.split(` -`).forEach(function(rt){et=rt.indexOf(":"),$=rt.substring(0,et).trim().toLowerCase(),j=rt.substring(et+1).trim(),!(!$||a[$]&&ignoreDuplicateOf[$])&&($==="set-cookie"?a[$]?a[$].push(j):a[$]=[j]:a[$]=a[$]?a[$]+", "+j:j)}),a},$internals=Symbol("internals");function normalizeHeader(_){return _&&String(_).trim().toLowerCase()}function normalizeValue(_){return _===!1||_==null?_:utils$r.isArray(_)?_.map(normalizeValue):String(_)}function parseTokens(_){const a=Object.create(null),$=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let j;for(;j=$.exec(_);)a[j[1]]=j[2];return a}const isValidHeaderName=_=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_.trim());function matchHeaderValue(_,a,$,j,et){if(utils$r.isFunction(j))return j.call(this,a,$);if(et&&(a=$),!!utils$r.isString(a)){if(utils$r.isString(j))return a.indexOf(j)!==-1;if(utils$r.isRegExp(j))return j.test(a)}}function formatHeader(_){return _.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,$,j)=>$.toUpperCase()+j)}function buildAccessors(_,a){const $=utils$r.toCamelCase(" "+a);["get","set","has"].forEach(j=>{Object.defineProperty(_,j+$,{value:function(et,tt,rt){return this[j].call(this,a,et,tt,rt)},configurable:!0})})}class AxiosHeaders{constructor(a){a&&this.set(a)}set(a,$,j){const et=this;function tt(nt,it,ot){const st=normalizeHeader(it);if(!st)throw new Error("header name must be a non-empty string");const at=utils$r.findKey(et,st);(!at||et[at]===void 0||ot===!0||ot===void 0&&et[at]!==!1)&&(et[at||it]=normalizeValue(nt))}const rt=(nt,it)=>utils$r.forEach(nt,(ot,st)=>tt(ot,st,it));if(utils$r.isPlainObject(a)||a instanceof this.constructor)rt(a,$);else if(utils$r.isString(a)&&(a=a.trim())&&!isValidHeaderName(a))rt(parseHeaders(a),$);else if(utils$r.isHeaders(a))for(const[nt,it]of a.entries())tt(it,nt,j);else a!=null&&tt($,a,j);return this}get(a,$){if(a=normalizeHeader(a),a){const j=utils$r.findKey(this,a);if(j){const et=this[j];if(!$)return et;if($===!0)return parseTokens(et);if(utils$r.isFunction($))return $.call(this,et,j);if(utils$r.isRegExp($))return $.exec(et);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,$){if(a=normalizeHeader(a),a){const j=utils$r.findKey(this,a);return!!(j&&this[j]!==void 0&&(!$||matchHeaderValue(this,this[j],j,$)))}return!1}delete(a,$){const j=this;let et=!1;function tt(rt){if(rt=normalizeHeader(rt),rt){const nt=utils$r.findKey(j,rt);nt&&(!$||matchHeaderValue(j,j[nt],nt,$))&&(delete j[nt],et=!0)}}return utils$r.isArray(a)?a.forEach(tt):tt(a),et}clear(a){const $=Object.keys(this);let j=$.length,et=!1;for(;j--;){const tt=$[j];(!a||matchHeaderValue(this,this[tt],tt,a,!0))&&(delete this[tt],et=!0)}return et}normalize(a){const $=this,j={};return utils$r.forEach(this,(et,tt)=>{const rt=utils$r.findKey(j,tt);if(rt){$[rt]=normalizeValue(et),delete $[tt];return}const nt=a?formatHeader(tt):String(tt).trim();nt!==tt&&delete $[tt],$[nt]=normalizeValue(et),j[nt]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const $=Object.create(null);return utils$r.forEach(this,(j,et)=>{j!=null&&j!==!1&&($[et]=a&&utils$r.isArray(j)?j.join(", "):j)}),$}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,$])=>a+": "+$).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...$){const j=new this(a);return $.forEach(et=>j.set(et)),j}static accessor(a){const j=(this[$internals]=this[$internals]={accessors:{}}).accessors,et=this.prototype;function tt(rt){const nt=normalizeHeader(rt);j[nt]||(buildAccessors(et,rt),j[nt]=!0)}return utils$r.isArray(a)?a.forEach(tt):tt(a),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$r.reduceDescriptors(AxiosHeaders.prototype,({value:_},a)=>{let $=a[0].toUpperCase()+a.slice(1);return{get:()=>_,set(j){this[$]=j}}});utils$r.freezeMethods(AxiosHeaders);function transformData(_,a){const $=this||defaults$1,j=a||$,et=AxiosHeaders.from(j.headers);let tt=j.data;return utils$r.forEach(_,function(nt){tt=nt.call($,tt,et.normalize(),a?a.status:void 0)}),et.normalize(),tt}function isCancel(_){return!!(_&&_.__CANCEL__)}function CanceledError(_,a,$){AxiosError.call(this,_??"canceled",AxiosError.ERR_CANCELED,a,$),this.name="CanceledError"}utils$r.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(_,a,$){const j=$.config.validateStatus;!$.status||!j||j($.status)?_($):a(new AxiosError("Request failed with status code "+$.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor($.status/100)-4],$.config,$.request,$))}function parseProtocol(_){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_);return a&&a[1]||""}function speedometer(_,a){_=_||10;const $=new Array(_),j=new Array(_);let et=0,tt=0,rt;return a=a!==void 0?a:1e3,function(it){const ot=Date.now(),st=j[tt];rt||(rt=ot),$[et]=it,j[et]=ot;let at=tt,ut=0;for(;at!==et;)ut+=$[at++],at=at%_;if(et=(et+1)%_,et===tt&&(tt=(tt+1)%_),ot-rtj)return et&&(clearTimeout(et),et=null),$=nt,_.apply(null,arguments);et||(et=setTimeout(()=>(et=null,$=Date.now(),_.apply(null,arguments)),j-(nt-$)))}}const progressEventReducer=(_,a,$=3)=>{let j=0;const et=speedometer(50,250);return throttle(tt=>{const rt=tt.loaded,nt=tt.lengthComputable?tt.total:void 0,it=rt-j,ot=et(it),st=rt<=nt;j=rt;const at={loaded:rt,total:nt,progress:nt?rt/nt:void 0,bytes:it,rate:ot||void 0,estimated:ot&&nt&&st?(nt-rt)/ot:void 0,event:tt,lengthComputable:nt!=null};at[a?"download":"upload"]=!0,_(at)},$)},isURLSameOrigin=platform.hasStandardBrowserEnv?function _(){const a=/(msie|trident)/i.test(navigator.userAgent),$=document.createElement("a");let j;function et(tt){let rt=tt;return a&&($.setAttribute("href",rt),rt=$.href),$.setAttribute("href",rt),{href:$.href,protocol:$.protocol?$.protocol.replace(/:$/,""):"",host:$.host,search:$.search?$.search.replace(/^\?/,""):"",hash:$.hash?$.hash.replace(/^#/,""):"",hostname:$.hostname,port:$.port,pathname:$.pathname.charAt(0)==="/"?$.pathname:"/"+$.pathname}}return j=et(window.location.href),function(rt){const nt=utils$r.isString(rt)?et(rt):rt;return nt.protocol===j.protocol&&nt.host===j.host}}():function _(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(_,a,$,j,et,tt){const rt=[_+"="+encodeURIComponent(a)];utils$r.isNumber($)&&rt.push("expires="+new Date($).toGMTString()),utils$r.isString(j)&&rt.push("path="+j),utils$r.isString(et)&&rt.push("domain="+et),tt===!0&&rt.push("secure"),document.cookie=rt.join("; ")},read(_){const a=document.cookie.match(new RegExp("(^|;\\s*)("+_+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove(_){this.write(_,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(_){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_)}function combineURLs(_,a){return a?_.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):_}function buildFullPath(_,a){return _&&!isAbsoluteURL(a)?combineURLs(_,a):a}const headersToObject=_=>_ instanceof AxiosHeaders?{..._}:_;function mergeConfig(_,a){a=a||{};const $={};function j(ot,st,at){return utils$r.isPlainObject(ot)&&utils$r.isPlainObject(st)?utils$r.merge.call({caseless:at},ot,st):utils$r.isPlainObject(st)?utils$r.merge({},st):utils$r.isArray(st)?st.slice():st}function et(ot,st,at){if(utils$r.isUndefined(st)){if(!utils$r.isUndefined(ot))return j(void 0,ot,at)}else return j(ot,st,at)}function tt(ot,st){if(!utils$r.isUndefined(st))return j(void 0,st)}function rt(ot,st){if(utils$r.isUndefined(st)){if(!utils$r.isUndefined(ot))return j(void 0,ot)}else return j(void 0,st)}function nt(ot,st,at){if(at in a)return j(ot,st);if(at in _)return j(void 0,ot)}const it={url:tt,method:tt,data:tt,baseURL:rt,transformRequest:rt,transformResponse:rt,paramsSerializer:rt,timeout:rt,timeoutMessage:rt,withCredentials:rt,withXSRFToken:rt,adapter:rt,responseType:rt,xsrfCookieName:rt,xsrfHeaderName:rt,onUploadProgress:rt,onDownloadProgress:rt,decompress:rt,maxContentLength:rt,maxBodyLength:rt,beforeRedirect:rt,transport:rt,httpAgent:rt,httpsAgent:rt,cancelToken:rt,socketPath:rt,responseEncoding:rt,validateStatus:nt,headers:(ot,st)=>et(headersToObject(ot),headersToObject(st),!0)};return utils$r.forEach(Object.keys(Object.assign({},_,a)),function(st){const at=it[st]||et,ut=at(_[st],a[st],st);utils$r.isUndefined(ut)&&at!==nt||($[st]=ut)}),$}const resolveConfig=_=>{const a=mergeConfig({},_);let{data:$,withXSRFToken:j,xsrfHeaderName:et,xsrfCookieName:tt,headers:rt,auth:nt}=a;a.headers=rt=AxiosHeaders.from(rt),a.url=buildURL(buildFullPath(a.baseURL,a.url),_.params,_.paramsSerializer),nt&&rt.set("Authorization","Basic "+btoa((nt.username||"")+":"+(nt.password?unescape(encodeURIComponent(nt.password)):"")));let it;if(utils$r.isFormData($)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)rt.setContentType(void 0);else if((it=rt.getContentType())!==!1){const[ot,...st]=it?it.split(";").map(at=>at.trim()).filter(Boolean):[];rt.setContentType([ot||"multipart/form-data",...st].join("; "))}}if(platform.hasStandardBrowserEnv&&(j&&utils$r.isFunction(j)&&(j=j(a)),j||j!==!1&&isURLSameOrigin(a.url))){const ot=et&&tt&&cookies.read(tt);ot&&rt.set(et,ot)}return a},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(_){return new Promise(function($,j){const et=resolveConfig(_);let tt=et.data;const rt=AxiosHeaders.from(et.headers).normalize();let{responseType:nt}=et,it;function ot(){et.cancelToken&&et.cancelToken.unsubscribe(it),et.signal&&et.signal.removeEventListener("abort",it)}let st=new XMLHttpRequest;st.open(et.method.toUpperCase(),et.url,!0),st.timeout=et.timeout;function at(){if(!st)return;const ht=AxiosHeaders.from("getAllResponseHeaders"in st&&st.getAllResponseHeaders()),Et={data:!nt||nt==="text"||nt==="json"?st.responseText:st.response,status:st.status,statusText:st.statusText,headers:ht,config:_,request:st};settle(function(Pt){$(Pt),ot()},function(Pt){j(Pt),ot()},Et),st=null}"onloadend"in st?st.onloadend=at:st.onreadystatechange=function(){!st||st.readyState!==4||st.status===0&&!(st.responseURL&&st.responseURL.indexOf("file:")===0)||setTimeout(at)},st.onabort=function(){st&&(j(new AxiosError("Request aborted",AxiosError.ECONNABORTED,et,st)),st=null)},st.onerror=function(){j(new AxiosError("Network Error",AxiosError.ERR_NETWORK,et,st)),st=null},st.ontimeout=function(){let bt=et.timeout?"timeout of "+et.timeout+"ms exceeded":"timeout exceeded";const Et=et.transitional||transitionalDefaults;et.timeoutErrorMessage&&(bt=et.timeoutErrorMessage),j(new AxiosError(bt,Et.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,et,st)),st=null},tt===void 0&&rt.setContentType(null),"setRequestHeader"in st&&utils$r.forEach(rt.toJSON(),function(bt,Et){st.setRequestHeader(Et,bt)}),utils$r.isUndefined(et.withCredentials)||(st.withCredentials=!!et.withCredentials),nt&&nt!=="json"&&(st.responseType=et.responseType),typeof et.onDownloadProgress=="function"&&st.addEventListener("progress",progressEventReducer(et.onDownloadProgress,!0)),typeof et.onUploadProgress=="function"&&st.upload&&st.upload.addEventListener("progress",progressEventReducer(et.onUploadProgress)),(et.cancelToken||et.signal)&&(it=ht=>{st&&(j(!ht||ht.type?new CanceledError(null,_,st):ht),st.abort(),st=null)},et.cancelToken&&et.cancelToken.subscribe(it),et.signal&&(et.signal.aborted?it():et.signal.addEventListener("abort",it)));const ut=parseProtocol(et.url);if(ut&&platform.protocols.indexOf(ut)===-1){j(new AxiosError("Unsupported protocol "+ut+":",AxiosError.ERR_BAD_REQUEST,_));return}st.send(tt||null)})},composeSignals=(_,a)=>{let $=new AbortController,j;const et=function(it){if(!j){j=!0,rt();const ot=it instanceof Error?it:this.reason;$.abort(ot instanceof AxiosError?ot:new CanceledError(ot instanceof Error?ot.message:ot))}};let tt=a&&setTimeout(()=>{et(new AxiosError(`timeout ${a} of ms exceeded`,AxiosError.ETIMEDOUT))},a);const rt=()=>{_&&(tt&&clearTimeout(tt),tt=null,_.forEach(it=>{it&&(it.removeEventListener?it.removeEventListener("abort",et):it.unsubscribe(et))}),_=null)};_.forEach(it=>it&&it.addEventListener&&it.addEventListener("abort",et));const{signal:nt}=$;return nt.unsubscribe=rt,[nt,()=>{tt&&clearTimeout(tt),tt=null}]},streamChunk=function*(_,a){let $=_.byteLength;if(!a||${const tt=readBytes(_,a,et);let rt=0;return new ReadableStream({type:"bytes",async pull(nt){const{done:it,value:ot}=await tt.next();if(it){nt.close(),j();return}let st=ot.byteLength;$&&$(rt+=st),nt.enqueue(new Uint8Array(ot))},cancel(nt){return j(nt),tt.return()}},{highWaterMark:2})},fetchProgressDecorator=(_,a)=>{const $=_!=null;return j=>setTimeout(()=>a({lengthComputable:$,total:_,loaded:j}))},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(_=>a=>_.encode(a))(new TextEncoder):async _=>new Uint8Array(await new Response(_).arrayBuffer())),supportsRequestStream=isReadableStreamSupported&&(()=>{let _=!1;const a=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return _=!0,"half"}}).headers.has("Content-Type");return _&&!a})(),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&!!(()=>{try{return utils$r.isReadableStream(new Response("").body)}catch{}})(),resolvers={stream:supportsResponseStream&&(_=>_.body)};isFetchSupported&&(_=>{["text","arrayBuffer","blob","formData","stream"].forEach(a=>{!resolvers[a]&&(resolvers[a]=utils$r.isFunction(_[a])?$=>$[a]():($,j)=>{throw new AxiosError(`Response type '${a}' is not supported`,AxiosError.ERR_NOT_SUPPORT,j)})})})(new Response);const getBodyLength=async _=>{if(_==null)return 0;if(utils$r.isBlob(_))return _.size;if(utils$r.isSpecCompliantForm(_))return(await new Request(_).arrayBuffer()).byteLength;if(utils$r.isArrayBufferView(_))return _.byteLength;if(utils$r.isURLSearchParams(_)&&(_=_+""),utils$r.isString(_))return(await encodeText(_)).byteLength},resolveBodyLength=async(_,a)=>{const $=utils$r.toFiniteNumber(_.getContentLength());return $??getBodyLength(a)},fetchAdapter=isFetchSupported&&(async _=>{let{url:a,method:$,data:j,signal:et,cancelToken:tt,timeout:rt,onDownloadProgress:nt,onUploadProgress:it,responseType:ot,headers:st,withCredentials:at="same-origin",fetchOptions:ut}=resolveConfig(_);ot=ot?(ot+"").toLowerCase():"text";let[ht,bt]=et||tt||rt?composeSignals([et,tt],rt):[],Et,Ct;const Pt=()=>{!Et&&setTimeout(()=>{ht&&ht.unsubscribe()}),Et=!0};let Tt;try{if(it&&supportsRequestStream&&$!=="get"&&$!=="head"&&(Tt=await resolveBodyLength(st,j))!==0){let Ut=new Request(a,{method:"POST",body:j,duplex:"half"}),jt;utils$r.isFormData(j)&&(jt=Ut.headers.get("content-type"))&&st.setContentType(jt),Ut.body&&(j=trackStream(Ut.body,DEFAULT_CHUNK_SIZE,fetchProgressDecorator(Tt,progressEventReducer(it)),null,encodeText))}utils$r.isString(at)||(at=at?"cors":"omit"),Ct=new Request(a,{...ut,signal:ht,method:$.toUpperCase(),headers:st.normalize().toJSON(),body:j,duplex:"half",withCredentials:at});let It=await fetch(Ct);const Lt=supportsResponseStream&&(ot==="stream"||ot==="response");if(supportsResponseStream&&(nt||Lt)){const Ut={};["status","statusText","headers"].forEach(Mt=>{Ut[Mt]=It[Mt]});const jt=utils$r.toFiniteNumber(It.headers.get("content-length"));It=new Response(trackStream(It.body,DEFAULT_CHUNK_SIZE,nt&&fetchProgressDecorator(jt,progressEventReducer(nt,!0)),Lt&&Pt,encodeText),Ut)}ot=ot||"text";let Nt=await resolvers[utils$r.findKey(resolvers,ot)||"text"](It,_);return!Lt&&Pt(),bt&&bt(),await new Promise((Ut,jt)=>{settle(Ut,jt,{data:Nt,headers:AxiosHeaders.from(It.headers),status:It.status,statusText:It.statusText,config:_,request:Ct})})}catch(It){throw Pt(),It&&It.name==="TypeError"&&/fetch/i.test(It.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,_,Ct),{cause:It.cause||It}):AxiosError.from(It,It&&It.code,_,Ct)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$r.forEach(knownAdapters,(_,a)=>{if(_){try{Object.defineProperty(_,"name",{value:a})}catch{}Object.defineProperty(_,"adapterName",{value:a})}});const renderReason=_=>`- ${_}`,isResolvedHandle=_=>utils$r.isFunction(_)||_===null||_===!1,adapters={getAdapter:_=>{_=utils$r.isArray(_)?_:[_];const{length:a}=_;let $,j;const et={};for(let tt=0;tt`adapter ${nt} `+(it===!1?"is not supported by the environment":"is not available in the build"));let rt=a?tt.length>1?`since : +`):" "+renderReason$1(tt[0]):"as no adapter specified";throw new AxiosError$1("There is no suitable adapter to dispatch the request "+rt,"ERR_NOT_SUPPORT")}return j},adapters:knownAdapters$1};function throwIfCancellationRequested$1(_){if(_.cancelToken&&_.cancelToken.throwIfRequested(),_.signal&&_.signal.aborted)throw new CanceledError$1(null,_)}function dispatchRequest$1(_){return throwIfCancellationRequested$1(_),_.headers=AxiosHeaders$1.from(_.headers),_.data=transformData$1.call(_,_.transformRequest),["post","put","patch"].indexOf(_.method)!==-1&&_.headers.setContentType("application/x-www-form-urlencoded",!1),adapters$1.getAdapter(_.adapter||defaults$2.adapter)(_).then(function(j){return throwIfCancellationRequested$1(_),j.data=transformData$1.call(_,_.transformResponse,j),j.headers=AxiosHeaders$1.from(j.headers),j},function(j){return isCancel$1(j)||(throwIfCancellationRequested$1(_),j&&j.response&&(j.response.data=transformData$1.call(_,_.transformResponse,j.response),j.response.headers=AxiosHeaders$1.from(j.response.headers))),Promise.reject(j)})}const headersToObject$1=_=>_ instanceof AxiosHeaders$1?_.toJSON():_;function mergeConfig$1(_,a){a=a||{};const $={};function j(at,st,ot){return utils$E.isPlainObject(at)&&utils$E.isPlainObject(st)?utils$E.merge.call({caseless:ot},at,st):utils$E.isPlainObject(st)?utils$E.merge({},st):utils$E.isArray(st)?st.slice():st}function et(at,st,ot){if(utils$E.isUndefined(st)){if(!utils$E.isUndefined(at))return j(void 0,at,ot)}else return j(at,st,ot)}function tt(at,st){if(!utils$E.isUndefined(st))return j(void 0,st)}function rt(at,st){if(utils$E.isUndefined(st)){if(!utils$E.isUndefined(at))return j(void 0,at)}else return j(void 0,st)}function nt(at,st,ot){if(ot in a)return j(at,st);if(ot in _)return j(void 0,at)}const it={url:tt,method:tt,data:tt,baseURL:rt,transformRequest:rt,transformResponse:rt,paramsSerializer:rt,timeout:rt,timeoutMessage:rt,withCredentials:rt,withXSRFToken:rt,adapter:rt,responseType:rt,xsrfCookieName:rt,xsrfHeaderName:rt,onUploadProgress:rt,onDownloadProgress:rt,decompress:rt,maxContentLength:rt,maxBodyLength:rt,beforeRedirect:rt,transport:rt,httpAgent:rt,httpsAgent:rt,cancelToken:rt,socketPath:rt,responseEncoding:rt,validateStatus:nt,headers:(at,st)=>et(headersToObject$1(at),headersToObject$1(st),!0)};return utils$E.forEach(Object.keys(Object.assign({},_,a)),function(st){const ot=it[st]||et,ut=ot(_[st],a[st],st);utils$E.isUndefined(ut)&&ot!==nt||($[st]=ut)}),$}const VERSION$3="1.6.5",validators$3={};["object","boolean","number","function","string","symbol"].forEach((_,a)=>{validators$3[_]=function(j){return typeof j===_||"a"+(a<1?"n ":" ")+_}});const deprecatedWarnings$1={};validators$3.transitional=function _(a,$,j){function et(tt,rt){return"[Axios v"+VERSION$3+"] Transitional option '"+tt+"'"+rt+(j?". "+j:"")}return(tt,rt,nt)=>{if(a===!1)throw new AxiosError$1(et(rt," has been removed"+($?" in "+$:"")),AxiosError$1.ERR_DEPRECATED);return $&&!deprecatedWarnings$1[rt]&&(deprecatedWarnings$1[rt]=!0,console.warn(et(rt," has been deprecated since v"+$+" and will be removed in the near future"))),a?a(tt,rt,nt):!0}};function assertOptions$1(_,a,$){if(typeof _!="object")throw new AxiosError$1("options must be an object",AxiosError$1.ERR_BAD_OPTION_VALUE);const j=Object.keys(_);let et=j.length;for(;et-- >0;){const tt=j[et],rt=a[tt];if(rt){const nt=_[tt],it=nt===void 0||rt(nt,tt,_);if(it!==!0)throw new AxiosError$1("option "+tt+" must be "+it,AxiosError$1.ERR_BAD_OPTION_VALUE);continue}if($!==!0)throw new AxiosError$1("Unknown option "+tt,AxiosError$1.ERR_BAD_OPTION)}}const validator$1={assertOptions:assertOptions$1,validators:validators$3},validators$2=validator$1.validators;let Axios$1=class{constructor(a){this.defaults=a,this.interceptors={request:new InterceptorManager$1,response:new InterceptorManager$1}}request(a,$){typeof a=="string"?($=$||{},$.url=a):$=a||{},$=mergeConfig$1(this.defaults,$);const{transitional:j,paramsSerializer:et,headers:tt}=$;j!==void 0&&validator$1.assertOptions(j,{silentJSONParsing:validators$2.transitional(validators$2.boolean),forcedJSONParsing:validators$2.transitional(validators$2.boolean),clarifyTimeoutError:validators$2.transitional(validators$2.boolean)},!1),et!=null&&(utils$E.isFunction(et)?$.paramsSerializer={serialize:et}:validator$1.assertOptions(et,{encode:validators$2.function,serialize:validators$2.function},!0)),$.method=($.method||this.defaults.method||"get").toLowerCase();let rt=tt&&utils$E.merge(tt.common,tt[$.method]);tt&&utils$E.forEach(["delete","get","head","post","put","patch","common"],mt=>{delete tt[mt]}),$.headers=AxiosHeaders$1.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(xt){typeof xt.runWhen=="function"&&xt.runWhen($)===!1||(it=it&&xt.synchronous,nt.unshift(xt.fulfilled,xt.rejected))});const at=[];this.interceptors.response.forEach(function(xt){at.push(xt.fulfilled,xt.rejected)});let st,ot=0,ut;if(!it){const mt=[dispatchRequest$1.bind(this),void 0];for(mt.unshift.apply(mt,nt),mt.push.apply(mt,at),ut=mt.length,st=Promise.resolve($);ot{if(!j._listeners)return;let tt=j._listeners.length;for(;tt-- >0;)j._listeners[tt](et);j._listeners=null}),this.promise.then=et=>{let tt;const rt=new Promise(nt=>{j.subscribe(nt),tt=nt}).then(et);return rt.cancel=function(){j.unsubscribe(tt)},rt},a(function(tt,rt,nt){j.reason||(j.reason=new CanceledError$1(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const $=this._listeners.indexOf(a);$!==-1&&this._listeners.splice($,1)}static source(){let a;return{token:new Rv(function(et){a=et}),cancel:a}}};function spread$1(_){return function($){return _.apply(null,$)}}function isAxiosError$1(_){return utils$E.isObject(_)&&_.isAxiosError===!0}const HttpStatusCode$1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode$1).forEach(([_,a])=>{HttpStatusCode$1[a]=_});function createInstance$1(_){const a=new Axios$1(_),$=bind$5(Axios$1.prototype.request,a);return utils$E.extend($,Axios$1.prototype,a,{allOwnKeys:!0}),utils$E.extend($,a,null,{allOwnKeys:!0}),$.create=function(et){return createInstance$1(mergeConfig$1(_,et))},$}const axios$1=createInstance$1(defaults$2);axios$1.Axios=Axios$1;axios$1.CanceledError=CanceledError$1;axios$1.CancelToken=CancelToken$1;axios$1.isCancel=isCancel$1;axios$1.VERSION=VERSION$3;axios$1.toFormData=toFormData$1;axios$1.AxiosError=AxiosError$1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function _(a){return Promise.all(a)};axios$1.spread=spread$1;axios$1.isAxiosError=isAxiosError$1;axios$1.mergeConfig=mergeConfig$1;axios$1.AxiosHeaders=AxiosHeaders$1;axios$1.formToJSON=_=>formDataToJSON$1(utils$E.isHTMLForm(_)?new FormData(_):_);axios$1.getAdapter=adapters$1.getAdapter;axios$1.HttpStatusCode=HttpStatusCode$1;axios$1.default=axios$1;var MatrixMessageType;(function(_){_.TEXT="m.text"})(MatrixMessageType||(MatrixMessageType={}));class MatrixMessage{constructor(a,$,j,et){Yr(this,"type");Yr(this,"sender");Yr(this,"content");Yr(this,"timestamp");this.type=a,this.sender=$,this.content=j,this.timestamp=et}static from(a){if(isTextMessageEvent(a))return new MatrixMessage(a.content.msgtype,a.sender,a.content.body,a.origin_server_ts)}}const isCreateEvent=_=>_.type==="m.room.create"&&_.content instanceof Object&&"creator"in _.content,isJoinEvent=_=>_.type==="m.room.member"&&_.content instanceof Object&&"membership"in _.content&&_.content.membership==="join",isMessageEvent=_=>_.type==="m.room.message",isTextMessageEvent=_=>isMessageEvent(_)&&_.content instanceof Object&&"msgtype"in _.content&&_.content.msgtype===MatrixMessageType.TEXT;var MatrixRoomStatus;(function(_){_[_.UNKNOWN=0]="UNKNOWN",_[_.JOINED=1]="JOINED",_[_.INVITED=2]="INVITED",_[_.LEFT=3]="LEFT"})(MatrixRoomStatus||(MatrixRoomStatus={}));class MatrixRoom{constructor(a,$=MatrixRoomStatus.UNKNOWN,j=[],et=[]){Yr(this,"id");Yr(this,"status");Yr(this,"members");Yr(this,"messages");this.id=a,this.status=$,this.members=j,this.messages=et}static fromSync(a){if(!a)return[];function $(j,et){return Object.entries(j).map(([tt,rt])=>et(tt,rt))}return[...$(a.join??{},MatrixRoom.fromJoined),...$(a.invite??{},MatrixRoom.fromInvited),...$(a.leave??{},MatrixRoom.fromLeft)]}static from(a,$){return typeof a=="string"?new MatrixRoom(a,$||MatrixRoomStatus.UNKNOWN):$!==void 0?new MatrixRoom(a.id,$,a.members,a.messages):a}static merge(a,$){return!$||$.id!==a.id?MatrixRoom.from(a):new MatrixRoom(a.id,a.status,[...$.members,...a.members].filter((j,et,tt)=>tt.indexOf(j)===et),[...$.messages,...a.messages])}static fromJoined(a,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(a,MatrixRoomStatus.JOINED,et,tt)}static fromInvited(a,$){const j=MatrixRoom.getMembersFromEvents($.invite_state.events);return new MatrixRoom(a,MatrixRoomStatus.INVITED,j)}static fromLeft(a,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(a,MatrixRoomStatus.LEFT,et,tt)}static getMembersFromEvents(a){return MatrixRoom.getUniqueEvents(a.filter($=>isCreateEvent($)||isJoinEvent($))).map($=>$.sender).filter(($,j,et)=>et.indexOf($)===j)}static getMessagesFromEvents(a){return MatrixRoom.getUniqueEvents(a.filter(isMessageEvent)).map($=>MatrixMessage.from($)).filter(Boolean)}static getUniqueEvents(a){const $={},j=[];return a.forEach((et,tt)=>{const rt=et.event_id;(rt===void 0||!(rt in $))&&(rt!==void 0&&($[rt]=tt),j.push(et))}),j}}const PRESERVED_FIELDS=["syncToken","rooms"];class MatrixClientStore{constructor(a){Yr(this,"storage");Yr(this,"state",{isRunning:!1,userId:void 0,deviceId:void 0,txnNo:0,accessToken:void 0,syncToken:void 0,pollingTimeout:void 0,pollingRetries:0,rooms:{}});Yr(this,"onStateChangedListeners",new Map);Yr(this,"waitReadyPromise");this.storage=a,this.waitReadyPromise=new Promise(async($,j)=>{try{await this.initFromStorage(),$()}catch(et){j(et)}})}get(a){return this.state[a]}getRoom(a){const $=MatrixRoom.from(a,MatrixRoomStatus.UNKNOWN);return this.state.rooms[$.id]||$}async update(a){await this.waitReady();const $=Object.assign({},this.state);this.setState(a),this.updateStorage(a),this.notifyListeners($,this.state,a)}onStateChanged(a,...$){$.length>0?$.forEach(j=>{this.onStateChangedListeners.set(j,a)}):this.onStateChangedListeners.set("all",a)}async waitReady(){return this.waitReadyPromise}async initFromStorage(){const a=await this.storage.get(StorageKey.MATRIX_PRESERVED_STATE);this.setState(a)}prepareData(a){const j=["rooms"].some(et=>a[et]!==void 0)?JSON.parse(JSON.stringify(a)):a;return Object.values(j.rooms||{}).forEach(et=>{et.messages=[]}),j}updateStorage(a){if(Object.entries(a).filter(([j,et])=>PRESERVED_FIELDS.includes(j)&&!!et).length>0){const j={};PRESERVED_FIELDS.forEach(et=>{j[et]=this.state[et]}),this.storage.set(StorageKey.MATRIX_PRESERVED_STATE,this.prepareData(j))}}setState(a){this.state={isRunning:a.isRunning||this.state.isRunning,userId:a.userId||this.state.userId,deviceId:a.deviceId||this.state.deviceId,txnNo:a.txnNo||this.state.txnNo,accessToken:a.accessToken||this.state.accessToken,syncToken:a.syncToken||this.state.syncToken,pollingTimeout:a.pollingTimeout||this.state.pollingTimeout,pollingRetries:a.pollingRetries||this.state.pollingRetries,rooms:this.mergeRooms(this.state.rooms,a.rooms)}}mergeRooms(a,$){if(!$)return a;const j=Array.isArray($)?$:Object.values($),et=Object.assign({},a);return j.forEach(tt=>{et[tt.id]=MatrixRoom.merge(tt,a[tt.id])}),et}notifyListeners(a,$,j){const et=this.onStateChangedListeners.get("all");et&&et(a,$,j),keys(j).filter(tt=>j[tt]!==void 0).forEach(tt=>{const rt=this.onStateChangedListeners.get(tt);rt&&rt(a,$,j)})}}const logger$6=new Logger("MatrixHttpClient"),CLIENT_API_R0="/_matrix/client/r0";class MatrixHttpClient{constructor(a){Yr(this,"baseUrl");Yr(this,"cancelTokenSource");this.baseUrl=a,this.cancelTokenSource=axios$1.CancelToken.source()}async get(a,$,j){return this.send("GET",a,j,$)}async post(a,$,j,et){return this.send("POST",a,j,et,$)}async put(a,$,j,et){return this.send("PUT",a,j,et,$)}async cancelAllRequests(){return this.cancelTokenSource.cancel("Manually cancelled")}async send(a,$,j,et,tt){const rt=j?this.getHeaders(j):void 0,nt=et?this.getParams(et):void 0;let it;try{it=await axios$1.request({method:a,url:$,baseURL:this.apiUrl(CLIENT_API_R0),headers:rt,data:tt,params:nt,cancelToken:this.cancelTokenSource.token})}catch(at){const st=at;throw logger$6.error("send",st.code,st.message,st.response.data),at.response.data}return it.data}getHeaders(a){const $={},j=[];if(a.accessToken&&j.push(["Authorization",`Bearer ${a.accessToken}`]),j.length!==0){for(const[et,tt]of j)$[et]=tt;return $}}getParams(a){if(!a)return;const $=Object.assign(a,{});return keys($).forEach(j=>$[j]===void 0&&delete $[j]),$}apiUrl(...a){const $=this.baseUrl.endsWith("/")?this.baseUrl.substr(0,this.baseUrl.length-1):this.baseUrl,j=a.map(et=>et.startsWith("/")?et.substr(1):et);return[$,...j].join("/")}}class MatrixRoomService{constructor(a){Yr(this,"httpClient");this.httpClient=a}async createRoom(a,$={}){return this.httpClient.post("/createRoom",$,{accessToken:a})}async inviteToRoom(a,$,j){return j.status!==MatrixRoomStatus.JOINED&&j.status!==MatrixRoomStatus.UNKNOWN?Promise.reject(`User is not a member of room ${j.id}.`):this.httpClient.post(`/rooms/${encodeURIComponent(j.id)}/invite`,{user_id:$},{accessToken:a})}async joinRoom(a,$){return $.status===MatrixRoomStatus.JOINED?Promise.resolve({room_id:$.id}):this.httpClient.post(`/rooms/${encodeURIComponent($.id)}/join`,{},{accessToken:a})}async getJoinedRooms(a){return this.httpClient.get("/joined_rooms",void 0,{accessToken:a})}}class MatrixUserService{constructor(a){Yr(this,"httpClient");this.httpClient=a}async login(a,$,j){return this.httpClient.post("/login",{type:"m.login.password",identifier:{type:"m.id.user",user:a},password:$,device_id:j})}}class MatrixEventService{constructor(a){Yr(this,"httpClient");Yr(this,"cachedPromises",new Map);this.httpClient=a}async sync(a,$){return this.withCache("sync",()=>this.httpClient.get("/sync",{timeout:$?$.pollingTimeout:void 0,since:$?$.syncToken:void 0},{accessToken:a}))}async sendMessage(a,$,j,et){return new Promise((tt,rt)=>this.scheduleEvent({accessToken:a,roomId:$,type:"m.room.message",content:j,txnId:et,onSuccess:tt,onError:rt}))}scheduleEvent(a){this.sendEvent(a)}async sendEvent(a){const{roomId:$,type:j,txnId:et,content:tt,accessToken:rt}=a;try{const nt=await this.httpClient.put(`/rooms/${encodeURIComponent($)}/send/${j}/${encodeURIComponent(et)}`,tt,{accessToken:rt});a.onSuccess(nt)}catch(nt){a.onError(nt)}}withCache(a,$){let j=this.cachedPromises.get(a);return j||(j=$().finally(()=>{this.cachedPromises.delete(a)}),this.cachedPromises.set(a,j)),j}}class EventEmitter{constructor(){Yr(this,"events",{})}on(a,$){return typeof this.events[a]!="object"&&(this.events[a]=[]),this.events[a].push($),()=>this.removeListener(a,$)}removeListener(a,$){if(typeof this.events[a]!="object")return;if(!$){this.events[a]=[];return}const j=this.events[a].indexOf($);j>-1&&this.events[a].splice(j,1)}removeAllListeners(){Object.keys(this.events).forEach(a=>this.events[a].splice(0,this.events[a].length))}emit(a,...$){typeof this.events[a]=="object"&&[...this.events[a]].forEach(j=>j.apply(this,$))}once(a,$){const j=this.on(a,(...et)=>{j(),$.apply(this,et)});return j}}var MatrixClientEventType;(function(_){_.INVITE="invite",_.MESSAGE="message"})(MatrixClientEventType||(MatrixClientEventType={}));class MatrixClientEventEmitter extends EventEmitter{constructor(){super(...arguments);Yr(this,"eventEmitProviders",new Map([[MatrixClientEventType.INVITE,()=>[this.isInvite,this.emitInvite.bind(this)]],[MatrixClientEventType.MESSAGE,()=>[this.isMessage,this.emitMessage.bind(this)]]]))}onStateChanged($,j,et){for(const tt of keys(MatrixClientEventType))this.emitIfEvent(MatrixClientEventType[tt],et)}emitIfEvent($,j){const et=this.eventEmitProviders.get($);if(et){const[tt,rt]=et();tt(j)&&rt($,j)}}emitClientEvent($,j,et){this.emit($,{type:$,content:j,timestamp:et})}isInvite($){return $.rooms?$.rooms.some(j=>j.status===MatrixRoomStatus.INVITED):!1}emitInvite($,j){j.rooms.filter(et=>et.status===MatrixRoomStatus.INVITED).map(et=>[et.id,et.members]).forEach(([et,tt])=>{this.emitClientEvent($,{roomId:et,members:tt})})}isMessage($){return $.rooms?$.rooms.some(j=>j.messages.length>0):!1}emitMessage($,j){j.rooms.filter(et=>et.messages.length>0).map(et=>et.messages.map(tt=>[et.id,tt,tt.timestamp])).reduce((et,tt)=>et.concat(tt),[]).forEach(([et,tt,rt])=>{this.emitClientEvent($,{roomId:et,message:tt},rt)})}}const logger$5=new Logger("MatrixClient"),IMMEDIATE_POLLING_RETRIES=3,RETRY_INTERVAL=5e3;class MatrixClient{constructor(a,$,j,et,tt,rt){Yr(this,"store");Yr(this,"eventEmitter");Yr(this,"userService");Yr(this,"roomService");Yr(this,"eventService");Yr(this,"httpClient");Yr(this,"isActive",!0);Yr(this,"_isReady",new ExposedPromise);this.store=a,this.eventEmitter=$,this.userService=j,this.roomService=et,this.eventService=tt,this.httpClient=rt,this.store.onStateChanged((nt,it,at)=>{this.eventEmitter.onStateChanged(nt,it,at)},"rooms")}static create(a){const $=new MatrixClientStore(a.storage),j=new MatrixClientEventEmitter,et=new MatrixHttpClient(a.baseUrl),tt=new MatrixUserService(et),rt=new MatrixRoomService(et),nt=new MatrixEventService(et);return new MatrixClient($,j,tt,rt,nt,et)}get joinedRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.JOINED))})}get invitedRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.INVITED))})}get leftRooms(){return new Promise(async a=>{await this.isConnected(),a(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.LEFT))})}async start(a){const $=await this.userService.login(a.id,a.password,a.deviceId);await this.store.update({accessToken:$.access_token});const j=new Promise(async(et,tt)=>{await this.poll(0,async rt=>{this.store.get("isRunning")||et(),await this.store.update({isRunning:!0,syncToken:rt.next_batch,pollingTimeout:3e4,pollingRetries:0,rooms:MatrixRoom.fromSync(rt.rooms)})},async rt=>{this.store.get("isRunning")||tt(rt),await this.store.update({isRunning:!1,pollingRetries:this.store.get("pollingRetries")+1})})});return j.then(()=>{this._isReady.resolve()}).catch(console.error),j}async isConnected(){return this._isReady.promise}async stop(){return logger$5.log("MATRIX CLIENT STOPPED"),this.isActive=!1,this._isReady=new ExposedPromise,this.httpClient.cancelAllRequests()}subscribe(a,$){this.eventEmitter.on(a,$)}unsubscribe(a,$){$&&this.eventEmitter.removeListener(a,$)}unsubscribeAll(a){this.eventEmitter.removeListener(a)}async getRoomById(a){return await this.isConnected(),this.store.getRoom(a)}async createTrustedPrivateRoom(...a){return await this.isConnected(),this.requiresAuthorization("createRoom",async $=>(await this.roomService.createRoom($,{room_version:"5",invite:a,preset:"public_chat",is_direct:!0})).room_id)}async inviteToRooms(a,...$){await this.isConnected(),await this.requiresAuthorization("invite",j=>Promise.all($.map(et=>{const tt=this.store.getRoom(et);this.roomService.inviteToRoom(j,a,tt).catch(rt=>logger$5.warn("inviteToRooms",rt))})))}async joinRooms(...a){await this.isConnected(),await this.requiresAuthorization("join",$=>Promise.all(a.map(j=>{const et=this.store.getRoom(j);return this.roomService.joinRoom($,et)})))}async sendTextMessage(a,$){await this.isConnected(),await this.requiresAuthorization("send",async j=>{const et=await this.createTxnId();return this.eventService.sendMessage(j,a,{msgtype:"m.text",body:$},et)})}async poll(a,$,j){const et=this.store,tt=this.sync.bind(this),rt=async(nt,it)=>{let at=0;try{const st=await tt();$(st)}catch(st){j(st),at=et.get("pollingRetries"),this.isActive&&logger$5.log(`Retry syncing... ${at} retries so far`)}finally{this.isActive?setTimeout(async()=>{await rt(nt,it)},at>IMMEDIATE_POLLING_RETRIES?RETRY_INTERVAL+a:a):it(new Error("Syncing stopped manually."))}};return new Promise(rt)}async sync(){return this.requiresAuthorization("sync",async a=>this.eventService.sync(a,{pollingTimeout:this.store.get("pollingTimeout"),syncToken:this.store.get("syncToken")}))}async requiresAuthorization(a,$){const j=this.store.get("accessToken");return j?$(j):Promise.reject(`${a} requires authorization but no access token has been provided.`)}async createTxnId(){const a=new Date().getTime(),$=this.store.get("txnNo");return await this.store.update({txnNo:$+1}),`m${a}.${$}`}}const logger$4=new Logger("P2PCommunicationClient"),RESPONSE_WAIT_TIME_MS=1e3,REGIONS_AND_SERVERS={[Regions.EUROPE_WEST]:["beacon-node-1.diamond.papers.tech","beacon-node-1.sky.papers.tech","beacon-node-2.sky.papers.tech","beacon-node-1.hope.papers.tech","beacon-node-1.hope-2.papers.tech","beacon-node-1.hope-3.papers.tech","beacon-node-1.hope-4.papers.tech","beacon-node-1.hope-5.papers.tech"],[Regions.NORTH_AMERICA_EAST]:["beacon-node-1.beacon-server-1.papers.tech"],[Regions.NORTH_AMERICA_WEST]:["beacon-node-1.beacon-server-2.papers.tech"],[Regions.ASIA_EAST]:["beacon-node-1.beacon-server-3.papers.tech"],[Regions.AUSTRALIA]:["beacon-node-1.beacon-server-4.papers.tech"]},sleep$2=_=>new Promise(a=>setTimeout(a,_));class P2PCommunicationClient extends CommunicationClient{constructor($,j,et,tt,rt,nt,it){super(j);Yr(this,"name");Yr(this,"replicationCount");Yr(this,"storage");Yr(this,"iconUrl");Yr(this,"appUrl");Yr(this,"client",new ExposedPromise);Yr(this,"initialEvent");Yr(this,"initialListener");Yr(this,"selectedRegion");Yr(this,"ENABLED_RELAY_SERVERS");Yr(this,"relayServer");Yr(this,"activeListeners",new Map);Yr(this,"ignoredRooms",[]);Yr(this,"loginCounter",0);this.name=$,this.replicationCount=et,this.storage=tt,this.iconUrl=nt,this.appUrl=it,logger$4.log("constructor","P2PCommunicationClient created"),this.ENABLED_RELAY_SERVERS=REGIONS_AND_SERVERS,rt&&(this.ENABLED_RELAY_SERVERS={...REGIONS_AND_SERVERS,...rt})}async getPairingRequestInfo(){const $=new P2PPairingRequest(await generateGUID(),this.name,await this.getPublicKey(),BEACON_VERSION,(await this.getRelayServer()).server);return this.iconUrl&&($.icon=this.iconUrl),this.appUrl&&($.appUrl=this.appUrl),$}async getPairingResponseInfo($){const j=new P2PPairingResponse($.id,this.name,await this.getPublicKey(),$.version,(await this.getRelayServer()).server);return this.iconUrl&&(j.icon=this.iconUrl),this.appUrl&&(j.appUrl=this.appUrl),j}async findBestRegionAndGetServer(){var at;if(this.selectedRegion)return(at=this.relayServer)==null?void 0:at.promiseResult;const $=Object.keys(this.ENABLED_RELAY_SERVERS),j=[],et=new ExposedPromise;let tt=0;const rt=new ExposedPromise;$.forEach(st=>{const ot=this.ENABLED_RELAY_SERVERS[st]??[];if(ot.length===0)return;tt+=2;const ut=(xt=!0)=>{const Ct=Date.now();Promise.race([this.getBeaconInfo(mt),rt.promise]).then(Pt=>{typeof Pt!="boolean"&&(j.push({time:Date.now()-Ct,server:mt,region:st,result:Pt}),j.length>=tt&&et.resolve(void 0),xt||ut(!0))})},dt=Math.floor(Math.random()*ot.length),mt=ot[dt];ut(!1)}),await Promise.race([et.promise,sleep$2(RESPONSE_WAIT_TIME_MS)]);let nt=0;for(;j.length<=0;){if(nt>=100)throw new Error("No server responded.");await sleep$2(50),nt++}rt.resolve(!0);const it=j.reduce((st,ot)=>st.time0){const et=await this.getBeaconInfo($);return this.relayServer.resolve({server:$,timestamp:et.timestamp,localTimestamp:new Date().getTime()}),{server:$,timestamp:et.timestamp}}const j=await this.findBestRegionAndGetServer();if(!j)throw new Error("No servers found");return this.storage.set(StorageKey.MATRIX_SELECTED_NODE,j.server).catch(et=>logger$4.log(et)),this.relayServer.resolve({server:j.server,timestamp:j.timestamp,localTimestamp:new Date().getTime()}),{server:j.server,timestamp:j.timestamp}}async getBeaconInfo($){return axios$1.get(`https://${$}/_synapse/client/beacon/info`).then(j=>({region:j.data.region,known_servers:j.data.known_servers,timestamp:Math.floor(j.data.timestamp)}))}async tryJoinRooms($,j=1){try{await(await this.client.promise).joinRooms($)}catch(et){j<=10&&et.errcode==="M_FORBIDDEN"?(logger$4.log("Retrying to join...",et),setTimeout(async()=>{await this.tryJoinRooms($,j+1)},200)):logger$4.log(`Failed to join after ${j} tries.`,et)}}async start(){logger$4.log("start","starting client"),logger$4.log("start","connecting to server");const $=await this.getRelayServer(),j=MatrixClient.create({baseUrl:`https://${$.server}`,storage:this.storage});if(this.initialListener=async at=>{this.initialEvent&&this.initialEvent.timestamp&&at&&at.timestamp?this.initialEvent.timestamp{let st;at.content.members.length===1&&(st=at.content.members[0]),await this.tryJoinRooms(at.content.roomId),st&&(await this.updateRelayServer(st),await this.updatePeerRoom(st,at.content.roomId))}),!$.timestamp)throw new Error("No timestamp received from relay server");const et=Math.floor($.timestamp),tt=`login:${Math.floor(et/(5*60))}`;logger$4.log("start",`login ${tt}, ${await this.getPublicKeyHash()} on ${$.server}`);const rt=blake2b$1.hash(encode_1(tt),32),nt=this.keyPair.secretKey??this.keyPair.privateKey,it=ed25519.sign(nt,rt);try{await j.start({id:await this.getPublicKeyHash(),password:`ed:${toHex$1(it)}:${await this.getPublicKey()}`,deviceId:toHex$1(this.keyPair.publicKey)})}catch{if(logger$4.error("start","Could not log in, retrying"),await this.reset(),!this.selectedRegion)throw new Error("No region selected.");if(this.loginCounter<=(this.ENABLED_RELAY_SERVERS[this.selectedRegion]??[]).length){this.loginCounter++,this.start();return}else throw logger$4.error("start","Tried to log in to every known beacon node, but no login was successful."),new Error("Could not connect to any beacon nodes. Try again later.")}logger$4.log("start","login successful, client is ready"),this.client.resolve(j)}async stop(){logger$4.log("stop","stopping client"),this.client.isResolved()&&await(await this.client.promise).stop().catch($=>logger$4.error($)),await this.reset()}async reset(){logger$4.log("reset","resetting connection"),await this.storage.delete(StorageKey.MATRIX_PEER_ROOM_IDS).catch($=>logger$4.log($)),await this.storage.delete(StorageKey.MATRIX_PRESERVED_STATE).catch($=>logger$4.log($)),await this.storage.delete(StorageKey.MATRIX_SELECTED_NODE).catch($=>logger$4.log($)),this.relayServer=void 0,this.client=new ExposedPromise,this.initialEvent=void 0,this.initialListener=void 0}async listenForEncryptedMessage($,j){if(this.activeListeners.has($))return;logger$4.log("listenForEncryptedMessage",`start listening for encrypted messages from publicKey ${$}`);const et=await this.createCryptoBoxServer($,this.keyPair),tt=async it=>{if(this.isTextMessage(it.content)&&await this.isSender(it,$)){let at;await this.updateRelayServer(it.content.message.sender),await this.updatePeerRoom(it.content.message.sender,it.content.roomId);try{at=Buffer$g.from(it.content.message.content,"hex")}catch{}if(at&&at.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const st=await decryptCryptoboxPayload(at,et.receive);logger$4.log("listenForEncryptedMessage",`received a message from ${$}`,st),j(st)}catch{}}};this.activeListeners.set($,tt),(await this.client.promise).subscribe(MatrixClientEventType.MESSAGE,tt);const rt=this.initialEvent;rt&&rt.timestamp&&new Date().getTime()-rt.timestamp<5*60*1e3?(logger$4.log("listenForEncryptedMessage","Handling previous event"),await tt(rt)):logger$4.log("listenForEncryptedMessage","No previous event found");const nt=this.initialListener;nt&&(await this.client.promise).unsubscribe(MatrixClientEventType.MESSAGE,nt),this.initialListener=void 0,this.initialEvent=void 0}async unsubscribeFromEncryptedMessage($){const j=this.activeListeners.get($);j&&((await this.client.promise).unsubscribe(MatrixClientEventType.MESSAGE,j),this.activeListeners.delete($))}async unsubscribeFromEncryptedMessages(){(await this.client.promise).unsubscribeAll(MatrixClientEventType.MESSAGE),this.activeListeners.clear()}async sendMessage($,j){const et=await this.createCryptoBoxClient(j.publicKey,this.keyPair),tt=await getHexHash(Buffer$g.from(j.publicKey,"hex")),rt=recipientString(tt,j.relayServer),nt=await this.getRelevantRoom(rt),it=await encryptCryptoboxPayload($,et.send);logger$4.log("sendMessage","sending encrypted message",j.publicKey,nt,$),(await this.client.promise).sendTextMessage(nt,it).catch(async at=>{if(at.errcode==="M_FORBIDDEN"){logger$4.log("sendMessage","M_FORBIDDEN",nt,at),await this.deleteRoomIdFromRooms(nt);const st=await this.getRelevantRoom(rt);logger$4.log("sendMessage","Old room deleted, new room created",st),(await this.client.promise).sendTextMessage(st,it).catch(async ot=>{logger$4.log("sendMessage","inner error",st,ot)})}else logger$4.log("sendMessage","unexpected error",at)})}async updatePeerRoom($,j){logger$4.log("updatePeerRoom",$,j);const et=$.split(":");if(et.length<2||!et[0].startsWith("@"))throw new Error("Invalid sender");const tt=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS),rt=tt[$];rt===j&&logger$4.debug("updatePeerRoom","rooms are the same, not updating"),logger$4.debug("updatePeerRoom","current room",rt,"new room",j),rt&&rt[1]&&(logger$4.log("updatePeerRoom",`adding room "${rt[1]}" to ignored array`),this.ignoredRooms.push(rt[1])),tt[$]=j,await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,tt)}async deleteRoomIdFromRooms($){const j=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS),et=Object.entries(j).filter(tt=>tt[1]!==$).reduce((tt,rt)=>({...tt,[rt[0]]:rt[1]}),{});await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,et),this.ignoredRooms.push($)}async listenForChannelOpening($){logger$4.debug("listenForChannelOpening"),(await this.client.promise).subscribe(MatrixClientEventType.MESSAGE,async j=>{if(this.isTextMessage(j.content)&&await this.isChannelOpenMessage(j.content)){logger$4.log("listenForChannelOpening","channel opening received, trying to decrypt",JSON.stringify(j)),await this.updateRelayServer(j.content.message.sender),await this.updatePeerRoom(j.content.message.sender,j.content.roomId);const et=j.content.message.content.split(":"),tt=Buffer$g.from(et[et.length-1],"hex");if(tt.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const rt=JSON.parse(await openCryptobox(tt,this.keyPair.publicKey,this.keyPair.secretKey));logger$4.log("listenForChannelOpening","channel opening received and decrypted",JSON.stringify(rt)),$({...rt,senderId:await getSenderId(rt.publicKey)})}catch{}}})}async waitForJoin($,j=0){const et=await(await this.client.promise).getRoomById($);if(logger$4.log("waitForJoin",`Currently ${et.members.length} members, we need at least 2`),!(et.members.length>=2)){if(j<=200)return logger$4.log(`Waiting for join... Try: ${j}`),new Promise(tt=>{setTimeout(()=>{tt(this.waitForJoin($,j+1))},100*(j>50?10:1))});throw new Error(`No one joined after ${j} tries.`)}}async sendPairingResponse($){logger$4.log("sendPairingResponse");const j=await getHexHash(Buffer$g.from($.publicKey,"hex")),et=recipientString(j,$.relayServer),tt=await(await this.client.promise).createTrustedPrivateRoom(et);logger$4.debug("sendPairingResponse",`Connecting to room "${tt}"`),await this.updatePeerRoom(et,tt),await this.waitForJoin(tt),logger$4.debug("sendPairingResponse","Successfully joined room.");const rt=typeof $.version>"u"?await this.getPublicKey():JSON.stringify(await this.getPairingResponseInfo($));logger$4.debug("sendPairingResponse","Sending pairing response",rt);const nt=await this.encryptMessageAsymmetric($.publicKey,rt),it=["@channel-open",et,nt].join(":");(await this.client.promise).sendTextMessage(tt,it).catch(async at=>{if(at.errcode==="M_FORBIDDEN"){logger$4.log("sendPairingResponse","M_FORBIDDEN",tt,at),await this.deleteRoomIdFromRooms(tt);const st=await this.getRelevantRoom(et);logger$4.log("sendPairingResponse","Old room deleted, new room created",st),(await this.client.promise).sendTextMessage(st,it).catch(async ot=>{logger$4.log("sendPairingResponse","inner error",st,ot)})}else logger$4.log("sendPairingResponse","unexpected error",at)})}isTextMessage($){return $.message.type===MatrixMessageType.TEXT}async updateRelayServer($){logger$4.log("updateRelayServer",$);const j=$.split(":");if(j.length<2||!j[0].startsWith("@"))throw new Error("Invalid sender");const et=j.shift(),tt=j.join(":"),rt=localStorage.getItem("beacon:communication-peers-dapp")?new PeerManager(this.storage,StorageKey.TRANSPORT_P2P_PEERS_DAPP):new PeerManager(this.storage,StorageKey.TRANSPORT_P2P_PEERS_WALLET),it=(await rt.getPeers()).map(async at=>{`@${await getHexHash(Buffer$g.from(at.publicKey,"hex"))}`===et&&at.relayServer!==tt&&(at.relayServer=tt,await rt.addPeer(at))});await Promise.all(it)}async isChannelOpenMessage($){return $.message.content.startsWith(`@channel-open:@${await getHexHash(Buffer$g.from(await this.getPublicKey(),"hex"))}`)}async isSender($,j){return $.content.message.sender.startsWith(`@${await getHexHash(Buffer$g.from(j,"hex"))}`)}async getRelevantRoom($){const j=await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS);let et=j[$];if(!et){logger$4.log("getRelevantRoom",`No room found for peer ${$}, checking joined ones.`);const tt=await this.getRelevantJoinedRoom($);et=tt.id,j[$]=tt.id,await this.storage.set(StorageKey.MATRIX_PEER_ROOM_IDS,j)}return logger$4.log("getRelevantRoom",`Using room ${et}`),et}async getRelevantJoinedRoom($){const j=await(await this.client.promise).joinedRooms;logger$4.log("checking joined rooms",j,$);const et=j.filter(rt=>!this.ignoredRooms.some(nt=>rt.id===nt)).filter(rt=>rt.members.some(nt=>nt===$));let tt;if(et.length===0||this.ignoredRooms.length>0){logger$4.log("getRelevantJoinedRoom","no relevant rooms found, creating new one");const rt=await(await this.client.promise).createTrustedPrivateRoom($);tt=await(await this.client.promise).getRoomById(rt),logger$4.log("getRelevantJoinedRoom",`waiting for other party to join room: ${tt.id}`),await this.waitForJoin(rt),logger$4.log("getRelevantJoinedRoom",`new room created and peer invited: ${tt.id}`)}else tt=et[0],logger$4.log("getRelevantJoinedRoom",`channel already open, reusing room ${tt.id}`);return tt}}const logger$3=new Logger("P2PTransport");class P2PTransport extends Transport$2{constructor($,j,et,tt,rt,nt,it){super($,new P2PCommunicationClient($,j,1,et,tt,nt,it),new PeerManager(et,rt));Yr(this,"type",TransportType.P2P)}static async isAvailable(){return Promise.resolve(!0)}async connect(){if(this._isConnected!==TransportStatus.NOT_CONNECTED)return;logger$3.log("connect"),this._isConnected=TransportStatus.CONNECTING,await this.client.start();const $=await this.getPeers();if($.length>0){logger$3.log("connect",`connecting to ${$.length} peers`);const j=$.map(async et=>this.listen(et.publicKey));Promise.all(j).catch(et=>logger$3.error("connect",et))}return await this.startOpenChannelListener(),super.connect()}async disconnect(){return await this.client.stop(),super.disconnect()}async startOpenChannelListener(){}async getPairingRequestInfo(){return this.client.getPairingRequestInfo()}async listen($){await this.client.listenForEncryptedMessage($,j=>{const et={origin:Origin.P2P,id:$};this.notifyListeners(j,et).catch(tt=>{throw tt})}).catch(j=>{throw j})}}function bind$4(_,a){return function(){return _.apply(a,arguments)}}const{toString:toString$2}=Object.prototype,{getPrototypeOf:getPrototypeOf$3}=Object,kindOf=(_=>a=>{const $=toString$2.call(a);return _[$]||(_[$]=$.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=_=>(_=_.toLowerCase(),a=>kindOf(a)===_),typeOfTest=_=>a=>typeof a===_,{isArray:isArray$3}=Array,isUndefined=typeOfTest("undefined");function isBuffer$1(_){return _!==null&&!isUndefined(_)&&_.constructor!==null&&!isUndefined(_.constructor)&&isFunction$2(_.constructor.isBuffer)&&_.constructor.isBuffer(_)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(_){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(_):a=_&&_.buffer&&isArrayBuffer(_.buffer),a}const isString$1=typeOfTest("string"),isFunction$2=typeOfTest("function"),isNumber=typeOfTest("number"),isObject$2=_=>_!==null&&typeof _=="object",isBoolean$1=_=>_===!0||_===!1,isPlainObject$4=_=>{if(kindOf(_)!=="object")return!1;const a=getPrototypeOf$3(_);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in _)&&!(Symbol.iterator in _)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=_=>isObject$2(_)&&isFunction$2(_.pipe),isFormData=_=>{let a;return _&&(typeof FormData=="function"&&_ instanceof FormData||isFunction$2(_.append)&&((a=kindOf(_))==="formdata"||a==="object"&&isFunction$2(_.toString)&&_.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$1=_=>_.trim?_.trim():_.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(_,a,{allOwnKeys:$=!1}={}){if(_===null||typeof _>"u")return;let j,et;if(typeof _!="object"&&(_=[_]),isArray$3(_))for(j=0,et=_.length;j0;)if(et=$[j],a===et.toLowerCase())return et;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=_=>!isUndefined(_)&&_!==_global;function merge(){const{caseless:_}=isContextDefined(this)&&this||{},a={},$=(j,et)=>{const tt=_&&findKey$1(a,et)||et;isPlainObject$4(a[tt])&&isPlainObject$4(j)?a[tt]=merge(a[tt],j):isPlainObject$4(j)?a[tt]=merge({},j):isArray$3(j)?a[tt]=j.slice():a[tt]=j};for(let j=0,et=arguments.length;j(forEach(a,(et,tt)=>{$&&isFunction$2(et)?_[tt]=bind$4(et,$):_[tt]=et},{allOwnKeys:j}),_),stripBOM=_=>(_.charCodeAt(0)===65279&&(_=_.slice(1)),_),inherits$9=(_,a,$,j)=>{_.prototype=Object.create(a.prototype,j),_.prototype.constructor=_,Object.defineProperty(_,"super",{value:a.prototype}),$&&Object.assign(_.prototype,$)},toFlatObject=(_,a,$,j)=>{let et,tt,rt;const nt={};if(a=a||{},_==null)return a;do{for(et=Object.getOwnPropertyNames(_),tt=et.length;tt-- >0;)rt=et[tt],(!j||j(rt,_,a))&&!nt[rt]&&(a[rt]=_[rt],nt[rt]=!0);_=$!==!1&&getPrototypeOf$3(_)}while(_&&(!$||$(_,a))&&_!==Object.prototype);return a},endsWith=(_,a,$)=>{_=String(_),($===void 0||$>_.length)&&($=_.length),$-=a.length;const j=_.indexOf(a,$);return j!==-1&&j===$},toArray$1=_=>{if(!_)return null;if(isArray$3(_))return _;let a=_.length;if(!isNumber(a))return null;const $=new Array(a);for(;a-- >0;)$[a]=_[a];return $},isTypedArray=(_=>a=>_&&a instanceof _)(typeof Uint8Array<"u"&&getPrototypeOf$3(Uint8Array)),forEachEntry=(_,a)=>{const j=(_&&_[Symbol.iterator]).call(_);let et;for(;(et=j.next())&&!et.done;){const tt=et.value;a.call(_,tt[0],tt[1])}},matchAll=(_,a)=>{let $;const j=[];for(;($=_.exec(a))!==null;)j.push($);return j},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=_=>_.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function($,j,et){return j.toUpperCase()+et}),hasOwnProperty=(({hasOwnProperty:_})=>(a,$)=>_.call(a,$))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(_,a)=>{const $=Object.getOwnPropertyDescriptors(_),j={};forEach($,(et,tt)=>{let rt;(rt=a(et,tt,_))!==!1&&(j[tt]=rt||et)}),Object.defineProperties(_,j)},freezeMethods=_=>{reduceDescriptors(_,(a,$)=>{if(isFunction$2(_)&&["arguments","caller","callee"].indexOf($)!==-1)return!1;const j=_[$];if(isFunction$2(j)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+$+"'")})}})},toObjectSet=(_,a)=>{const $={},j=et=>{et.forEach(tt=>{$[tt]=!0})};return isArray$3(_)?j(_):j(String(_).split(a)),$},noop$6=()=>{},toFiniteNumber=(_,a)=>_!=null&&Number.isFinite(_=+_)?_:a,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$1={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(_=16,a=ALPHABET$1.ALPHA_DIGIT)=>{let $="";const{length:j}=a;for(;_--;)$+=a[Math.random()*j|0];return $};function isSpecCompliantForm(_){return!!(_&&isFunction$2(_.append)&&_[Symbol.toStringTag]==="FormData"&&_[Symbol.iterator])}const toJSONObject=_=>{const a=new Array(10),$=(j,et)=>{if(isObject$2(j)){if(a.indexOf(j)>=0)return;if(!("toJSON"in j)){a[et]=j;const tt=isArray$3(j)?[]:{};return forEach(j,(rt,nt)=>{const it=$(rt,et+1);!isUndefined(it)&&(tt[nt]=it)}),a[et]=void 0,tt}}return j};return $(_,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable$1=_=>_&&(isObject$2(_)||isFunction$2(_))&&isFunction$2(_.then)&&isFunction$2(_.catch),utils$C={isArray:isArray$3,isArrayBuffer,isBuffer:isBuffer$1,isFormData,isArrayBufferView,isString:isString$1,isNumber,isBoolean:isBoolean$1,isObject:isObject$2,isPlainObject:isPlainObject$4,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate:isDate$1,isFile,isBlob,isRegExp,isFunction:isFunction$2,isStream,isURLSearchParams,isTypedArray,isFileList,forEach,merge,extend,trim:trim$1,stripBOM,inherits:inherits$9,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$1,forEachEntry,matchAll,isHTMLForm,hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$6,toFiniteNumber,findKey:findKey$1,global:_global,isContextDefined,ALPHABET:ALPHABET$1,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable:isThenable$1};function AxiosError(_,a,$,j,et){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=_,this.name="AxiosError",a&&(this.code=a),$&&(this.config=$),j&&(this.request=j),et&&(this.response=et)}utils$C.inherits(AxiosError,Error,{toJSON:function _(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$C.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const prototype$1=AxiosError.prototype,descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(_=>{descriptors[_]={value:_}});Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype$1,"isAxiosError",{value:!0});AxiosError.from=(_,a,$,j,et,tt)=>{const rt=Object.create(prototype$1);return utils$C.toFlatObject(_,rt,function(it){return it!==Error.prototype},nt=>nt!=="isAxiosError"),AxiosError.call(rt,_.message,a,$,j,et),rt.cause=_,rt.name=_.name,tt&&Object.assign(rt,tt),rt};const httpAdapter=null;function isVisitable(_){return utils$C.isPlainObject(_)||utils$C.isArray(_)}function removeBrackets(_){return utils$C.endsWith(_,"[]")?_.slice(0,-2):_}function renderKey(_,a,$){return _?_.concat(a).map(function(et,tt){return et=removeBrackets(et),!$&&tt?"["+et+"]":et}).join($?".":""):a}function isFlatArray(_){return utils$C.isArray(_)&&!_.some(isVisitable)}const predicates=utils$C.toFlatObject(utils$C,{},null,function _(a){return/^is[A-Z]/.test(a)});function toFormData(_,a,$){if(!utils$C.isObject(_))throw new TypeError("target must be an object");a=a||new FormData,$=utils$C.toFlatObject($,{metaTokens:!0,dots:!1,indexes:!1},!1,function(xt,Ct){return!utils$C.isUndefined(Ct[xt])});const j=$.metaTokens,et=$.visitor||st,tt=$.dots,rt=$.indexes,it=($.Blob||typeof Blob<"u"&&Blob)&&utils$C.isSpecCompliantForm(a);if(!utils$C.isFunction(et))throw new TypeError("visitor must be a function");function at(mt){if(mt===null)return"";if(utils$C.isDate(mt))return mt.toISOString();if(!it&&utils$C.isBlob(mt))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$C.isArrayBuffer(mt)||utils$C.isTypedArray(mt)?it&&typeof Blob=="function"?new Blob([mt]):Buffer$g.from(mt):mt}function st(mt,xt,Ct){let Pt=mt;if(mt&&!Ct&&typeof mt=="object"){if(utils$C.endsWith(xt,"{}"))xt=j?xt:xt.slice(0,-2),mt=JSON.stringify(mt);else if(utils$C.isArray(mt)&&isFlatArray(mt)||(utils$C.isFileList(mt)||utils$C.endsWith(xt,"[]"))&&(Pt=utils$C.toArray(mt)))return xt=removeBrackets(xt),Pt.forEach(function(kt,Lt){!(utils$C.isUndefined(kt)||kt===null)&&a.append(rt===!0?renderKey([xt],Lt,tt):rt===null?xt:xt+"[]",at(kt))}),!1}return isVisitable(mt)?!0:(a.append(renderKey(Ct,xt,tt),at(mt)),!1)}const ot=[],ut=Object.assign(predicates,{defaultVisitor:st,convertValue:at,isVisitable});function dt(mt,xt){if(!utils$C.isUndefined(mt)){if(ot.indexOf(mt)!==-1)throw Error("Circular reference detected in "+xt.join("."));ot.push(mt),utils$C.forEach(mt,function(Pt,Tt){(!(utils$C.isUndefined(Pt)||Pt===null)&&et.call(a,Pt,utils$C.isString(Tt)?Tt.trim():Tt,xt,ut))===!0&&dt(Pt,xt?xt.concat(Tt):[Tt])}),ot.pop()}}if(!utils$C.isObject(_))throw new TypeError("data must be an object");return dt(_),a}function encode$5(_){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(_).replace(/[!'()~]|%20|%00/g,function(j){return a[j]})}function AxiosURLSearchParams(_,a){this._pairs=[],_&&toFormData(_,this,a)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function _(a,$){this._pairs.push([a,$])};prototype.toString=function _(a){const $=a?function(j){return a.call(this,j,encode$5)}:encode$5;return this._pairs.map(function(et){return $(et[0])+"="+$(et[1])},"").join("&")};function encode$4(_){return encodeURIComponent(_).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(_,a,$){if(!a)return _;const j=$&&$.encode||encode$4,et=$&&$.serialize;let tt;if(et?tt=et(a,$):tt=utils$C.isURLSearchParams(a)?a.toString():new AxiosURLSearchParams(a,$).toString(j),tt){const rt=_.indexOf("#");rt!==-1&&(_=_.slice(0,rt)),_+=(_.indexOf("?")===-1?"?":"&")+tt}return _}class InterceptorManager{constructor(){this.handlers=[]}use(a,$,j){return this.handlers.push({fulfilled:a,rejected:$,synchronous:j?j.synchronous:!1,runWhen:j?j.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){utils$C.forEach(this.handlers,function(j){j!==null&&a(j)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$1=typeof Blob<"u"?Blob:null,platform$1={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",hasStandardBrowserEnv=(_=>hasBrowserEnv&&["ReactNative","NativeScript","NS"].indexOf(_)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$B=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,origin},Symbol.toStringTag,{value:"Module"})),platform={...utils$B,...platform$1};function toURLEncodedForm(_,a){return toFormData(_,new platform.classes.URLSearchParams,Object.assign({visitor:function($,j,et,tt){return platform.isNode&&utils$C.isBuffer($)?(this.append(j,$.toString("base64")),!1):tt.defaultVisitor.apply(this,arguments)}},a))}function parsePropPath(_){return utils$C.matchAll(/\w+|\[(\w*)]/g,_).map(a=>a[0]==="[]"?"":a[1]||a[0])}function arrayToObject(_){const a={},$=Object.keys(_);let j;const et=$.length;let tt;for(j=0;j=$.length;return rt=!rt&&utils$C.isArray(et)?et.length:rt,it?(utils$C.hasOwnProp(et,rt)?et[rt]=[et[rt],j]:et[rt]=j,!nt):((!et[rt]||!utils$C.isObject(et[rt]))&&(et[rt]=[]),a($,j,et[rt],tt)&&utils$C.isArray(et[rt])&&(et[rt]=arrayToObject(et[rt])),!nt)}if(utils$C.isFormData(_)&&utils$C.isFunction(_.entries)){const $={};return utils$C.forEachEntry(_,(j,et)=>{a(parsePropPath(j),et,$,0)}),$}return null}function stringifySafely(_,a,$){if(utils$C.isString(_))try{return(a||JSON.parse)(_),utils$C.trim(_)}catch(j){if(j.name!=="SyntaxError")throw j}return($||JSON.stringify)(_)}const defaults$1={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function _(a,$){const j=$.getContentType()||"",et=j.indexOf("application/json")>-1,tt=utils$C.isObject(a);if(tt&&utils$C.isHTMLForm(a)&&(a=new FormData(a)),utils$C.isFormData(a))return et?JSON.stringify(formDataToJSON(a)):a;if(utils$C.isArrayBuffer(a)||utils$C.isBuffer(a)||utils$C.isStream(a)||utils$C.isFile(a)||utils$C.isBlob(a)||utils$C.isReadableStream(a))return a;if(utils$C.isArrayBufferView(a))return a.buffer;if(utils$C.isURLSearchParams(a))return $.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let nt;if(tt){if(j.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(a,this.formSerializer).toString();if((nt=utils$C.isFileList(a))||j.indexOf("multipart/form-data")>-1){const it=this.env&&this.env.FormData;return toFormData(nt?{"files[]":a}:a,it&&new it,this.formSerializer)}}return tt||et?($.setContentType("application/json",!1),stringifySafely(a)):a}],transformResponse:[function _(a){const $=this.transitional||defaults$1.transitional,j=$&&$.forcedJSONParsing,et=this.responseType==="json";if(utils$C.isResponse(a)||utils$C.isReadableStream(a))return a;if(a&&utils$C.isString(a)&&(j&&!this.responseType||et)){const rt=!($&&$.silentJSONParsing)&&et;try{return JSON.parse(a)}catch(nt){if(rt)throw nt.name==="SyntaxError"?AxiosError.from(nt,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):nt}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function _(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$C.forEach(["delete","get","head","post","put","patch"],_=>{defaults$1.headers[_]={}});const ignoreDuplicateOf=utils$C.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=_=>{const a={};let $,j,et;return _&&_.split(` +`).forEach(function(rt){et=rt.indexOf(":"),$=rt.substring(0,et).trim().toLowerCase(),j=rt.substring(et+1).trim(),!(!$||a[$]&&ignoreDuplicateOf[$])&&($==="set-cookie"?a[$]?a[$].push(j):a[$]=[j]:a[$]=a[$]?a[$]+", "+j:j)}),a},$internals=Symbol("internals");function normalizeHeader(_){return _&&String(_).trim().toLowerCase()}function normalizeValue(_){return _===!1||_==null?_:utils$C.isArray(_)?_.map(normalizeValue):String(_)}function parseTokens(_){const a=Object.create(null),$=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let j;for(;j=$.exec(_);)a[j[1]]=j[2];return a}const isValidHeaderName=_=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_.trim());function matchHeaderValue(_,a,$,j,et){if(utils$C.isFunction(j))return j.call(this,a,$);if(et&&(a=$),!!utils$C.isString(a)){if(utils$C.isString(j))return a.indexOf(j)!==-1;if(utils$C.isRegExp(j))return j.test(a)}}function formatHeader(_){return _.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,$,j)=>$.toUpperCase()+j)}function buildAccessors(_,a){const $=utils$C.toCamelCase(" "+a);["get","set","has"].forEach(j=>{Object.defineProperty(_,j+$,{value:function(et,tt,rt){return this[j].call(this,a,et,tt,rt)},configurable:!0})})}class AxiosHeaders{constructor(a){a&&this.set(a)}set(a,$,j){const et=this;function tt(nt,it,at){const st=normalizeHeader(it);if(!st)throw new Error("header name must be a non-empty string");const ot=utils$C.findKey(et,st);(!ot||et[ot]===void 0||at===!0||at===void 0&&et[ot]!==!1)&&(et[ot||it]=normalizeValue(nt))}const rt=(nt,it)=>utils$C.forEach(nt,(at,st)=>tt(at,st,it));if(utils$C.isPlainObject(a)||a instanceof this.constructor)rt(a,$);else if(utils$C.isString(a)&&(a=a.trim())&&!isValidHeaderName(a))rt(parseHeaders(a),$);else if(utils$C.isHeaders(a))for(const[nt,it]of a.entries())tt(it,nt,j);else a!=null&&tt($,a,j);return this}get(a,$){if(a=normalizeHeader(a),a){const j=utils$C.findKey(this,a);if(j){const et=this[j];if(!$)return et;if($===!0)return parseTokens(et);if(utils$C.isFunction($))return $.call(this,et,j);if(utils$C.isRegExp($))return $.exec(et);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,$){if(a=normalizeHeader(a),a){const j=utils$C.findKey(this,a);return!!(j&&this[j]!==void 0&&(!$||matchHeaderValue(this,this[j],j,$)))}return!1}delete(a,$){const j=this;let et=!1;function tt(rt){if(rt=normalizeHeader(rt),rt){const nt=utils$C.findKey(j,rt);nt&&(!$||matchHeaderValue(j,j[nt],nt,$))&&(delete j[nt],et=!0)}}return utils$C.isArray(a)?a.forEach(tt):tt(a),et}clear(a){const $=Object.keys(this);let j=$.length,et=!1;for(;j--;){const tt=$[j];(!a||matchHeaderValue(this,this[tt],tt,a,!0))&&(delete this[tt],et=!0)}return et}normalize(a){const $=this,j={};return utils$C.forEach(this,(et,tt)=>{const rt=utils$C.findKey(j,tt);if(rt){$[rt]=normalizeValue(et),delete $[tt];return}const nt=a?formatHeader(tt):String(tt).trim();nt!==tt&&delete $[tt],$[nt]=normalizeValue(et),j[nt]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const $=Object.create(null);return utils$C.forEach(this,(j,et)=>{j!=null&&j!==!1&&($[et]=a&&utils$C.isArray(j)?j.join(", "):j)}),$}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,$])=>a+": "+$).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...$){const j=new this(a);return $.forEach(et=>j.set(et)),j}static accessor(a){const j=(this[$internals]=this[$internals]={accessors:{}}).accessors,et=this.prototype;function tt(rt){const nt=normalizeHeader(rt);j[nt]||(buildAccessors(et,rt),j[nt]=!0)}return utils$C.isArray(a)?a.forEach(tt):tt(a),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$C.reduceDescriptors(AxiosHeaders.prototype,({value:_},a)=>{let $=a[0].toUpperCase()+a.slice(1);return{get:()=>_,set(j){this[$]=j}}});utils$C.freezeMethods(AxiosHeaders);function transformData(_,a){const $=this||defaults$1,j=a||$,et=AxiosHeaders.from(j.headers);let tt=j.data;return utils$C.forEach(_,function(nt){tt=nt.call($,tt,et.normalize(),a?a.status:void 0)}),et.normalize(),tt}function isCancel(_){return!!(_&&_.__CANCEL__)}function CanceledError(_,a,$){AxiosError.call(this,_??"canceled",AxiosError.ERR_CANCELED,a,$),this.name="CanceledError"}utils$C.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(_,a,$){const j=$.config.validateStatus;!$.status||!j||j($.status)?_($):a(new AxiosError("Request failed with status code "+$.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor($.status/100)-4],$.config,$.request,$))}function parseProtocol(_){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_);return a&&a[1]||""}function speedometer(_,a){_=_||10;const $=new Array(_),j=new Array(_);let et=0,tt=0,rt;return a=a!==void 0?a:1e3,function(it){const at=Date.now(),st=j[tt];rt||(rt=at),$[et]=it,j[et]=at;let ot=tt,ut=0;for(;ot!==et;)ut+=$[ot++],ot=ot%_;if(et=(et+1)%_,et===tt&&(tt=(tt+1)%_),at-rtj)return et&&(clearTimeout(et),et=null),$=nt,_.apply(null,arguments);et||(et=setTimeout(()=>(et=null,$=Date.now(),_.apply(null,arguments)),j-(nt-$)))}}const progressEventReducer=(_,a,$=3)=>{let j=0;const et=speedometer(50,250);return throttle(tt=>{const rt=tt.loaded,nt=tt.lengthComputable?tt.total:void 0,it=rt-j,at=et(it),st=rt<=nt;j=rt;const ot={loaded:rt,total:nt,progress:nt?rt/nt:void 0,bytes:it,rate:at||void 0,estimated:at&&nt&&st?(nt-rt)/at:void 0,event:tt,lengthComputable:nt!=null};ot[a?"download":"upload"]=!0,_(ot)},$)},isURLSameOrigin=platform.hasStandardBrowserEnv?function _(){const a=/(msie|trident)/i.test(navigator.userAgent),$=document.createElement("a");let j;function et(tt){let rt=tt;return a&&($.setAttribute("href",rt),rt=$.href),$.setAttribute("href",rt),{href:$.href,protocol:$.protocol?$.protocol.replace(/:$/,""):"",host:$.host,search:$.search?$.search.replace(/^\?/,""):"",hash:$.hash?$.hash.replace(/^#/,""):"",hostname:$.hostname,port:$.port,pathname:$.pathname.charAt(0)==="/"?$.pathname:"/"+$.pathname}}return j=et(window.location.href),function(rt){const nt=utils$C.isString(rt)?et(rt):rt;return nt.protocol===j.protocol&&nt.host===j.host}}():function _(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(_,a,$,j,et,tt){const rt=[_+"="+encodeURIComponent(a)];utils$C.isNumber($)&&rt.push("expires="+new Date($).toGMTString()),utils$C.isString(j)&&rt.push("path="+j),utils$C.isString(et)&&rt.push("domain="+et),tt===!0&&rt.push("secure"),document.cookie=rt.join("; ")},read(_){const a=document.cookie.match(new RegExp("(^|;\\s*)("+_+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove(_){this.write(_,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(_){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_)}function combineURLs(_,a){return a?_.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):_}function buildFullPath(_,a){return _&&!isAbsoluteURL(a)?combineURLs(_,a):a}const headersToObject=_=>_ instanceof AxiosHeaders?{..._}:_;function mergeConfig(_,a){a=a||{};const $={};function j(at,st,ot){return utils$C.isPlainObject(at)&&utils$C.isPlainObject(st)?utils$C.merge.call({caseless:ot},at,st):utils$C.isPlainObject(st)?utils$C.merge({},st):utils$C.isArray(st)?st.slice():st}function et(at,st,ot){if(utils$C.isUndefined(st)){if(!utils$C.isUndefined(at))return j(void 0,at,ot)}else return j(at,st,ot)}function tt(at,st){if(!utils$C.isUndefined(st))return j(void 0,st)}function rt(at,st){if(utils$C.isUndefined(st)){if(!utils$C.isUndefined(at))return j(void 0,at)}else return j(void 0,st)}function nt(at,st,ot){if(ot in a)return j(at,st);if(ot in _)return j(void 0,at)}const it={url:tt,method:tt,data:tt,baseURL:rt,transformRequest:rt,transformResponse:rt,paramsSerializer:rt,timeout:rt,timeoutMessage:rt,withCredentials:rt,withXSRFToken:rt,adapter:rt,responseType:rt,xsrfCookieName:rt,xsrfHeaderName:rt,onUploadProgress:rt,onDownloadProgress:rt,decompress:rt,maxContentLength:rt,maxBodyLength:rt,beforeRedirect:rt,transport:rt,httpAgent:rt,httpsAgent:rt,cancelToken:rt,socketPath:rt,responseEncoding:rt,validateStatus:nt,headers:(at,st)=>et(headersToObject(at),headersToObject(st),!0)};return utils$C.forEach(Object.keys(Object.assign({},_,a)),function(st){const ot=it[st]||et,ut=ot(_[st],a[st],st);utils$C.isUndefined(ut)&&ot!==nt||($[st]=ut)}),$}const resolveConfig=_=>{const a=mergeConfig({},_);let{data:$,withXSRFToken:j,xsrfHeaderName:et,xsrfCookieName:tt,headers:rt,auth:nt}=a;a.headers=rt=AxiosHeaders.from(rt),a.url=buildURL(buildFullPath(a.baseURL,a.url),_.params,_.paramsSerializer),nt&&rt.set("Authorization","Basic "+btoa((nt.username||"")+":"+(nt.password?unescape(encodeURIComponent(nt.password)):"")));let it;if(utils$C.isFormData($)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)rt.setContentType(void 0);else if((it=rt.getContentType())!==!1){const[at,...st]=it?it.split(";").map(ot=>ot.trim()).filter(Boolean):[];rt.setContentType([at||"multipart/form-data",...st].join("; "))}}if(platform.hasStandardBrowserEnv&&(j&&utils$C.isFunction(j)&&(j=j(a)),j||j!==!1&&isURLSameOrigin(a.url))){const at=et&&tt&&cookies.read(tt);at&&rt.set(et,at)}return a},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(_){return new Promise(function($,j){const et=resolveConfig(_);let tt=et.data;const rt=AxiosHeaders.from(et.headers).normalize();let{responseType:nt}=et,it;function at(){et.cancelToken&&et.cancelToken.unsubscribe(it),et.signal&&et.signal.removeEventListener("abort",it)}let st=new XMLHttpRequest;st.open(et.method.toUpperCase(),et.url,!0),st.timeout=et.timeout;function ot(){if(!st)return;const dt=AxiosHeaders.from("getAllResponseHeaders"in st&&st.getAllResponseHeaders()),xt={data:!nt||nt==="text"||nt==="json"?st.responseText:st.response,status:st.status,statusText:st.statusText,headers:dt,config:_,request:st};settle(function(Pt){$(Pt),at()},function(Pt){j(Pt),at()},xt),st=null}"onloadend"in st?st.onloadend=ot:st.onreadystatechange=function(){!st||st.readyState!==4||st.status===0&&!(st.responseURL&&st.responseURL.indexOf("file:")===0)||setTimeout(ot)},st.onabort=function(){st&&(j(new AxiosError("Request aborted",AxiosError.ECONNABORTED,et,st)),st=null)},st.onerror=function(){j(new AxiosError("Network Error",AxiosError.ERR_NETWORK,et,st)),st=null},st.ontimeout=function(){let mt=et.timeout?"timeout of "+et.timeout+"ms exceeded":"timeout exceeded";const xt=et.transitional||transitionalDefaults;et.timeoutErrorMessage&&(mt=et.timeoutErrorMessage),j(new AxiosError(mt,xt.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,et,st)),st=null},tt===void 0&&rt.setContentType(null),"setRequestHeader"in st&&utils$C.forEach(rt.toJSON(),function(mt,xt){st.setRequestHeader(xt,mt)}),utils$C.isUndefined(et.withCredentials)||(st.withCredentials=!!et.withCredentials),nt&&nt!=="json"&&(st.responseType=et.responseType),typeof et.onDownloadProgress=="function"&&st.addEventListener("progress",progressEventReducer(et.onDownloadProgress,!0)),typeof et.onUploadProgress=="function"&&st.upload&&st.upload.addEventListener("progress",progressEventReducer(et.onUploadProgress)),(et.cancelToken||et.signal)&&(it=dt=>{st&&(j(!dt||dt.type?new CanceledError(null,_,st):dt),st.abort(),st=null)},et.cancelToken&&et.cancelToken.subscribe(it),et.signal&&(et.signal.aborted?it():et.signal.addEventListener("abort",it)));const ut=parseProtocol(et.url);if(ut&&platform.protocols.indexOf(ut)===-1){j(new AxiosError("Unsupported protocol "+ut+":",AxiosError.ERR_BAD_REQUEST,_));return}st.send(tt||null)})},composeSignals=(_,a)=>{let $=new AbortController,j;const et=function(it){if(!j){j=!0,rt();const at=it instanceof Error?it:this.reason;$.abort(at instanceof AxiosError?at:new CanceledError(at instanceof Error?at.message:at))}};let tt=a&&setTimeout(()=>{et(new AxiosError(`timeout ${a} of ms exceeded`,AxiosError.ETIMEDOUT))},a);const rt=()=>{_&&(tt&&clearTimeout(tt),tt=null,_.forEach(it=>{it&&(it.removeEventListener?it.removeEventListener("abort",et):it.unsubscribe(et))}),_=null)};_.forEach(it=>it&&it.addEventListener&&it.addEventListener("abort",et));const{signal:nt}=$;return nt.unsubscribe=rt,[nt,()=>{tt&&clearTimeout(tt),tt=null}]},streamChunk=function*(_,a){let $=_.byteLength;if(!a||${const tt=readBytes(_,a,et);let rt=0;return new ReadableStream({type:"bytes",async pull(nt){const{done:it,value:at}=await tt.next();if(it){nt.close(),j();return}let st=at.byteLength;$&&$(rt+=st),nt.enqueue(new Uint8Array(at))},cancel(nt){return j(nt),tt.return()}},{highWaterMark:2})},fetchProgressDecorator=(_,a)=>{const $=_!=null;return j=>setTimeout(()=>a({lengthComputable:$,total:_,loaded:j}))},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(_=>a=>_.encode(a))(new TextEncoder):async _=>new Uint8Array(await new Response(_).arrayBuffer())),supportsRequestStream=isReadableStreamSupported&&(()=>{let _=!1;const a=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return _=!0,"half"}}).headers.has("Content-Type");return _&&!a})(),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&!!(()=>{try{return utils$C.isReadableStream(new Response("").body)}catch{}})(),resolvers={stream:supportsResponseStream&&(_=>_.body)};isFetchSupported&&(_=>{["text","arrayBuffer","blob","formData","stream"].forEach(a=>{!resolvers[a]&&(resolvers[a]=utils$C.isFunction(_[a])?$=>$[a]():($,j)=>{throw new AxiosError(`Response type '${a}' is not supported`,AxiosError.ERR_NOT_SUPPORT,j)})})})(new Response);const getBodyLength=async _=>{if(_==null)return 0;if(utils$C.isBlob(_))return _.size;if(utils$C.isSpecCompliantForm(_))return(await new Request(_).arrayBuffer()).byteLength;if(utils$C.isArrayBufferView(_))return _.byteLength;if(utils$C.isURLSearchParams(_)&&(_=_+""),utils$C.isString(_))return(await encodeText(_)).byteLength},resolveBodyLength=async(_,a)=>{const $=utils$C.toFiniteNumber(_.getContentLength());return $??getBodyLength(a)},fetchAdapter=isFetchSupported&&(async _=>{let{url:a,method:$,data:j,signal:et,cancelToken:tt,timeout:rt,onDownloadProgress:nt,onUploadProgress:it,responseType:at,headers:st,withCredentials:ot="same-origin",fetchOptions:ut}=resolveConfig(_);at=at?(at+"").toLowerCase():"text";let[dt,mt]=et||tt||rt?composeSignals([et,tt],rt):[],xt,Ct;const Pt=()=>{!xt&&setTimeout(()=>{dt&&dt.unsubscribe()}),xt=!0};let Tt;try{if(it&&supportsRequestStream&&$!=="get"&&$!=="head"&&(Tt=await resolveBodyLength(st,j))!==0){let zt=new Request(a,{method:"POST",body:j,duplex:"half"}),jt;utils$C.isFormData(j)&&(jt=zt.headers.get("content-type"))&&st.setContentType(jt),zt.body&&(j=trackStream(zt.body,DEFAULT_CHUNK_SIZE,fetchProgressDecorator(Tt,progressEventReducer(it)),null,encodeText))}utils$C.isString(ot)||(ot=ot?"cors":"omit"),Ct=new Request(a,{...ut,signal:dt,method:$.toUpperCase(),headers:st.normalize().toJSON(),body:j,duplex:"half",withCredentials:ot});let kt=await fetch(Ct);const Lt=supportsResponseStream&&(at==="stream"||at==="response");if(supportsResponseStream&&(nt||Lt)){const zt={};["status","statusText","headers"].forEach(Mt=>{zt[Mt]=kt[Mt]});const jt=utils$C.toFiniteNumber(kt.headers.get("content-length"));kt=new Response(trackStream(kt.body,DEFAULT_CHUNK_SIZE,nt&&fetchProgressDecorator(jt,progressEventReducer(nt,!0)),Lt&&Pt,encodeText),zt)}at=at||"text";let Nt=await resolvers[utils$C.findKey(resolvers,at)||"text"](kt,_);return!Lt&&Pt(),mt&&mt(),await new Promise((zt,jt)=>{settle(zt,jt,{data:Nt,headers:AxiosHeaders.from(kt.headers),status:kt.status,statusText:kt.statusText,config:_,request:Ct})})}catch(kt){throw Pt(),kt&&kt.name==="TypeError"&&/fetch/i.test(kt.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,_,Ct),{cause:kt.cause||kt}):AxiosError.from(kt,kt&&kt.code,_,Ct)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$C.forEach(knownAdapters,(_,a)=>{if(_){try{Object.defineProperty(_,"name",{value:a})}catch{}Object.defineProperty(_,"adapterName",{value:a})}});const renderReason=_=>`- ${_}`,isResolvedHandle=_=>utils$C.isFunction(_)||_===null||_===!1,adapters={getAdapter:_=>{_=utils$C.isArray(_)?_:[_];const{length:a}=_;let $,j;const et={};for(let tt=0;tt`adapter ${nt} `+(it===!1?"is not supported by the environment":"is not available in the build"));let rt=a?tt.length>1?`since : `+tt.map(renderReason).join(` `):" "+renderReason(tt[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+rt,"ERR_NOT_SUPPORT")}return j},adapters:knownAdapters};function throwIfCancellationRequested(_){if(_.cancelToken&&_.cancelToken.throwIfRequested(),_.signal&&_.signal.aborted)throw new CanceledError(null,_)}function dispatchRequest(_){return throwIfCancellationRequested(_),_.headers=AxiosHeaders.from(_.headers),_.data=transformData.call(_,_.transformRequest),["post","put","patch"].indexOf(_.method)!==-1&&_.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(_.adapter||defaults$1.adapter)(_).then(function(j){return throwIfCancellationRequested(_),j.data=transformData.call(_,_.transformResponse,j),j.headers=AxiosHeaders.from(j.headers),j},function(j){return isCancel(j)||(throwIfCancellationRequested(_),j&&j.response&&(j.response.data=transformData.call(_,_.transformResponse,j.response),j.response.headers=AxiosHeaders.from(j.response.headers))),Promise.reject(j)})}const VERSION$2="1.7.2",validators$1={};["object","boolean","number","function","string","symbol"].forEach((_,a)=>{validators$1[_]=function(j){return typeof j===_||"a"+(a<1?"n ":" ")+_}});const deprecatedWarnings={};validators$1.transitional=function _(a,$,j){function et(tt,rt){return"[Axios v"+VERSION$2+"] Transitional option '"+tt+"'"+rt+(j?". "+j:"")}return(tt,rt,nt)=>{if(a===!1)throw new AxiosError(et(rt," has been removed"+($?" in "+$:"")),AxiosError.ERR_DEPRECATED);return $&&!deprecatedWarnings[rt]&&(deprecatedWarnings[rt]=!0,console.warn(et(rt," has been deprecated since v"+$+" and will be removed in the near future"))),a?a(tt,rt,nt):!0}};function assertOptions(_,a,$){if(typeof _!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const j=Object.keys(_);let et=j.length;for(;et-- >0;){const tt=j[et],rt=a[tt];if(rt){const nt=_[tt],it=nt===void 0||rt(nt,tt,_);if(it!==!0)throw new AxiosError("option "+tt+" must be "+it,AxiosError.ERR_BAD_OPTION_VALUE);continue}if($!==!0)throw new AxiosError("Unknown option "+tt,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(a){this.defaults=a,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(a,$){try{return await this._request(a,$)}catch(j){if(j instanceof Error){let et;Error.captureStackTrace?Error.captureStackTrace(et={}):et=new Error;const tt=et.stack?et.stack.replace(/^.+\n/,""):"";try{j.stack?tt&&!String(j.stack).endsWith(tt.replace(/^.+\n.+\n/,""))&&(j.stack+=` -`+tt):j.stack=tt}catch{}}throw j}}_request(a,$){typeof a=="string"?($=$||{},$.url=a):$=a||{},$=mergeConfig(this.defaults,$);const{transitional:j,paramsSerializer:et,headers:tt}=$;j!==void 0&&validator.assertOptions(j,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),et!=null&&(utils$r.isFunction(et)?$.paramsSerializer={serialize:et}:validator.assertOptions(et,{encode:validators.function,serialize:validators.function},!0)),$.method=($.method||this.defaults.method||"get").toLowerCase();let rt=tt&&utils$r.merge(tt.common,tt[$.method]);tt&&utils$r.forEach(["delete","get","head","post","put","patch","common"],bt=>{delete tt[bt]}),$.headers=AxiosHeaders.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(Et){typeof Et.runWhen=="function"&&Et.runWhen($)===!1||(it=it&&Et.synchronous,nt.unshift(Et.fulfilled,Et.rejected))});const ot=[];this.interceptors.response.forEach(function(Et){ot.push(Et.fulfilled,Et.rejected)});let st,at=0,ut;if(!it){const bt=[dispatchRequest.bind(this),void 0];for(bt.unshift.apply(bt,nt),bt.push.apply(bt,ot),ut=bt.length,st=Promise.resolve($);at{if(!j._listeners)return;let tt=j._listeners.length;for(;tt-- >0;)j._listeners[tt](et);j._listeners=null}),this.promise.then=et=>{let tt;const rt=new Promise(nt=>{j.subscribe(nt),tt=nt}).then(et);return rt.cancel=function(){j.unsubscribe(tt)},rt},a(function(tt,rt,nt){j.reason||(j.reason=new CanceledError(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const $=this._listeners.indexOf(a);$!==-1&&this._listeners.splice($,1)}static source(){let a;return{token:new CancelToken(function(et){a=et}),cancel:a}}}function spread(_){return function($){return _.apply(null,$)}}function isAxiosError(_){return utils$r.isObject(_)&&_.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([_,a])=>{HttpStatusCode[a]=_});function createInstance(_){const a=new Axios(_),$=bind$4(Axios.prototype.request,a);return utils$r.extend($,Axios.prototype,a,{allOwnKeys:!0}),utils$r.extend($,a,null,{allOwnKeys:!0}),$.create=function(et){return createInstance(mergeConfig(_,et))},$}const axios=createInstance(defaults$1);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION$2;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function _(a){return Promise.all(a)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=_=>formDataToJSON(utils$r.isHTMLForm(_)?new FormData(_):_);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;class WalletP2PTransport extends P2PTransport{constructor(a,$,j,et,tt,rt){super(a,$,j,et,StorageKey.TRANSPORT_P2P_PEERS_WALLET,tt,rt)}async addPeer(a,$=!0){await super.addPeer(a),$&&await this.client.sendPairingResponse(a)}}const logger$2=new Logger("IncomingRequestInterceptor");class IncomingRequestInterceptor{static async intercept(a){logger$2.log("INTERCEPTING REQUEST",a.message),a.message.version==="2"?IncomingRequestInterceptor.handleV2Message(a):a.message.version==="3"&&IncomingRequestInterceptor.handleV3Message(a)}static async getAppMetadata(a,$){const j=await a.getAppMetadata($);if(!j)throw new Error("AppMetadata not found");return j}static async handleV2Message(a){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=a;switch($.type){case BeaconMessageType.PermissionRequest:logger$2.log("PERMISSION REQUEST V*",$),$.appMetadata.beaconId&&!$.appMetadata.senderId&&($.appMetadata.senderId=$.appMetadata.beaconId,delete $.appMetadata.beaconId),await et.addAppMetadata($.appMetadata),tt($,j);break;case BeaconMessageType.OperationRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SignPayloadRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.BroadcastRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.ProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SimulatedProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SimulatedProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;default:logger$2.log("intercept","Message not handled"),assertNever$1()}}static async handleV3Message(a){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=a,rt=$,nt=rt.message;switch(nt.type){case BeaconMessageType.PermissionRequest:await et.addAppMetadata({...nt.blockchainData.appMetadata,senderId:$.senderId}),tt(rt,j);break;case BeaconMessageType.BlockchainRequest:{const it={...rt};tt(it,j)}break;default:logger$2.log("intercept","Message not handled"),assertNever$1()}}}function assertNever$1(_){throw new Error("Function not implemented.")}const logger$1=new Logger("OutgoingResponseInterceptor");class OutgoingResponseInterceptor{static async intercept(a){a.request.version==="2"?OutgoingResponseInterceptor.handleV2Message(a):a.request.version==="3"&&OutgoingResponseInterceptor.handleV3Message(a)}static async handleV3Message(a){const{message:$,appMetadataManager:j,interceptorCallback:et}=a,rt=$.message;logger$1.log("LOGGING OUTGOING V3",rt,j),et($)}static async handleV2Message(a){const{senderId:$,request:j,message:et,ownAppMetadata:tt,permissionManager:rt,appMetadataManager:nt,interceptorCallback:it}=a;switch(et.type){case BeaconMessageType.Error:{const ot={type:et.type,version:"2",senderId:$,id:et.id,errorType:et.errorType};if(et.errorType===BeaconErrorType.TRANSACTION_INVALID_ERROR&&et.errorData){const st=et.errorData;Array.isArray(st)&&st.every(at=>!!at.kind&&!!at.id)?ot.errorData=et.errorData:logger$1.warn("ErrorData provided is not in correct format. It needs to be an array of RPC errors. It will not be included in the message sent to the dApp")}it(ot);break}case BeaconMessageType.Acknowledge:{const ot={type:et.type,version:"2",senderId:$,id:et.id};it(ot);break}case BeaconMessageType.PermissionResponse:{const ot={senderId:$,version:"2",appMetadata:tt,...et};if(!ot.address&&!ot.publicKey)throw new Error("Address or PublicKey must be defined");const st=ot.publicKey,at=ot.address??await getAddressFromPublicKey(st);if(!isValidAddress(at))throw new Error(`Invalid address: "${at}"`);if(et.walletType==="abstracted_account"&&at.substring(0,3)!==CONTRACT_PREFIX)throw new Error(`Invalid abstracted account address "${at}", it should be a ${CONTRACT_PREFIX} address`);const ut=await nt.getAppMetadata(j.senderId);if(!ut)throw new Error("AppMetadata not found");const ht={accountIdentifier:await getAccountIdentifier(at,ot.network),senderId:j.senderId,appMetadata:ut,website:"",address:at,publicKey:st,network:ot.network,scopes:ot.scopes,connectedAt:new Date().getTime()};rt.addPermission(ht).catch(console.error),it(ot);break}case BeaconMessageType.OperationResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.SignPayloadResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.BroadcastResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.ProofOfEventChallengeResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;case BeaconMessageType.SimulatedProofOfEventChallengeResponse:{const ot={senderId:$,version:"2",...et};it(ot)}break;default:logger$1.log("intercept","Message not handled"),assertNever()}}}function assertNever(_){throw new Error("Function not implemented.")}const logger=new Logger("WalletClient");let WalletClient$1=class extends Client{constructor($){super({storage:$&&$.storage?$.storage:new LocalStorage,...$});Yr(this,"_isConnected",new ExposedPromise);Yr(this,"permissionManager");Yr(this,"appMetadataManager");Yr(this,"pendingRequests",[]);this.permissionManager=new PermissionManager(this.storage),this.appMetadataManager=new AppMetadataManager(this.storage)}get isConnected(){return this._isConnected.promise}async init(){const $=await this.keyPair,j=new WalletP2PTransport(this.name,$,this.storage,this.matrixNodes,this.iconUrl,this.appUrl);return super.init(j)}async connect($){return this.handleResponse=async(j,et)=>{if(j.version==="3"){const tt=j;if(tt.message.type===BeaconMessageType.Disconnect)return this.disconnect(tt.senderId);this.pendingRequests.some(rt=>rt[0].id===j.id)||(this.pendingRequests.push([tt,et]),await this.sendAcknowledgeResponse(tt,et),await IncomingRequestInterceptor.intercept({message:tt,connectionInfo:et,appMetadataManager:this.appMetadataManager,interceptorCallback:$}))}else{const tt=j;if(tt.type===BeaconMessageType.Disconnect)return this.disconnect(tt.senderId);this.pendingRequests.some(rt=>rt[0].id===j.id)||(this.pendingRequests.push([tt,et]),tt.version!=="1"&&await this.sendAcknowledgeResponse(tt,et),await IncomingRequestInterceptor.intercept({message:tt,connectionInfo:et,appMetadataManager:this.appMetadataManager,interceptorCallback:$}))}},this._connect()}async getRegisterPushChallenge($,j,et=NOTIFICATION_ORACLE_URL){const tt=(await axios.get(`${et}/challenge`)).data,rt=["Tezos Signed Message: ",tt.id,tt.timestamp,j,$].join(" "),nt=toHex$1(rt),it="0501"+nt.length.toString(16).padStart(8,"0")+nt;return{challenge:tt,payloadToSign:it}}async registerPush($,j,et,tt,rt,nt,it=NOTIFICATION_ORACLE_URL){const ot=await this.storage.get(StorageKey.PUSH_TOKENS),st=ot.find(ht=>ht.publicKey===tt&&ht.backendUrl===et);if(st)return st;const at=(await axios.post(`${it}/register`,{name:this.name,challenge:$,accountPublicKey:tt,signature:j,backendUrl:et,protocolIdentifier:rt,deviceId:nt})).data,ut={publicKey:tt,backendUrl:et,accessToken:at.accessToken,managementToken:at.managementToken};return ot.push(ut),await this.storage.set(StorageKey.PUSH_TOKENS,ot),ut}async _connect(){const $=await this.transport;$.connectionStatus===TransportStatus.NOT_CONNECTED&&(await $.connect(),$.addListener(async(j,et)=>{if(typeof j=="string"){const tt=await new Serializer().deserialize(j);this.handleResponse(tt,et)}}).catch(j=>logger.log("_connect",j)),this._isConnected.resolve(!0))}async respond($){logger.log("RESPONSE",$);const j=this.pendingRequests.find(et=>et[0].id===$.id);if(!j)throw new Error("No matching request found!");this.pendingRequests=this.pendingRequests.filter(et=>et[0].id!==$.id),await OutgoingResponseInterceptor.intercept({senderId:await getSenderId(await this.beaconId),request:j[0],message:$,ownAppMetadata:await this.getOwnAppMetadata(),permissionManager:this.permissionManager,appMetadataManager:this.appMetadataManager,interceptorCallback:async et=>{await this.respondToMessage(et,j[1])}})}async getAppMetadataList(){return this.appMetadataManager.getAppMetadataList()}async getAppMetadata($){return this.appMetadataManager.getAppMetadata($)}async removeAppMetadata($){return this.appMetadataManager.removeAppMetadata($)}async removeAllAppMetadata(){return this.appMetadataManager.removeAllAppMetadata()}async getPermissions(){return this.permissionManager.getPermissions()}async getPermission($){return this.permissionManager.getPermission($)}async removePermission($){return this.permissionManager.removePermission($)}async removeAllPermissions(){return this.permissionManager.removeAllPermissions()}async getPeerInfo($){const j=await getSenderId($.publicKey);return $ instanceof PostMessagePairingRequest?new ExtendedPostMessagePairingRequest($.id,$.name,$.publicKey,$.version,j):$ instanceof P2PPairingRequest?new ExtendedP2PPairingRequest($.id,$.name,$.publicKey,$.version,$.relayServer,j):$ instanceof ExtendedWalletConnectPairingRequest?new ExtendedWalletConnectPairingRequest($.id,$.name,$.publicKey,$.version,j,$.uri):{...$,senderId:j}}async addPeer($,j=!0){return(await this.transport).addPeer(await this.getPeerInfo($),j)}async removePeer($,j=!1){const et=(await this.transport).removePeer($);return await this.removePermissionsForPeers([$]),j&&await this.sendDisconnectToPeer($),et}async removeAllPeers($=!1){const j=await(await this.transport).getPeers(),et=(await this.transport).removeAllPeers();if(await this.removePermissionsForPeers(j),$){const tt=j.map(rt=>this.sendDisconnectToPeer(rt));await Promise.all(tt)}return et}async removePermissionsForPeers($){const j=await this.permissionManager.getPermissions(),et=$.map(nt=>nt.senderId),rt=j.filter(nt=>et.includes(nt.appMetadata.senderId)).map(nt=>nt.accountIdentifier);await this.permissionManager.removePermissions(rt)}async sendAcknowledgeResponse($,j){const et={id:$.id,type:BeaconMessageType.Acknowledge};await OutgoingResponseInterceptor.intercept({senderId:await getSenderId(await this.beaconId),request:$,message:et,ownAppMetadata:await this.getOwnAppMetadata(),permissionManager:this.permissionManager,appMetadataManager:this.appMetadataManager,interceptorCallback:async tt=>{await this.respondToMessage(tt,j)}})}async respondToMessage($,j){const et=await new Serializer().serialize($);if(j){const rt=(await this.getPeers()).find(nt=>nt.publicKey===j.id);await(await this.transport).send(et,rt)}else await(await this.transport).send(et)}async disconnect($){const j=await this.transport,tt=(await j.getPeers()).find(rt=>rt.senderId===$);tt&&await this.removePeer(tt),await j.disconnect()}};const WalletClient=new WalletClient$1({name:"Umami",iconUrl:"",appUrl:"https://umamiwallet.com/"});var KEY_PREFIX$2="persist:",FLUSH="persist/FLUSH",REHYDRATE="persist/REHYDRATE",PAUSE="persist/PAUSE",PERSIST="persist/PERSIST",PURGE="persist/PURGE",REGISTER="persist/REGISTER",DEFAULT_VERSION=-1;function _typeof$5(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function($){return typeof $}:_typeof$5=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$5(_)}function ownKeys$5(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$4(_){for(var a=1;a=0)&&Object.prototype.propertyIsEnumerable.call(_,j)&&($[j]=_[j])}return $}function _objectWithoutPropertiesLoose$2(_,a){if(_==null)return{};var $={},j=Object.keys(_),et,tt;for(tt=0;tt=0)&&($[et]=_[et]);return $}var DEFAULT_TIMEOUT=5e3;function persistReducer(_,a){var $=_.version!==void 0?_.version:DEFAULT_VERSION;_.debug;var j=_.stateReconciler===void 0?autoMergeLevel1:_.stateReconciler,et=_.getStoredState||getStoredState,tt=_.timeout!==void 0?_.timeout:DEFAULT_TIMEOUT,rt=null,nt=!1,it=!0,ot=function(at){return at._persist.rehydrated&&rt&&!it&&rt.update(at),at};return function(st,at){var ut=st||{},ht=ut._persist,bt=_objectWithoutProperties$1(ut,["_persist"]),Et=bt;if(at.type===PERSIST){var Ct=!1,Pt=function(Mt,Dt){Ct||(at.rehydrate(_.key,Mt,Dt),Ct=!0)};if(tt&&setTimeout(function(){!Ct&&Pt(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(_.key,'"')))},tt),it=!1,rt||(rt=createPersistoid(_)),ht)return _objectSpread$3({},a(Et,at),{_persist:ht});if(typeof at.rehydrate!="function"||typeof at.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return at.register(_.key),et(_).then(function(jt){var Mt=_.migrate||function(Dt,Ft){return Promise.resolve(Dt)};Mt(jt,$).then(function(Dt){Pt(Dt)},function(Dt){Pt(void 0,Dt)})},function(jt){Pt(void 0,jt)}),_objectSpread$3({},a(Et,at),{_persist:{version:$,rehydrated:!1}})}else{if(at.type===PURGE)return nt=!0,at.result(purgeStoredState(_)),_objectSpread$3({},a(Et,at),{_persist:ht});if(at.type===FLUSH)return at.result(rt&&rt.flush()),_objectSpread$3({},a(Et,at),{_persist:ht});if(at.type===PAUSE)it=!0;else if(at.type===REHYDRATE){if(nt)return _objectSpread$3({},Et,{_persist:_objectSpread$3({},ht,{rehydrated:!0})});if(at.key===_.key){var Tt=a(Et,at),It=at.payload,Lt=j!==!1&&It!==void 0?j(It,st,Tt,_):Tt,Nt=_objectSpread$3({},Lt,{_persist:_objectSpread$3({},ht,{rehydrated:!0})});return ot(Nt)}}}if(!ht)return a(st,at);var Ut=a(Et,at);return Ut===Et?st:ot(_objectSpread$3({},Ut,{_persist:ht}))}}function formatProdErrorMessage$1(_){return`Minified Redux error #${_}; visit https://redux.js.org/Errors?code=${_} for the full message or use the non-minified dev environment for full errors. `}var $$observable=typeof Symbol=="function"&&Symbol.observable||"@@observable",symbol_observable_default=$$observable,randomString$1=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString$1()}`,REPLACE:`@@redux/REPLACE${randomString$1()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString$1()}`},actionTypes_default=ActionTypes;function isPlainObject$3(_){if(typeof _!="object"||_===null)return!1;let a=_;for(;Object.getPrototypeOf(a)!==null;)a=Object.getPrototypeOf(a);return Object.getPrototypeOf(_)===a||Object.getPrototypeOf(_)===null}function createStore(_,a,$){if(typeof _!="function")throw new Error(formatProdErrorMessage$1(2));if(typeof a=="function"&&typeof $=="function"||typeof $=="function"&&typeof arguments[3]=="function")throw new Error(formatProdErrorMessage$1(0));if(typeof a=="function"&&typeof $>"u"&&($=a,a=void 0),typeof $<"u"){if(typeof $!="function")throw new Error(formatProdErrorMessage$1(1));return $(createStore)(_,a)}let j=_,et=a,tt=new Map,rt=tt,nt=0,it=!1;function ot(){rt===tt&&(rt=new Map,tt.forEach((Ct,Pt)=>{rt.set(Pt,Ct)}))}function st(){if(it)throw new Error(formatProdErrorMessage$1(3));return et}function at(Ct){if(typeof Ct!="function")throw new Error(formatProdErrorMessage$1(4));if(it)throw new Error(formatProdErrorMessage$1(5));let Pt=!0;ot();const Tt=nt++;return rt.set(Tt,Ct),function(){if(Pt){if(it)throw new Error(formatProdErrorMessage$1(6));Pt=!1,ot(),rt.delete(Tt),tt=null}}}function ut(Ct){if(!isPlainObject$3(Ct))throw new Error(formatProdErrorMessage$1(7));if(typeof Ct.type>"u")throw new Error(formatProdErrorMessage$1(8));if(typeof Ct.type!="string")throw new Error(formatProdErrorMessage$1(17));if(it)throw new Error(formatProdErrorMessage$1(9));try{it=!0,et=j(et,Ct)}finally{it=!1}return(tt=rt).forEach(Tt=>{Tt()}),Ct}function ht(Ct){if(typeof Ct!="function")throw new Error(formatProdErrorMessage$1(10));j=Ct,ut({type:actionTypes_default.REPLACE})}function bt(){const Ct=at;return{subscribe(Pt){if(typeof Pt!="object"||Pt===null)throw new Error(formatProdErrorMessage$1(11));function Tt(){const Lt=Pt;Lt.next&&Lt.next(st())}return Tt(),{unsubscribe:Ct(Tt)}},[symbol_observable_default](){return this}}}return ut({type:actionTypes_default.INIT}),{dispatch:ut,subscribe:at,getState:st,replaceReducer:ht,[symbol_observable_default]:bt}}function assertReducerShape(_){Object.keys(_).forEach(a=>{const $=_[a];if(typeof $(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(formatProdErrorMessage$1(12));if(typeof $(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(formatProdErrorMessage$1(13))})}function combineReducers(_){const a=Object.keys(_),$={};for(let tt=0;tt"u")throw nt&&nt.type,new Error(formatProdErrorMessage$1(14));ot[at]=bt,it=it||bt!==ht}return it=it||j.length!==Object.keys(rt).length,it?ot:rt}}function compose(..._){return _.length===0?a=>a:_.length===1?_[0]:_.reduce((a,$)=>(...j)=>a($(...j)))}function applyMiddleware(..._){return a=>($,j)=>{const et=a($,j);let tt=()=>{throw new Error(formatProdErrorMessage$1(15))};const rt={getState:et.getState,dispatch:(it,...ot)=>tt(it,...ot)},nt=_.map(it=>it(rt));return tt=compose(...nt)(et.dispatch),{...et,dispatch:tt}}}function isAction(_){return isPlainObject$3(_)&&"type"in _&&typeof _.type=="string"}function _toConsumableArray(_){return _arrayWithoutHoles(_)||_iterableToArray(_)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(_){if(Symbol.iterator in Object(_)||Object.prototype.toString.call(_)==="[object Arguments]")return Array.from(_)}function _arrayWithoutHoles(_){if(Array.isArray(_)){for(var a=0,$=new Array(_.length);a<_.length;a++)$[a]=_[a];return $}}function ownKeys$3(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$2(_){for(var a=1;a0&&arguments[0]!==void 0?arguments[0]:initialState$a,$=arguments.length>1?arguments[1]:void 0;switch($.type){case REGISTER:return _objectSpread$2({},a,{registry:[].concat(_toConsumableArray(a.registry),[$.key])});case REHYDRATE:var j=a.registry.indexOf($.key),et=_toConsumableArray(a.registry);return et.splice(j,1),_objectSpread$2({},a,{registry:et,bootstrapped:et.length===0});default:return a}};function persistStore(_,a,$){var j=createStore(persistorReducer,initialState$a,void 0),et=function(it){j.dispatch({type:REGISTER,key:it})},tt=function(it,ot,st){var at={type:REHYDRATE,payload:ot,err:st,key:it};_.dispatch(at),j.dispatch(at)},rt=_objectSpread$2({},j,{purge:function(){var it=[];return _.dispatch({type:PURGE,result:function(st){it.push(st)}}),Promise.all(it)},flush:function(){var it=[];return _.dispatch({type:FLUSH,result:function(st){it.push(st)}}),Promise.all(it)},pause:function(){_.dispatch({type:PAUSE})},persist:function(){_.dispatch({type:PERSIST,register:et,rehydrate:tt})}});return rt.persist(),rt}var NOTHING$1=Symbol.for("immer-nothing"),DRAFTABLE$1=Symbol.for("immer-draftable"),DRAFT_STATE$1=Symbol.for("immer-state");function die$1(_,...a){throw new Error(`[Immer] minified error nr: ${_}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$2=Object.getPrototypeOf;function isDraft$1(_){return!!_&&!!_[DRAFT_STATE$1]}function isDraftable$1(_){var a;return _?isPlainObject$2(_)||Array.isArray(_)||!!_[DRAFTABLE$1]||!!((a=_.constructor)!=null&&a[DRAFTABLE$1])||isMap$1(_)||isSet$1(_):!1}var objectCtorString$1=Object.prototype.constructor.toString();function isPlainObject$2(_){if(!_||typeof _!="object")return!1;const a=getPrototypeOf$2(_);if(a===null)return!0;const $=Object.hasOwnProperty.call(a,"constructor")&&a.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString$1}function each$1(_,a){getArchtype$1(_)===0?Reflect.ownKeys(_).forEach($=>{a($,_[$],_)}):_.forEach(($,j)=>a(j,$,_))}function getArchtype$1(_){const a=_[DRAFT_STATE$1];return a?a.type_:Array.isArray(_)?1:isMap$1(_)?2:isSet$1(_)?3:0}function has$1(_,a){return getArchtype$1(_)===2?_.has(a):Object.prototype.hasOwnProperty.call(_,a)}function set$1(_,a,$){const j=getArchtype$1(_);j===2?_.set(a,$):j===3?_.add($):_[a]=$}function is$1(_,a){return _===a?_!==0||1/_===1/a:_!==_&&a!==a}function isMap$1(_){return _ instanceof Map}function isSet$1(_){return _ instanceof Set}function latest$1(_){return _.copy_||_.base_}function shallowCopy$1(_,a){if(isMap$1(_))return new Map(_);if(isSet$1(_))return new Set(_);if(Array.isArray(_))return Array.prototype.slice.call(_);if(!a&&isPlainObject$2(_))return getPrototypeOf$2(_)?{..._}:Object.assign(Object.create(null),_);const $=Object.getOwnPropertyDescriptors(_);delete $[DRAFT_STATE$1];let j=Reflect.ownKeys($);for(let et=0;et1&&(_.set=_.add=_.clear=_.delete=dontMutateFrozenCollections$1),Object.freeze(_),a&&Object.entries(_).forEach(([$,j])=>freeze$1(j,!0))),_}function dontMutateFrozenCollections$1(){die$1(2)}function isFrozen$1(_){return Object.isFrozen(_)}var plugins$1={};function getPlugin$1(_){const a=plugins$1[_];return a||die$1(0,_),a}var currentScope$1;function getCurrentScope$1(){return currentScope$1}function createScope$1(_,a){return{drafts_:[],parent_:_,immer_:a,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope$1(_,a){a&&(getPlugin$1("Patches"),_.patches_=[],_.inversePatches_=[],_.patchListener_=a)}function revokeScope$1(_){leaveScope$1(_),_.drafts_.forEach(revokeDraft$1),_.drafts_=null}function leaveScope$1(_){_===currentScope$1&&(currentScope$1=_.parent_)}function enterScope$1(_){return currentScope$1=createScope$1(currentScope$1,_)}function revokeDraft$1(_){const a=_[DRAFT_STATE$1];a.type_===0||a.type_===1?a.revoke_():a.revoked_=!0}function processResult$1(_,a){a.unfinalizedDrafts_=a.drafts_.length;const $=a.drafts_[0];return _!==void 0&&_!==$?($[DRAFT_STATE$1].modified_&&(revokeScope$1(a),die$1(4)),isDraftable$1(_)&&(_=finalize$1(a,_),a.parent_||maybeFreeze$1(a,_)),a.patches_&&getPlugin$1("Patches").generateReplacementPatches_($[DRAFT_STATE$1].base_,_,a.patches_,a.inversePatches_)):_=finalize$1(a,$,[]),revokeScope$1(a),a.patches_&&a.patchListener_(a.patches_,a.inversePatches_),_!==NOTHING$1?_:void 0}function finalize$1(_,a,$){if(isFrozen$1(a))return a;const j=a[DRAFT_STATE$1];if(!j)return each$1(a,(et,tt)=>finalizeProperty$1(_,j,a,et,tt,$)),a;if(j.scope_!==_)return a;if(!j.modified_)return maybeFreeze$1(_,j.base_,!0),j.base_;if(!j.finalized_){j.finalized_=!0,j.scope_.unfinalizedDrafts_--;const et=j.copy_;let tt=et,rt=!1;j.type_===3&&(tt=new Set(et),et.clear(),rt=!0),each$1(tt,(nt,it)=>finalizeProperty$1(_,j,et,nt,it,$,rt)),maybeFreeze$1(_,et,!1),$&&_.patches_&&getPlugin$1("Patches").generatePatches_(j,$,_.patches_,_.inversePatches_)}return j.copy_}function finalizeProperty$1(_,a,$,j,et,tt,rt){if(isDraft$1(et)){const nt=tt&&a&&a.type_!==3&&!has$1(a.assigned_,j)?tt.concat(j):void 0,it=finalize$1(_,et,nt);if(set$1($,j,it),isDraft$1(it))_.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable$1(et)&&!isFrozen$1(et)){if(!_.immer_.autoFreeze_&&_.unfinalizedDrafts_<1)return;finalize$1(_,et),(!a||!a.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze$1(_,et)}}function maybeFreeze$1(_,a,$=!1){!_.parent_&&_.immer_.autoFreeze_&&_.canAutoFreeze_&&freeze$1(a,$)}function createProxyProxy$1(_,a){const $=Array.isArray(_),j={type_:$?1:0,scope_:a?a.scope_:getCurrentScope$1(),modified_:!1,finalized_:!1,assigned_:{},parent_:a,base_:_,draft_:null,copy_:null,revoke_:null,isManual_:!1};let et=j,tt=objectTraps$1;$&&(et=[j],tt=arrayTraps$1);const{revoke:rt,proxy:nt}=Proxy.revocable(et,tt);return j.draft_=nt,j.revoke_=rt,nt}var objectTraps$1={get(_,a){if(a===DRAFT_STATE$1)return _;const $=latest$1(_);if(!has$1($,a))return readPropFromProto$1(_,$,a);const j=$[a];return _.finalized_||!isDraftable$1(j)?j:j===peek$1(_.base_,a)?(prepareCopy$1(_),_.copy_[a]=createProxy$1(j,_)):j},has(_,a){return a in latest$1(_)},ownKeys(_){return Reflect.ownKeys(latest$1(_))},set(_,a,$){const j=getDescriptorFromProto$1(latest$1(_),a);if(j!=null&&j.set)return j.set.call(_.draft_,$),!0;if(!_.modified_){const et=peek$1(latest$1(_),a),tt=et==null?void 0:et[DRAFT_STATE$1];if(tt&&tt.base_===$)return _.copy_[a]=$,_.assigned_[a]=!1,!0;if(is$1($,et)&&($!==void 0||has$1(_.base_,a)))return!0;prepareCopy$1(_),markChanged$1(_)}return _.copy_[a]===$&&($!==void 0||a in _.copy_)||Number.isNaN($)&&Number.isNaN(_.copy_[a])||(_.copy_[a]=$,_.assigned_[a]=!0),!0},deleteProperty(_,a){return peek$1(_.base_,a)!==void 0||a in _.base_?(_.assigned_[a]=!1,prepareCopy$1(_),markChanged$1(_)):delete _.assigned_[a],_.copy_&&delete _.copy_[a],!0},getOwnPropertyDescriptor(_,a){const $=latest$1(_),j=Reflect.getOwnPropertyDescriptor($,a);return j&&{writable:!0,configurable:_.type_!==1||a!=="length",enumerable:j.enumerable,value:$[a]}},defineProperty(){die$1(11)},getPrototypeOf(_){return getPrototypeOf$2(_.base_)},setPrototypeOf(){die$1(12)}},arrayTraps$1={};each$1(objectTraps$1,(_,a)=>{arrayTraps$1[_]=function(){return arguments[0]=arguments[0][0],a.apply(this,arguments)}});arrayTraps$1.deleteProperty=function(_,a){return arrayTraps$1.set.call(this,_,a,void 0)};arrayTraps$1.set=function(_,a,$){return objectTraps$1.set.call(this,_[0],a,$,_[0])};function peek$1(_,a){const $=_[DRAFT_STATE$1];return($?latest$1($):_)[a]}function readPropFromProto$1(_,a,$){var et;const j=getDescriptorFromProto$1(a,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(_.draft_):void 0}function getDescriptorFromProto$1(_,a){if(!(a in _))return;let $=getPrototypeOf$2(_);for(;$;){const j=Object.getOwnPropertyDescriptor($,a);if(j)return j;$=getPrototypeOf$2($)}}function markChanged$1(_){_.modified_||(_.modified_=!0,_.parent_&&markChanged$1(_.parent_))}function prepareCopy$1(_){_.copy_||(_.copy_=shallowCopy$1(_.base_,_.scope_.immer_.useStrictShallowCopy_))}var Immer2$1=class{constructor(a){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=($,j,et)=>{if(typeof $=="function"&&typeof j!="function"){const rt=j;j=$;const nt=this;return function(ot=rt,...st){return nt.produce(ot,at=>j.call(this,at,...st))}}typeof j!="function"&&die$1(6),et!==void 0&&typeof et!="function"&&die$1(7);let tt;if(isDraftable$1($)){const rt=enterScope$1(this),nt=createProxy$1($,void 0);let it=!0;try{tt=j(nt),it=!1}finally{it?revokeScope$1(rt):leaveScope$1(rt)}return usePatchesInScope$1(rt,et),processResult$1(tt,rt)}else if(!$||typeof $!="object"){if(tt=j($),tt===void 0&&(tt=$),tt===NOTHING$1&&(tt=void 0),this.autoFreeze_&&freeze$1(tt,!0),et){const rt=[],nt=[];getPlugin$1("Patches").generateReplacementPatches_($,tt,rt,nt),et(rt,nt)}return tt}else die$1(1,$)},this.produceWithPatches=($,j)=>{if(typeof $=="function")return(nt,...it)=>this.produceWithPatches(nt,ot=>$(ot,...it));let et,tt;return[this.produce($,j,(nt,it)=>{et=nt,tt=it}),et,tt]},typeof(a==null?void 0:a.autoFreeze)=="boolean"&&this.setAutoFreeze(a.autoFreeze),typeof(a==null?void 0:a.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(a.useStrictShallowCopy)}createDraft(a){isDraftable$1(a)||die$1(8),isDraft$1(a)&&(a=current$1(a));const $=enterScope$1(this),j=createProxy$1(a,void 0);return j[DRAFT_STATE$1].isManual_=!0,leaveScope$1($),j}finishDraft(a,$){const j=a&&a[DRAFT_STATE$1];(!j||!j.isManual_)&&die$1(9);const{scope_:et}=j;return usePatchesInScope$1(et,$),processResult$1(void 0,et)}setAutoFreeze(a){this.autoFreeze_=a}setUseStrictShallowCopy(a){this.useStrictShallowCopy_=a}applyPatches(a,$){let j;for(j=$.length-1;j>=0;j--){const tt=$[j];if(tt.path.length===0&&tt.op==="replace"){a=tt.value;break}}j>-1&&($=$.slice(j+1));const et=getPlugin$1("Patches").applyPatches_;return isDraft$1(a)?et(a,$):this.produce(a,tt=>et(tt,$))}};function createProxy$1(_,a){const $=isMap$1(_)?getPlugin$1("MapSet").proxyMap_(_,a):isSet$1(_)?getPlugin$1("MapSet").proxySet_(_,a):createProxyProxy$1(_,a);return(a?a.scope_:getCurrentScope$1()).drafts_.push($),$}function current$1(_){return isDraft$1(_)||die$1(10,_),currentImpl$1(_)}function currentImpl$1(_){if(!isDraftable$1(_)||isFrozen$1(_))return _;const a=_[DRAFT_STATE$1];let $;if(a){if(!a.modified_)return a.base_;a.finalized_=!0,$=shallowCopy$1(_,a.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy$1(_,!0);return each$1($,(j,et)=>{set$1($,j,currentImpl$1(et))}),a&&(a.finalized_=!1),$}var immer$1=new Immer2$1,produce$1=immer$1.produce;immer$1.produceWithPatches.bind(immer$1);immer$1.setAutoFreeze.bind(immer$1);immer$1.setUseStrictShallowCopy.bind(immer$1);immer$1.applyPatches.bind(immer$1);immer$1.createDraft.bind(immer$1);immer$1.finishDraft.bind(immer$1);function assertIsFunction(_,a=`expected a function, instead received ${typeof _}`){if(typeof _!="function")throw new TypeError(a)}function assertIsObject(_,a=`expected an object, instead received ${typeof _}`){if(typeof _!="object")throw new TypeError(a)}function assertIsArrayOfFunctions(_,a="expected all items to be functions, instead received the following types: "){if(!_.every($=>typeof $=="function")){const $=_.map(j=>typeof j=="function"?`function ${j.name||"unnamed"}()`:typeof j).join(", ");throw new TypeError(`${a}[${$}]`)}}var ensureIsArray=_=>Array.isArray(_)?_:[_];function getDependencies(_){const a=Array.isArray(_[0])?_[0]:_;return assertIsArrayOfFunctions(a,"createSelector expects all input-selectors to be functions, but received the following types: "),a}function collectInputSelectorResults(_,a){const $=[],{length:j}=_;for(let et=0;et{$=createCacheNode(),rt.resetResultsCount()},rt.resultsCount=()=>tt,rt.resetResultsCount=()=>{tt=0},rt}function createSelectorCreator(_,...a){const $=typeof _=="function"?{memoize:_,memoizeOptions:a}:_,j=(...et)=>{let tt=0,rt=0,nt,it={},ot=et.pop();typeof ot=="object"&&(it=ot,ot=et.pop()),assertIsFunction(ot,`createSelector expects an output function after the inputs, but received: [${typeof ot}]`);const st={...$,...it},{memoize:at,memoizeOptions:ut=[],argsMemoize:ht=weakMapMemoize,argsMemoizeOptions:bt=[],devModeChecks:Et={}}=st,Ct=ensureIsArray(ut),Pt=ensureIsArray(bt),Tt=getDependencies(et),It=at(function(){return tt++,ot.apply(null,arguments)},...Ct),Lt=ht(function(){rt++;const Ut=collectInputSelectorResults(Tt,arguments);return nt=It.apply(null,Ut),nt},...Pt);return Object.assign(Lt,{resultFunc:ot,memoizedResultFunc:It,dependencies:Tt,dependencyRecomputations:()=>rt,resetDependencyRecomputations:()=>{rt=0},lastResult:()=>nt,recomputations:()=>tt,resetRecomputations:()=>{tt=0},memoize:at,argsMemoize:ht})};return Object.assign(j,{withTypes:()=>j}),j}var createSelector=createSelectorCreator(weakMapMemoize),createStructuredSelector=Object.assign((_,a=createSelector)=>{assertIsObject(_,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof _}`);const $=Object.keys(_),j=$.map(tt=>_[tt]);return a(j,(...tt)=>tt.reduce((rt,nt,it)=>(rt[$[it]]=nt,rt),{}))},{withTypes:()=>createStructuredSelector});function createThunkMiddleware(_){return({dispatch:$,getState:j})=>et=>tt=>typeof tt=="function"?tt($,j,_):et(tt)}var thunk=createThunkMiddleware(),withExtraArgument=createThunkMiddleware,createDraftSafeSelectorCreator=(..._)=>{const a=createSelectorCreator(..._),$=Object.assign((...j)=>{const et=a(...j),tt=(rt,...nt)=>et(isDraft$1(rt)?current$1(rt):rt,...nt);return Object.assign(tt,et),tt},{withTypes:()=>$});return $};createDraftSafeSelectorCreator(weakMapMemoize);var composeWithDevTools=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?compose:compose.apply(null,arguments)},hasMatchFunction=_=>_&&typeof _.match=="function";function createAction(_,a){function $(...j){if(a){let et=a(...j);if(!et)throw new Error(formatProdErrorMessage(0));return{type:_,payload:et.payload,..."meta"in et&&{meta:et.meta},..."error"in et&&{error:et.error}}}return{type:_,payload:j[0]}}return $.toString=()=>`${_}`,$.type=_,$.match=j=>isAction(j)&&j.type===_,$}var Tuple=class ip extends Array{constructor(...a){super(...a),Object.setPrototypeOf(this,ip.prototype)}static get[Symbol.species](){return ip}concat(...a){return super.concat.apply(this,a)}prepend(...a){return a.length===1&&Array.isArray(a[0])?new ip(...a[0].concat(this)):new ip(...a.concat(this))}};function freezeDraftable(_){return isDraftable$1(_)?produce$1(_,()=>{}):_}function emplace(_,a,$){if(_.has(a)){let et=_.get(a);return $.update&&(et=$.update(et,a,_),_.set(a,et)),et}if(!$.insert)throw new Error(formatProdErrorMessage(10));const j=$.insert(a,_);return _.set(a,j),j}function isBoolean(_){return typeof _=="boolean"}var buildGetDefaultMiddleware=()=>function(a){const{thunk:$=!0,immutableCheck:j=!0,serializableCheck:et=!0,actionCreatorCheck:tt=!0}=a??{};let rt=new Tuple;return $&&(isBoolean($)?rt.push(thunk):rt.push(withExtraArgument($.extraArgument))),rt},SHOULD_AUTOBATCH="RTK_autoBatch",createQueueWithTimer=_=>a=>{setTimeout(a,_)},rAF=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:createQueueWithTimer(10),autoBatchEnhancer=(_={type:"raf"})=>a=>(...$)=>{const j=a(...$);let et=!0,tt=!1,rt=!1;const nt=new Set,it=_.type==="tick"?queueMicrotask:_.type==="raf"?rAF:_.type==="callback"?_.queueNotification:createQueueWithTimer(_.timeout),ot=()=>{rt=!1,tt&&(tt=!1,nt.forEach(st=>st()))};return Object.assign({},j,{subscribe(st){const at=()=>et&&st(),ut=j.subscribe(at);return nt.add(st),()=>{ut(),nt.delete(st)}},dispatch(st){var at;try{return et=!((at=st==null?void 0:st.meta)!=null&&at[SHOULD_AUTOBATCH]),tt=!et,tt&&(rt||(rt=!0,it(ot))),j.dispatch(st)}finally{et=!0}}})},buildGetDefaultEnhancers=_=>function($){const{autoBatch:j=!0}=$??{};let et=new Tuple(_);return j&&et.push(autoBatchEnhancer(typeof j=="object"?j:void 0)),et},IS_PRODUCTION=!0;function configureStore(_){const a=buildGetDefaultMiddleware(),{reducer:$=void 0,middleware:j,devTools:et=!0,preloadedState:tt=void 0,enhancers:rt=void 0}=_||{};let nt;if(typeof $=="function")nt=$;else if(isPlainObject$3($))nt=combineReducers($);else throw new Error(formatProdErrorMessage(1));let it;typeof j=="function"?it=j(a):it=a();let ot=compose;et&&(ot=composeWithDevTools({trace:!IS_PRODUCTION,...typeof et=="object"&&et}));const st=applyMiddleware(...it),at=buildGetDefaultEnhancers(st);let ut=typeof rt=="function"?rt(at):at();const ht=ot(...ut);return createStore(nt,tt,ht)}function executeReducerBuilderCallback(_){const a={},$=[];let j;const et={addCase(tt,rt){const nt=typeof tt=="string"?tt:tt.type;if(!nt)throw new Error(formatProdErrorMessage(28));if(nt in a)throw new Error(formatProdErrorMessage(29));return a[nt]=rt,et},addMatcher(tt,rt){return $.push({matcher:tt,reducer:rt}),et},addDefaultCase(tt){return j=tt,et}};return _(et),[a,$,j]}function isStateFunction(_){return typeof _=="function"}function createReducer(_,a){let[$,j,et]=executeReducerBuilderCallback(a),tt;if(isStateFunction(_))tt=()=>freezeDraftable(_());else{const nt=freezeDraftable(_);tt=()=>nt}function rt(nt=tt(),it){let ot=[$[it.type],...j.filter(({matcher:st})=>st(it)).map(({reducer:st})=>st)];return ot.filter(st=>!!st).length===0&&(ot=[et]),ot.reduce((st,at)=>{if(at)if(isDraft$1(st)){const ht=at(st,it);return ht===void 0?st:ht}else{if(isDraftable$1(st))return produce$1(st,ut=>at(ut,it));{const ut=at(st,it);if(ut===void 0){if(st===null)return st;throw new Error(formatProdErrorMessage(9))}return ut}}return st},nt)}return rt.getInitialState=tt,rt}var urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nanoid=(_=21)=>{let a="",$=_;for(;$--;)a+=urlAlphabet[Math.random()*64|0];return a},matches=(_,a)=>hasMatchFunction(_)?_.match(a):_(a);function isAnyOf(..._){return a=>_.some($=>matches($,a))}var commonProperties=["name","message","stack","code"],RejectWithValue=class{constructor(_,a){Yr(this,"_type");this.payload=_,this.meta=a}},FulfillWithMeta=class{constructor(_,a){Yr(this,"_type");this.payload=_,this.meta=a}},miniSerializeError=_=>{if(typeof _=="object"&&_!==null){const a={};for(const $ of commonProperties)typeof _[$]=="string"&&(a[$]=_[$]);return a}return{message:String(_)}},createAsyncThunk=(()=>{function _(a,$,j){const et=createAction(a+"/fulfilled",(it,ot,st,at)=>({payload:it,meta:{...at||{},arg:st,requestId:ot,requestStatus:"fulfilled"}})),tt=createAction(a+"/pending",(it,ot,st)=>({payload:void 0,meta:{...st||{},arg:ot,requestId:it,requestStatus:"pending"}})),rt=createAction(a+"/rejected",(it,ot,st,at,ut)=>({payload:at,error:(j&&j.serializeError||miniSerializeError)(it||"Rejected"),meta:{...ut||{},arg:st,requestId:ot,rejectedWithValue:!!at,requestStatus:"rejected",aborted:(it==null?void 0:it.name)==="AbortError",condition:(it==null?void 0:it.name)==="ConditionError"}}));function nt(it){return(ot,st,at)=>{const ut=j!=null&&j.idGenerator?j.idGenerator(it):nanoid(),ht=new AbortController;let bt,Et;function Ct(Tt){Et=Tt,ht.abort()}const Pt=async function(){var Lt,Nt;let Tt;try{let Ut=(Lt=j==null?void 0:j.condition)==null?void 0:Lt.call(j,it,{getState:st,extra:at});if(isThenable(Ut)&&(Ut=await Ut),Ut===!1||ht.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const jt=new Promise((Mt,Dt)=>{bt=()=>{Dt({name:"AbortError",message:Et||"Aborted"})},ht.signal.addEventListener("abort",bt)});ot(tt(ut,it,(Nt=j==null?void 0:j.getPendingMeta)==null?void 0:Nt.call(j,{requestId:ut,arg:it},{getState:st,extra:at}))),Tt=await Promise.race([jt,Promise.resolve($(it,{dispatch:ot,getState:st,extra:at,requestId:ut,signal:ht.signal,abort:Ct,rejectWithValue:(Mt,Dt)=>new RejectWithValue(Mt,Dt),fulfillWithValue:(Mt,Dt)=>new FulfillWithMeta(Mt,Dt)})).then(Mt=>{if(Mt instanceof RejectWithValue)throw Mt;return Mt instanceof FulfillWithMeta?et(Mt.payload,ut,it,Mt.meta):et(Mt,ut,it)})])}catch(Ut){Tt=Ut instanceof RejectWithValue?rt(null,ut,it,Ut.payload,Ut.meta):rt(Ut,ut,it)}finally{bt&&ht.signal.removeEventListener("abort",bt)}return j&&!j.dispatchConditionRejection&&rt.match(Tt)&&Tt.meta.condition||ot(Tt),Tt}();return Object.assign(Pt,{abort:Ct,requestId:ut,arg:it,unwrap(){return Pt.then(unwrapResult)}})}}return Object.assign(nt,{pending:tt,rejected:rt,fulfilled:et,settled:isAnyOf(rt,et),typePrefix:a})}return _.withTypes=()=>_,_})();function unwrapResult(_){if(_.meta&&_.meta.rejectedWithValue)throw _.payload;if(_.error)throw _.error;return _.payload}function isThenable(_){return _!==null&&typeof _=="object"&&typeof _.then=="function"}var asyncThunkSymbol=Symbol.for("rtk-slice-createasyncthunk");function getType(_,a){return`${_}/${a}`}function buildCreateSlice({creators:_}={}){var $;const a=($=_==null?void 0:_.asyncThunk)==null?void 0:$[asyncThunkSymbol];return function(et){const{name:tt,reducerPath:rt=tt}=et;if(!tt)throw new Error(formatProdErrorMessage(11));typeof process$1$1<"u";const nt=(typeof et.reducers=="function"?et.reducers(buildReducerCreators()):et.reducers)||{},it=Object.keys(nt),ot={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},st={addCase(It,Lt){const Nt=typeof It=="string"?It:It.type;if(!Nt)throw new Error(formatProdErrorMessage(12));if(Nt in ot.sliceCaseReducersByType)throw new Error(formatProdErrorMessage(13));return ot.sliceCaseReducersByType[Nt]=Lt,st},addMatcher(It,Lt){return ot.sliceMatchers.push({matcher:It,reducer:Lt}),st},exposeAction(It,Lt){return ot.actionCreators[It]=Lt,st},exposeCaseReducer(It,Lt){return ot.sliceCaseReducersByName[It]=Lt,st}};it.forEach(It=>{const Lt=nt[It],Nt={reducerName:It,type:getType(tt,It),createNotation:typeof et.reducers=="function"};isAsyncThunkSliceReducerDefinition(Lt)?handleThunkCaseReducerDefinition(Nt,Lt,st,a):handleNormalReducerDefinition(Nt,Lt,st)});function at(){const[It={},Lt=[],Nt=void 0]=typeof et.extraReducers=="function"?executeReducerBuilderCallback(et.extraReducers):[et.extraReducers],Ut={...It,...ot.sliceCaseReducersByType};return createReducer(et.initialState,jt=>{for(let Mt in Ut)jt.addCase(Mt,Ut[Mt]);for(let Mt of ot.sliceMatchers)jt.addMatcher(Mt.matcher,Mt.reducer);for(let Mt of Lt)jt.addMatcher(Mt.matcher,Mt.reducer);Nt&&jt.addDefaultCase(Nt)})}const ut=It=>It,ht=new Map;let bt;function Et(It,Lt){return bt||(bt=at()),bt(It,Lt)}function Ct(){return bt||(bt=at()),bt.getInitialState()}function Pt(It,Lt=!1){function Nt(jt){let Mt=jt[It];return typeof Mt>"u"&&Lt&&(Mt=Ct()),Mt}function Ut(jt=ut){const Mt=emplace(ht,Lt,{insert:()=>new WeakMap});return emplace(Mt,jt,{insert:()=>{const Dt={};for(const[Ft,Bt]of Object.entries(et.selectors??{}))Dt[Ft]=wrapSelector(Bt,jt,Ct,Lt);return Dt}})}return{reducerPath:It,getSelectors:Ut,get selectors(){return Ut(Nt)},selectSlice:Nt}}const Tt={name:tt,reducer:Et,actions:ot.actionCreators,caseReducers:ot.sliceCaseReducersByName,getInitialState:Ct,...Pt(rt),injectInto(It,{reducerPath:Lt,...Nt}={}){const Ut=Lt??rt;return It.inject({reducerPath:Ut,reducer:Et},Nt),{...Tt,...Pt(Ut,!0)}}};return Tt}}function wrapSelector(_,a,$,j){function et(tt,...rt){let nt=a(tt);return typeof nt>"u"&&j&&(nt=$()),_(nt,...rt)}return et.unwrapped=_,et}var createSlice=buildCreateSlice();function buildReducerCreators(){function _(a,$){return{_reducerDefinitionType:"asyncThunk",payloadCreator:a,...$}}return _.withTypes=()=>_,{reducer(a){return Object.assign({[a.name](...$){return a(...$)}}[a.name],{_reducerDefinitionType:"reducer"})},preparedReducer(a,$){return{_reducerDefinitionType:"reducerWithPrepare",prepare:a,reducer:$}},asyncThunk:_}}function handleNormalReducerDefinition({type:_,reducerName:a,createNotation:$},j,et){let tt,rt;if("reducer"in j){if($&&!isCaseReducerWithPrepareDefinition(j))throw new Error(formatProdErrorMessage(17));tt=j.reducer,rt=j.prepare}else tt=j;et.addCase(_,tt).exposeCaseReducer(a,tt).exposeAction(a,rt?createAction(_,rt):createAction(_))}function isAsyncThunkSliceReducerDefinition(_){return _._reducerDefinitionType==="asyncThunk"}function isCaseReducerWithPrepareDefinition(_){return _._reducerDefinitionType==="reducerWithPrepare"}function handleThunkCaseReducerDefinition({type:_,reducerName:a},$,j,et){if(!et)throw new Error(formatProdErrorMessage(18));const{payloadCreator:tt,fulfilled:rt,pending:nt,rejected:it,settled:ot,options:st}=$,at=et(_,tt,st);j.exposeAction(a,at),rt&&j.addCase(at.fulfilled,rt),nt&&j.addCase(at.pending,nt),it&&j.addCase(at.rejected,it),ot&&j.addMatcher(at.settled,ot),j.exposeCaseReducer(a,{fulfilled:rt||noop$5,pending:nt||noop$5,rejected:it||noop$5,settled:ot||noop$5})}function noop$5(){}var assertFunction=(_,a)=>{if(typeof _!="function")throw new Error(formatProdErrorMessage(32))},alm="listenerMiddleware",getListenerEntryPropsFrom=_=>{let{type:a,actionCreator:$,matcher:j,predicate:et,effect:tt}=_;if(a)et=createAction(a).match;else if($)a=$.type,et=$.match;else if(j)et=j;else if(!et)throw new Error(formatProdErrorMessage(21));return assertFunction(tt),{predicate:et,type:a,effect:tt}},createListenerEntry=Object.assign(_=>{const{type:a,predicate:$,effect:j}=getListenerEntryPropsFrom(_);return{id:nanoid(),effect:j,type:a,predicate:$,pending:new Set,unsubscribe:()=>{throw new Error(formatProdErrorMessage(22))}}},{withTypes:()=>createListenerEntry}),addListener=Object.assign(createAction(`${alm}/add`),{withTypes:()=>addListener});createAction(`${alm}/removeAll`);var removeListener=Object.assign(createAction(`${alm}/remove`),{withTypes:()=>removeListener});function formatProdErrorMessage(_){return`Minified Redux Toolkit error #${_}; visit https://redux-toolkit.js.org/Errors?code=${_} for the full message or use the non-minified dev environment for full errors. `}var createWebStorage$1={},getStorage$1={};getStorage$1.__esModule=!0;getStorage$1.default=getStorage;function _typeof$4(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$4=function($){return typeof $}:_typeof$4=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$4(_)}function noop$4(){}var noopStorage={getItem:noop$4,setItem:noop$4,removeItem:noop$4};function hasStorage(_){if((typeof self>"u"?"undefined":_typeof$4(self))!=="object"||!(_ in self))return!1;try{var a=self[_],$="redux-persist ".concat(_," test");a.setItem($,"test"),a.getItem($),a.removeItem($)}catch{return!1}return!0}function getStorage(_){var a="".concat(_,"Storage");return hasStorage(a)?self[a]:noopStorage}createWebStorage$1.__esModule=!0;createWebStorage$1.default=createWebStorage;var _getStorage=_interopRequireDefault$6(getStorage$1);function _interopRequireDefault$6(_){return _&&_.__esModule?_:{default:_}}function createWebStorage(_){var a=(0,_getStorage.default)(_);return{getItem:function(j){return new Promise(function(et,tt){et(a.getItem(j))})},setItem:function(j,et){return new Promise(function(tt,rt){tt(a.setItem(j,et))})},removeItem:function(j){return new Promise(function(et,tt){et(a.removeItem(j))})}}}var default_1=void 0,_createWebStorage=_interopRequireDefault$5(createWebStorage$1);function _interopRequireDefault$5(_){return _&&_.__esModule?_:{default:_}}var _default$5=(0,_createWebStorage.default)("local");default_1=_default$5;function createAsyncMigrate(_,a){return async($,j)=>{if(!$)return;const et=$._persist&&$._persist.version!==void 0?$._persist.version:DEFAULT_VERSION;if(et===j||et>j)return $;const tt=Object.keys(_).map(nt=>parseInt(nt)).filter(nt=>j>=nt&&nt>et).sort((nt,it)=>nt-it);let rt=$;for(const nt of tt)rt=await _[nt](rt);return rt}}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state");function die(_,...a){throw new Error(`[Immer] minified error nr: ${_}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$1=Object.getPrototypeOf;function isDraft(_){return!!_&&!!_[DRAFT_STATE]}function isDraftable(_){var a;return _?isPlainObject$1(_)||Array.isArray(_)||!!_[DRAFTABLE]||!!((a=_.constructor)!=null&&a[DRAFTABLE])||isMap(_)||isSet(_):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject$1(_){if(!_||typeof _!="object")return!1;const a=getPrototypeOf$1(_);if(a===null)return!0;const $=Object.hasOwnProperty.call(a,"constructor")&&a.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString}function each(_,a){getArchtype(_)===0?Reflect.ownKeys(_).forEach($=>{a($,_[$],_)}):_.forEach(($,j)=>a(j,$,_))}function getArchtype(_){const a=_[DRAFT_STATE];return a?a.type_:Array.isArray(_)?1:isMap(_)?2:isSet(_)?3:0}function has(_,a){return getArchtype(_)===2?_.has(a):Object.prototype.hasOwnProperty.call(_,a)}function set(_,a,$){const j=getArchtype(_);j===2?_.set(a,$):j===3?_.add($):_[a]=$}function is(_,a){return _===a?_!==0||1/_===1/a:_!==_&&a!==a}function isMap(_){return _ instanceof Map}function isSet(_){return _ instanceof Set}function latest(_){return _.copy_||_.base_}function shallowCopy(_,a){if(isMap(_))return new Map(_);if(isSet(_))return new Set(_);if(Array.isArray(_))return Array.prototype.slice.call(_);const $=isPlainObject$1(_);if(a===!0||a==="class_only"&&!$){const j=Object.getOwnPropertyDescriptors(_);delete j[DRAFT_STATE];let et=Reflect.ownKeys(j);for(let tt=0;tt1&&(_.set=_.add=_.clear=_.delete=dontMutateFrozenCollections),Object.freeze(_),a&&Object.entries(_).forEach(([$,j])=>freeze(j,!0))),_}function dontMutateFrozenCollections(){die(2)}function isFrozen(_){return Object.isFrozen(_)}var plugins={};function getPlugin(_){const a=plugins[_];return a||die(0,_),a}var currentScope;function getCurrentScope(){return currentScope}function createScope(_,a){return{drafts_:[],parent_:_,immer_:a,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(_,a){a&&(getPlugin("Patches"),_.patches_=[],_.inversePatches_=[],_.patchListener_=a)}function revokeScope(_){leaveScope(_),_.drafts_.forEach(revokeDraft),_.drafts_=null}function leaveScope(_){_===currentScope&&(currentScope=_.parent_)}function enterScope(_){return currentScope=createScope(currentScope,_)}function revokeDraft(_){const a=_[DRAFT_STATE];a.type_===0||a.type_===1?a.revoke_():a.revoked_=!0}function processResult(_,a){a.unfinalizedDrafts_=a.drafts_.length;const $=a.drafts_[0];return _!==void 0&&_!==$?($[DRAFT_STATE].modified_&&(revokeScope(a),die(4)),isDraftable(_)&&(_=finalize(a,_),a.parent_||maybeFreeze(a,_)),a.patches_&&getPlugin("Patches").generateReplacementPatches_($[DRAFT_STATE].base_,_,a.patches_,a.inversePatches_)):_=finalize(a,$,[]),revokeScope(a),a.patches_&&a.patchListener_(a.patches_,a.inversePatches_),_!==NOTHING?_:void 0}function finalize(_,a,$){if(isFrozen(a))return a;const j=a[DRAFT_STATE];if(!j)return each(a,(et,tt)=>finalizeProperty(_,j,a,et,tt,$)),a;if(j.scope_!==_)return a;if(!j.modified_)return maybeFreeze(_,j.base_,!0),j.base_;if(!j.finalized_){j.finalized_=!0,j.scope_.unfinalizedDrafts_--;const et=j.copy_;let tt=et,rt=!1;j.type_===3&&(tt=new Set(et),et.clear(),rt=!0),each(tt,(nt,it)=>finalizeProperty(_,j,et,nt,it,$,rt)),maybeFreeze(_,et,!1),$&&_.patches_&&getPlugin("Patches").generatePatches_(j,$,_.patches_,_.inversePatches_)}return j.copy_}function finalizeProperty(_,a,$,j,et,tt,rt){if(isDraft(et)){const nt=tt&&a&&a.type_!==3&&!has(a.assigned_,j)?tt.concat(j):void 0,it=finalize(_,et,nt);if(set($,j,it),isDraft(it))_.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable(et)&&!isFrozen(et)){if(!_.immer_.autoFreeze_&&_.unfinalizedDrafts_<1)return;finalize(_,et),(!a||!a.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze(_,et)}}function maybeFreeze(_,a,$=!1){!_.parent_&&_.immer_.autoFreeze_&&_.canAutoFreeze_&&freeze(a,$)}function createProxyProxy(_,a){const $=Array.isArray(_),j={type_:$?1:0,scope_:a?a.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:a,base_:_,draft_:null,copy_:null,revoke_:null,isManual_:!1};let et=j,tt=objectTraps;$&&(et=[j],tt=arrayTraps);const{revoke:rt,proxy:nt}=Proxy.revocable(et,tt);return j.draft_=nt,j.revoke_=rt,nt}var objectTraps={get(_,a){if(a===DRAFT_STATE)return _;const $=latest(_);if(!has($,a))return readPropFromProto(_,$,a);const j=$[a];return _.finalized_||!isDraftable(j)?j:j===peek(_.base_,a)?(prepareCopy(_),_.copy_[a]=createProxy(j,_)):j},has(_,a){return a in latest(_)},ownKeys(_){return Reflect.ownKeys(latest(_))},set(_,a,$){const j=getDescriptorFromProto(latest(_),a);if(j!=null&&j.set)return j.set.call(_.draft_,$),!0;if(!_.modified_){const et=peek(latest(_),a),tt=et==null?void 0:et[DRAFT_STATE];if(tt&&tt.base_===$)return _.copy_[a]=$,_.assigned_[a]=!1,!0;if(is($,et)&&($!==void 0||has(_.base_,a)))return!0;prepareCopy(_),markChanged(_)}return _.copy_[a]===$&&($!==void 0||a in _.copy_)||Number.isNaN($)&&Number.isNaN(_.copy_[a])||(_.copy_[a]=$,_.assigned_[a]=!0),!0},deleteProperty(_,a){return peek(_.base_,a)!==void 0||a in _.base_?(_.assigned_[a]=!1,prepareCopy(_),markChanged(_)):delete _.assigned_[a],_.copy_&&delete _.copy_[a],!0},getOwnPropertyDescriptor(_,a){const $=latest(_),j=Reflect.getOwnPropertyDescriptor($,a);return j&&{writable:!0,configurable:_.type_!==1||a!=="length",enumerable:j.enumerable,value:$[a]}},defineProperty(){die(11)},getPrototypeOf(_){return getPrototypeOf$1(_.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(_,a)=>{arrayTraps[_]=function(){return arguments[0]=arguments[0][0],a.apply(this,arguments)}});arrayTraps.deleteProperty=function(_,a){return arrayTraps.set.call(this,_,a,void 0)};arrayTraps.set=function(_,a,$){return objectTraps.set.call(this,_[0],a,$,_[0])};function peek(_,a){const $=_[DRAFT_STATE];return($?latest($):_)[a]}function readPropFromProto(_,a,$){var et;const j=getDescriptorFromProto(a,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(_.draft_):void 0}function getDescriptorFromProto(_,a){if(!(a in _))return;let $=getPrototypeOf$1(_);for(;$;){const j=Object.getOwnPropertyDescriptor($,a);if(j)return j;$=getPrototypeOf$1($)}}function markChanged(_){_.modified_||(_.modified_=!0,_.parent_&&markChanged(_.parent_))}function prepareCopy(_){_.copy_||(_.copy_=shallowCopy(_.base_,_.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(_){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(a,$,j)=>{if(typeof a=="function"&&typeof $!="function"){const tt=$;$=a;const rt=this;return function(it=tt,...ot){return rt.produce(it,st=>$.call(this,st,...ot))}}typeof $!="function"&&die(6),j!==void 0&&typeof j!="function"&&die(7);let et;if(isDraftable(a)){const tt=enterScope(this),rt=createProxy(a,void 0);let nt=!0;try{et=$(rt),nt=!1}finally{nt?revokeScope(tt):leaveScope(tt)}return usePatchesInScope(tt,j),processResult(et,tt)}else if(!a||typeof a!="object"){if(et=$(a),et===void 0&&(et=a),et===NOTHING&&(et=void 0),this.autoFreeze_&&freeze(et,!0),j){const tt=[],rt=[];getPlugin("Patches").generateReplacementPatches_(a,et,tt,rt),j(tt,rt)}return et}else die(1,a)},this.produceWithPatches=(a,$)=>{if(typeof a=="function")return(rt,...nt)=>this.produceWithPatches(rt,it=>a(it,...nt));let j,et;return[this.produce(a,$,(rt,nt)=>{j=rt,et=nt}),j,et]},typeof(_==null?void 0:_.autoFreeze)=="boolean"&&this.setAutoFreeze(_.autoFreeze),typeof(_==null?void 0:_.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(_.useStrictShallowCopy)}createDraft(_){isDraftable(_)||die(8),isDraft(_)&&(_=current(_));const a=enterScope(this),$=createProxy(_,void 0);return $[DRAFT_STATE].isManual_=!0,leaveScope(a),$}finishDraft(_,a){const $=_&&_[DRAFT_STATE];(!$||!$.isManual_)&&die(9);const{scope_:j}=$;return usePatchesInScope(j,a),processResult(void 0,j)}setAutoFreeze(_){this.autoFreeze_=_}setUseStrictShallowCopy(_){this.useStrictShallowCopy_=_}applyPatches(_,a){let $;for($=a.length-1;$>=0;$--){const et=a[$];if(et.path.length===0&&et.op==="replace"){_=et.value;break}}$>-1&&(a=a.slice($+1));const j=getPlugin("Patches").applyPatches_;return isDraft(_)?j(_,a):this.produce(_,et=>j(et,a))}};function createProxy(_,a){const $=isMap(_)?getPlugin("MapSet").proxyMap_(_,a):isSet(_)?getPlugin("MapSet").proxySet_(_,a):createProxyProxy(_,a);return(a?a.scope_:getCurrentScope()).drafts_.push($),$}function current(_){return isDraft(_)||die(10,_),currentImpl(_)}function currentImpl(_){if(!isDraftable(_)||isFrozen(_))return _;const a=_[DRAFT_STATE];let $;if(a){if(!a.modified_)return a.base_;a.finalized_=!0,$=shallowCopy(_,a.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy(_,!0);return each($,(j,et)=>{set($,j,currentImpl(et))}),a&&(a.finalized_=!1),$}var immer=new Immer2,produce=immer.produce;immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer);immer.setUseStrictShallowCopy.bind(immer);immer.applyPatches.bind(immer);immer.createDraft.bind(immer);immer.finishDraft.bind(immer);const initialState$9={html:"",seen:!0},announcementSlice=createSlice({name:"announcements",initialState:initialState$9,reducers:{reset:()=>initialState$9,setCurrent:(_,{payload:a})=>{a!==_.html&&(_.seen=!1),_.html=a},setSeen:_=>{_.seen=!0}}}),ERROR_MSG_INPUT="Input must be an string, Buffer or Uint8Array";function normalizeInput(_){let a;if(_ instanceof Uint8Array)a=_;else if(typeof _=="string")a=new TextEncoder().encode(_);else throw new Error(ERROR_MSG_INPUT);return a}function toHex(_){return Array.prototype.map.call(_,function(a){return(a<16?"0":"")+a.toString(16)}).join("")}function uint32ToHex(_){return(4294967296+_).toString(16).substring(1)}function debugPrint(_,a,$){let j=` +`+tt):j.stack=tt}catch{}}throw j}}_request(a,$){typeof a=="string"?($=$||{},$.url=a):$=a||{},$=mergeConfig(this.defaults,$);const{transitional:j,paramsSerializer:et,headers:tt}=$;j!==void 0&&validator.assertOptions(j,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),et!=null&&(utils$C.isFunction(et)?$.paramsSerializer={serialize:et}:validator.assertOptions(et,{encode:validators.function,serialize:validators.function},!0)),$.method=($.method||this.defaults.method||"get").toLowerCase();let rt=tt&&utils$C.merge(tt.common,tt[$.method]);tt&&utils$C.forEach(["delete","get","head","post","put","patch","common"],mt=>{delete tt[mt]}),$.headers=AxiosHeaders.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(xt){typeof xt.runWhen=="function"&&xt.runWhen($)===!1||(it=it&&xt.synchronous,nt.unshift(xt.fulfilled,xt.rejected))});const at=[];this.interceptors.response.forEach(function(xt){at.push(xt.fulfilled,xt.rejected)});let st,ot=0,ut;if(!it){const mt=[dispatchRequest.bind(this),void 0];for(mt.unshift.apply(mt,nt),mt.push.apply(mt,at),ut=mt.length,st=Promise.resolve($);ot{if(!j._listeners)return;let tt=j._listeners.length;for(;tt-- >0;)j._listeners[tt](et);j._listeners=null}),this.promise.then=et=>{let tt;const rt=new Promise(nt=>{j.subscribe(nt),tt=nt}).then(et);return rt.cancel=function(){j.unsubscribe(tt)},rt},a(function(tt,rt,nt){j.reason||(j.reason=new CanceledError(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const $=this._listeners.indexOf(a);$!==-1&&this._listeners.splice($,1)}static source(){let a;return{token:new CancelToken(function(et){a=et}),cancel:a}}}function spread(_){return function($){return _.apply(null,$)}}function isAxiosError(_){return utils$C.isObject(_)&&_.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([_,a])=>{HttpStatusCode[a]=_});function createInstance(_){const a=new Axios(_),$=bind$4(Axios.prototype.request,a);return utils$C.extend($,Axios.prototype,a,{allOwnKeys:!0}),utils$C.extend($,a,null,{allOwnKeys:!0}),$.create=function(et){return createInstance(mergeConfig(_,et))},$}const axios=createInstance(defaults$1);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION$2;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function _(a){return Promise.all(a)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=_=>formDataToJSON(utils$C.isHTMLForm(_)?new FormData(_):_);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;class WalletP2PTransport extends P2PTransport{constructor(a,$,j,et,tt,rt){super(a,$,j,et,StorageKey.TRANSPORT_P2P_PEERS_WALLET,tt,rt)}async addPeer(a,$=!0){await super.addPeer(a),$&&await this.client.sendPairingResponse(a)}}const logger$2=new Logger("IncomingRequestInterceptor");class IncomingRequestInterceptor{static async intercept(a){logger$2.log("INTERCEPTING REQUEST",a.message),a.message.version==="2"?IncomingRequestInterceptor.handleV2Message(a):a.message.version==="3"&&IncomingRequestInterceptor.handleV3Message(a)}static async getAppMetadata(a,$){const j=await a.getAppMetadata($);if(!j)throw new Error("AppMetadata not found");return j}static async handleV2Message(a){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=a;switch($.type){case BeaconMessageType.PermissionRequest:logger$2.log("PERMISSION REQUEST V*",$),$.appMetadata.beaconId&&!$.appMetadata.senderId&&($.appMetadata.senderId=$.appMetadata.beaconId,delete $.appMetadata.beaconId),await et.addAppMetadata($.appMetadata),tt($,j);break;case BeaconMessageType.OperationRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SignPayloadRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.BroadcastRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.ProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SimulatedProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;case BeaconMessageType.SimulatedProofOfEventChallengeRequest:{const nt={appMetadata:await IncomingRequestInterceptor.getAppMetadata(et,$.senderId),...$};tt(nt,j)}break;default:logger$2.log("intercept","Message not handled"),assertNever$1()}}static async handleV3Message(a){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=a,rt=$,nt=rt.message;switch(nt.type){case BeaconMessageType.PermissionRequest:await et.addAppMetadata({...nt.blockchainData.appMetadata,senderId:$.senderId}),tt(rt,j);break;case BeaconMessageType.BlockchainRequest:{const it={...rt};tt(it,j)}break;default:logger$2.log("intercept","Message not handled"),assertNever$1()}}}function assertNever$1(_){throw new Error("Function not implemented.")}const logger$1=new Logger("OutgoingResponseInterceptor");class OutgoingResponseInterceptor{static async intercept(a){a.request.version==="2"?OutgoingResponseInterceptor.handleV2Message(a):a.request.version==="3"&&OutgoingResponseInterceptor.handleV3Message(a)}static async handleV3Message(a){const{message:$,appMetadataManager:j,interceptorCallback:et}=a,rt=$.message;logger$1.log("LOGGING OUTGOING V3",rt,j),et($)}static async handleV2Message(a){const{senderId:$,request:j,message:et,ownAppMetadata:tt,permissionManager:rt,appMetadataManager:nt,interceptorCallback:it}=a;switch(et.type){case BeaconMessageType.Error:{const at={type:et.type,version:"2",senderId:$,id:et.id,errorType:et.errorType};if(et.errorType===BeaconErrorType.TRANSACTION_INVALID_ERROR&&et.errorData){const st=et.errorData;Array.isArray(st)&&st.every(ot=>!!ot.kind&&!!ot.id)?at.errorData=et.errorData:logger$1.warn("ErrorData provided is not in correct format. It needs to be an array of RPC errors. It will not be included in the message sent to the dApp")}it(at);break}case BeaconMessageType.Acknowledge:{const at={type:et.type,version:"2",senderId:$,id:et.id};it(at);break}case BeaconMessageType.PermissionResponse:{const at={senderId:$,version:"2",appMetadata:tt,...et};if(!at.address&&!at.publicKey)throw new Error("Address or PublicKey must be defined");const st=at.publicKey,ot=at.address??await getAddressFromPublicKey(st);if(!isValidAddress(ot))throw new Error(`Invalid address: "${ot}"`);if(et.walletType==="abstracted_account"&&ot.substring(0,3)!==CONTRACT_PREFIX)throw new Error(`Invalid abstracted account address "${ot}", it should be a ${CONTRACT_PREFIX} address`);const ut=await nt.getAppMetadata(j.senderId);if(!ut)throw new Error("AppMetadata not found");const dt={accountIdentifier:await getAccountIdentifier(ot,at.network),senderId:j.senderId,appMetadata:ut,website:"",address:ot,publicKey:st,network:at.network,scopes:at.scopes,connectedAt:new Date().getTime()};rt.addPermission(dt).catch(console.error),it(at);break}case BeaconMessageType.OperationResponse:{const at={senderId:$,version:"2",...et};it(at)}break;case BeaconMessageType.SignPayloadResponse:{const at={senderId:$,version:"2",...et};it(at)}break;case BeaconMessageType.BroadcastResponse:{const at={senderId:$,version:"2",...et};it(at)}break;case BeaconMessageType.ProofOfEventChallengeResponse:{const at={senderId:$,version:"2",...et};it(at)}break;case BeaconMessageType.SimulatedProofOfEventChallengeResponse:{const at={senderId:$,version:"2",...et};it(at)}break;default:logger$1.log("intercept","Message not handled"),assertNever()}}}function assertNever(_){throw new Error("Function not implemented.")}const logger=new Logger("WalletClient");let WalletClient$1=class extends Client{constructor($){super({storage:$&&$.storage?$.storage:new LocalStorage,...$});Yr(this,"_isConnected",new ExposedPromise);Yr(this,"permissionManager");Yr(this,"appMetadataManager");Yr(this,"pendingRequests",[]);this.permissionManager=new PermissionManager(this.storage),this.appMetadataManager=new AppMetadataManager(this.storage)}get isConnected(){return this._isConnected.promise}async init(){const $=await this.keyPair,j=new WalletP2PTransport(this.name,$,this.storage,this.matrixNodes,this.iconUrl,this.appUrl);return super.init(j)}async connect($){return this.handleResponse=async(j,et)=>{if(j.version==="3"){const tt=j;if(tt.message.type===BeaconMessageType.Disconnect)return this.disconnect(tt.senderId);this.pendingRequests.some(rt=>rt[0].id===j.id)||(this.pendingRequests.push([tt,et]),await this.sendAcknowledgeResponse(tt,et),await IncomingRequestInterceptor.intercept({message:tt,connectionInfo:et,appMetadataManager:this.appMetadataManager,interceptorCallback:$}))}else{const tt=j;if(tt.type===BeaconMessageType.Disconnect)return this.disconnect(tt.senderId);this.pendingRequests.some(rt=>rt[0].id===j.id)||(this.pendingRequests.push([tt,et]),tt.version!=="1"&&await this.sendAcknowledgeResponse(tt,et),await IncomingRequestInterceptor.intercept({message:tt,connectionInfo:et,appMetadataManager:this.appMetadataManager,interceptorCallback:$}))}},this._connect()}async getRegisterPushChallenge($,j,et=NOTIFICATION_ORACLE_URL){const tt=(await axios.get(`${et}/challenge`)).data,rt=["Tezos Signed Message: ",tt.id,tt.timestamp,j,$].join(" "),nt=toHex$1(rt),it="0501"+nt.length.toString(16).padStart(8,"0")+nt;return{challenge:tt,payloadToSign:it}}async registerPush($,j,et,tt,rt,nt,it=NOTIFICATION_ORACLE_URL){const at=await this.storage.get(StorageKey.PUSH_TOKENS),st=at.find(dt=>dt.publicKey===tt&&dt.backendUrl===et);if(st)return st;const ot=(await axios.post(`${it}/register`,{name:this.name,challenge:$,accountPublicKey:tt,signature:j,backendUrl:et,protocolIdentifier:rt,deviceId:nt})).data,ut={publicKey:tt,backendUrl:et,accessToken:ot.accessToken,managementToken:ot.managementToken};return at.push(ut),await this.storage.set(StorageKey.PUSH_TOKENS,at),ut}async _connect(){const $=await this.transport;$.connectionStatus===TransportStatus.NOT_CONNECTED&&(await $.connect(),$.addListener(async(j,et)=>{if(typeof j=="string"){const tt=await new Serializer().deserialize(j);this.handleResponse(tt,et)}}).catch(j=>logger.log("_connect",j)),this._isConnected.resolve(!0))}async respond($){logger.log("RESPONSE",$);const j=this.pendingRequests.find(et=>et[0].id===$.id);if(!j)throw new Error("No matching request found!");this.pendingRequests=this.pendingRequests.filter(et=>et[0].id!==$.id),await OutgoingResponseInterceptor.intercept({senderId:await getSenderId(await this.beaconId),request:j[0],message:$,ownAppMetadata:await this.getOwnAppMetadata(),permissionManager:this.permissionManager,appMetadataManager:this.appMetadataManager,interceptorCallback:async et=>{await this.respondToMessage(et,j[1])}})}async getAppMetadataList(){return this.appMetadataManager.getAppMetadataList()}async getAppMetadata($){return this.appMetadataManager.getAppMetadata($)}async removeAppMetadata($){return this.appMetadataManager.removeAppMetadata($)}async removeAllAppMetadata(){return this.appMetadataManager.removeAllAppMetadata()}async getPermissions(){return this.permissionManager.getPermissions()}async getPermission($){return this.permissionManager.getPermission($)}async removePermission($){return this.permissionManager.removePermission($)}async removeAllPermissions(){return this.permissionManager.removeAllPermissions()}async getPeerInfo($){const j=await getSenderId($.publicKey);return $ instanceof PostMessagePairingRequest?new ExtendedPostMessagePairingRequest($.id,$.name,$.publicKey,$.version,j):$ instanceof P2PPairingRequest?new ExtendedP2PPairingRequest($.id,$.name,$.publicKey,$.version,$.relayServer,j):$ instanceof ExtendedWalletConnectPairingRequest?new ExtendedWalletConnectPairingRequest($.id,$.name,$.publicKey,$.version,j,$.uri):{...$,senderId:j}}async addPeer($,j=!0){return(await this.transport).addPeer(await this.getPeerInfo($),j)}async removePeer($,j=!1){const et=(await this.transport).removePeer($);return await this.removePermissionsForPeers([$]),j&&await this.sendDisconnectToPeer($),et}async removeAllPeers($=!1){const j=await(await this.transport).getPeers(),et=(await this.transport).removeAllPeers();if(await this.removePermissionsForPeers(j),$){const tt=j.map(rt=>this.sendDisconnectToPeer(rt));await Promise.all(tt)}return et}async removePermissionsForPeers($){const j=await this.permissionManager.getPermissions(),et=$.map(nt=>nt.senderId),rt=j.filter(nt=>et.includes(nt.appMetadata.senderId)).map(nt=>nt.accountIdentifier);await this.permissionManager.removePermissions(rt)}async sendAcknowledgeResponse($,j){const et={id:$.id,type:BeaconMessageType.Acknowledge};await OutgoingResponseInterceptor.intercept({senderId:await getSenderId(await this.beaconId),request:$,message:et,ownAppMetadata:await this.getOwnAppMetadata(),permissionManager:this.permissionManager,appMetadataManager:this.appMetadataManager,interceptorCallback:async tt=>{await this.respondToMessage(tt,j)}})}async respondToMessage($,j){const et=await new Serializer().serialize($);if(j){const rt=(await this.getPeers()).find(nt=>nt.publicKey===j.id);await(await this.transport).send(et,rt)}else await(await this.transport).send(et)}async disconnect($){const j=await this.transport,tt=(await j.getPeers()).find(rt=>rt.senderId===$);tt&&await this.removePeer(tt),await j.disconnect()}};const WalletClient=new WalletClient$1({name:"Umami",iconUrl:"",appUrl:"https://umamiwallet.com/"});var KEY_PREFIX$2="persist:",FLUSH="persist/FLUSH",REHYDRATE="persist/REHYDRATE",PAUSE="persist/PAUSE",PERSIST="persist/PERSIST",PURGE="persist/PURGE",REGISTER="persist/REGISTER",DEFAULT_VERSION=-1;function _typeof$5(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function($){return typeof $}:_typeof$5=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$5(_)}function ownKeys$5(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$4(_){for(var a=1;a=0)&&Object.prototype.propertyIsEnumerable.call(_,j)&&($[j]=_[j])}return $}function _objectWithoutPropertiesLoose$2(_,a){if(_==null)return{};var $={},j=Object.keys(_),et,tt;for(tt=0;tt=0)&&($[et]=_[et]);return $}var DEFAULT_TIMEOUT=5e3;function persistReducer(_,a){var $=_.version!==void 0?_.version:DEFAULT_VERSION;_.debug;var j=_.stateReconciler===void 0?autoMergeLevel1:_.stateReconciler,et=_.getStoredState||getStoredState,tt=_.timeout!==void 0?_.timeout:DEFAULT_TIMEOUT,rt=null,nt=!1,it=!0,at=function(ot){return ot._persist.rehydrated&&rt&&!it&&rt.update(ot),ot};return function(st,ot){var ut=st||{},dt=ut._persist,mt=_objectWithoutProperties$1(ut,["_persist"]),xt=mt;if(ot.type===PERSIST){var Ct=!1,Pt=function(Mt,Dt){Ct||(ot.rehydrate(_.key,Mt,Dt),Ct=!0)};if(tt&&setTimeout(function(){!Ct&&Pt(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(_.key,'"')))},tt),it=!1,rt||(rt=createPersistoid(_)),dt)return _objectSpread$3({},a(xt,ot),{_persist:dt});if(typeof ot.rehydrate!="function"||typeof ot.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return ot.register(_.key),et(_).then(function(jt){var Mt=_.migrate||function(Dt,Ft){return Promise.resolve(Dt)};Mt(jt,$).then(function(Dt){Pt(Dt)},function(Dt){Pt(void 0,Dt)})},function(jt){Pt(void 0,jt)}),_objectSpread$3({},a(xt,ot),{_persist:{version:$,rehydrated:!1}})}else{if(ot.type===PURGE)return nt=!0,ot.result(purgeStoredState(_)),_objectSpread$3({},a(xt,ot),{_persist:dt});if(ot.type===FLUSH)return ot.result(rt&&rt.flush()),_objectSpread$3({},a(xt,ot),{_persist:dt});if(ot.type===PAUSE)it=!0;else if(ot.type===REHYDRATE){if(nt)return _objectSpread$3({},xt,{_persist:_objectSpread$3({},dt,{rehydrated:!0})});if(ot.key===_.key){var Tt=a(xt,ot),kt=ot.payload,Lt=j!==!1&&kt!==void 0?j(kt,st,Tt,_):Tt,Nt=_objectSpread$3({},Lt,{_persist:_objectSpread$3({},dt,{rehydrated:!0})});return at(Nt)}}}if(!dt)return a(st,ot);var zt=a(xt,ot);return zt===xt?st:at(_objectSpread$3({},zt,{_persist:dt}))}}function formatProdErrorMessage$1(_){return`Minified Redux error #${_}; visit https://redux.js.org/Errors?code=${_} for the full message or use the non-minified dev environment for full errors. `}var $$observable=typeof Symbol=="function"&&Symbol.observable||"@@observable",symbol_observable_default=$$observable,randomString$1=()=>Math.random().toString(36).substring(7).split("").join("."),ActionTypes={INIT:`@@redux/INIT${randomString$1()}`,REPLACE:`@@redux/REPLACE${randomString$1()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${randomString$1()}`},actionTypes_default=ActionTypes;function isPlainObject$3(_){if(typeof _!="object"||_===null)return!1;let a=_;for(;Object.getPrototypeOf(a)!==null;)a=Object.getPrototypeOf(a);return Object.getPrototypeOf(_)===a||Object.getPrototypeOf(_)===null}function createStore(_,a,$){if(typeof _!="function")throw new Error(formatProdErrorMessage$1(2));if(typeof a=="function"&&typeof $=="function"||typeof $=="function"&&typeof arguments[3]=="function")throw new Error(formatProdErrorMessage$1(0));if(typeof a=="function"&&typeof $>"u"&&($=a,a=void 0),typeof $<"u"){if(typeof $!="function")throw new Error(formatProdErrorMessage$1(1));return $(createStore)(_,a)}let j=_,et=a,tt=new Map,rt=tt,nt=0,it=!1;function at(){rt===tt&&(rt=new Map,tt.forEach((Ct,Pt)=>{rt.set(Pt,Ct)}))}function st(){if(it)throw new Error(formatProdErrorMessage$1(3));return et}function ot(Ct){if(typeof Ct!="function")throw new Error(formatProdErrorMessage$1(4));if(it)throw new Error(formatProdErrorMessage$1(5));let Pt=!0;at();const Tt=nt++;return rt.set(Tt,Ct),function(){if(Pt){if(it)throw new Error(formatProdErrorMessage$1(6));Pt=!1,at(),rt.delete(Tt),tt=null}}}function ut(Ct){if(!isPlainObject$3(Ct))throw new Error(formatProdErrorMessage$1(7));if(typeof Ct.type>"u")throw new Error(formatProdErrorMessage$1(8));if(typeof Ct.type!="string")throw new Error(formatProdErrorMessage$1(17));if(it)throw new Error(formatProdErrorMessage$1(9));try{it=!0,et=j(et,Ct)}finally{it=!1}return(tt=rt).forEach(Tt=>{Tt()}),Ct}function dt(Ct){if(typeof Ct!="function")throw new Error(formatProdErrorMessage$1(10));j=Ct,ut({type:actionTypes_default.REPLACE})}function mt(){const Ct=ot;return{subscribe(Pt){if(typeof Pt!="object"||Pt===null)throw new Error(formatProdErrorMessage$1(11));function Tt(){const Lt=Pt;Lt.next&&Lt.next(st())}return Tt(),{unsubscribe:Ct(Tt)}},[symbol_observable_default](){return this}}}return ut({type:actionTypes_default.INIT}),{dispatch:ut,subscribe:ot,getState:st,replaceReducer:dt,[symbol_observable_default]:mt}}function assertReducerShape(_){Object.keys(_).forEach(a=>{const $=_[a];if(typeof $(void 0,{type:actionTypes_default.INIT})>"u")throw new Error(formatProdErrorMessage$1(12));if(typeof $(void 0,{type:actionTypes_default.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(formatProdErrorMessage$1(13))})}function combineReducers(_){const a=Object.keys(_),$={};for(let tt=0;tt"u")throw nt&&nt.type,new Error(formatProdErrorMessage$1(14));at[ot]=mt,it=it||mt!==dt}return it=it||j.length!==Object.keys(rt).length,it?at:rt}}function compose(..._){return _.length===0?a=>a:_.length===1?_[0]:_.reduce((a,$)=>(...j)=>a($(...j)))}function applyMiddleware(..._){return a=>($,j)=>{const et=a($,j);let tt=()=>{throw new Error(formatProdErrorMessage$1(15))};const rt={getState:et.getState,dispatch:(it,...at)=>tt(it,...at)},nt=_.map(it=>it(rt));return tt=compose(...nt)(et.dispatch),{...et,dispatch:tt}}}function isAction(_){return isPlainObject$3(_)&&"type"in _&&typeof _.type=="string"}function _toConsumableArray(_){return _arrayWithoutHoles(_)||_iterableToArray(_)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(_){if(Symbol.iterator in Object(_)||Object.prototype.toString.call(_)==="[object Arguments]")return Array.from(_)}function _arrayWithoutHoles(_){if(Array.isArray(_)){for(var a=0,$=new Array(_.length);a<_.length;a++)$[a]=_[a];return $}}function ownKeys$3(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$2(_){for(var a=1;a0&&arguments[0]!==void 0?arguments[0]:initialState$a,$=arguments.length>1?arguments[1]:void 0;switch($.type){case REGISTER:return _objectSpread$2({},a,{registry:[].concat(_toConsumableArray(a.registry),[$.key])});case REHYDRATE:var j=a.registry.indexOf($.key),et=_toConsumableArray(a.registry);return et.splice(j,1),_objectSpread$2({},a,{registry:et,bootstrapped:et.length===0});default:return a}};function persistStore(_,a,$){var j=createStore(persistorReducer,initialState$a,void 0),et=function(it){j.dispatch({type:REGISTER,key:it})},tt=function(it,at,st){var ot={type:REHYDRATE,payload:at,err:st,key:it};_.dispatch(ot),j.dispatch(ot)},rt=_objectSpread$2({},j,{purge:function(){var it=[];return _.dispatch({type:PURGE,result:function(st){it.push(st)}}),Promise.all(it)},flush:function(){var it=[];return _.dispatch({type:FLUSH,result:function(st){it.push(st)}}),Promise.all(it)},pause:function(){_.dispatch({type:PAUSE})},persist:function(){_.dispatch({type:PERSIST,register:et,rehydrate:tt})}});return rt.persist(),rt}var NOTHING$1=Symbol.for("immer-nothing"),DRAFTABLE$1=Symbol.for("immer-draftable"),DRAFT_STATE$1=Symbol.for("immer-state");function die$1(_,...a){throw new Error(`[Immer] minified error nr: ${_}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$2=Object.getPrototypeOf;function isDraft$1(_){return!!_&&!!_[DRAFT_STATE$1]}function isDraftable$1(_){var a;return _?isPlainObject$2(_)||Array.isArray(_)||!!_[DRAFTABLE$1]||!!((a=_.constructor)!=null&&a[DRAFTABLE$1])||isMap$1(_)||isSet$1(_):!1}var objectCtorString$1=Object.prototype.constructor.toString();function isPlainObject$2(_){if(!_||typeof _!="object")return!1;const a=getPrototypeOf$2(_);if(a===null)return!0;const $=Object.hasOwnProperty.call(a,"constructor")&&a.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString$1}function each$1(_,a){getArchtype$1(_)===0?Reflect.ownKeys(_).forEach($=>{a($,_[$],_)}):_.forEach(($,j)=>a(j,$,_))}function getArchtype$1(_){const a=_[DRAFT_STATE$1];return a?a.type_:Array.isArray(_)?1:isMap$1(_)?2:isSet$1(_)?3:0}function has$1(_,a){return getArchtype$1(_)===2?_.has(a):Object.prototype.hasOwnProperty.call(_,a)}function set$1(_,a,$){const j=getArchtype$1(_);j===2?_.set(a,$):j===3?_.add($):_[a]=$}function is$1(_,a){return _===a?_!==0||1/_===1/a:_!==_&&a!==a}function isMap$1(_){return _ instanceof Map}function isSet$1(_){return _ instanceof Set}function latest$1(_){return _.copy_||_.base_}function shallowCopy$1(_,a){if(isMap$1(_))return new Map(_);if(isSet$1(_))return new Set(_);if(Array.isArray(_))return Array.prototype.slice.call(_);if(!a&&isPlainObject$2(_))return getPrototypeOf$2(_)?{..._}:Object.assign(Object.create(null),_);const $=Object.getOwnPropertyDescriptors(_);delete $[DRAFT_STATE$1];let j=Reflect.ownKeys($);for(let et=0;et1&&(_.set=_.add=_.clear=_.delete=dontMutateFrozenCollections$1),Object.freeze(_),a&&Object.entries(_).forEach(([$,j])=>freeze$1(j,!0))),_}function dontMutateFrozenCollections$1(){die$1(2)}function isFrozen$1(_){return Object.isFrozen(_)}var plugins$1={};function getPlugin$1(_){const a=plugins$1[_];return a||die$1(0,_),a}var currentScope$1;function getCurrentScope$1(){return currentScope$1}function createScope$1(_,a){return{drafts_:[],parent_:_,immer_:a,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope$1(_,a){a&&(getPlugin$1("Patches"),_.patches_=[],_.inversePatches_=[],_.patchListener_=a)}function revokeScope$1(_){leaveScope$1(_),_.drafts_.forEach(revokeDraft$1),_.drafts_=null}function leaveScope$1(_){_===currentScope$1&&(currentScope$1=_.parent_)}function enterScope$1(_){return currentScope$1=createScope$1(currentScope$1,_)}function revokeDraft$1(_){const a=_[DRAFT_STATE$1];a.type_===0||a.type_===1?a.revoke_():a.revoked_=!0}function processResult$1(_,a){a.unfinalizedDrafts_=a.drafts_.length;const $=a.drafts_[0];return _!==void 0&&_!==$?($[DRAFT_STATE$1].modified_&&(revokeScope$1(a),die$1(4)),isDraftable$1(_)&&(_=finalize$1(a,_),a.parent_||maybeFreeze$1(a,_)),a.patches_&&getPlugin$1("Patches").generateReplacementPatches_($[DRAFT_STATE$1].base_,_,a.patches_,a.inversePatches_)):_=finalize$1(a,$,[]),revokeScope$1(a),a.patches_&&a.patchListener_(a.patches_,a.inversePatches_),_!==NOTHING$1?_:void 0}function finalize$1(_,a,$){if(isFrozen$1(a))return a;const j=a[DRAFT_STATE$1];if(!j)return each$1(a,(et,tt)=>finalizeProperty$1(_,j,a,et,tt,$)),a;if(j.scope_!==_)return a;if(!j.modified_)return maybeFreeze$1(_,j.base_,!0),j.base_;if(!j.finalized_){j.finalized_=!0,j.scope_.unfinalizedDrafts_--;const et=j.copy_;let tt=et,rt=!1;j.type_===3&&(tt=new Set(et),et.clear(),rt=!0),each$1(tt,(nt,it)=>finalizeProperty$1(_,j,et,nt,it,$,rt)),maybeFreeze$1(_,et,!1),$&&_.patches_&&getPlugin$1("Patches").generatePatches_(j,$,_.patches_,_.inversePatches_)}return j.copy_}function finalizeProperty$1(_,a,$,j,et,tt,rt){if(isDraft$1(et)){const nt=tt&&a&&a.type_!==3&&!has$1(a.assigned_,j)?tt.concat(j):void 0,it=finalize$1(_,et,nt);if(set$1($,j,it),isDraft$1(it))_.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable$1(et)&&!isFrozen$1(et)){if(!_.immer_.autoFreeze_&&_.unfinalizedDrafts_<1)return;finalize$1(_,et),(!a||!a.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze$1(_,et)}}function maybeFreeze$1(_,a,$=!1){!_.parent_&&_.immer_.autoFreeze_&&_.canAutoFreeze_&&freeze$1(a,$)}function createProxyProxy$1(_,a){const $=Array.isArray(_),j={type_:$?1:0,scope_:a?a.scope_:getCurrentScope$1(),modified_:!1,finalized_:!1,assigned_:{},parent_:a,base_:_,draft_:null,copy_:null,revoke_:null,isManual_:!1};let et=j,tt=objectTraps$1;$&&(et=[j],tt=arrayTraps$1);const{revoke:rt,proxy:nt}=Proxy.revocable(et,tt);return j.draft_=nt,j.revoke_=rt,nt}var objectTraps$1={get(_,a){if(a===DRAFT_STATE$1)return _;const $=latest$1(_);if(!has$1($,a))return readPropFromProto$1(_,$,a);const j=$[a];return _.finalized_||!isDraftable$1(j)?j:j===peek$1(_.base_,a)?(prepareCopy$1(_),_.copy_[a]=createProxy$1(j,_)):j},has(_,a){return a in latest$1(_)},ownKeys(_){return Reflect.ownKeys(latest$1(_))},set(_,a,$){const j=getDescriptorFromProto$1(latest$1(_),a);if(j!=null&&j.set)return j.set.call(_.draft_,$),!0;if(!_.modified_){const et=peek$1(latest$1(_),a),tt=et==null?void 0:et[DRAFT_STATE$1];if(tt&&tt.base_===$)return _.copy_[a]=$,_.assigned_[a]=!1,!0;if(is$1($,et)&&($!==void 0||has$1(_.base_,a)))return!0;prepareCopy$1(_),markChanged$1(_)}return _.copy_[a]===$&&($!==void 0||a in _.copy_)||Number.isNaN($)&&Number.isNaN(_.copy_[a])||(_.copy_[a]=$,_.assigned_[a]=!0),!0},deleteProperty(_,a){return peek$1(_.base_,a)!==void 0||a in _.base_?(_.assigned_[a]=!1,prepareCopy$1(_),markChanged$1(_)):delete _.assigned_[a],_.copy_&&delete _.copy_[a],!0},getOwnPropertyDescriptor(_,a){const $=latest$1(_),j=Reflect.getOwnPropertyDescriptor($,a);return j&&{writable:!0,configurable:_.type_!==1||a!=="length",enumerable:j.enumerable,value:$[a]}},defineProperty(){die$1(11)},getPrototypeOf(_){return getPrototypeOf$2(_.base_)},setPrototypeOf(){die$1(12)}},arrayTraps$1={};each$1(objectTraps$1,(_,a)=>{arrayTraps$1[_]=function(){return arguments[0]=arguments[0][0],a.apply(this,arguments)}});arrayTraps$1.deleteProperty=function(_,a){return arrayTraps$1.set.call(this,_,a,void 0)};arrayTraps$1.set=function(_,a,$){return objectTraps$1.set.call(this,_[0],a,$,_[0])};function peek$1(_,a){const $=_[DRAFT_STATE$1];return($?latest$1($):_)[a]}function readPropFromProto$1(_,a,$){var et;const j=getDescriptorFromProto$1(a,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(_.draft_):void 0}function getDescriptorFromProto$1(_,a){if(!(a in _))return;let $=getPrototypeOf$2(_);for(;$;){const j=Object.getOwnPropertyDescriptor($,a);if(j)return j;$=getPrototypeOf$2($)}}function markChanged$1(_){_.modified_||(_.modified_=!0,_.parent_&&markChanged$1(_.parent_))}function prepareCopy$1(_){_.copy_||(_.copy_=shallowCopy$1(_.base_,_.scope_.immer_.useStrictShallowCopy_))}var Immer2$1=class{constructor(a){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=($,j,et)=>{if(typeof $=="function"&&typeof j!="function"){const rt=j;j=$;const nt=this;return function(at=rt,...st){return nt.produce(at,ot=>j.call(this,ot,...st))}}typeof j!="function"&&die$1(6),et!==void 0&&typeof et!="function"&&die$1(7);let tt;if(isDraftable$1($)){const rt=enterScope$1(this),nt=createProxy$1($,void 0);let it=!0;try{tt=j(nt),it=!1}finally{it?revokeScope$1(rt):leaveScope$1(rt)}return usePatchesInScope$1(rt,et),processResult$1(tt,rt)}else if(!$||typeof $!="object"){if(tt=j($),tt===void 0&&(tt=$),tt===NOTHING$1&&(tt=void 0),this.autoFreeze_&&freeze$1(tt,!0),et){const rt=[],nt=[];getPlugin$1("Patches").generateReplacementPatches_($,tt,rt,nt),et(rt,nt)}return tt}else die$1(1,$)},this.produceWithPatches=($,j)=>{if(typeof $=="function")return(nt,...it)=>this.produceWithPatches(nt,at=>$(at,...it));let et,tt;return[this.produce($,j,(nt,it)=>{et=nt,tt=it}),et,tt]},typeof(a==null?void 0:a.autoFreeze)=="boolean"&&this.setAutoFreeze(a.autoFreeze),typeof(a==null?void 0:a.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(a.useStrictShallowCopy)}createDraft(a){isDraftable$1(a)||die$1(8),isDraft$1(a)&&(a=current$1(a));const $=enterScope$1(this),j=createProxy$1(a,void 0);return j[DRAFT_STATE$1].isManual_=!0,leaveScope$1($),j}finishDraft(a,$){const j=a&&a[DRAFT_STATE$1];(!j||!j.isManual_)&&die$1(9);const{scope_:et}=j;return usePatchesInScope$1(et,$),processResult$1(void 0,et)}setAutoFreeze(a){this.autoFreeze_=a}setUseStrictShallowCopy(a){this.useStrictShallowCopy_=a}applyPatches(a,$){let j;for(j=$.length-1;j>=0;j--){const tt=$[j];if(tt.path.length===0&&tt.op==="replace"){a=tt.value;break}}j>-1&&($=$.slice(j+1));const et=getPlugin$1("Patches").applyPatches_;return isDraft$1(a)?et(a,$):this.produce(a,tt=>et(tt,$))}};function createProxy$1(_,a){const $=isMap$1(_)?getPlugin$1("MapSet").proxyMap_(_,a):isSet$1(_)?getPlugin$1("MapSet").proxySet_(_,a):createProxyProxy$1(_,a);return(a?a.scope_:getCurrentScope$1()).drafts_.push($),$}function current$1(_){return isDraft$1(_)||die$1(10,_),currentImpl$1(_)}function currentImpl$1(_){if(!isDraftable$1(_)||isFrozen$1(_))return _;const a=_[DRAFT_STATE$1];let $;if(a){if(!a.modified_)return a.base_;a.finalized_=!0,$=shallowCopy$1(_,a.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy$1(_,!0);return each$1($,(j,et)=>{set$1($,j,currentImpl$1(et))}),a&&(a.finalized_=!1),$}var immer$1=new Immer2$1,produce$1=immer$1.produce;immer$1.produceWithPatches.bind(immer$1);immer$1.setAutoFreeze.bind(immer$1);immer$1.setUseStrictShallowCopy.bind(immer$1);immer$1.applyPatches.bind(immer$1);immer$1.createDraft.bind(immer$1);immer$1.finishDraft.bind(immer$1);function assertIsFunction(_,a=`expected a function, instead received ${typeof _}`){if(typeof _!="function")throw new TypeError(a)}function assertIsObject(_,a=`expected an object, instead received ${typeof _}`){if(typeof _!="object")throw new TypeError(a)}function assertIsArrayOfFunctions(_,a="expected all items to be functions, instead received the following types: "){if(!_.every($=>typeof $=="function")){const $=_.map(j=>typeof j=="function"?`function ${j.name||"unnamed"}()`:typeof j).join(", ");throw new TypeError(`${a}[${$}]`)}}var ensureIsArray=_=>Array.isArray(_)?_:[_];function getDependencies(_){const a=Array.isArray(_[0])?_[0]:_;return assertIsArrayOfFunctions(a,"createSelector expects all input-selectors to be functions, but received the following types: "),a}function collectInputSelectorResults(_,a){const $=[],{length:j}=_;for(let et=0;et{$=createCacheNode(),rt.resetResultsCount()},rt.resultsCount=()=>tt,rt.resetResultsCount=()=>{tt=0},rt}function createSelectorCreator(_,...a){const $=typeof _=="function"?{memoize:_,memoizeOptions:a}:_,j=(...et)=>{let tt=0,rt=0,nt,it={},at=et.pop();typeof at=="object"&&(it=at,at=et.pop()),assertIsFunction(at,`createSelector expects an output function after the inputs, but received: [${typeof at}]`);const st={...$,...it},{memoize:ot,memoizeOptions:ut=[],argsMemoize:dt=weakMapMemoize,argsMemoizeOptions:mt=[],devModeChecks:xt={}}=st,Ct=ensureIsArray(ut),Pt=ensureIsArray(mt),Tt=getDependencies(et),kt=ot(function(){return tt++,at.apply(null,arguments)},...Ct),Lt=dt(function(){rt++;const zt=collectInputSelectorResults(Tt,arguments);return nt=kt.apply(null,zt),nt},...Pt);return Object.assign(Lt,{resultFunc:at,memoizedResultFunc:kt,dependencies:Tt,dependencyRecomputations:()=>rt,resetDependencyRecomputations:()=>{rt=0},lastResult:()=>nt,recomputations:()=>tt,resetRecomputations:()=>{tt=0},memoize:ot,argsMemoize:dt})};return Object.assign(j,{withTypes:()=>j}),j}var createSelector=createSelectorCreator(weakMapMemoize),createStructuredSelector=Object.assign((_,a=createSelector)=>{assertIsObject(_,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof _}`);const $=Object.keys(_),j=$.map(tt=>_[tt]);return a(j,(...tt)=>tt.reduce((rt,nt,it)=>(rt[$[it]]=nt,rt),{}))},{withTypes:()=>createStructuredSelector});function createThunkMiddleware(_){return({dispatch:$,getState:j})=>et=>tt=>typeof tt=="function"?tt($,j,_):et(tt)}var thunk=createThunkMiddleware(),withExtraArgument=createThunkMiddleware,createDraftSafeSelectorCreator=(..._)=>{const a=createSelectorCreator(..._),$=Object.assign((...j)=>{const et=a(...j),tt=(rt,...nt)=>et(isDraft$1(rt)?current$1(rt):rt,...nt);return Object.assign(tt,et),tt},{withTypes:()=>$});return $};createDraftSafeSelectorCreator(weakMapMemoize);var composeWithDevTools=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?compose:compose.apply(null,arguments)},hasMatchFunction=_=>_&&typeof _.match=="function";function createAction(_,a){function $(...j){if(a){let et=a(...j);if(!et)throw new Error(formatProdErrorMessage(0));return{type:_,payload:et.payload,..."meta"in et&&{meta:et.meta},..."error"in et&&{error:et.error}}}return{type:_,payload:j[0]}}return $.toString=()=>`${_}`,$.type=_,$.match=j=>isAction(j)&&j.type===_,$}var Tuple=class ip extends Array{constructor(...a){super(...a),Object.setPrototypeOf(this,ip.prototype)}static get[Symbol.species](){return ip}concat(...a){return super.concat.apply(this,a)}prepend(...a){return a.length===1&&Array.isArray(a[0])?new ip(...a[0].concat(this)):new ip(...a.concat(this))}};function freezeDraftable(_){return isDraftable$1(_)?produce$1(_,()=>{}):_}function emplace(_,a,$){if(_.has(a)){let et=_.get(a);return $.update&&(et=$.update(et,a,_),_.set(a,et)),et}if(!$.insert)throw new Error(formatProdErrorMessage(10));const j=$.insert(a,_);return _.set(a,j),j}function isBoolean(_){return typeof _=="boolean"}var buildGetDefaultMiddleware=()=>function(a){const{thunk:$=!0,immutableCheck:j=!0,serializableCheck:et=!0,actionCreatorCheck:tt=!0}=a??{};let rt=new Tuple;return $&&(isBoolean($)?rt.push(thunk):rt.push(withExtraArgument($.extraArgument))),rt},SHOULD_AUTOBATCH="RTK_autoBatch",createQueueWithTimer=_=>a=>{setTimeout(a,_)},rAF=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:createQueueWithTimer(10),autoBatchEnhancer=(_={type:"raf"})=>a=>(...$)=>{const j=a(...$);let et=!0,tt=!1,rt=!1;const nt=new Set,it=_.type==="tick"?queueMicrotask:_.type==="raf"?rAF:_.type==="callback"?_.queueNotification:createQueueWithTimer(_.timeout),at=()=>{rt=!1,tt&&(tt=!1,nt.forEach(st=>st()))};return Object.assign({},j,{subscribe(st){const ot=()=>et&&st(),ut=j.subscribe(ot);return nt.add(st),()=>{ut(),nt.delete(st)}},dispatch(st){var ot;try{return et=!((ot=st==null?void 0:st.meta)!=null&&ot[SHOULD_AUTOBATCH]),tt=!et,tt&&(rt||(rt=!0,it(at))),j.dispatch(st)}finally{et=!0}}})},buildGetDefaultEnhancers=_=>function($){const{autoBatch:j=!0}=$??{};let et=new Tuple(_);return j&&et.push(autoBatchEnhancer(typeof j=="object"?j:void 0)),et},IS_PRODUCTION=!0;function configureStore(_){const a=buildGetDefaultMiddleware(),{reducer:$=void 0,middleware:j,devTools:et=!0,preloadedState:tt=void 0,enhancers:rt=void 0}=_||{};let nt;if(typeof $=="function")nt=$;else if(isPlainObject$3($))nt=combineReducers($);else throw new Error(formatProdErrorMessage(1));let it;typeof j=="function"?it=j(a):it=a();let at=compose;et&&(at=composeWithDevTools({trace:!IS_PRODUCTION,...typeof et=="object"&&et}));const st=applyMiddleware(...it),ot=buildGetDefaultEnhancers(st);let ut=typeof rt=="function"?rt(ot):ot();const dt=at(...ut);return createStore(nt,tt,dt)}function executeReducerBuilderCallback(_){const a={},$=[];let j;const et={addCase(tt,rt){const nt=typeof tt=="string"?tt:tt.type;if(!nt)throw new Error(formatProdErrorMessage(28));if(nt in a)throw new Error(formatProdErrorMessage(29));return a[nt]=rt,et},addMatcher(tt,rt){return $.push({matcher:tt,reducer:rt}),et},addDefaultCase(tt){return j=tt,et}};return _(et),[a,$,j]}function isStateFunction(_){return typeof _=="function"}function createReducer(_,a){let[$,j,et]=executeReducerBuilderCallback(a),tt;if(isStateFunction(_))tt=()=>freezeDraftable(_());else{const nt=freezeDraftable(_);tt=()=>nt}function rt(nt=tt(),it){let at=[$[it.type],...j.filter(({matcher:st})=>st(it)).map(({reducer:st})=>st)];return at.filter(st=>!!st).length===0&&(at=[et]),at.reduce((st,ot)=>{if(ot)if(isDraft$1(st)){const dt=ot(st,it);return dt===void 0?st:dt}else{if(isDraftable$1(st))return produce$1(st,ut=>ot(ut,it));{const ut=ot(st,it);if(ut===void 0){if(st===null)return st;throw new Error(formatProdErrorMessage(9))}return ut}}return st},nt)}return rt.getInitialState=tt,rt}var urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nanoid=(_=21)=>{let a="",$=_;for(;$--;)a+=urlAlphabet[Math.random()*64|0];return a},matches=(_,a)=>hasMatchFunction(_)?_.match(a):_(a);function isAnyOf(..._){return a=>_.some($=>matches($,a))}var commonProperties=["name","message","stack","code"],RejectWithValue=class{constructor(_,a){Yr(this,"_type");this.payload=_,this.meta=a}},FulfillWithMeta=class{constructor(_,a){Yr(this,"_type");this.payload=_,this.meta=a}},miniSerializeError=_=>{if(typeof _=="object"&&_!==null){const a={};for(const $ of commonProperties)typeof _[$]=="string"&&(a[$]=_[$]);return a}return{message:String(_)}},createAsyncThunk=(()=>{function _(a,$,j){const et=createAction(a+"/fulfilled",(it,at,st,ot)=>({payload:it,meta:{...ot||{},arg:st,requestId:at,requestStatus:"fulfilled"}})),tt=createAction(a+"/pending",(it,at,st)=>({payload:void 0,meta:{...st||{},arg:at,requestId:it,requestStatus:"pending"}})),rt=createAction(a+"/rejected",(it,at,st,ot,ut)=>({payload:ot,error:(j&&j.serializeError||miniSerializeError)(it||"Rejected"),meta:{...ut||{},arg:st,requestId:at,rejectedWithValue:!!ot,requestStatus:"rejected",aborted:(it==null?void 0:it.name)==="AbortError",condition:(it==null?void 0:it.name)==="ConditionError"}}));function nt(it){return(at,st,ot)=>{const ut=j!=null&&j.idGenerator?j.idGenerator(it):nanoid(),dt=new AbortController;let mt,xt;function Ct(Tt){xt=Tt,dt.abort()}const Pt=async function(){var Lt,Nt;let Tt;try{let zt=(Lt=j==null?void 0:j.condition)==null?void 0:Lt.call(j,it,{getState:st,extra:ot});if(isThenable(zt)&&(zt=await zt),zt===!1||dt.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const jt=new Promise((Mt,Dt)=>{mt=()=>{Dt({name:"AbortError",message:xt||"Aborted"})},dt.signal.addEventListener("abort",mt)});at(tt(ut,it,(Nt=j==null?void 0:j.getPendingMeta)==null?void 0:Nt.call(j,{requestId:ut,arg:it},{getState:st,extra:ot}))),Tt=await Promise.race([jt,Promise.resolve($(it,{dispatch:at,getState:st,extra:ot,requestId:ut,signal:dt.signal,abort:Ct,rejectWithValue:(Mt,Dt)=>new RejectWithValue(Mt,Dt),fulfillWithValue:(Mt,Dt)=>new FulfillWithMeta(Mt,Dt)})).then(Mt=>{if(Mt instanceof RejectWithValue)throw Mt;return Mt instanceof FulfillWithMeta?et(Mt.payload,ut,it,Mt.meta):et(Mt,ut,it)})])}catch(zt){Tt=zt instanceof RejectWithValue?rt(null,ut,it,zt.payload,zt.meta):rt(zt,ut,it)}finally{mt&&dt.signal.removeEventListener("abort",mt)}return j&&!j.dispatchConditionRejection&&rt.match(Tt)&&Tt.meta.condition||at(Tt),Tt}();return Object.assign(Pt,{abort:Ct,requestId:ut,arg:it,unwrap(){return Pt.then(unwrapResult)}})}}return Object.assign(nt,{pending:tt,rejected:rt,fulfilled:et,settled:isAnyOf(rt,et),typePrefix:a})}return _.withTypes=()=>_,_})();function unwrapResult(_){if(_.meta&&_.meta.rejectedWithValue)throw _.payload;if(_.error)throw _.error;return _.payload}function isThenable(_){return _!==null&&typeof _=="object"&&typeof _.then=="function"}var asyncThunkSymbol=Symbol.for("rtk-slice-createasyncthunk");function getType(_,a){return`${_}/${a}`}function buildCreateSlice({creators:_}={}){var $;const a=($=_==null?void 0:_.asyncThunk)==null?void 0:$[asyncThunkSymbol];return function(et){const{name:tt,reducerPath:rt=tt}=et;if(!tt)throw new Error(formatProdErrorMessage(11));typeof process$1$1<"u";const nt=(typeof et.reducers=="function"?et.reducers(buildReducerCreators()):et.reducers)||{},it=Object.keys(nt),at={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},st={addCase(kt,Lt){const Nt=typeof kt=="string"?kt:kt.type;if(!Nt)throw new Error(formatProdErrorMessage(12));if(Nt in at.sliceCaseReducersByType)throw new Error(formatProdErrorMessage(13));return at.sliceCaseReducersByType[Nt]=Lt,st},addMatcher(kt,Lt){return at.sliceMatchers.push({matcher:kt,reducer:Lt}),st},exposeAction(kt,Lt){return at.actionCreators[kt]=Lt,st},exposeCaseReducer(kt,Lt){return at.sliceCaseReducersByName[kt]=Lt,st}};it.forEach(kt=>{const Lt=nt[kt],Nt={reducerName:kt,type:getType(tt,kt),createNotation:typeof et.reducers=="function"};isAsyncThunkSliceReducerDefinition(Lt)?handleThunkCaseReducerDefinition(Nt,Lt,st,a):handleNormalReducerDefinition(Nt,Lt,st)});function ot(){const[kt={},Lt=[],Nt=void 0]=typeof et.extraReducers=="function"?executeReducerBuilderCallback(et.extraReducers):[et.extraReducers],zt={...kt,...at.sliceCaseReducersByType};return createReducer(et.initialState,jt=>{for(let Mt in zt)jt.addCase(Mt,zt[Mt]);for(let Mt of at.sliceMatchers)jt.addMatcher(Mt.matcher,Mt.reducer);for(let Mt of Lt)jt.addMatcher(Mt.matcher,Mt.reducer);Nt&&jt.addDefaultCase(Nt)})}const ut=kt=>kt,dt=new Map;let mt;function xt(kt,Lt){return mt||(mt=ot()),mt(kt,Lt)}function Ct(){return mt||(mt=ot()),mt.getInitialState()}function Pt(kt,Lt=!1){function Nt(jt){let Mt=jt[kt];return typeof Mt>"u"&&Lt&&(Mt=Ct()),Mt}function zt(jt=ut){const Mt=emplace(dt,Lt,{insert:()=>new WeakMap});return emplace(Mt,jt,{insert:()=>{const Dt={};for(const[Ft,Bt]of Object.entries(et.selectors??{}))Dt[Ft]=wrapSelector(Bt,jt,Ct,Lt);return Dt}})}return{reducerPath:kt,getSelectors:zt,get selectors(){return zt(Nt)},selectSlice:Nt}}const Tt={name:tt,reducer:xt,actions:at.actionCreators,caseReducers:at.sliceCaseReducersByName,getInitialState:Ct,...Pt(rt),injectInto(kt,{reducerPath:Lt,...Nt}={}){const zt=Lt??rt;return kt.inject({reducerPath:zt,reducer:xt},Nt),{...Tt,...Pt(zt,!0)}}};return Tt}}function wrapSelector(_,a,$,j){function et(tt,...rt){let nt=a(tt);return typeof nt>"u"&&j&&(nt=$()),_(nt,...rt)}return et.unwrapped=_,et}var createSlice=buildCreateSlice();function buildReducerCreators(){function _(a,$){return{_reducerDefinitionType:"asyncThunk",payloadCreator:a,...$}}return _.withTypes=()=>_,{reducer(a){return Object.assign({[a.name](...$){return a(...$)}}[a.name],{_reducerDefinitionType:"reducer"})},preparedReducer(a,$){return{_reducerDefinitionType:"reducerWithPrepare",prepare:a,reducer:$}},asyncThunk:_}}function handleNormalReducerDefinition({type:_,reducerName:a,createNotation:$},j,et){let tt,rt;if("reducer"in j){if($&&!isCaseReducerWithPrepareDefinition(j))throw new Error(formatProdErrorMessage(17));tt=j.reducer,rt=j.prepare}else tt=j;et.addCase(_,tt).exposeCaseReducer(a,tt).exposeAction(a,rt?createAction(_,rt):createAction(_))}function isAsyncThunkSliceReducerDefinition(_){return _._reducerDefinitionType==="asyncThunk"}function isCaseReducerWithPrepareDefinition(_){return _._reducerDefinitionType==="reducerWithPrepare"}function handleThunkCaseReducerDefinition({type:_,reducerName:a},$,j,et){if(!et)throw new Error(formatProdErrorMessage(18));const{payloadCreator:tt,fulfilled:rt,pending:nt,rejected:it,settled:at,options:st}=$,ot=et(_,tt,st);j.exposeAction(a,ot),rt&&j.addCase(ot.fulfilled,rt),nt&&j.addCase(ot.pending,nt),it&&j.addCase(ot.rejected,it),at&&j.addMatcher(ot.settled,at),j.exposeCaseReducer(a,{fulfilled:rt||noop$5,pending:nt||noop$5,rejected:it||noop$5,settled:at||noop$5})}function noop$5(){}var assertFunction=(_,a)=>{if(typeof _!="function")throw new Error(formatProdErrorMessage(32))},alm="listenerMiddleware",getListenerEntryPropsFrom=_=>{let{type:a,actionCreator:$,matcher:j,predicate:et,effect:tt}=_;if(a)et=createAction(a).match;else if($)a=$.type,et=$.match;else if(j)et=j;else if(!et)throw new Error(formatProdErrorMessage(21));return assertFunction(tt),{predicate:et,type:a,effect:tt}},createListenerEntry=Object.assign(_=>{const{type:a,predicate:$,effect:j}=getListenerEntryPropsFrom(_);return{id:nanoid(),effect:j,type:a,predicate:$,pending:new Set,unsubscribe:()=>{throw new Error(formatProdErrorMessage(22))}}},{withTypes:()=>createListenerEntry}),addListener=Object.assign(createAction(`${alm}/add`),{withTypes:()=>addListener});createAction(`${alm}/removeAll`);var removeListener=Object.assign(createAction(`${alm}/remove`),{withTypes:()=>removeListener});function formatProdErrorMessage(_){return`Minified Redux Toolkit error #${_}; visit https://redux-toolkit.js.org/Errors?code=${_} for the full message or use the non-minified dev environment for full errors. `}var createWebStorage$1={},getStorage$1={};getStorage$1.__esModule=!0;getStorage$1.default=getStorage;function _typeof$4(_){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$4=function($){return typeof $}:_typeof$4=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof$4(_)}function noop$4(){}var noopStorage={getItem:noop$4,setItem:noop$4,removeItem:noop$4};function hasStorage(_){if((typeof self>"u"?"undefined":_typeof$4(self))!=="object"||!(_ in self))return!1;try{var a=self[_],$="redux-persist ".concat(_," test");a.setItem($,"test"),a.getItem($),a.removeItem($)}catch{return!1}return!0}function getStorage(_){var a="".concat(_,"Storage");return hasStorage(a)?self[a]:noopStorage}createWebStorage$1.__esModule=!0;createWebStorage$1.default=createWebStorage;var _getStorage=_interopRequireDefault$6(getStorage$1);function _interopRequireDefault$6(_){return _&&_.__esModule?_:{default:_}}function createWebStorage(_){var a=(0,_getStorage.default)(_);return{getItem:function(j){return new Promise(function(et,tt){et(a.getItem(j))})},setItem:function(j,et){return new Promise(function(tt,rt){tt(a.setItem(j,et))})},removeItem:function(j){return new Promise(function(et,tt){et(a.removeItem(j))})}}}var default_1=void 0,_createWebStorage=_interopRequireDefault$5(createWebStorage$1);function _interopRequireDefault$5(_){return _&&_.__esModule?_:{default:_}}var _default$5=(0,_createWebStorage.default)("local");default_1=_default$5;function createAsyncMigrate(_,a){return async($,j)=>{if(!$)return;const et=$._persist&&$._persist.version!==void 0?$._persist.version:DEFAULT_VERSION;if(et===j||et>j)return $;const tt=Object.keys(_).map(nt=>parseInt(nt)).filter(nt=>j>=nt&&nt>et).sort((nt,it)=>nt-it);let rt=$;for(const nt of tt)rt=await _[nt](rt);return rt}}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state");function die(_,...a){throw new Error(`[Immer] minified error nr: ${_}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$1=Object.getPrototypeOf;function isDraft(_){return!!_&&!!_[DRAFT_STATE]}function isDraftable(_){var a;return _?isPlainObject$1(_)||Array.isArray(_)||!!_[DRAFTABLE]||!!((a=_.constructor)!=null&&a[DRAFTABLE])||isMap(_)||isSet(_):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject$1(_){if(!_||typeof _!="object")return!1;const a=getPrototypeOf$1(_);if(a===null)return!0;const $=Object.hasOwnProperty.call(a,"constructor")&&a.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString}function each(_,a){getArchtype(_)===0?Reflect.ownKeys(_).forEach($=>{a($,_[$],_)}):_.forEach(($,j)=>a(j,$,_))}function getArchtype(_){const a=_[DRAFT_STATE];return a?a.type_:Array.isArray(_)?1:isMap(_)?2:isSet(_)?3:0}function has(_,a){return getArchtype(_)===2?_.has(a):Object.prototype.hasOwnProperty.call(_,a)}function set(_,a,$){const j=getArchtype(_);j===2?_.set(a,$):j===3?_.add($):_[a]=$}function is(_,a){return _===a?_!==0||1/_===1/a:_!==_&&a!==a}function isMap(_){return _ instanceof Map}function isSet(_){return _ instanceof Set}function latest(_){return _.copy_||_.base_}function shallowCopy(_,a){if(isMap(_))return new Map(_);if(isSet(_))return new Set(_);if(Array.isArray(_))return Array.prototype.slice.call(_);const $=isPlainObject$1(_);if(a===!0||a==="class_only"&&!$){const j=Object.getOwnPropertyDescriptors(_);delete j[DRAFT_STATE];let et=Reflect.ownKeys(j);for(let tt=0;tt1&&(_.set=_.add=_.clear=_.delete=dontMutateFrozenCollections),Object.freeze(_),a&&Object.entries(_).forEach(([$,j])=>freeze(j,!0))),_}function dontMutateFrozenCollections(){die(2)}function isFrozen(_){return Object.isFrozen(_)}var plugins={};function getPlugin(_){const a=plugins[_];return a||die(0,_),a}var currentScope;function getCurrentScope(){return currentScope}function createScope(_,a){return{drafts_:[],parent_:_,immer_:a,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(_,a){a&&(getPlugin("Patches"),_.patches_=[],_.inversePatches_=[],_.patchListener_=a)}function revokeScope(_){leaveScope(_),_.drafts_.forEach(revokeDraft),_.drafts_=null}function leaveScope(_){_===currentScope&&(currentScope=_.parent_)}function enterScope(_){return currentScope=createScope(currentScope,_)}function revokeDraft(_){const a=_[DRAFT_STATE];a.type_===0||a.type_===1?a.revoke_():a.revoked_=!0}function processResult(_,a){a.unfinalizedDrafts_=a.drafts_.length;const $=a.drafts_[0];return _!==void 0&&_!==$?($[DRAFT_STATE].modified_&&(revokeScope(a),die(4)),isDraftable(_)&&(_=finalize(a,_),a.parent_||maybeFreeze(a,_)),a.patches_&&getPlugin("Patches").generateReplacementPatches_($[DRAFT_STATE].base_,_,a.patches_,a.inversePatches_)):_=finalize(a,$,[]),revokeScope(a),a.patches_&&a.patchListener_(a.patches_,a.inversePatches_),_!==NOTHING?_:void 0}function finalize(_,a,$){if(isFrozen(a))return a;const j=a[DRAFT_STATE];if(!j)return each(a,(et,tt)=>finalizeProperty(_,j,a,et,tt,$)),a;if(j.scope_!==_)return a;if(!j.modified_)return maybeFreeze(_,j.base_,!0),j.base_;if(!j.finalized_){j.finalized_=!0,j.scope_.unfinalizedDrafts_--;const et=j.copy_;let tt=et,rt=!1;j.type_===3&&(tt=new Set(et),et.clear(),rt=!0),each(tt,(nt,it)=>finalizeProperty(_,j,et,nt,it,$,rt)),maybeFreeze(_,et,!1),$&&_.patches_&&getPlugin("Patches").generatePatches_(j,$,_.patches_,_.inversePatches_)}return j.copy_}function finalizeProperty(_,a,$,j,et,tt,rt){if(isDraft(et)){const nt=tt&&a&&a.type_!==3&&!has(a.assigned_,j)?tt.concat(j):void 0,it=finalize(_,et,nt);if(set($,j,it),isDraft(it))_.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable(et)&&!isFrozen(et)){if(!_.immer_.autoFreeze_&&_.unfinalizedDrafts_<1)return;finalize(_,et),(!a||!a.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze(_,et)}}function maybeFreeze(_,a,$=!1){!_.parent_&&_.immer_.autoFreeze_&&_.canAutoFreeze_&&freeze(a,$)}function createProxyProxy(_,a){const $=Array.isArray(_),j={type_:$?1:0,scope_:a?a.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:a,base_:_,draft_:null,copy_:null,revoke_:null,isManual_:!1};let et=j,tt=objectTraps;$&&(et=[j],tt=arrayTraps);const{revoke:rt,proxy:nt}=Proxy.revocable(et,tt);return j.draft_=nt,j.revoke_=rt,nt}var objectTraps={get(_,a){if(a===DRAFT_STATE)return _;const $=latest(_);if(!has($,a))return readPropFromProto(_,$,a);const j=$[a];return _.finalized_||!isDraftable(j)?j:j===peek(_.base_,a)?(prepareCopy(_),_.copy_[a]=createProxy(j,_)):j},has(_,a){return a in latest(_)},ownKeys(_){return Reflect.ownKeys(latest(_))},set(_,a,$){const j=getDescriptorFromProto(latest(_),a);if(j!=null&&j.set)return j.set.call(_.draft_,$),!0;if(!_.modified_){const et=peek(latest(_),a),tt=et==null?void 0:et[DRAFT_STATE];if(tt&&tt.base_===$)return _.copy_[a]=$,_.assigned_[a]=!1,!0;if(is($,et)&&($!==void 0||has(_.base_,a)))return!0;prepareCopy(_),markChanged(_)}return _.copy_[a]===$&&($!==void 0||a in _.copy_)||Number.isNaN($)&&Number.isNaN(_.copy_[a])||(_.copy_[a]=$,_.assigned_[a]=!0),!0},deleteProperty(_,a){return peek(_.base_,a)!==void 0||a in _.base_?(_.assigned_[a]=!1,prepareCopy(_),markChanged(_)):delete _.assigned_[a],_.copy_&&delete _.copy_[a],!0},getOwnPropertyDescriptor(_,a){const $=latest(_),j=Reflect.getOwnPropertyDescriptor($,a);return j&&{writable:!0,configurable:_.type_!==1||a!=="length",enumerable:j.enumerable,value:$[a]}},defineProperty(){die(11)},getPrototypeOf(_){return getPrototypeOf$1(_.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(_,a)=>{arrayTraps[_]=function(){return arguments[0]=arguments[0][0],a.apply(this,arguments)}});arrayTraps.deleteProperty=function(_,a){return arrayTraps.set.call(this,_,a,void 0)};arrayTraps.set=function(_,a,$){return objectTraps.set.call(this,_[0],a,$,_[0])};function peek(_,a){const $=_[DRAFT_STATE];return($?latest($):_)[a]}function readPropFromProto(_,a,$){var et;const j=getDescriptorFromProto(a,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(_.draft_):void 0}function getDescriptorFromProto(_,a){if(!(a in _))return;let $=getPrototypeOf$1(_);for(;$;){const j=Object.getOwnPropertyDescriptor($,a);if(j)return j;$=getPrototypeOf$1($)}}function markChanged(_){_.modified_||(_.modified_=!0,_.parent_&&markChanged(_.parent_))}function prepareCopy(_){_.copy_||(_.copy_=shallowCopy(_.base_,_.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(_){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(a,$,j)=>{if(typeof a=="function"&&typeof $!="function"){const tt=$;$=a;const rt=this;return function(it=tt,...at){return rt.produce(it,st=>$.call(this,st,...at))}}typeof $!="function"&&die(6),j!==void 0&&typeof j!="function"&&die(7);let et;if(isDraftable(a)){const tt=enterScope(this),rt=createProxy(a,void 0);let nt=!0;try{et=$(rt),nt=!1}finally{nt?revokeScope(tt):leaveScope(tt)}return usePatchesInScope(tt,j),processResult(et,tt)}else if(!a||typeof a!="object"){if(et=$(a),et===void 0&&(et=a),et===NOTHING&&(et=void 0),this.autoFreeze_&&freeze(et,!0),j){const tt=[],rt=[];getPlugin("Patches").generateReplacementPatches_(a,et,tt,rt),j(tt,rt)}return et}else die(1,a)},this.produceWithPatches=(a,$)=>{if(typeof a=="function")return(rt,...nt)=>this.produceWithPatches(rt,it=>a(it,...nt));let j,et;return[this.produce(a,$,(rt,nt)=>{j=rt,et=nt}),j,et]},typeof(_==null?void 0:_.autoFreeze)=="boolean"&&this.setAutoFreeze(_.autoFreeze),typeof(_==null?void 0:_.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(_.useStrictShallowCopy)}createDraft(_){isDraftable(_)||die(8),isDraft(_)&&(_=current(_));const a=enterScope(this),$=createProxy(_,void 0);return $[DRAFT_STATE].isManual_=!0,leaveScope(a),$}finishDraft(_,a){const $=_&&_[DRAFT_STATE];(!$||!$.isManual_)&&die(9);const{scope_:j}=$;return usePatchesInScope(j,a),processResult(void 0,j)}setAutoFreeze(_){this.autoFreeze_=_}setUseStrictShallowCopy(_){this.useStrictShallowCopy_=_}applyPatches(_,a){let $;for($=a.length-1;$>=0;$--){const et=a[$];if(et.path.length===0&&et.op==="replace"){_=et.value;break}}$>-1&&(a=a.slice($+1));const j=getPlugin("Patches").applyPatches_;return isDraft(_)?j(_,a):this.produce(_,et=>j(et,a))}};function createProxy(_,a){const $=isMap(_)?getPlugin("MapSet").proxyMap_(_,a):isSet(_)?getPlugin("MapSet").proxySet_(_,a):createProxyProxy(_,a);return(a?a.scope_:getCurrentScope()).drafts_.push($),$}function current(_){return isDraft(_)||die(10,_),currentImpl(_)}function currentImpl(_){if(!isDraftable(_)||isFrozen(_))return _;const a=_[DRAFT_STATE];let $;if(a){if(!a.modified_)return a.base_;a.finalized_=!0,$=shallowCopy(_,a.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy(_,!0);return each($,(j,et)=>{set($,j,currentImpl(et))}),a&&(a.finalized_=!1),$}var immer=new Immer2,produce=immer.produce;immer.produceWithPatches.bind(immer);immer.setAutoFreeze.bind(immer);immer.setUseStrictShallowCopy.bind(immer);immer.applyPatches.bind(immer);immer.createDraft.bind(immer);immer.finishDraft.bind(immer);const initialState$9={html:"",seen:!0},announcementSlice=createSlice({name:"announcements",initialState:initialState$9,reducers:{reset:()=>initialState$9,setCurrent:(_,{payload:a})=>{a!==_.html&&(_.seen=!1),_.html=a},setSeen:_=>{_.seen=!0}}}),ERROR_MSG_INPUT="Input must be an string, Buffer or Uint8Array";function normalizeInput(_){let a;if(_ instanceof Uint8Array)a=_;else if(typeof _=="string")a=new TextEncoder().encode(_);else throw new Error(ERROR_MSG_INPUT);return a}function toHex(_){return Array.prototype.map.call(_,function(a){return(a<16?"0":"")+a.toString(16)}).join("")}function uint32ToHex(_){return(4294967296+_).toString(16).substring(1)}function debugPrint(_,a,$){let j=` `+_+" = ";for(let et=0;et=4294967296&&et++,_[a]=j,_[a+1]=et}function ADD64AC(_,a,$,j){let et=_[a]+$;$<0&&(et+=4294967296);let tt=_[a+1]+j;et>=4294967296&&tt++,_[a]=et,_[a+1]=tt}function B2B_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2B_G(_,a,$,j,et,tt){const rt=m$1[et],nt=m$1[et+1],it=m$1[tt],ot=m$1[tt+1];ADD64AA(v$2,_,a),ADD64AC(v$2,_,rt,nt);let st=v$2[j]^v$2[_],at=v$2[j+1]^v$2[_+1];v$2[j]=at,v$2[j+1]=st,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],at=v$2[a+1]^v$2[$+1],v$2[a]=st>>>24^at<<8,v$2[a+1]=at>>>24^st<<8,ADD64AA(v$2,_,a),ADD64AC(v$2,_,it,ot),st=v$2[j]^v$2[_],at=v$2[j+1]^v$2[_+1],v$2[j]=st>>>16^at<<16,v$2[j+1]=at>>>16^st<<16,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],at=v$2[a+1]^v$2[$+1],v$2[a]=at>>>31^st<<1,v$2[a+1]=st>>>31^at<<1}const BLAKE2B_IV32=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),SIGMA8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],SIGMA82=new Uint8Array(SIGMA8.map(function(_){return _*2})),v$2=new Uint32Array(32),m$1=new Uint32Array(32);function blake2bCompress(_,a){let $=0;for($=0;$<16;$++)v$2[$]=_.h[$],v$2[$+16]=BLAKE2B_IV32[$];for(v$2[24]=v$2[24]^_.t,v$2[25]=v$2[25]^_.t/4294967296,a&&(v$2[28]=~v$2[28],v$2[29]=~v$2[29]),$=0;$<32;$++)m$1[$]=B2B_GET32(_.b,4*$);for($=0;$<12;$++)B2B_G(0,8,16,24,SIGMA82[$*16+0],SIGMA82[$*16+1]),B2B_G(2,10,18,26,SIGMA82[$*16+2],SIGMA82[$*16+3]),B2B_G(4,12,20,28,SIGMA82[$*16+4],SIGMA82[$*16+5]),B2B_G(6,14,22,30,SIGMA82[$*16+6],SIGMA82[$*16+7]),B2B_G(0,10,20,30,SIGMA82[$*16+8],SIGMA82[$*16+9]),B2B_G(2,12,22,24,SIGMA82[$*16+10],SIGMA82[$*16+11]),B2B_G(4,14,16,26,SIGMA82[$*16+12],SIGMA82[$*16+13]),B2B_G(6,8,18,28,SIGMA82[$*16+14],SIGMA82[$*16+15]);for($=0;$<16;$++)_.h[$]=_.h[$]^v$2[$]^v$2[$+16]}const parameterBlock=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function blake2bInit(_,a,$,j){if(_===0||_>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(a&&a.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if($&&$.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(j&&j.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const et={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:_};parameterBlock.fill(0),parameterBlock[0]=_,a&&(parameterBlock[1]=a.length),parameterBlock[2]=1,parameterBlock[3]=1,$&¶meterBlock.set($,32),j&¶meterBlock.set(j,48);for(let tt=0;tt<16;tt++)et.h[tt]=BLAKE2B_IV32[tt]^B2B_GET32(parameterBlock,tt*4);return a&&(blake2bUpdate(et,a),et.c=128),et}function blake2bUpdate(_,a){for(let $=0;$>2]>>8*($&3);return a}function blake2b(_,a,$,j,et){$=$||64,_=util$2.normalizeInput(_),j&&(j=util$2.normalizeInput(j)),et&&(et=util$2.normalizeInput(et));const tt=blake2bInit($,a,j,et);return blake2bUpdate(tt,_),blake2bFinal(tt)}function blake2bHex(_,a,$,j,et){const tt=blake2b(_,a,$,j,et);return util$2.toHex(tt)}var blake2b_1={blake2b,blake2bHex,blake2bInit,blake2bUpdate,blake2bFinal};const util$1=util$3;function B2S_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2S_G(_,a,$,j,et,tt){v$1[_]=v$1[_]+v$1[a]+et,v$1[j]=ROTR32(v$1[j]^v$1[_],16),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],12),v$1[_]=v$1[_]+v$1[a]+tt,v$1[j]=ROTR32(v$1[j]^v$1[_],8),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],7)}function ROTR32(_,a){return _>>>a^_<<32-a}const BLAKE2S_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),v$1=new Uint32Array(16),m=new Uint32Array(16);function blake2sCompress(_,a){let $=0;for($=0;$<8;$++)v$1[$]=_.h[$],v$1[$+8]=BLAKE2S_IV[$];for(v$1[12]^=_.t,v$1[13]^=_.t/4294967296,a&&(v$1[14]=~v$1[14]),$=0;$<16;$++)m[$]=B2S_GET32(_.b,4*$);for($=0;$<10;$++)B2S_G(0,4,8,12,m[SIGMA[$*16+0]],m[SIGMA[$*16+1]]),B2S_G(1,5,9,13,m[SIGMA[$*16+2]],m[SIGMA[$*16+3]]),B2S_G(2,6,10,14,m[SIGMA[$*16+4]],m[SIGMA[$*16+5]]),B2S_G(3,7,11,15,m[SIGMA[$*16+6]],m[SIGMA[$*16+7]]),B2S_G(0,5,10,15,m[SIGMA[$*16+8]],m[SIGMA[$*16+9]]),B2S_G(1,6,11,12,m[SIGMA[$*16+10]],m[SIGMA[$*16+11]]),B2S_G(2,7,8,13,m[SIGMA[$*16+12]],m[SIGMA[$*16+13]]),B2S_G(3,4,9,14,m[SIGMA[$*16+14]],m[SIGMA[$*16+15]]);for($=0;$<8;$++)_.h[$]^=v$1[$]^v$1[$+8]}function blake2sInit(_,a){if(!(_>0&&_<=32))throw new Error("Incorrect output length, should be in [1, 32]");const $=a?a.length:0;if(a&&!($>0&&$<=32))throw new Error("Incorrect key length, should be in [1, 32]");const j={h:new Uint32Array(BLAKE2S_IV),b:new Uint8Array(64),c:0,t:0,outlen:_};return j.h[0]^=16842752^$<<8^_,$>0&&(blake2sUpdate(j,a),j.c=64),j}function blake2sUpdate(_,a){for(let $=0;$>2]>>8*($&3)&255;return a}function blake2s(_,a,$){$=$||32,_=util$1.normalizeInput(_);const j=blake2sInit($,a);return blake2sUpdate(j,_),blake2sFinal(j)}function blake2sHex(_,a,$){const j=blake2s(_,a,$);return util$1.toHex(j)}var blake2s_1={blake2s,blake2sHex,blake2sInit,blake2sUpdate,blake2sFinal};const b2b=blake2b_1,b2s=blake2s_1;var blakejs={blake2b:b2b.blake2b,blake2bHex:b2b.blake2bHex,blake2bInit:b2b.blake2bInit,blake2bUpdate:b2b.blake2bUpdate,blake2bFinal:b2b.blake2bFinal,blake2s:b2s.blake2s,blake2sHex:b2s.blake2sHex,blake2sInit:b2s.blake2sInit,blake2sUpdate:b2s.blake2sUpdate,blake2sFinal:b2s.blake2sFinal};const blake=getDefaultExportFromCjs$1(blakejs);var sha256$3={},_sha2$1={},_assert$1={};Object.defineProperty(_assert$1,"__esModule",{value:!0});_assert$1.output=_assert$1.exists=_assert$1.hash=_assert$1.bytes=_assert$1.bool=_assert$1.number=void 0;function number$3(_){if(!Number.isSafeInteger(_)||_<0)throw new Error(`Wrong positive integer: ${_}`)}_assert$1.number=number$3;function bool$3(_){if(typeof _!="boolean")throw new Error(`Expected boolean, not ${_}`)}_assert$1.bool=bool$3;function bytes$2(_,...a){if(!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length>0&&!a.includes(_.length))throw new TypeError(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}_assert$1.bytes=bytes$2;function hash$5(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$3(_.outputLen),number$3(_.blockLen)}_assert$1.hash=hash$5;function exists$2(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}_assert$1.exists=exists$2;function output$2(_,a){bytes$2(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert$1.output=output$2;const assert$l={number:number$3,bool:bool$3,bytes:bytes$2,hash:hash$5,exists:exists$2,output:output$2};_assert$1.default=assert$l;var utils$p={},crypto$2={};Object.defineProperty(crypto$2,"__esModule",{value:!0});crypto$2.crypto=void 0;crypto$2.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(_){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_,"__esModule",{value:!0}),_.randomBytes=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;const a=crypto$2,$=Lt=>new Uint8Array(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.u8=$;const j=Lt=>new Uint32Array(Lt.buffer,Lt.byteOffset,Math.floor(Lt.byteLength/4));_.u32=j;const et=Lt=>new DataView(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.createView=et;const tt=(Lt,Nt)=>Lt<<32-Nt|Lt>>>Nt;if(_.rotr=tt,_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!_.isLE)throw new Error("Non little-endian hardware is not supported");const rt=Array.from({length:256},(Lt,Nt)=>Nt.toString(16).padStart(2,"0"));function nt(Lt){if(!(Lt instanceof Uint8Array))throw new Error("Uint8Array expected");let Nt="";for(let Ut=0;Ut{};_.nextTick=ot;async function st(Lt,Nt,Ut){let jt=Date.now();for(let Mt=0;Mt=0&&Dtjt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Lt.length===1)return Lt[0];const Nt=Lt.reduce((jt,Mt)=>jt+Mt.length,0),Ut=new Uint8Array(Nt);for(let jt=0,Mt=0;jtObject.prototype.toString.call(Lt)==="[object Object]"&&Lt.constructor===Object;function Ct(Lt,Nt){if(Nt!==void 0&&(typeof Nt!="object"||!Et(Nt)))throw new TypeError("Options should be object or undefined");return Object.assign(Lt,Nt)}_.checkOpts=Ct;function Pt(Lt){const Nt=jt=>Lt().update(ut(jt)).digest(),Ut=Lt();return Nt.outputLen=Ut.outputLen,Nt.blockLen=Ut.blockLen,Nt.create=()=>Lt(),Nt}_.wrapConstructor=Pt;function Tt(Lt){const Nt=(jt,Mt)=>Lt(Mt).update(ut(jt)).digest(),Ut=Lt({});return Nt.outputLen=Ut.outputLen,Nt.blockLen=Ut.blockLen,Nt.create=jt=>Lt(jt),Nt}_.wrapConstructorWithOpts=Tt;function It(Lt=32){if(a.crypto&&typeof a.crypto.getRandomValues=="function")return a.crypto.getRandomValues(new Uint8Array(Lt));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=It})(utils$p);Object.defineProperty(_sha2$1,"__esModule",{value:!0});_sha2$1.SHA2=void 0;const _assert_js_1$2=_assert$1,utils_js_1$5=utils$p;function setBigUint64$1(_,a,$,j){if(typeof _.setBigUint64=="function")return _.setBigUint64(a,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,ot=j?0:4;_.setUint32(a+it,rt,j),_.setUint32(a+ot,nt,j)}let SHA2$1=class extends utils_js_1$5.Hash{constructor(a,$,j,et){super(),this.blockLen=a,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,utils_js_1$5.createView)(this.buffer)}update(a){_assert_js_1$2.default.exists(this);const{view:$,buffer:j,blockLen:et}=this;a=(0,utils_js_1$5.toBytes)(a);const tt=a.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let at=rt;atst.length)throw new Error("_sha2: outputLen bigger than state");for(let at=0;at_&a^~_&$,Maj$1=(_,a,$)=>_&a^_&$^a&$,SHA256_K$1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$1=class extends _sha2_js_1$2.SHA2{constructor(){super(64,32,8,!1),this.A=IV$1[0]|0,this.B=IV$1[1]|0,this.C=IV$1[2]|0,this.D=IV$1[3]|0,this.E=IV$1[4]|0,this.F=IV$1[5]|0,this.G=IV$1[6]|0,this.H=IV$1[7]|0}get(){const{A:a,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[a,$,j,et,tt,rt,nt,it]}set(a,$,j,et,tt,rt,nt,it){this.A=a|0,this.B=$|0,this.C=j|0,this.D=et|0,this.E=tt|0,this.F=rt|0,this.G=nt|0,this.H=it|0}process(a,$){for(let at=0;at<16;at++,$+=4)SHA256_W$1[at]=a.getUint32($,!1);for(let at=16;at<64;at++){const ut=SHA256_W$1[at-15],ht=SHA256_W$1[at-2],bt=(0,utils_js_1$4.rotr)(ut,7)^(0,utils_js_1$4.rotr)(ut,18)^ut>>>3,Et=(0,utils_js_1$4.rotr)(ht,17)^(0,utils_js_1$4.rotr)(ht,19)^ht>>>10;SHA256_W$1[at]=Et+SHA256_W$1[at-7]+bt+SHA256_W$1[at-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:ot,H:st}=this;for(let at=0;at<64;at++){const ut=(0,utils_js_1$4.rotr)(nt,6)^(0,utils_js_1$4.rotr)(nt,11)^(0,utils_js_1$4.rotr)(nt,25),ht=st+ut+Chi$1(nt,it,ot)+SHA256_K$1[at]+SHA256_W$1[at]|0,Et=((0,utils_js_1$4.rotr)(j,2)^(0,utils_js_1$4.rotr)(j,13)^(0,utils_js_1$4.rotr)(j,22))+Maj$1(j,et,tt)|0;st=ot,ot=it,it=nt,nt=rt+ht|0,rt=tt,tt=et,et=j,j=ht+Et|0}j=j+this.A|0,et=et+this.B|0,tt=tt+this.C|0,rt=rt+this.D|0,nt=nt+this.E|0,it=it+this.F|0,ot=ot+this.G|0,st=st+this.H|0,this.set(j,et,tt,rt,nt,it,ot,st)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224$1=class extends SHA256$1{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};sha256$3.sha256=(0,utils_js_1$4.wrapConstructor)(()=>new SHA256$1);sha256$3.sha224=(0,utils_js_1$4.wrapConstructor)(()=>new SHA224$1);function base$3(_){if(_.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),$=0;$>>0,It=new Uint8Array(Tt);Ct!==Pt;){for(var Lt=ht[Ct],Nt=0,Ut=Tt-1;(Lt!==0||Nt>>0,It[Ut]=Lt%rt>>>0,Lt=Lt/rt>>>0;if(Lt!==0)throw new Error("Non-zero carry");Et=Nt,Ct++}for(var jt=Tt-Et;jt!==Tt&&It[jt]===0;)jt++;for(var Mt=nt.repeat(bt);jt>>0,Tt=new Uint8Array(Pt);ht[bt];){var It=a[ht.charCodeAt(bt)];if(It===255)return;for(var Lt=0,Nt=Pt-1;(It!==0||Lt>>0,Tt[Nt]=It%256>>>0,It=It/256>>>0;if(It!==0)throw new Error("Non-zero carry");Ct=Lt,bt++}for(var Ut=Pt-Ct;Ut!==Pt&&Tt[Ut]===0;)Ut++;for(var jt=new Uint8Array(Et+(Pt-Ut)),Mt=Et;Ut!==Pt;)jt[Mt++]=Tt[Ut++];return jt}function ut(ht){var bt=at(ht);if(bt)return bt;throw new Error("Non-base"+rt+" character")}return{encode:st,decodeUnsafe:at,decode:ut}}var src$1=base$3;const basex=src$1,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58=basex(ALPHABET),base58=bs58,base$2=function(_){function a(tt){var rt=Uint8Array.from(tt),nt=_(rt),it=rt.length+4,ot=new Uint8Array(it);return ot.set(rt,0),ot.set(nt.subarray(0,4),rt.length),base58.encode(ot,it)}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=_(rt);if(!(nt[0]^it[0]|nt[1]^it[1]|nt[2]^it[2]|nt[3]^it[3]))return rt}function j(tt){var rt=base58.decodeUnsafe(tt);if(rt)return $(rt)}function et(tt){var rt=base58.decode(tt),nt=$(rt);if(!nt)throw new Error("Invalid checksum");return nt}return{encode:a,decode:et,decodeUnsafe:j}},{sha256:sha256$2}=sha256$3,bs58checkBase=base$2;function sha256x2(_){return sha256$2(sha256$2(_))}var bs58check=bs58checkBase(sha256x2);const bs58check$1=getDefaultExportFromCjs$1(bs58check);class TaquitoError extends Error{}class ParameterValidationError extends TaquitoError{}class RpcError extends TaquitoError{}class TezosToolkitConfigError extends TaquitoError{}class UnsupportedActionError extends TaquitoError{}class NetworkError extends TaquitoError{}class InvalidAddressError extends ParameterValidationError{constructor(a,$){super(),this.address=a,this.errorDetail=$,this.name="InvalidAddressError",this.message=`Invalid address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidBlockHashError extends ParameterValidationError{constructor(a,$){super(),this.blockHash=a,this.errorDetail=$,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidAmountError extends ParameterValidationError{constructor(a){super(),this.amount=a,this.name="InvalidAmountError",this.message=`Invalid amount "${a}"`}}class InvalidDerivationPathError extends ParameterValidationError{constructor(a,$){super(),this.derivationPath=a,this.errorDetail=$,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidHexStringError extends ParameterValidationError{constructor(a,$){super(),this.hexString=a,this.errorDetail=$,this.name="InvalidHexStringError",this.message=`Invalid hex string "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidMessageError extends ParameterValidationError{constructor(a,$){super(),this.msg=a,this.errorDetail=$,this.name="InvalidMessageError",this.message=`Invalid message "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidViewParameterError extends ParameterValidationError{constructor(a,$,j,et){super(),this.viewName=a,this.sigs=$,this.args=j,this.cause=et,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(j)} received for name "${a}" expecting one of the following signatures ${JSON.stringify($)}.`}}class InvalidKeyError extends ParameterValidationError{constructor(a){super(),this.errorDetail=a,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=a?` ${a}.`:"."}}class InvalidPublicKeyError extends ParameterValidationError{constructor(a,$){super(),this.publicKey=a,this.errorDetail=$,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidContractAddressError extends ParameterValidationError{constructor(a,$){super(),this.contractAddress=a,this.errorDetail=$,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidChainIdError extends ParameterValidationError{constructor(a,$){super(),this.chainId=a,this.errorDetail=$,this.name="InvalidChainIdError",this.message=`Invalid chain id "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidKeyHashError extends ParameterValidationError{constructor(a,$){super(),this.keyHash=a,this.errorDetail=$,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationHashError extends ParameterValidationError{constructor(a,$){super(),this.operationHash=a,this.errorDetail=$,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationKindError extends ParameterValidationError{constructor(a,$){super(),this.operationKind=a,this.errorDetail=$,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${a}"`,this.message+=$?` ${$}.`:"."}}class DeprecationError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="DeprecationError"}}class ProhibitedActionError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="ProhibitedActionError"}}class PublicKeyNotFoundError extends TaquitoError{constructor(a,$){super(),this.pkh=a,this.cause=$,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${a}" in either wallet or contract API.`}}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$2=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX$1=1e9;function clone(_){var a,$,j,et=Tt.prototype={constructor:Tt,toString:null,valueOf:null},tt=new Tt(1),rt=20,nt=4,it=-7,ot=21,st=-1e7,at=1e7,ut=!1,ht=1,bt=0,Et={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ct="0123456789abcdefghijklmnopqrstuvwxyz",Pt=!0;function Tt(Mt,Dt){var Ft,Bt,yt,mt,ct,dt,vt,St,Rt=this;if(!(Rt instanceof Tt))return new Tt(Mt,Dt);if(Dt==null){if(Mt&&Mt._isBigNumber===!0){Rt.s=Mt.s,!Mt.c||Mt.e>at?Rt.c=Rt.e=null:Mt.e=10;ct/=10,mt++);mt>at?Rt.c=Rt.e=null:(Rt.e=mt,Rt.c=[Mt]);return}St=String(Mt)}else{if(!isNumeric.test(St=String(Mt)))return j(Rt,St,dt);Rt.s=St.charCodeAt(0)==45?(St=St.slice(1),-1):1}(mt=St.indexOf("."))>-1&&(St=St.replace(".","")),(ct=St.search(/e/i))>0?(mt<0&&(mt=ct),mt+=+St.slice(ct+1),St=St.substring(0,ct)):mt<0&&(mt=St.length)}else{if(intCheck(Dt,2,Ct.length,"Base"),Dt==10&&Pt)return Rt=new Tt(Mt),Ut(Rt,rt+Rt.e+1,nt);if(St=String(Mt),dt=typeof Mt=="number"){if(Mt*0!=0)return j(Rt,St,dt,Dt);if(Rt.s=1/Mt<0?(St=St.slice(1),-1):1,Tt.DEBUG&&St.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+Mt)}else Rt.s=St.charCodeAt(0)===45?(St=St.slice(1),-1):1;for(Ft=Ct.slice(0,Dt),mt=ct=0,vt=St.length;ctmt){mt=vt;continue}}else if(!yt&&(St==St.toUpperCase()&&(St=St.toLowerCase())||St==St.toLowerCase()&&(St=St.toUpperCase()))){yt=!0,ct=-1,mt=0;continue}return j(Rt,String(Mt),dt,Dt)}dt=!1,St=$(St,Dt,10,Rt.s),(mt=St.indexOf("."))>-1?St=St.replace(".",""):mt=St.length}for(ct=0;St.charCodeAt(ct)===48;ct++);for(vt=St.length;St.charCodeAt(--vt)===48;);if(St=St.slice(ct,++vt)){if(vt-=ct,dt&&Tt.DEBUG&&vt>15&&(Mt>MAX_SAFE_INTEGER$2||Mt!==mathfloor(Mt)))throw Error(tooManyDigits+Rt.s*Mt);if((mt=mt-ct-1)>at)Rt.c=Rt.e=null;else if(mt=-MAX$1&&yt<=MAX$1&&yt===mathfloor(yt)){if(Bt[0]===0){if(yt===0&&Bt.length===1)return!0;break e}if(Dt=(yt+1)%LOG_BASE,Dt<1&&(Dt+=LOG_BASE),String(Bt[0]).length==Dt){for(Dt=0;Dt=BASE||Ft!==mathfloor(Ft))break e;if(Ft!==0)return!0}}}else if(Bt===null&&yt===null&&(mt===null||mt===1||mt===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+Mt)},Tt.maximum=Tt.max=function(){return Lt(arguments,-1)},Tt.minimum=Tt.min=function(){return Lt(arguments,1)},Tt.random=function(){var Mt=9007199254740992,Dt=Math.random()*Mt&2097151?function(){return mathfloor(Math.random()*Mt)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Ft){var Bt,yt,mt,ct,dt,vt=0,St=[],Rt=new Tt(tt);if(Ft==null?Ft=rt:intCheck(Ft,0,MAX$1),ct=mathceil(Ft/LOG_BASE),ut)if(crypto.getRandomValues){for(Bt=crypto.getRandomValues(new Uint32Array(ct*=2));vt>>11),dt>=9e15?(yt=crypto.getRandomValues(new Uint32Array(2)),Bt[vt]=yt[0],Bt[vt+1]=yt[1]):(St.push(dt%1e14),vt+=2);vt=ct/2}else if(crypto.randomBytes){for(Bt=crypto.randomBytes(ct*=7);vt=9e15?crypto.randomBytes(7).copy(Bt,vt):(St.push(dt%1e14),vt+=7);vt=ct/7}else throw ut=!1,Error(bignumberError+"crypto unavailable");if(!ut)for(;vt=10;dt/=10,vt++);vtyt-1&&(dt[ct+1]==null&&(dt[ct+1]=0),dt[ct+1]+=dt[ct]/yt|0,dt[ct]%=yt)}return dt.reverse()}return function(Ft,Bt,yt,mt,ct){var dt,vt,St,Rt,$t,xt,At,wt,Ot=Ft.indexOf("."),tr=rt,nr=nt;for(Ot>=0&&(Rt=bt,bt=0,Ft=Ft.replace(".",""),wt=new Tt(Bt),xt=wt.pow(Ft.length-Ot),bt=Rt,wt.c=Dt(toFixedPoint(coeffToString(xt.c),xt.e,"0"),10,yt,Mt),wt.e=wt.c.length),At=Dt(Ft,Bt,yt,ct?(dt=Ct,Mt):(dt=Mt,Ct)),St=Rt=At.length;At[--Rt]==0;At.pop());if(!At[0])return dt.charAt(0);if(Ot<0?--St:(xt.c=At,xt.e=St,xt.s=mt,xt=a(xt,wt,tr,nr,yt),At=xt.c,$t=xt.r,St=xt.e),vt=St+tr+1,Ot=At[vt],Rt=yt/2,$t=$t||vt<0||At[vt+1]!=null,$t=nr<4?(Ot!=null||$t)&&(nr==0||nr==(xt.s<0?3:2)):Ot>Rt||Ot==Rt&&(nr==4||$t||nr==6&&At[vt-1]&1||nr==(xt.s<0?8:7)),vt<1||!At[0])Ft=$t?toFixedPoint(dt.charAt(1),-tr,dt.charAt(0)):dt.charAt(0);else{if(At.length=vt,$t)for(--yt;++At[--vt]>yt;)At[vt]=0,vt||(++St,At=[1].concat(At));for(Rt=At.length;!At[--Rt];);for(Ot=0,Ft="";Ot<=Rt;Ft+=dt.charAt(At[Ot++]));Ft=toFixedPoint(Ft,St,dt.charAt(0))}return Ft}}(),a=function(){function Mt(Bt,yt,mt){var ct,dt,vt,St,Rt=0,$t=Bt.length,xt=yt%SQRT_BASE,At=yt/SQRT_BASE|0;for(Bt=Bt.slice();$t--;)vt=Bt[$t]%SQRT_BASE,St=Bt[$t]/SQRT_BASE|0,ct=At*vt+St*xt,dt=xt*vt+ct%SQRT_BASE*SQRT_BASE+Rt,Rt=(dt/mt|0)+(ct/SQRT_BASE|0)+At*St,Bt[$t]=dt%mt;return Rt&&(Bt=[Rt].concat(Bt)),Bt}function Dt(Bt,yt,mt,ct){var dt,vt;if(mt!=ct)vt=mt>ct?1:-1;else for(dt=vt=0;dtyt[dt]?1:-1;break}return vt}function Ft(Bt,yt,mt,ct){for(var dt=0;mt--;)Bt[mt]-=dt,dt=Bt[mt]1;Bt.splice(0,1));}return function(Bt,yt,mt,ct,dt){var vt,St,Rt,$t,xt,At,wt,Ot,tr,nr,ir,Wt,Kt,Jt,Ht,qt,Qt,dr=Bt.s==yt.s?1:-1,xr=Bt.c,pr=yt.c;if(!xr||!xr[0]||!pr||!pr[0])return new Tt(!Bt.s||!yt.s||(xr?pr&&xr[0]==pr[0]:!pr)?NaN:xr&&xr[0]==0||!pr?dr*0:dr/0);for(Ot=new Tt(dr),tr=Ot.c=[],St=Bt.e-yt.e,dr=mt+St+1,dt||(dt=BASE,St=bitFloor(Bt.e/LOG_BASE)-bitFloor(yt.e/LOG_BASE),dr=dr/LOG_BASE|0),Rt=0;pr[Rt]==(xr[Rt]||0);Rt++);if(pr[Rt]>(xr[Rt]||0)&&St--,dr<0)tr.push(1),$t=!0;else{for(Jt=xr.length,qt=pr.length,Rt=0,dr+=2,xt=mathfloor(dt/(pr[0]+1)),xt>1&&(pr=Mt(pr,xt,dt),xr=Mt(xr,xt,dt),qt=pr.length,Jt=xr.length),Kt=qt,nr=xr.slice(0,qt),ir=nr.length;ir=dt/2&&Ht++;do{if(xt=0,vt=Dt(pr,nr,qt,ir),vt<0){if(Wt=nr[0],qt!=ir&&(Wt=Wt*dt+(nr[1]||0)),xt=mathfloor(Wt/Ht),xt>1)for(xt>=dt&&(xt=dt-1),At=Mt(pr,xt,dt),wt=At.length,ir=nr.length;Dt(At,nr,wt,ir)==1;)xt--,Ft(At,qt=10;dr/=10,Rt++);Ut(Ot,mt+(Ot.e=Rt+St*LOG_BASE-1)+1,ct,$t)}else Ot.e=St,Ot.r=+$t;return Ot}}();function It(Mt,Dt,Ft,Bt){var yt,mt,ct,dt,vt;if(Ft==null?Ft=nt:intCheck(Ft,0,8),!Mt.c)return Mt.toString();if(yt=Mt.c[0],ct=Mt.e,Dt==null)vt=coeffToString(Mt.c),vt=Bt==1||Bt==2&&(ct<=it||ct>=ot)?toExponential(vt,ct):toFixedPoint(vt,ct,"0");else if(Mt=Ut(new Tt(Mt),Dt,Ft),mt=Mt.e,vt=coeffToString(Mt.c),dt=vt.length,Bt==1||Bt==2&&(Dt<=mt||mt<=it)){for(;dtdt){if(--Dt>0)for(vt+=".";Dt--;vt+="0");}else if(Dt+=mt-dt,Dt>0)for(mt+1==dt&&(vt+=".");Dt--;vt+="0");return Mt.s<0&&yt?"-"+vt:vt}function Lt(Mt,Dt){for(var Ft,Bt,yt=1,mt=new Tt(Mt[0]);yt=10;yt/=10,Bt++);return(Ft=Bt+Ft*LOG_BASE-1)>at?Mt.c=Mt.e=null:Ft=10;dt/=10,yt++);if(mt=Dt-yt,mt<0)mt+=LOG_BASE,ct=Dt,vt=$t[St=0],Rt=mathfloor(vt/xt[yt-ct-1]%10);else if(St=mathceil((mt+1)/LOG_BASE),St>=$t.length)if(Bt){for(;$t.length<=St;$t.push(0));vt=Rt=0,yt=1,mt%=LOG_BASE,ct=mt-LOG_BASE+1}else break e;else{for(vt=dt=$t[St],yt=1;dt>=10;dt/=10,yt++);mt%=LOG_BASE,ct=mt-LOG_BASE+yt,Rt=ct<0?0:mathfloor(vt/xt[yt-ct-1]%10)}if(Bt=Bt||Dt<0||$t[St+1]!=null||(ct<0?vt:vt%xt[yt-ct-1]),Bt=Ft<4?(Rt||Bt)&&(Ft==0||Ft==(Mt.s<0?3:2)):Rt>5||Rt==5&&(Ft==4||Bt||Ft==6&&(mt>0?ct>0?vt/xt[yt-ct]:0:$t[St-1])%10&1||Ft==(Mt.s<0?8:7)),Dt<1||!$t[0])return $t.length=0,Bt?(Dt-=Mt.e+1,$t[0]=xt[(LOG_BASE-Dt%LOG_BASE)%LOG_BASE],Mt.e=-Dt||0):$t[0]=Mt.e=0,Mt;if(mt==0?($t.length=St,dt=1,St--):($t.length=St+1,dt=xt[LOG_BASE-mt],$t[St]=ct>0?mathfloor(vt/xt[yt-ct]%xt[ct])*dt:0),Bt)for(;;)if(St==0){for(mt=1,ct=$t[0];ct>=10;ct/=10,mt++);for(ct=$t[0]+=dt,dt=1;ct>=10;ct/=10,dt++);mt!=dt&&(Mt.e++,$t[0]==BASE&&($t[0]=1));break}else{if($t[St]+=dt,$t[St]!=BASE)break;$t[St--]=0,dt=1}for(mt=$t.length;$t[--mt]===0;$t.pop());}Mt.e>at?Mt.c=Mt.e=null:Mt.e=ot?toExponential(Dt,Ft):toFixedPoint(Dt,Ft,"0"),Mt.s<0?"-"+Dt:Dt)}return et.absoluteValue=et.abs=function(){var Mt=new Tt(this);return Mt.s<0&&(Mt.s=1),Mt},et.comparedTo=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))},et.decimalPlaces=et.dp=function(Mt,Dt){var Ft,Bt,yt,mt=this;if(Mt!=null)return intCheck(Mt,0,MAX$1),Dt==null?Dt=nt:intCheck(Dt,0,8),Ut(new Tt(mt),Mt+mt.e+1,Dt);if(!(Ft=mt.c))return null;if(Bt=((yt=Ft.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,yt=Ft[yt])for(;yt%10==0;yt/=10,Bt--);return Bt<0&&(Bt=0),Bt},et.dividedBy=et.div=function(Mt,Dt){return a(this,new Tt(Mt,Dt),rt,nt)},et.dividedToIntegerBy=et.idiv=function(Mt,Dt){return a(this,new Tt(Mt,Dt),0,1)},et.exponentiatedBy=et.pow=function(Mt,Dt){var Ft,Bt,yt,mt,ct,dt,vt,St,Rt,$t=this;if(Mt=new Tt(Mt),Mt.c&&!Mt.isInteger())throw Error(bignumberError+"Exponent not an integer: "+jt(Mt));if(Dt!=null&&(Dt=new Tt(Dt)),dt=Mt.e>14,!$t.c||!$t.c[0]||$t.c[0]==1&&!$t.e&&$t.c.length==1||!Mt.c||!Mt.c[0])return Rt=new Tt(Math.pow(+jt($t),dt?Mt.s*(2-isOdd(Mt)):+jt(Mt))),Dt?Rt.mod(Dt):Rt;if(vt=Mt.s<0,Dt){if(Dt.c?!Dt.c[0]:!Dt.s)return new Tt(NaN);Bt=!vt&&$t.isInteger()&&Dt.isInteger(),Bt&&($t=$t.mod(Dt))}else{if(Mt.e>9&&($t.e>0||$t.e<-1||($t.e==0?$t.c[0]>1||dt&&$t.c[1]>=24e7:$t.c[0]<8e13||dt&&$t.c[0]<=9999975e7)))return mt=$t.s<0&&isOdd(Mt)?-0:0,$t.e>-1&&(mt=1/mt),new Tt(vt?1/mt:mt);bt&&(mt=mathceil(bt/LOG_BASE+2))}for(dt?(Ft=new Tt(.5),vt&&(Mt.s=1),St=isOdd(Mt)):(yt=Math.abs(+jt(Mt)),St=yt%2),Rt=new Tt(tt);;){if(St){if(Rt=Rt.times($t),!Rt.c)break;mt?Rt.c.length>mt&&(Rt.c.length=mt):Bt&&(Rt=Rt.mod(Dt))}if(yt){if(yt=mathfloor(yt/2),yt===0)break;St=yt%2}else if(Mt=Mt.times(Ft),Ut(Mt,Mt.e+1,1),Mt.e>14)St=isOdd(Mt);else{if(yt=+jt(Mt),yt===0)break;St=yt%2}$t=$t.times($t),mt?$t.c&&$t.c.length>mt&&($t.c.length=mt):Bt&&($t=$t.mod(Dt))}return Bt?Rt:(vt&&(Rt=tt.div(Rt)),Dt?Rt.mod(Dt):mt?Ut(Rt,bt,nt,ct):Rt)},et.integerValue=function(Mt){var Dt=new Tt(this);return Mt==null?Mt=nt:intCheck(Mt,0,8),Ut(Dt,Dt.e+1,Mt)},et.isEqualTo=et.eq=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))===0},et.isFinite=function(){return!!this.c},et.isGreaterThan=et.gt=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))>0},et.isGreaterThanOrEqualTo=et.gte=function(Mt,Dt){return(Dt=compare$c(this,new Tt(Mt,Dt)))===1||Dt===0},et.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},et.isLessThan=et.lt=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))<0},et.isLessThanOrEqualTo=et.lte=function(Mt,Dt){return(Dt=compare$c(this,new Tt(Mt,Dt)))===-1||Dt===0},et.isNaN=function(){return!this.s},et.isNegative=function(){return this.s<0},et.isPositive=function(){return this.s>0},et.isZero=function(){return!!this.c&&this.c[0]==0},et.minus=function(Mt,Dt){var Ft,Bt,yt,mt,ct=this,dt=ct.s;if(Mt=new Tt(Mt,Dt),Dt=Mt.s,!dt||!Dt)return new Tt(NaN);if(dt!=Dt)return Mt.s=-Dt,ct.plus(Mt);var vt=ct.e/LOG_BASE,St=Mt.e/LOG_BASE,Rt=ct.c,$t=Mt.c;if(!vt||!St){if(!Rt||!$t)return Rt?(Mt.s=-Dt,Mt):new Tt($t?ct:NaN);if(!Rt[0]||!$t[0])return $t[0]?(Mt.s=-Dt,Mt):new Tt(Rt[0]?ct:nt==3?-0:0)}if(vt=bitFloor(vt),St=bitFloor(St),Rt=Rt.slice(),dt=vt-St){for((mt=dt<0)?(dt=-dt,yt=Rt):(St=vt,yt=$t),yt.reverse(),Dt=dt;Dt--;yt.push(0));yt.reverse()}else for(Bt=(mt=(dt=Rt.length)<(Dt=$t.length))?dt:Dt,dt=Dt=0;Dt0)for(;Dt--;Rt[Ft++]=0);for(Dt=BASE-1;Bt>dt;){if(Rt[--Bt]<$t[Bt]){for(Ft=Bt;Ft&&!Rt[--Ft];Rt[Ft]=Dt);--Rt[Ft],Rt[Bt]+=BASE}Rt[Bt]-=$t[Bt]}for(;Rt[0]==0;Rt.splice(0,1),--St);return Rt[0]?Nt(Mt,Rt,St):(Mt.s=nt==3?-1:1,Mt.c=[Mt.e=0],Mt)},et.modulo=et.mod=function(Mt,Dt){var Ft,Bt,yt=this;return Mt=new Tt(Mt,Dt),!yt.c||!Mt.s||Mt.c&&!Mt.c[0]?new Tt(NaN):!Mt.c||yt.c&&!yt.c[0]?new Tt(yt):(ht==9?(Bt=Mt.s,Mt.s=1,Ft=a(yt,Mt,0,3),Mt.s=Bt,Ft.s*=Bt):Ft=a(yt,Mt,0,ht),Mt=yt.minus(Ft.times(Mt)),!Mt.c[0]&&ht==1&&(Mt.s=yt.s),Mt)},et.multipliedBy=et.times=function(Mt,Dt){var Ft,Bt,yt,mt,ct,dt,vt,St,Rt,$t,xt,At,wt,Ot,tr,nr=this,ir=nr.c,Wt=(Mt=new Tt(Mt,Dt)).c;if(!ir||!Wt||!ir[0]||!Wt[0])return!nr.s||!Mt.s||ir&&!ir[0]&&!Wt||Wt&&!Wt[0]&&!ir?Mt.c=Mt.e=Mt.s=null:(Mt.s*=nr.s,!ir||!Wt?Mt.c=Mt.e=null:(Mt.c=[0],Mt.e=0)),Mt;for(Bt=bitFloor(nr.e/LOG_BASE)+bitFloor(Mt.e/LOG_BASE),Mt.s*=nr.s,vt=ir.length,$t=Wt.length,vt<$t&&(wt=ir,ir=Wt,Wt=wt,yt=vt,vt=$t,$t=yt),yt=vt+$t,wt=[];yt--;wt.push(0));for(Ot=BASE,tr=SQRT_BASE,yt=$t;--yt>=0;){for(Ft=0,xt=Wt[yt]%tr,At=Wt[yt]/tr|0,ct=vt,mt=yt+ct;mt>yt;)St=ir[--ct]%tr,Rt=ir[ct]/tr|0,dt=At*St+Rt*xt,St=xt*St+dt%tr*tr+wt[mt]+Ft,Ft=(St/Ot|0)+(dt/tr|0)+At*Rt,wt[mt--]=St%Ot;wt[mt]=Ft}return Ft?++Bt:wt.splice(0,1),Nt(Mt,wt,Bt)},et.negated=function(){var Mt=new Tt(this);return Mt.s=-Mt.s||null,Mt},et.plus=function(Mt,Dt){var Ft,Bt=this,yt=Bt.s;if(Mt=new Tt(Mt,Dt),Dt=Mt.s,!yt||!Dt)return new Tt(NaN);if(yt!=Dt)return Mt.s=-Dt,Bt.minus(Mt);var mt=Bt.e/LOG_BASE,ct=Mt.e/LOG_BASE,dt=Bt.c,vt=Mt.c;if(!mt||!ct){if(!dt||!vt)return new Tt(yt/0);if(!dt[0]||!vt[0])return vt[0]?Mt:new Tt(dt[0]?Bt:yt*0)}if(mt=bitFloor(mt),ct=bitFloor(ct),dt=dt.slice(),yt=mt-ct){for(yt>0?(ct=mt,Ft=vt):(yt=-yt,Ft=dt),Ft.reverse();yt--;Ft.push(0));Ft.reverse()}for(yt=dt.length,Dt=vt.length,yt-Dt<0&&(Ft=vt,vt=dt,dt=Ft,Dt=yt),yt=0;Dt;)yt=(dt[--Dt]=dt[Dt]+vt[Dt]+yt)/BASE|0,dt[Dt]=BASE===dt[Dt]?0:dt[Dt]%BASE;return yt&&(dt=[yt].concat(dt),++ct),Nt(Mt,dt,ct)},et.precision=et.sd=function(Mt,Dt){var Ft,Bt,yt,mt=this;if(Mt!=null&&Mt!==!!Mt)return intCheck(Mt,1,MAX$1),Dt==null?Dt=nt:intCheck(Dt,0,8),Ut(new Tt(mt),Mt,Dt);if(!(Ft=mt.c))return null;if(yt=Ft.length-1,Bt=yt*LOG_BASE+1,yt=Ft[yt]){for(;yt%10==0;yt/=10,Bt--);for(yt=Ft[0];yt>=10;yt/=10,Bt++);}return Mt&&mt.e+1>Bt&&(Bt=mt.e+1),Bt},et.shiftedBy=function(Mt){return intCheck(Mt,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+Mt)},et.squareRoot=et.sqrt=function(){var Mt,Dt,Ft,Bt,yt,mt=this,ct=mt.c,dt=mt.s,vt=mt.e,St=rt+4,Rt=new Tt("0.5");if(dt!==1||!ct||!ct[0])return new Tt(!dt||dt<0&&(!ct||ct[0])?NaN:ct?mt:1/0);if(dt=Math.sqrt(+jt(mt)),dt==0||dt==1/0?(Dt=coeffToString(ct),(Dt.length+vt)%2==0&&(Dt+="0"),dt=Math.sqrt(+Dt),vt=bitFloor((vt+1)/2)-(vt<0||vt%2),dt==1/0?Dt="5e"+vt:(Dt=dt.toExponential(),Dt=Dt.slice(0,Dt.indexOf("e")+1)+vt),Ft=new Tt(Dt)):Ft=new Tt(dt+""),Ft.c[0]){for(vt=Ft.e,dt=vt+St,dt<3&&(dt=0);;)if(yt=Ft,Ft=Rt.times(yt.plus(a(mt,yt,St,1))),coeffToString(yt.c).slice(0,dt)===(Dt=coeffToString(Ft.c)).slice(0,dt))if(Ft.e0&&wt>0){for(mt=wt%dt||dt,Rt=At.substr(0,mt);mt0&&(Rt+=St+At.slice(mt)),xt&&(Rt="-"+Rt)}Bt=$t?Rt+(Ft.decimalSeparator||"")+((vt=+Ft.fractionGroupSize)?$t.replace(new RegExp("\\d{"+vt+"}\\B","g"),"$&"+(Ft.fractionGroupSeparator||"")):$t):Rt}return(Ft.prefix||"")+Bt+(Ft.suffix||"")},et.toFraction=function(Mt){var Dt,Ft,Bt,yt,mt,ct,dt,vt,St,Rt,$t,xt,At=this,wt=At.c;if(Mt!=null&&(dt=new Tt(Mt),!dt.isInteger()&&(dt.c||dt.s!==1)||dt.lt(tt)))throw Error(bignumberError+"Argument "+(dt.isInteger()?"out of range: ":"not an integer: ")+jt(dt));if(!wt)return new Tt(At);for(Dt=new Tt(tt),St=Ft=new Tt(tt),Bt=vt=new Tt(tt),xt=coeffToString(wt),mt=Dt.e=xt.length-At.e-1,Dt.c[0]=POWS_TEN[(ct=mt%LOG_BASE)<0?LOG_BASE+ct:ct],Mt=!Mt||dt.comparedTo(Dt)>0?mt>0?Dt:St:dt,ct=at,at=1/0,dt=new Tt(xt),vt.c[0]=0;Rt=a(dt,Dt,0,1),yt=Ft.plus(Rt.times(Bt)),yt.comparedTo(Mt)!=1;)Ft=Bt,Bt=yt,St=vt.plus(Rt.times(yt=St)),vt=yt,Dt=dt.minus(Rt.times(yt=Dt)),dt=yt;return yt=a(Mt.minus(Ft),Bt,0,1),vt=vt.plus(yt.times(St)),Ft=Ft.plus(yt.times(Bt)),vt.s=St.s=At.s,mt=mt*2,$t=a(St,Bt,mt,nt).minus(At).abs().comparedTo(a(vt,Ft,mt,nt).minus(At).abs())<1?[St,Bt]:[vt,Ft],at=ct,$t},et.toNumber=function(){return+jt(this)},et.toPrecision=function(Mt,Dt){return Mt!=null&&intCheck(Mt,1,MAX$1),It(this,Mt,Dt,2)},et.toString=function(Mt){var Dt,Ft=this,Bt=Ft.s,yt=Ft.e;return yt===null?Bt?(Dt="Infinity",Bt<0&&(Dt="-"+Dt)):Dt="NaN":(Mt==null?Dt=yt<=it||yt>=ot?toExponential(coeffToString(Ft.c),yt):toFixedPoint(coeffToString(Ft.c),yt,"0"):Mt===10&&Pt?(Ft=Ut(new Tt(Ft),rt+yt+1,nt),Dt=toFixedPoint(coeffToString(Ft.c),Ft.e,"0")):(intCheck(Mt,2,Ct.length,"Base"),Dt=$(toFixedPoint(coeffToString(Ft.c),yt,"0"),10,Mt,Bt,!0)),Bt<0&&Ft.c[0]&&(Dt="-"+Dt)),Dt},et.valueOf=et.toJSON=function(){return jt(this)},et._isBigNumber=!0,et[Symbol.toStringTag]="BigNumber",et[Symbol.for("nodejs.util.inspect.custom")]=et.valueOf,_!=null&&Tt.set(_),Tt}function bitFloor(_){var a=_|0;return _>0||_===a?a:a-1}function coeffToString(_){for(var a,$,j=1,et=_.length,tt=_[0]+"";jot^$?1:-1;for(nt=(it=et.length)<(ot=tt.length)?it:ot,rt=0;rttt[rt]^$?1:-1;return it==ot?0:it>ot^$?1:-1}function intCheck(_,a,$,j){if(_$||_!==mathfloor(_))throw Error(bignumberError+(j||"Argument")+(typeof _=="number"?_$?" out of range: ":" not an integer: ":" not a primitive number: ")+String(_))}function isOdd(_){var a=_.c.length-1;return bitFloor(_.e/LOG_BASE)==a&&_.c[a]%2!=0}function toExponential(_,a){return(_.length>1?_.charAt(0)+"."+_.slice(1):_)+(a<0?"e":"e+")+a}function toFixedPoint(_,a,$){var j,et;if(a<0){for(et=$+".";++a;et+=$);_=et+_}else if(j=_.length,++a>j){for(et=$,a-=j;--a;et+=$);_+=et}else a",license$2="MIT",bugs$1={url:"https://github.com/indutny/elliptic/issues"},homepage$2="https://github.com/indutny/elliptic",devDependencies$2={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$2={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$2={name:name$2,version:version$2,description:description$2,main:main$2,files:files$1,scripts:scripts$2,repository:repository$2,keywords:keywords$1,author:author$2,license:license$2,bugs:bugs$1,homepage:homepage$2,devDependencies:devDependencies$2,dependencies:dependencies$2};var utils$o={};(function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$G;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,at,ut){var ht=new Array(Math.max(st.bitLength(),ut)+1);ht.fill(0);for(var bt=1<(bt>>1)-1?Pt=(bt>>1)-Tt:Pt=Tt,Et.isubn(Pt)):Pt=0,ht[Ct]=Pt,Et.iushrn(1)}return ht}a.getNAF=tt;function rt(st,at){var ut=[[],[]];st=st.clone(),at=at.clone();for(var ht=0,bt=0,Et;st.cmpn(-ht)>0||at.cmpn(-bt)>0;){var Ct=st.andln(3)+ht&3,Pt=at.andln(3)+bt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(Et=st.andln(7)+ht&7,(Et===3||Et===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var It;Pt&1?(Et=at.andln(7)+bt&7,(Et===3||Et===5)&&Ct===2?It=-Pt:It=Pt):It=0,ut[1].push(It),2*ht===Tt+1&&(ht=1-ht),2*bt===It+1&&(bt=1-bt),st.iushrn(1),at.iushrn(1)}return ut}a.getJSF=rt;function nt(st,at,ut){var ht="_"+at;st.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function ot(st){return new $(st,"hex","le")}a.intFromLE=ot})(utils$o);var curve$1={},BN$g=bnExports$1,utils$n=utils$o,getNAF$1=utils$n.getNAF,getJSF$1=utils$n.getJSF,assert$k=utils$n.assert;function BaseCurve$1(_,a){this.type=_,this.p=new BN$g(a.p,16),this.red=a.prime?BN$g.red(a.prime):BN$g.mont(this.p),this.zero=new BN$g(0).toRed(this.red),this.one=new BN$g(1).toRed(this.red),this.two=new BN$g(2).toRed(this.red),this.n=a.n&&new BN$g(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var $=this.n&&this.p.div(this.n);!$||$.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve$1;BaseCurve$1.prototype.point=function _(){throw new Error("Not implemented")};BaseCurve$1.prototype.validate=function _(){throw new Error("Not implemented")};BaseCurve$1.prototype._fixedNafMul=function _(a,$){assert$k(a.precomputed);var j=a._getDoubles(),et=getNAF$1($,1,this._bitLength),tt=(1<=nt;ot--)it=(it<<1)+et[ot];rt.push(it)}for(var st=this.jpoint(null,null,null),at=this.jpoint(null,null,null),ut=tt;ut>0;ut--){for(nt=0;nt=0;it--){for(var ot=0;it>=0&&rt[it]===0;it--)ot++;if(it>=0&&ot++,nt=nt.dblp(ot),it<0)break;var st=rt[it];assert$k(st!==0),a.type==="affine"?st>0?nt=nt.mixedAdd(tt[st-1>>1]):nt=nt.mixedAdd(tt[-st-1>>1].neg()):st>0?nt=nt.add(tt[st-1>>1]):nt=nt.add(tt[-st-1>>1].neg())}return a.type==="affine"?nt.toP():nt};BaseCurve$1.prototype._wnafMulAdd=function _(a,$,j,et,tt){var rt=this._wnafT1,nt=this._wnafT2,it=this._wnafT3,ot=0,st,at,ut;for(st=0;st=1;st-=2){var bt=st-1,Et=st;if(rt[bt]!==1||rt[Et]!==1){it[bt]=getNAF$1(j[bt],rt[bt],this._bitLength),it[Et]=getNAF$1(j[Et],rt[Et],this._bitLength),ot=Math.max(it[bt].length,ot),ot=Math.max(it[Et].length,ot);continue}var Ct=[$[bt],null,null,$[Et]];$[bt].y.cmp($[Et].y)===0?(Ct[1]=$[bt].add($[Et]),Ct[2]=$[bt].toJ().mixedAdd($[Et].neg())):$[bt].y.cmp($[Et].y.redNeg())===0?(Ct[1]=$[bt].toJ().mixedAdd($[Et]),Ct[2]=$[bt].add($[Et].neg())):(Ct[1]=$[bt].toJ().mixedAdd($[Et]),Ct[2]=$[bt].toJ().mixedAdd($[Et].neg()));var Pt=[-3,-1,-5,-7,0,7,5,1,3],Tt=getJSF$1(j[bt],j[Et]);for(ot=Math.max(Tt[0].length,ot),it[bt]=new Array(ot),it[Et]=new Array(ot),at=0;at=0;st--){for(var jt=0;st>=0;){var Mt=!0;for(at=0;at=0&&jt++,Nt=Nt.dblp(jt),st<0)break;for(at=0;at0?ut=nt[at][Dt-1>>1]:Dt<0&&(ut=nt[at][-Dt-1>>1].neg()),ut.type==="affine"?Nt=Nt.mixedAdd(ut):Nt=Nt.add(ut))}}for(st=0;st=Math.ceil((a.bitLength()+1)/$.step):!1};BasePoint$1.prototype._getDoubles=function _(a,$){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var j=[this],et=this,tt=0;tt<$;tt+=a){for(var rt=0;rt=0&&(ht=ot,bt=st),at.negative&&(at=at.neg(),ut=ut.neg()),ht.negative&&(ht=ht.neg(),bt=bt.neg()),[{a:at,b:ut},{a:ht,b:bt}]};ShortCurve$1.prototype._endoSplit=function _(a){var $=this.endo.basis,j=$[0],et=$[1],tt=et.b.mul(a).divRound(this.n),rt=j.b.neg().mul(a).divRound(this.n),nt=tt.mul(j.a),it=rt.mul(et.a),ot=tt.mul(j.b),st=rt.mul(et.b),at=a.sub(nt).sub(it),ut=ot.add(st).neg();return{k1:at,k2:ut}};ShortCurve$1.prototype.pointFromX=function _(a,$){a=new BN$f(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");var tt=et.fromRed().isOdd();return($&&!tt||!$&&tt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve$1.prototype.validate=function _(a){if(a.inf)return!0;var $=a.x,j=a.y,et=this.a.redMul($),tt=$.redSqr().redMul($).redIAdd(et).redIAdd(this.b);return j.redSqr().redISub(tt).cmpn(0)===0};ShortCurve$1.prototype._endoWnafMulAdd=function _(a,$,j){for(var et=this._endoWnafT1,tt=this._endoWnafT2,rt=0;rt":""};Point$5.prototype.isInfinity=function _(){return this.inf};Point$5.prototype.add=function _(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var $=this.y.redSub(a.y);$.cmpn(0)!==0&&($=$.redMul(this.x.redSub(a.x).redInvm()));var j=$.redSqr().redISub(this.x).redISub(a.x),et=$.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$5.prototype.dbl=function _(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var $=this.curve.a,j=this.x.redSqr(),et=a.redInvm(),tt=j.redAdd(j).redIAdd(j).redIAdd($).redMul(et),rt=tt.redSqr().redISub(this.x.redAdd(this.x)),nt=tt.redMul(this.x.redSub(rt)).redISub(this.y);return this.curve.point(rt,nt)};Point$5.prototype.getX=function _(){return this.x.fromRed()};Point$5.prototype.getY=function _(){return this.y.fromRed()};Point$5.prototype.mul=function _(a){return a=new BN$f(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$5.prototype.mulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt):this.curve._wnafMulAdd(1,et,tt,2)};Point$5.prototype.jmulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt,!0):this.curve._wnafMulAdd(1,et,tt,2,!0)};Point$5.prototype.eq=function _(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$5.prototype.neg=function _(a){if(this.inf)return this;var $=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var j=this.precomputed,et=function(tt){return tt.neg()};$.precomputed={naf:j.naf&&{wnd:j.naf.wnd,points:j.naf.points.map(et)},doubles:j.doubles&&{step:j.doubles.step,points:j.doubles.points.map(et)}}}return $};Point$5.prototype.toJ=function _(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint$1(_,a,$,j){Base$5.BasePoint.call(this,_,"jacobian"),a===null&&$===null&&j===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$f(0)):(this.x=new BN$f(a,16),this.y=new BN$f($,16),this.z=new BN$f(j,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$5(JPoint$1,Base$5.BasePoint);ShortCurve$1.prototype.jpoint=function _(a,$,j){return new JPoint$1(this,a,$,j)};JPoint$1.prototype.toP=function _(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),$=a.redSqr(),j=this.x.redMul($),et=this.y.redMul($).redMul(a);return this.curve.point(j,et)};JPoint$1.prototype.neg=function _(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint$1.prototype.add=function _(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var $=a.z.redSqr(),j=this.z.redSqr(),et=this.x.redMul($),tt=a.x.redMul(j),rt=this.y.redMul($.redMul(a.z)),nt=a.y.redMul(j.redMul(this.z)),it=et.redSub(tt),ot=rt.redSub(nt);if(it.cmpn(0)===0)return ot.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var st=it.redSqr(),at=st.redMul(it),ut=et.redMul(st),ht=ot.redSqr().redIAdd(at).redISub(ut).redISub(ut),bt=ot.redMul(ut.redISub(ht)).redISub(rt.redMul(at)),Et=this.z.redMul(a.z).redMul(it);return this.curve.jpoint(ht,bt,Et)};JPoint$1.prototype.mixedAdd=function _(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var $=this.z.redSqr(),j=this.x,et=a.x.redMul($),tt=this.y,rt=a.y.redMul($).redMul(this.z),nt=j.redSub(et),it=tt.redSub(rt);if(nt.cmpn(0)===0)return it.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ot=nt.redSqr(),st=ot.redMul(nt),at=j.redMul(ot),ut=it.redSqr().redIAdd(st).redISub(at).redISub(at),ht=it.redMul(at.redISub(ut)).redISub(tt.redMul(st)),bt=this.z.redMul(nt);return this.curve.jpoint(ut,ht,bt)};JPoint$1.prototype.dblp=function _(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var $;if(this.curve.zeroA||this.curve.threeA){var j=this;for($=0;$=0)return!1;if(j.redIAdd(tt),this.x.cmp(j)===0)return!0}};JPoint$1.prototype.inspect=function _(){return this.isInfinity()?"":""};JPoint$1.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};var BN$e=bnExports$1,inherits$4=inherits_browserExports,Base$4=base$1,utils$l=utils$o;function MontCurve$1(_){Base$4.call(this,"mont",_),this.a=new BN$e(_.a,16).toRed(this.red),this.b=new BN$e(_.b,16).toRed(this.red),this.i4=new BN$e(4).toRed(this.red).redInvm(),this.two=new BN$e(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$4(MontCurve$1,Base$4);var mont$1=MontCurve$1;MontCurve$1.prototype.validate=function _(a){var $=a.normalize().x,j=$.redSqr(),et=j.redMul($).redAdd(j.redMul(this.a)).redAdd($),tt=et.redSqrt();return tt.redSqr().cmp(et)===0};function Point$4(_,a,$){Base$4.BasePoint.call(this,_,"projective"),a===null&&$===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$e(a,16),this.z=new BN$e($,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$4(Point$4,Base$4.BasePoint);MontCurve$1.prototype.decodePoint=function _(a,$){return this.point(utils$l.toArray(a,$),1)};MontCurve$1.prototype.point=function _(a,$){return new Point$4(this,a,$)};MontCurve$1.prototype.pointFromJSON=function _(a){return Point$4.fromJSON(this,a)};Point$4.prototype.precompute=function _(){};Point$4.prototype._encode=function _(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$4.fromJSON=function _(a,$){return new Point$4(a,$[0],$[1]||a.one)};Point$4.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$4.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};Point$4.prototype.dbl=function _(){var a=this.x.redAdd(this.z),$=a.redSqr(),j=this.x.redSub(this.z),et=j.redSqr(),tt=$.redSub(et),rt=$.redMul(et),nt=tt.redMul(et.redAdd(this.curve.a24.redMul(tt)));return this.curve.point(rt,nt)};Point$4.prototype.add=function _(){throw new Error("Not supported on Montgomery curve")};Point$4.prototype.diffAdd=function _(a,$){var j=this.x.redAdd(this.z),et=this.x.redSub(this.z),tt=a.x.redAdd(a.z),rt=a.x.redSub(a.z),nt=rt.redMul(j),it=tt.redMul(et),ot=$.z.redMul(nt.redAdd(it).redSqr()),st=$.x.redMul(nt.redISub(it).redSqr());return this.curve.point(ot,st)};Point$4.prototype.mul=function _(a){for(var $=a.clone(),j=this,et=this.curve.point(null,null),tt=this,rt=[];$.cmpn(0)!==0;$.iushrn(1))rt.push($.andln(1));for(var nt=rt.length-1;nt>=0;nt--)rt[nt]===0?(j=j.diffAdd(et,tt),et=et.dbl()):(et=j.diffAdd(et,tt),j=j.dbl());return et};Point$4.prototype.mulAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$4.prototype.jumlAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$4.prototype.eq=function _(a){return this.getX().cmp(a.getX())===0};Point$4.prototype.normalize=function _(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$4.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};var utils$k=utils$o,BN$d=bnExports$1,inherits$3=inherits_browserExports,Base$3=base$1,assert$i=utils$k.assert;function EdwardsCurve$1(_){this.twisted=(_.a|0)!==1,this.mOneA=this.twisted&&(_.a|0)===-1,this.extended=this.mOneA,Base$3.call(this,"edwards",_),this.a=new BN$d(_.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$d(_.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$d(_.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$i(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(_.c|0)===1}inherits$3(EdwardsCurve$1,Base$3);var edwards$1=EdwardsCurve$1;EdwardsCurve$1.prototype._mulA=function _(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve$1.prototype._mulC=function _(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve$1.prototype.jpoint=function _(a,$,j,et){return this.point(a,$,j,et)};EdwardsCurve$1.prototype.pointFromX=function _(a,$){a=new BN$d(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=this.c2.redSub(this.a.redMul(j)),tt=this.one.redSub(this.c2.redMul(this.d).redMul(j)),rt=et.redMul(tt.redInvm()),nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");var it=nt.fromRed().isOdd();return($&&!it||!$&&it)&&(nt=nt.redNeg()),this.point(a,nt)};EdwardsCurve$1.prototype.pointFromY=function _(a,$){a=new BN$d(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=j.redSub(this.c2),tt=j.redMul(this.d).redMul(this.c2).redSub(this.a),rt=et.redMul(tt.redInvm());if(rt.cmp(this.zero)===0){if($)throw new Error("invalid point");return this.point(this.zero,a)}var nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");return nt.fromRed().isOdd()!==$&&(nt=nt.redNeg()),this.point(nt,a)};EdwardsCurve$1.prototype.validate=function _(a){if(a.isInfinity())return!0;a.normalize();var $=a.x.redSqr(),j=a.y.redSqr(),et=$.redMul(this.a).redAdd(j),tt=this.c2.redMul(this.one.redAdd(this.d.redMul($).redMul(j)));return et.cmp(tt)===0};function Point$3(_,a,$,j,et){Base$3.BasePoint.call(this,_,"projective"),a===null&&$===null&&j===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$d(a,16),this.y=new BN$d($,16),this.z=j?new BN$d(j,16):this.curve.one,this.t=et&&new BN$d(et,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits$3(Point$3,Base$3.BasePoint);EdwardsCurve$1.prototype.pointFromJSON=function _(a){return Point$3.fromJSON(this,a)};EdwardsCurve$1.prototype.point=function _(a,$,j,et){return new Point$3(this,a,$,j,et)};Point$3.fromJSON=function _(a,$){return new Point$3(a,$[0],$[1],$[2])};Point$3.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$3.prototype.isInfinity=function _(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point$3.prototype._extDbl=function _(){var a=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr();j=j.redIAdd(j);var et=this.curve._mulA(a),tt=this.x.redAdd(this.y).redSqr().redISub(a).redISub($),rt=et.redAdd($),nt=rt.redSub(j),it=et.redSub($),ot=tt.redMul(nt),st=rt.redMul(it),at=tt.redMul(it),ut=nt.redMul(rt);return this.curve.point(ot,st,ut,at)};Point$3.prototype._projDbl=function _(){var a=this.x.redAdd(this.y).redSqr(),$=this.x.redSqr(),j=this.y.redSqr(),et,tt,rt,nt,it,ot;if(this.curve.twisted){nt=this.curve._mulA($);var st=nt.redAdd(j);this.zOne?(et=a.redSub($).redSub(j).redMul(st.redSub(this.curve.two)),tt=st.redMul(nt.redSub(j)),rt=st.redSqr().redSub(st).redSub(st)):(it=this.z.redSqr(),ot=st.redSub(it).redISub(it),et=a.redSub($).redISub(j).redMul(ot),tt=st.redMul(nt.redSub(j)),rt=st.redMul(ot))}else nt=$.redAdd(j),it=this.curve._mulC(this.z).redSqr(),ot=nt.redSub(it).redSub(it),et=this.curve._mulC(a.redISub(nt)).redMul(ot),tt=this.curve._mulC(nt).redMul($.redISub(j)),rt=nt.redMul(ot);return this.curve.point(et,tt,rt)};Point$3.prototype.dbl=function _(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point$3.prototype._extAdd=function _(a){var $=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),j=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),tt=this.z.redMul(a.z.redAdd(a.z)),rt=j.redSub($),nt=tt.redSub(et),it=tt.redAdd(et),ot=j.redAdd($),st=rt.redMul(nt),at=it.redMul(ot),ut=rt.redMul(ot),ht=nt.redMul(it);return this.curve.point(st,at,ht,ut)};Point$3.prototype._projAdd=function _(a){var $=this.z.redMul(a.z),j=$.redSqr(),et=this.x.redMul(a.x),tt=this.y.redMul(a.y),rt=this.curve.d.redMul(et).redMul(tt),nt=j.redSub(rt),it=j.redAdd(rt),ot=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(tt),st=$.redMul(nt).redMul(ot),at,ut;return this.curve.twisted?(at=$.redMul(it).redMul(tt.redSub(this.curve._mulA(et))),ut=nt.redMul(it)):(at=$.redMul(it).redMul(tt.redSub(et)),ut=this.curve._mulC(nt).redMul(it)),this.curve.point(st,at,ut)};Point$3.prototype.add=function _(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point$3.prototype.mul=function _(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point$3.prototype.mulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!1)};Point$3.prototype.jmulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!0)};Point$3.prototype.normalize=function _(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point$3.prototype.neg=function _(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point$3.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};Point$3.prototype.getY=function _(){return this.normalize(),this.y.fromRed()};Point$3.prototype.eq=function _(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point$3.prototype.eqXToP=function _(a){var $=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp($)===0)return!0;for(var j=a.clone(),et=this.curve.redN.redMul(this.z);;){if(j.iadd(this.curve.n),j.cmp(this.curve.p)>=0)return!1;if($.redIAdd(et),this.x.cmp($)===0)return!0}};Point$3.prototype.toP=Point$3.prototype.normalize;Point$3.prototype.mixedAdd=Point$3.prototype.add;(function(_){var a=_;a.base=base$1,a.short=short$1,a.mont=mont$1,a.edwards=edwards$1})(curve$1);var curves$5={},secp256k1$1,hasRequiredSecp256k1$1;function requireSecp256k1$1(){return hasRequiredSecp256k1$1||(hasRequiredSecp256k1$1=1,secp256k1$1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1$1}(function(_){var a=_,$=hash$7,j=curve$1,et=utils$o,tt=et.assert;function rt(ot){ot.type==="short"?this.curve=new j.short(ot):ot.type==="edwards"?this.curve=new j.edwards(ot):this.curve=new j.mont(ot),this.g=this.curve.g,this.n=this.curve.n,this.hash=ot.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(ot,st){Object.defineProperty(a,ot,{configurable:!0,enumerable:!0,get:function(){var at=new rt(st);return Object.defineProperty(a,ot,{configurable:!0,enumerable:!0,value:at}),at}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1$1()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})})(curves$5);var BN$c=bnExports$1,utils$j=utils$o,assert$h=utils$j.assert;function KeyPair$7(_,a){this.ec=_,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$3=KeyPair$7;KeyPair$7.fromPublic=function _(a,$,j){return $ instanceof KeyPair$7?$:new KeyPair$7(a,{pub:$,pubEnc:j})};KeyPair$7.fromPrivate=function _(a,$,j){return $ instanceof KeyPair$7?$:new KeyPair$7(a,{priv:$,privEnc:j})};KeyPair$7.prototype.validate=function _(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$7.prototype.getPublic=function _(a,$){return typeof a=="string"&&($=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),$?this.pub.encode($,a):this.pub};KeyPair$7.prototype.getPrivate=function _(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$7.prototype._importPrivate=function _(a,$){this.priv=new BN$c(a,$||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$7.prototype._importPublic=function _(a,$){if(a.x||a.y){this.ec.curve.type==="mont"?assert$h(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$h(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,$)};KeyPair$7.prototype.derive=function _(a){return a.validate()||assert$h(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$7.prototype.sign=function _(a,$,j){return this.ec.sign(a,this,$,j)};KeyPair$7.prototype.verify=function _(a,$){return this.ec.verify(a,$,this)};KeyPair$7.prototype.inspect=function _(){return""};var BN$b=bnExports$1,utils$i=utils$o,assert$g=utils$i.assert;function Signature$7(_,a){if(_ instanceof Signature$7)return _;this._importDER(_,a)||(assert$g(_.r&&_.s,"Signature without r or s"),this.r=new BN$b(_.r,16),this.s=new BN$b(_.s,16),_.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=_.recoveryParam)}var signature$3=Signature$7;function Position$1(){this.place=0}function getLength$1(_,a){var $=_[a.place++];if(!($&128))return $;var j=$&15;if(j===0||j>4)return!1;for(var et=0,tt=0,rt=a.place;tt>>=0;return et<=127?!1:(a.place=rt,et)}function rmPadding$1(_){for(var a=0,$=_.length-1;!_[a]&&!(_[a+1]&128)&&a<$;)a++;return a===0?_:_.slice(a)}Signature$7.prototype._importDER=function _(a,$){a=utils$i.toArray(a,$);var j=new Position$1;if(a[j.place++]!==48)return!1;var et=getLength$1(a,j);if(et===!1||et+j.place!==a.length||a[j.place++]!==2)return!1;var tt=getLength$1(a,j);if(tt===!1)return!1;var rt=a.slice(j.place,tt+j.place);if(j.place+=tt,a[j.place++]!==2)return!1;var nt=getLength$1(a,j);if(nt===!1||a.length!==nt+j.place)return!1;var it=a.slice(j.place,nt+j.place);if(rt[0]===0)if(rt[1]&128)rt=rt.slice(1);else return!1;if(it[0]===0)if(it[1]&128)it=it.slice(1);else return!1;return this.r=new BN$b(rt),this.s=new BN$b(it),this.recoveryParam=null,!0};function constructLength$1(_,a){if(a<128){_.push(a);return}var $=1+(Math.log(a)/Math.LN2>>>3);for(_.push($|128);--$;)_.push(a>>>($<<3)&255);_.push(a)}Signature$7.prototype.toDER=function _(a){var $=this.r.toArray(),j=this.s.toArray();for($[0]&128&&($=[0].concat($)),j[0]&128&&(j=[0].concat(j)),$=rmPadding$1($),j=rmPadding$1(j);!j[0]&&!(j[1]&128);)j=j.slice(1);var et=[2];constructLength$1(et,$.length),et=et.concat($),et.push(2),constructLength$1(et,j.length);var tt=et.concat(j),rt=[48];return constructLength$1(rt,tt.length),rt=rt.concat(tt),utils$i.encode(rt,a)};var BN$a=bnExports$1,HmacDRBG$1=hmacDrbg,utils$h=utils$o,curves$4=curves$5,rand$1=requireBrorand(),assert$f=utils$h.assert,KeyPair$6=key$3,Signature$6=signature$3;function EC$1(_){if(!(this instanceof EC$1))return new EC$1(_);typeof _=="string"&&(assert$f(Object.prototype.hasOwnProperty.call(curves$4,_),"Unknown curve "+_),_=curves$4[_]),_ instanceof curves$4.PresetCurve&&(_={curve:_}),this.curve=_.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=_.curve.g,this.g.precompute(_.curve.n.bitLength()+1),this.hash=_.hash||_.curve.hash}var ec$3=EC$1;EC$1.prototype.keyPair=function _(a){return new KeyPair$6(this,a)};EC$1.prototype.keyFromPrivate=function _(a,$){return KeyPair$6.fromPrivate(this,a,$)};EC$1.prototype.keyFromPublic=function _(a,$){return KeyPair$6.fromPublic(this,a,$)};EC$1.prototype.genKeyPair=function _(a){a||(a={});for(var $=new HmacDRBG$1({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand$1(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),j=this.n.byteLength(),et=this.n.sub(new BN$a(2));;){var tt=new BN$a($.generate(j));if(!(tt.cmp(et)>0))return tt.iaddn(1),this.keyFromPrivate(tt)}};EC$1.prototype._truncateToN=function _(a,$){var j=a.byteLength()*8-this.n.bitLength();return j>0&&(a=a.ushrn(j)),!$&&a.cmp(this.n)>=0?a.sub(this.n):a};EC$1.prototype.sign=function _(a,$,j,et){typeof j=="object"&&(et=j,j=null),et||(et={}),$=this.keyFromPrivate($,j),a=this._truncateToN(new BN$a(a,16));for(var tt=this.n.byteLength(),rt=$.getPrivate().toArray("be",tt),nt=a.toArray("be",tt),it=new HmacDRBG$1({hash:this.hash,entropy:rt,nonce:nt,pers:et.pers,persEnc:et.persEnc||"utf8"}),ot=this.n.sub(new BN$a(1)),st=0;;st++){var at=et.k?et.k(st):new BN$a(it.generate(this.n.byteLength()));if(at=this._truncateToN(at,!0),!(at.cmpn(1)<=0||at.cmp(ot)>=0)){var ut=this.g.mul(at);if(!ut.isInfinity()){var ht=ut.getX(),bt=ht.umod(this.n);if(bt.cmpn(0)!==0){var Et=at.invm(this.n).mul(bt.mul($.getPrivate()).iadd(a));if(Et=Et.umod(this.n),Et.cmpn(0)!==0){var Ct=(ut.getY().isOdd()?1:0)|(ht.cmp(bt)!==0?2:0);return et.canonical&&Et.cmp(this.nh)>0&&(Et=this.n.sub(Et),Ct^=1),new Signature$6({r:bt,s:Et,recoveryParam:Ct})}}}}}};EC$1.prototype.verify=function _(a,$,j,et){a=this._truncateToN(new BN$a(a,16)),j=this.keyFromPublic(j,et),$=new Signature$6($,"hex");var tt=$.r,rt=$.s;if(tt.cmpn(1)<0||tt.cmp(this.n)>=0||rt.cmpn(1)<0||rt.cmp(this.n)>=0)return!1;var nt=rt.invm(this.n),it=nt.mul(a).umod(this.n),ot=nt.mul(tt).umod(this.n),st;return this.curve._maxwellTrick?(st=this.g.jmulAdd(it,j.getPublic(),ot),st.isInfinity()?!1:st.eqXToP(tt)):(st=this.g.mulAdd(it,j.getPublic(),ot),st.isInfinity()?!1:st.getX().umod(this.n).cmp(tt)===0)};EC$1.prototype.recoverPubKey=function(_,a,$,j){assert$f((3&$)===$,"The recovery param is more than two bits"),a=new Signature$6(a,j);var et=this.n,tt=new BN$a(_),rt=a.r,nt=a.s,it=$&1,ot=$>>1;if(rt.cmp(this.curve.p.umod(this.curve.n))>=0&&ot)throw new Error("Unable to find sencond key candinate");ot?rt=this.curve.pointFromX(rt.add(this.curve.n),it):rt=this.curve.pointFromX(rt,it);var st=a.r.invm(et),at=et.sub(tt).mul(st).umod(et),ut=nt.mul(st).umod(et);return this.g.mulAdd(at,rt,ut)};EC$1.prototype.getKeyRecoveryParam=function(_,a,$,j){if(a=new Signature$6(a,j),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var tt;try{tt=this.recoverPubKey(_,a,et)}catch{continue}if(tt.eq($))return et}throw new Error("Unable to find valid recovery factor")};var utils$g=utils$o,assert$e=utils$g.assert,parseBytes$6=utils$g.parseBytes,cachedProperty$3=utils$g.cachedProperty;function KeyPair$5(_,a){this.eddsa=_,this._secret=parseBytes$6(a.secret),_.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$6(a.pub)}KeyPair$5.fromPublic=function _(a,$){return $ instanceof KeyPair$5?$:new KeyPair$5(a,{pub:$})};KeyPair$5.fromSecret=function _(a,$){return $ instanceof KeyPair$5?$:new KeyPair$5(a,{secret:$})};KeyPair$5.prototype.secret=function _(){return this._secret};cachedProperty$3(KeyPair$5,"pubBytes",function _(){return this.eddsa.encodePoint(this.pub())});cachedProperty$3(KeyPair$5,"pub",function _(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$3(KeyPair$5,"privBytes",function _(){var a=this.eddsa,$=this.hash(),j=a.encodingLength-1,et=$.slice(0,a.encodingLength);return et[0]&=248,et[j]&=127,et[j]|=64,et});cachedProperty$3(KeyPair$5,"priv",function _(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$3(KeyPair$5,"hash",function _(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$3(KeyPair$5,"messagePrefix",function _(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$5.prototype.sign=function _(a){return assert$e(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$5.prototype.verify=function _(a,$){return this.eddsa.verify(a,$,this)};KeyPair$5.prototype.getSecret=function _(a){return assert$e(this._secret,"KeyPair is public only"),utils$g.encode(this.secret(),a)};KeyPair$5.prototype.getPublic=function _(a){return utils$g.encode(this.pubBytes(),a)};var key$2=KeyPair$5,BN$9=bnExports$1,utils$f=utils$o,assert$d=utils$f.assert,cachedProperty$2=utils$f.cachedProperty,parseBytes$5=utils$f.parseBytes;function Signature$5(_,a){this.eddsa=_,typeof a!="object"&&(a=parseBytes$5(a)),Array.isArray(a)&&(a={R:a.slice(0,_.encodingLength),S:a.slice(_.encodingLength)}),assert$d(a.R&&a.S,"Signature without R or S"),_.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN$9&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty$2(Signature$5,"S",function _(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty$2(Signature$5,"R",function _(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty$2(Signature$5,"Rencoded",function _(){return this.eddsa.encodePoint(this.R())});cachedProperty$2(Signature$5,"Sencoded",function _(){return this.eddsa.encodeInt(this.S())});Signature$5.prototype.toBytes=function _(){return this.Rencoded().concat(this.Sencoded())};Signature$5.prototype.toHex=function _(){return utils$f.encode(this.toBytes(),"hex").toUpperCase()};var signature$2=Signature$5,hash$4=hash$7,curves$3=curves$5,utils$e=utils$o,assert$c=utils$e.assert,parseBytes$4=utils$e.parseBytes,KeyPair$4=key$2,Signature$4=signature$2;function EDDSA$1(_){if(assert$c(_==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA$1))return new EDDSA$1(_);_=curves$3[_].curve,this.curve=_,this.g=_.g,this.g.precompute(_.n.bitLength()+1),this.pointClass=_.point().constructor,this.encodingLength=Math.ceil(_.n.bitLength()/8),this.hash=hash$4.sha512}var eddsa$1=EDDSA$1;EDDSA$1.prototype.sign=function _(a,$){a=parseBytes$4(a);var j=this.keyFromSecret($),et=this.hashInt(j.messagePrefix(),a),tt=this.g.mul(et),rt=this.encodePoint(tt),nt=this.hashInt(rt,j.pubBytes(),a).mul(j.priv()),it=et.add(nt).umod(this.curve.n);return this.makeSignature({R:tt,S:it,Rencoded:rt})};EDDSA$1.prototype.verify=function _(a,$,j){a=parseBytes$4(a),$=this.makeSignature($);var et=this.keyFromPublic(j),tt=this.hashInt($.Rencoded(),et.pubBytes(),a),rt=this.g.mul($.S()),nt=$.R().add(et.pub().mul(tt));return nt.eq(rt)};EDDSA$1.prototype.hashInt=function _(){for(var a=this.hash(),$=0;$bs58check$1.decode(_).slice(a.length);function b58decode(_){const a=bs58check$1.decode(_),j={[prefix.tz1.toString()]:"0000",[prefix.tz2.toString()]:"0001",[prefix.tz3.toString()]:"0002"}[new Uint8Array(a.slice(0,3)).toString()];if(j){const et=buf2hex(a.slice(3));return j+et}else return"01"+buf2hex(a.slice(3,42))+"00"}function encodeAddress(_){if(_.substring(0,2)==="0x"&&(_=_.slice(2)),_.substring(0,2)==="00"){const a={"0000":prefix.tz1,"0001":prefix.tz2,"0002":prefix.tz3};return b58cencode(_.substring(4),a[_.substring(0,4)])}return b58cencode(_.substring(2,42),prefix.KT)}function encodeKey(_){if(_[0]==="0"){const a={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}function encodeKeyHash(_){if(_[0]==="0"){const a={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}const hex2buf=_=>{if(_.length%2!==0)throw new InvalidHexStringError(_,": Expecting even number of characters");const a=stripHexPrefix$1(_);if(!a.match(/^([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const $=new Uint8Array(a.length/2);let j=0;for(let et=0;et{const $=new Uint8Array(_.length+a.length);return $.set(_),$.set(a,_.length),$},buf2hex=_=>{const a=[];return _.forEach($=>{const et=`00${$.toString(16)}`.slice(-2);a.push(et)}),a.join("")};function hex2Bytes(_){const a=stripHexPrefix$1(_);if(!a.match(/^(0x)?([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return buffer$1.Buffer.from(a,"hex")}function stripHexPrefix$1(_){return _.startsWith("0x")?_.slice(2):_}var util;(function(_){_.assertEqual=et=>et;function a(et){}_.assertIs=a;function $(et){throw new Error}_.assertNever=$,_.arrayToEnum=et=>{const tt={};for(const rt of et)tt[rt]=rt;return tt},_.getValidEnumValues=et=>{const tt=_.objectKeys(et).filter(nt=>typeof et[et[nt]]!="number"),rt={};for(const nt of tt)rt[nt]=et[nt];return _.objectValues(rt)},_.objectValues=et=>_.objectKeys(et).map(function(tt){return et[tt]}),_.objectKeys=typeof Object.keys=="function"?et=>Object.keys(et):et=>{const tt=[];for(const rt in et)Object.prototype.hasOwnProperty.call(et,rt)&&tt.push(rt);return tt},_.find=(et,tt)=>{for(const rt of et)if(tt(rt))return rt},_.isInteger=typeof Number.isInteger=="function"?et=>Number.isInteger(et):et=>typeof et=="number"&&isFinite(et)&&Math.floor(et)===et;function j(et,tt=" | "){return et.map(rt=>typeof rt=="string"?`'${rt}'`:rt).join(tt)}_.joinValues=j,_.jsonStringifyReplacer=(et,tt)=>typeof tt=="bigint"?tt.toString():tt})(util||(util={}));var objectUtil;(function(_){_.mergeShapes=(a,$)=>({...a,...$})})(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=_=>{switch(typeof _){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(_)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(_)?ZodParsedType.array:_===null?ZodParsedType.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&_ instanceof Map?ZodParsedType.map:typeof Set<"u"&&_ instanceof Set?ZodParsedType.set:typeof Date<"u"&&_ instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(a){super(),this.issues=[],this.addIssue=j=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};const $=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,$):this.__proto__=$,this.name="ZodError",this.issues=a}get errors(){return this.issues}format(a){const $=a||function(tt){return tt.message},j={_errors:[]},et=tt=>{for(const rt of tt.issues)if(rt.code==="invalid_union")rt.unionErrors.map(et);else if(rt.code==="invalid_return_type")et(rt.returnTypeError);else if(rt.code==="invalid_arguments")et(rt.argumentsError);else if(rt.path.length===0)j._errors.push($(rt));else{let nt=j,it=0;for(;it$.message){const $={},j=[];for(const et of this.issues)et.path.length>0?($[et.path[0]]=$[et.path[0]]||[],$[et.path[0]].push(a(et))):j.push(a(et));return{formErrors:j,fieldErrors:$}}get formErrors(){return this.flatten()}}ZodError.create=_=>new ZodError(_);const errorMap=(_,a)=>{let $;switch(_.code){case ZodIssueCode.invalid_type:_.received===ZodParsedType.undefined?$="Required":$=`Expected ${_.expected}, received ${_.received}`;break;case ZodIssueCode.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(_.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:$=`Unrecognized key(s) in object: ${util.joinValues(_.keys,", ")}`;break;case ZodIssueCode.invalid_union:$="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${util.joinValues(_.options)}`;break;case ZodIssueCode.invalid_enum_value:$=`Invalid enum value. Expected ${util.joinValues(_.options)}, received '${_.received}'`;break;case ZodIssueCode.invalid_arguments:$="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:$="Invalid function return type";break;case ZodIssueCode.invalid_date:$="Invalid date";break;case ZodIssueCode.invalid_string:typeof _.validation=="object"?"includes"in _.validation?($=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&($=`${$} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?$=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?$=`Invalid input: must end with "${_.validation.endsWith}"`:util.assertNever(_.validation):_.validation!=="regex"?$=`Invalid ${_.validation}`:$="Invalid";break;case ZodIssueCode.too_small:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:$="Invalid input";break;case ZodIssueCode.too_big:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?$=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`:$="Invalid input";break;case ZodIssueCode.custom:$="Invalid input";break;case ZodIssueCode.invalid_intersection_types:$="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:$=`Number must be a multiple of ${_.multipleOf}`;break;case ZodIssueCode.not_finite:$="Number must be finite";break;default:$=a.defaultError,util.assertNever(_)}return{message:$}};let overrideErrorMap=errorMap;function setErrorMap(_){overrideErrorMap=_}function getErrorMap(){return overrideErrorMap}const makeIssue=_=>{const{data:a,path:$,errorMaps:j,issueData:et}=_,tt=[...$,...et.path||[]],rt={...et,path:tt};if(et.message!==void 0)return{...et,path:tt,message:et.message};let nt="";const it=j.filter(ot=>!!ot).slice().reverse();for(const ot of it)nt=ot(rt,{data:a,defaultError:nt}).message;return{...et,path:tt,message:nt}},EMPTY_PATH=[];function addIssueToContext(_,a){const $=getErrorMap(),j=makeIssue({issueData:a,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,$,$===errorMap?void 0:errorMap].filter(et=>!!et)});_.common.issues.push(j)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,$){const j=[];for(const et of $){if(et.status==="aborted")return INVALID;et.status==="dirty"&&a.dirty(),j.push(et.value)}return{status:a.value,value:j}}static async mergeObjectAsync(a,$){const j=[];for(const et of $){const tt=await et.key,rt=await et.value;j.push({key:tt,value:rt})}return ParseStatus.mergeObjectSync(a,j)}static mergeObjectSync(a,$){const j={};for(const et of $){const{key:tt,value:rt}=et;if(tt.status==="aborted"||rt.status==="aborted")return INVALID;tt.status==="dirty"&&a.dirty(),rt.status==="dirty"&&a.dirty(),tt.value!=="__proto__"&&(typeof rt.value<"u"||et.alwaysSet)&&(j[tt.value]=rt.value)}return{status:a.value,value:j}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=_=>({status:"dirty",value:_}),OK=_=>({status:"valid",value:_}),isAborted=_=>_.status==="aborted",isDirty=_=>_.status==="dirty",isValid$1=_=>_.status==="valid",isAsync=_=>typeof Promise<"u"&&_ instanceof Promise;function __classPrivateFieldGet$1(_,a,$,j){if(typeof a=="function"?_!==a||!j:!a.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a.get(_)}function __classPrivateFieldSet$1(_,a,$,j,et){if(typeof a=="function"?_!==a||!et:!a.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a.set(_,$),$}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(_){_.errToObj=a=>typeof a=="string"?{message:a}:a||{},_.toString=a=>typeof a=="string"?a:a==null?void 0:a.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(a,$,j,et){this._cachedPath=[],this.parent=a,this.data=$,this._path=j,this._key=et}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(_,a)=>{if(isValid$1(a))return{success:!0,data:a.value};if(!_.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const $=new ZodError(_.common.issues);return this._error=$,this._error}}};function processCreateParams(_){if(!_)return{};const{errorMap:a,invalid_type_error:$,required_error:j,description:et}=_;if(a&&($||j))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:et}:{errorMap:(rt,nt)=>{var it,ot;const{message:st}=_;return rt.code==="invalid_enum_value"?{message:st??nt.defaultError}:typeof nt.data>"u"?{message:(it=st??j)!==null&&it!==void 0?it:nt.defaultError}:rt.code!=="invalid_type"?{message:nt.defaultError}:{message:(ot=st??$)!==null&&ot!==void 0?ot:nt.defaultError}},description:et}}class ZodType{constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(a){return getParsedType(a.data)}_getOrReturnCtx(a,$){return $||{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new ParseStatus,ctx:{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const $=this._parse(a);if(isAsync($))throw new Error("Synchronous parse encountered promise.");return $}_parseAsync(a){const $=this._parse(a);return Promise.resolve($)}parse(a,$){const j=this.safeParse(a,$);if(j.success)return j.data;throw j.error}safeParse(a,$){var j;const et={common:{issues:[],async:(j=$==null?void 0:$.async)!==null&&j!==void 0?j:!1,contextualErrorMap:$==null?void 0:$.errorMap},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},tt=this._parseSync({data:a,path:et.path,parent:et});return handleResult(et,tt)}async parseAsync(a,$){const j=await this.safeParseAsync(a,$);if(j.success)return j.data;throw j.error}async safeParseAsync(a,$){const j={common:{issues:[],contextualErrorMap:$==null?void 0:$.errorMap,async:!0},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},et=this._parse({data:a,path:j.path,parent:j}),tt=await(isAsync(et)?et:Promise.resolve(et));return handleResult(j,tt)}refine(a,$){const j=et=>typeof $=="string"||typeof $>"u"?{message:$}:typeof $=="function"?$(et):$;return this._refinement((et,tt)=>{const rt=a(et),nt=()=>tt.addIssue({code:ZodIssueCode.custom,...j(et)});return typeof Promise<"u"&&rt instanceof Promise?rt.then(it=>it?!0:(nt(),!1)):rt?!0:(nt(),!1)})}refinement(a,$){return this._refinement((j,et)=>a(j)?!0:(et.addIssue(typeof $=="function"?$(j,et):$),!1))}_refinement(a){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(a){return ZodUnion.create([this,a],this._def)}and(a){return ZodIntersection.create(this,a,this._def)}transform(a){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const $=typeof a=="function"?a:()=>a;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:$,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(a){const $=typeof a=="function"?a:()=>a;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:$,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(a){const $=this.constructor;return new $({...this._def,description:a})}pipe(a){return ZodPipeline.create(this,a)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(_){let a="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?a=`${a}\\.\\d{${_.precision}}`:_.precision==null&&(a=`${a}(\\.\\d+)?`),a}function timeRegex(_){return new RegExp(`^${timeRegexSource(_)}$`)}function datetimeRegex(_){let a=`${dateRegexSource}T${timeRegexSource(_)}`;const $=[];return $.push(_.local?"Z?":"Z"),_.offset&&$.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${$.join("|")})`,new RegExp(`^${a}$`)}function isValidIP(_,a){return!!((a==="v4"||!a)&&ipv4Regex.test(_)||(a==="v6"||!a)&&ipv6Regex.test(_))}class ZodString extends ZodType{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==ZodParsedType.string){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:tt.parsedType}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)if(tt.kind==="min")a.data.lengthtt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,maximum:tt.value,type:"string",inclusive:!0,exact:!1,message:tt.message}),j.dirty());else if(tt.kind==="length"){const rt=a.data.length>tt.value,nt=a.data.lengtha.test(et),{validation:$,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(j)})}_addCheck(a){return new ZodString({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...errorUtil.errToObj(a)})}url(a){return this._addCheck({kind:"url",...errorUtil.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...errorUtil.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...errorUtil.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...errorUtil.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...errorUtil.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...errorUtil.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...errorUtil.errToObj(a)})}datetime(a){var $,j;return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,offset:($=a==null?void 0:a.offset)!==null&&$!==void 0?$:!1,local:(j=a==null?void 0:a.local)!==null&&j!==void 0?j:!1,...errorUtil.errToObj(a==null?void 0:a.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,...errorUtil.errToObj(a==null?void 0:a.message)})}duration(a){return this._addCheck({kind:"duration",...errorUtil.errToObj(a)})}regex(a,$){return this._addCheck({kind:"regex",regex:a,...errorUtil.errToObj($)})}includes(a,$){return this._addCheck({kind:"includes",value:a,position:$==null?void 0:$.position,...errorUtil.errToObj($==null?void 0:$.message)})}startsWith(a,$){return this._addCheck({kind:"startsWith",value:a,...errorUtil.errToObj($)})}endsWith(a,$){return this._addCheck({kind:"endsWith",value:a,...errorUtil.errToObj($)})}min(a,$){return this._addCheck({kind:"min",value:a,...errorUtil.errToObj($)})}max(a,$){return this._addCheck({kind:"max",value:a,...errorUtil.errToObj($)})}length(a,$){return this._addCheck({kind:"length",value:a,...errorUtil.errToObj($)})}nonempty(a){return this.min(1,errorUtil.errToObj(a))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get minLength(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxLength(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};function floatSafeRemainder(_,a){const $=(_.toString().split(".")[1]||"").length,j=(a.toString().split(".")[1]||"").length,et=$>j?$:j,tt=parseInt(_.toFixed(et).replace(".","")),rt=parseInt(a.toFixed(et).replace(".",""));return tt%rt/Math.pow(10,et)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==ZodParsedType.number){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="int"?util.isInteger(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:tt.message}),et.dirty()):tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:tt.value,type:"number",inclusive:tt.inclusive,exact:!1,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?floatSafeRemainder(a.data,tt.value)!==0&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):tt.kind==="finite"?Number.isFinite(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_finite,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodNumber({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:errorUtil.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}finite(a){return this._addCheck({kind:"finite",message:errorUtil.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(a)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuea.kind==="int"||a.kind==="multipleOf"&&util.isInteger(a.value))}get isFinite(){let a=null,$=null;for(const j of this._def.checks){if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;j.kind==="min"?($===null||j.value>$)&&($=j.value):j.kind==="max"&&(a===null||j.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce&&(a.data=BigInt(a.data)),this._getType(a)!==ZodParsedType.bigint){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,type:"bigint",maximum:tt.value,inclusive:tt.inclusive,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?a.data%tt.value!==BigInt(0)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodBigInt({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};class ZodBoolean extends ZodType{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==ZodParsedType.boolean){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:j.parsedType}),INVALID}return OK(a.data)}}ZodBoolean.create=_=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodDate extends ZodType{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==ZodParsedType.date){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:tt.parsedType}),INVALID}if(isNaN(a.data.getTime())){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_date}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)tt.kind==="min"?a.data.getTime()tt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,message:tt.message,inclusive:!0,exact:!1,maximum:tt.value,type:"date"}),j.dirty()):util.assertNever(tt);return{status:j.value,value:new Date(a.data.getTime())}}_addCheck(a){return new ZodDate({...this._def,checks:[...this._def.checks,a]})}min(a,$){return this._addCheck({kind:"min",value:a.getTime(),message:errorUtil.toString($)})}max(a,$){return this._addCheck({kind:"max",value:a.getTime(),message:errorUtil.toString($)})}get minDate(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuenew ZodDate({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(_)});class ZodSymbol extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.symbol){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:j.parsedType}),INVALID}return OK(a.data)}}ZodSymbol.create=_=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(_)});class ZodUndefined extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:j.parsedType}),INVALID}return OK(a.data)}}ZodUndefined.create=_=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(_)});class ZodNull extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.null){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:j.parsedType}),INVALID}return OK(a.data)}}ZodNull.create=_=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(_)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(a){return OK(a.data)}}ZodAny.create=_=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(_)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(a){return OK(a.data)}}ZodUnknown.create=_=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(_)});class ZodNever extends ZodType{_parse(a){const $=this._getOrReturnCtx(a);return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:$.parsedType}),INVALID}}ZodNever.create=_=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(_)});class ZodVoid extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:j.parsedType}),INVALID}return OK(a.data)}}ZodVoid.create=_=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(_)});class ZodArray extends ZodType{_parse(a){const{ctx:$,status:j}=this._processInputParams(a),et=this._def;if($.parsedType!==ZodParsedType.array)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:$.parsedType}),INVALID;if(et.exactLength!==null){const rt=$.data.length>et.exactLength.value,nt=$.data.lengthet.maxLength.value&&(addIssueToContext($,{code:ZodIssueCode.too_big,maximum:et.maxLength.value,type:"array",inclusive:!0,exact:!1,message:et.maxLength.message}),j.dirty()),$.common.async)return Promise.all([...$.data].map((rt,nt)=>et.type._parseAsync(new ParseInputLazyPath($,rt,$.path,nt)))).then(rt=>ParseStatus.mergeArray(j,rt));const tt=[...$.data].map((rt,nt)=>et.type._parseSync(new ParseInputLazyPath($,rt,$.path,nt)));return ParseStatus.mergeArray(j,tt)}get element(){return this._def.type}min(a,$){return new ZodArray({...this._def,minLength:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodArray({...this._def,maxLength:{value:a,message:errorUtil.toString($)}})}length(a,$){return new ZodArray({...this._def,exactLength:{value:a,message:errorUtil.toString($)}})}nonempty(a){return this.min(1,a)}}ZodArray.create=(_,a)=>new ZodArray({type:_,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(a)});function deepPartialify(_){if(_ instanceof ZodObject){const a={};for(const $ in _.shape){const j=_.shape[$];a[$]=ZodOptional.create(deepPartialify(j))}return new ZodObject({..._._def,shape:()=>a})}else return _ instanceof ZodArray?new ZodArray({..._._def,type:deepPartialify(_.element)}):_ instanceof ZodOptional?ZodOptional.create(deepPartialify(_.unwrap())):_ instanceof ZodNullable?ZodNullable.create(deepPartialify(_.unwrap())):_ instanceof ZodTuple?ZodTuple.create(_.items.map(a=>deepPartialify(a))):_}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),$=util.objectKeys(a);return this._cached={shape:a,keys:$}}_parse(a){if(this._getType(a)!==ZodParsedType.object){const ot=this._getOrReturnCtx(a);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ot.parsedType}),INVALID}const{status:j,ctx:et}=this._processInputParams(a),{shape:tt,keys:rt}=this._getCached(),nt=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const ot in et.data)rt.includes(ot)||nt.push(ot);const it=[];for(const ot of rt){const st=tt[ot],at=et.data[ot];it.push({key:{status:"valid",value:ot},value:st._parse(new ParseInputLazyPath(et,at,et.path,ot)),alwaysSet:ot in et.data})}if(this._def.catchall instanceof ZodNever){const ot=this._def.unknownKeys;if(ot==="passthrough")for(const st of nt)it.push({key:{status:"valid",value:st},value:{status:"valid",value:et.data[st]}});else if(ot==="strict")nt.length>0&&(addIssueToContext(et,{code:ZodIssueCode.unrecognized_keys,keys:nt}),j.dirty());else if(ot!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ot=this._def.catchall;for(const st of nt){const at=et.data[st];it.push({key:{status:"valid",value:st},value:ot._parse(new ParseInputLazyPath(et,at,et.path,st)),alwaysSet:st in et.data})}}return et.common.async?Promise.resolve().then(async()=>{const ot=[];for(const st of it){const at=await st.key,ut=await st.value;ot.push({key:at,value:ut,alwaysSet:st.alwaysSet})}return ot}).then(ot=>ParseStatus.mergeObjectSync(j,ot)):ParseStatus.mergeObjectSync(j,it)}get shape(){return this._def.shape()}strict(a){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:($,j)=>{var et,tt,rt,nt;const it=(rt=(tt=(et=this._def).errorMap)===null||tt===void 0?void 0:tt.call(et,$,j).message)!==null&&rt!==void 0?rt:j.defaultError;return $.code==="unrecognized_keys"?{message:(nt=errorUtil.errToObj(a).message)!==null&&nt!==void 0?nt:it}:{message:it}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(a){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new ZodObject({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(a,$){return this.augment({[a]:$})}catchall(a){return new ZodObject({...this._def,catchall:a})}pick(a){const $={};return util.objectKeys(a).forEach(j=>{a[j]&&this.shape[j]&&($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}omit(a){const $={};return util.objectKeys(this.shape).forEach(j=>{a[j]||($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}deepPartial(){return deepPartialify(this)}partial(a){const $={};return util.objectKeys(this.shape).forEach(j=>{const et=this.shape[j];a&&!a[j]?$[j]=et:$[j]=et.optional()}),new ZodObject({...this._def,shape:()=>$})}required(a){const $={};return util.objectKeys(this.shape).forEach(j=>{if(a&&!a[j])$[j]=this.shape[j];else{let tt=this.shape[j];for(;tt instanceof ZodOptional;)tt=tt._def.innerType;$[j]=tt}}),new ZodObject({...this._def,shape:()=>$})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.strictCreate=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.lazycreate=(_,a)=>new ZodObject({shape:_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});class ZodUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=this._def.options;function et(tt){for(const nt of tt)if(nt.result.status==="valid")return nt.result;for(const nt of tt)if(nt.result.status==="dirty")return $.common.issues.push(...nt.ctx.common.issues),nt.result;const rt=tt.map(nt=>new ZodError(nt.ctx.common.issues));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:rt}),INVALID}if($.common.async)return Promise.all(j.map(async tt=>{const rt={...$,common:{...$.common,issues:[]},parent:null};return{result:await tt._parseAsync({data:$.data,path:$.path,parent:rt}),ctx:rt}})).then(et);{let tt;const rt=[];for(const it of j){const ot={...$,common:{...$.common,issues:[]},parent:null},st=it._parseSync({data:$.data,path:$.path,parent:ot});if(st.status==="valid")return st;st.status==="dirty"&&!tt&&(tt={result:st,ctx:ot}),ot.common.issues.length&&rt.push(ot.common.issues)}if(tt)return $.common.issues.push(...tt.ctx.common.issues),tt.result;const nt=rt.map(it=>new ZodError(it));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:nt}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(_,a)=>new ZodUnion({options:_,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(a)});const getDiscriminator=_=>_ instanceof ZodLazy?getDiscriminator(_.schema):_ instanceof ZodEffects?getDiscriminator(_.innerType()):_ instanceof ZodLiteral?[_.value]:_ instanceof ZodEnum?_.options:_ instanceof ZodNativeEnum?util.objectValues(_.enum):_ instanceof ZodDefault?getDiscriminator(_._def.innerType):_ instanceof ZodUndefined?[void 0]:_ instanceof ZodNull?[null]:_ instanceof ZodOptional?[void 0,...getDiscriminator(_.unwrap())]:_ instanceof ZodNullable?[null,...getDiscriminator(_.unwrap())]:_ instanceof ZodBranded||_ instanceof ZodReadonly?getDiscriminator(_.unwrap()):_ instanceof ZodCatch?getDiscriminator(_._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.object)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:$.parsedType}),INVALID;const j=this.discriminator,et=$.data[j],tt=this.optionsMap.get(et);return tt?$.common.async?tt._parseAsync({data:$.data,path:$.path,parent:$}):tt._parseSync({data:$.data,path:$.path,parent:$}):(addIssueToContext($,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,$,j){const et=new Map;for(const tt of $){const rt=getDiscriminator(tt.shape[a]);if(!rt.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const nt of rt){if(et.has(nt))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(nt)}`);et.set(nt,tt)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:a,options:$,optionsMap:et,...processCreateParams(j)})}}function mergeValues(_,a){const $=getParsedType(_),j=getParsedType(a);if(_===a)return{valid:!0,data:_};if($===ZodParsedType.object&&j===ZodParsedType.object){const et=util.objectKeys(a),tt=util.objectKeys(_).filter(nt=>et.indexOf(nt)!==-1),rt={..._,...a};for(const nt of tt){const it=mergeValues(_[nt],a[nt]);if(!it.valid)return{valid:!1};rt[nt]=it.data}return{valid:!0,data:rt}}else if($===ZodParsedType.array&&j===ZodParsedType.array){if(_.length!==a.length)return{valid:!1};const et=[];for(let tt=0;tt<_.length;tt++){const rt=_[tt],nt=a[tt],it=mergeValues(rt,nt);if(!it.valid)return{valid:!1};et.push(it.data)}return{valid:!0,data:et}}else return $===ZodParsedType.date&&j===ZodParsedType.date&&+_==+a?{valid:!0,data:_}:{valid:!1}}class ZodIntersection extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=(tt,rt)=>{if(isAborted(tt)||isAborted(rt))return INVALID;const nt=mergeValues(tt.value,rt.value);return nt.valid?((isDirty(tt)||isDirty(rt))&&$.dirty(),{status:$.value,value:nt.data}):(addIssueToContext(j,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return j.common.async?Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([tt,rt])=>et(tt,rt)):et(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}}ZodIntersection.create=(_,a,$)=>new ZodIntersection({left:_,right:a,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams($)});class ZodTuple extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.array)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:j.parsedType}),INVALID;if(j.data.lengththis._def.items.length&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty());const tt=[...j.data].map((rt,nt)=>{const it=this._def.items[nt]||this._def.rest;return it?it._parse(new ParseInputLazyPath(j,rt,j.path,nt)):null}).filter(rt=>!!rt);return j.common.async?Promise.all(tt).then(rt=>ParseStatus.mergeArray($,rt)):ParseStatus.mergeArray($,tt)}get items(){return this._def.items}rest(a){return new ZodTuple({...this._def,rest:a})}}ZodTuple.create=(_,a)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:_,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(a)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.object)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:j.parsedType}),INVALID;const et=[],tt=this._def.keyType,rt=this._def.valueType;for(const nt in j.data)et.push({key:tt._parse(new ParseInputLazyPath(j,nt,j.path,nt)),value:rt._parse(new ParseInputLazyPath(j,j.data[nt],j.path,nt)),alwaysSet:nt in j.data});return j.common.async?ParseStatus.mergeObjectAsync($,et):ParseStatus.mergeObjectSync($,et)}get element(){return this._def.valueType}static create(a,$,j){return $ instanceof ZodType?new ZodRecord({keyType:a,valueType:$,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(j)}):new ZodRecord({keyType:ZodString.create(),valueType:a,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams($)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.map)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:j.parsedType}),INVALID;const et=this._def.keyType,tt=this._def.valueType,rt=[...j.data.entries()].map(([nt,it],ot)=>({key:et._parse(new ParseInputLazyPath(j,nt,j.path,[ot,"key"])),value:tt._parse(new ParseInputLazyPath(j,it,j.path,[ot,"value"]))}));if(j.common.async){const nt=new Map;return Promise.resolve().then(async()=>{for(const it of rt){const ot=await it.key,st=await it.value;if(ot.status==="aborted"||st.status==="aborted")return INVALID;(ot.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(ot.value,st.value)}return{status:$.value,value:nt}})}else{const nt=new Map;for(const it of rt){const ot=it.key,st=it.value;if(ot.status==="aborted"||st.status==="aborted")return INVALID;(ot.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(ot.value,st.value)}return{status:$.value,value:nt}}}}ZodMap.create=(_,a,$)=>new ZodMap({valueType:a,keyType:_,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams($)});class ZodSet extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.set)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:j.parsedType}),INVALID;const et=this._def;et.minSize!==null&&j.data.sizeet.maxSize.value&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:et.maxSize.value,type:"set",inclusive:!0,exact:!1,message:et.maxSize.message}),$.dirty());const tt=this._def.valueType;function rt(it){const ot=new Set;for(const st of it){if(st.status==="aborted")return INVALID;st.status==="dirty"&&$.dirty(),ot.add(st.value)}return{status:$.value,value:ot}}const nt=[...j.data.values()].map((it,ot)=>tt._parse(new ParseInputLazyPath(j,it,j.path,ot)));return j.common.async?Promise.all(nt).then(it=>rt(it)):rt(nt)}min(a,$){return new ZodSet({...this._def,minSize:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodSet({...this._def,maxSize:{value:a,message:errorUtil.toString($)}})}size(a,$){return this.min(a,$).max(a,$)}nonempty(a){return this.min(1,a)}}ZodSet.create=(_,a)=>new ZodSet({valueType:_,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(a)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.function)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:$.parsedType}),INVALID;function j(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(ot=>!!ot),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:it}})}function et(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(ot=>!!ot),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:it}})}const tt={errorMap:$.common.contextualErrorMap},rt=$.data;if(this._def.returns instanceof ZodPromise){const nt=this;return OK(async function(...it){const ot=new ZodError([]),st=await nt._def.args.parseAsync(it,tt).catch(ht=>{throw ot.addIssue(j(it,ht)),ot}),at=await Reflect.apply(rt,this,st);return await nt._def.returns._def.type.parseAsync(at,tt).catch(ht=>{throw ot.addIssue(et(at,ht)),ot})})}else{const nt=this;return OK(function(...it){const ot=nt._def.args.safeParse(it,tt);if(!ot.success)throw new ZodError([j(it,ot.error)]);const st=Reflect.apply(rt,this,ot.data),at=nt._def.returns.safeParse(st,tt);if(!at.success)throw new ZodError([et(st,at.error)]);return at.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...a){return new ZodFunction({...this._def,args:ZodTuple.create(a).rest(ZodUnknown.create())})}returns(a){return new ZodFunction({...this._def,returns:a})}implement(a){return this.parse(a)}strictImplement(a){return this.parse(a)}static create(a,$,j){return new ZodFunction({args:a||ZodTuple.create([]).rest(ZodUnknown.create()),returns:$||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(j)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(a){const{ctx:$}=this._processInputParams(a);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}ZodLazy.create=(_,a)=>new ZodLazy({getter:_,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(a)});class ZodLiteral extends ZodType{_parse(a){if(a.data!==this._def.value){const $=this._getOrReturnCtx(a);return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:a.data}}get value(){return this._def.value}}ZodLiteral.create=(_,a)=>new ZodLiteral({value:_,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(a)});function createZodEnum(_,a){return new ZodEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(a)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(a){if(typeof a.data!="string"){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{expected:util.joinValues(j),received:$.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodEnum_cache)||__classPrivateFieldSet$1(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet$1(this,_ZodEnum_cache).has(a.data)){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_enum_value,options:j}),INVALID}return OK(a.data)}get options(){return this._def.values}get enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Values(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}extract(a,$=this._def){return ZodEnum.create(a,{...this._def,...$})}exclude(a,$=this._def){return ZodEnum.create(this.options.filter(j=>!a.includes(j)),{...this._def,...$})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(a){const $=util.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(a);if(j.parsedType!==ZodParsedType.string&&j.parsedType!==ZodParsedType.number){const et=util.objectValues($);return addIssueToContext(j,{expected:util.joinValues(et),received:j.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodNativeEnum_cache)||__classPrivateFieldSet$1(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet$1(this,_ZodNativeEnum_cache).has(a.data)){const et=util.objectValues($);return addIssueToContext(j,{received:j.data,code:ZodIssueCode.invalid_enum_value,options:et}),INVALID}return OK(a.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(_,a)=>new ZodNativeEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(a)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.promise&&$.common.async===!1)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:$.parsedType}),INVALID;const j=$.parsedType===ZodParsedType.promise?$.data:Promise.resolve($.data);return OK(j.then(et=>this._def.type.parseAsync(et,{path:$.path,errorMap:$.common.contextualErrorMap})))}}ZodPromise.create=(_,a)=>new ZodPromise({type:_,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(a)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=this._def.effect||null,tt={addIssue:rt=>{addIssueToContext(j,rt),rt.fatal?$.abort():$.dirty()},get path(){return j.path}};if(tt.addIssue=tt.addIssue.bind(tt),et.type==="preprocess"){const rt=et.transform(j.data,tt);if(j.common.async)return Promise.resolve(rt).then(async nt=>{if($.value==="aborted")return INVALID;const it=await this._def.schema._parseAsync({data:nt,path:j.path,parent:j});return it.status==="aborted"?INVALID:it.status==="dirty"||$.value==="dirty"?DIRTY(it.value):it});{if($.value==="aborted")return INVALID;const nt=this._def.schema._parseSync({data:rt,path:j.path,parent:j});return nt.status==="aborted"?INVALID:nt.status==="dirty"||$.value==="dirty"?DIRTY(nt.value):nt}}if(et.type==="refinement"){const rt=nt=>{const it=et.refinement(nt,tt);if(j.common.async)return Promise.resolve(it);if(it instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return nt};if(j.common.async===!1){const nt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});return nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value),{status:$.value,value:nt.value})}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(nt=>nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value).then(()=>({status:$.value,value:nt.value}))))}if(et.type==="transform")if(j.common.async===!1){const rt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!isValid$1(rt))return rt;const nt=et.transform(rt.value,tt);if(nt instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:nt}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(rt=>isValid$1(rt)?Promise.resolve(et.transform(rt.value,tt)).then(nt=>({status:$.value,value:nt})):rt);util.assertNever(et)}}ZodEffects.create=(_,a,$)=>new ZodEffects({schema:_,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:a,...processCreateParams($)});ZodEffects.createWithPreprocess=(_,a,$)=>new ZodEffects({schema:a,effect:{type:"preprocess",transform:_},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams($)});class ZodOptional extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodOptional.create=(_,a)=>new ZodOptional({innerType:_,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(a)});class ZodNullable extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.null?OK(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodNullable.create=(_,a)=>new ZodNullable({innerType:_,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(a)});class ZodDefault extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);let j=$.data;return $.parsedType===ZodParsedType.undefined&&(j=this._def.defaultValue()),this._def.innerType._parse({data:j,path:$.path,parent:$})}removeDefault(){return this._def.innerType}}ZodDefault.create=(_,a)=>new ZodDefault({innerType:_,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...processCreateParams(a)});class ZodCatch extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j={...$,common:{...$.common,issues:[]}},et=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});return isAsync(et)?et.then(tt=>({status:"valid",value:tt.status==="valid"?tt.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})})):{status:"valid",value:et.status==="valid"?et.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(_,a)=>new ZodCatch({innerType:_,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...processCreateParams(a)});class ZodNaN extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.nan){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:j.parsedType}),INVALID}return{status:"valid",value:a.data}}}ZodNaN.create=_=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(_)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=$.data;return this._def.type._parse({data:j,path:$.path,parent:$})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.common.async)return(async()=>{const tt=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});return tt.status==="aborted"?INVALID:tt.status==="dirty"?($.dirty(),DIRTY(tt.value)):this._def.out._parseAsync({data:tt.value,path:j.path,parent:j})})();{const et=this._def.in._parseSync({data:j.data,path:j.path,parent:j});return et.status==="aborted"?INVALID:et.status==="dirty"?($.dirty(),{status:"dirty",value:et.value}):this._def.out._parseSync({data:et.value,path:j.path,parent:j})}}static create(a,$){return new ZodPipeline({in:a,out:$,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(a){const $=this._def.innerType._parse(a),j=et=>(isValid$1(et)&&(et.value=Object.freeze(et.value)),et);return isAsync($)?$.then(et=>j(et)):j($)}unwrap(){return this._def.innerType}}ZodReadonly.create=(_,a)=>new ZodReadonly({innerType:_,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(a)});function custom(_,a={},$){return _?ZodAny.create().superRefine((j,et)=>{var tt,rt;if(!_(j)){const nt=typeof a=="function"?a(j):typeof a=="string"?{message:a}:a,it=(rt=(tt=nt.fatal)!==null&&tt!==void 0?tt:$)!==null&&rt!==void 0?rt:!0,ot=typeof nt=="string"?{message:nt}:nt;et.addIssue({code:"custom",...ot,fatal:it})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(_,a={message:`Input not instance of ${_.name}`})=>custom($=>$ instanceof _,a),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType$1=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$2={string:_=>ZodString.create({..._,coerce:!0}),number:_=>ZodNumber.create({..._,coerce:!0}),boolean:_=>ZodBoolean.create({..._,coerce:!0}),bigint:_=>ZodBigInt.create({..._,coerce:!0}),date:_=>ZodDate.create({..._,coerce:!0})},NEVER$1=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid:isValid$1,isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$2,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType$1,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER$1,ZodIssueCode,quotelessJson,ZodError});const Schema$1=z.object({address:z.string()}),parsePkh=_=>{if(isValidContractPkh(_))return parseContractPkh(_);if(isValidImplicitPkh(_))return parseImplicitPkh(_);throw new Error(`Cannot parse address type: ${_}`)},isAddressValid=_=>validateAddress(_)===ValidationResult.VALID,isValidContractPkh=_=>isAddressValid(_)&&_.match(/^KT1\w+/),isValidImplicitPkh=_=>isAddressValid(_)&&_.match(/^tz[1234]\w+/),parseContractPkh=_=>{if(isValidContractPkh(_))return{type:"contract",pkh:_};throw new Error(`Invalid contract address: ${_}`)},parseImplicitPkh=_=>{if(isValidImplicitPkh(_))return{type:"implicit",pkh:_};throw new Error(`Invalid implicit address: ${_}`)},encodeReserved=[encodeURIComponent,encodeURIComponent];function encode$3(_,a=","){const $=(j,et)=>{const tt=_[et%_.length];return typeof j>"u"?"":typeof j=="object"?Array.isArray(j)?j.map(tt).join(a):Object.entries(j).reduce((nt,it)=>[...nt,...it],[]).map(tt).join(a):tt(String(j))};return(j,...et)=>j.reduce((tt,rt,nt)=>`${tt}${rt}${$(et[nt],nt)}`,"")}function delimited(_=","){return(a,$=encodeReserved)=>Object.entries(a).filter(([,j])=>j!==void 0).map(([j,et])=>encode$3($,_)`${j}=${et}`).join("&")}function stripUndefined(_){return _&&JSON.parse(JSON.stringify(_))}function joinUrl(..._){return _.filter(Boolean).map((a,$)=>$===0?a:a.replace(/^\/+/,"")).map((a,$,j)=>$===j.length-1?a:a.replace(/\/+$/,"")).join("/")}function query(..._){const a=_.filter(Boolean).join("&");return a&&`?${a}`}function explode(_,a=encodeReserved){const $=encode$3(a);return Object.entries(_).filter(([,j])=>j!==void 0).map(([j,et])=>Array.isArray(et)?et.map(tt=>$`${j}=${tt}`).join("&"):typeof et=="object"?explode(et,a):$`${j}=${et}`).join("&")}const form=delimited(),SUCCESS_CODES=[200,201,202,204];async function ok(_){const a=await _;if(SUCCESS_CODES.some($=>$==a.status))return a.data;throw new HttpError(a.status,a.data)}class HttpError extends Error{constructor($,j){super(`Error: ${$}`);Yr(this,"status");Yr(this,"data");this.status=$,this.data=j}}function runtime$1(_){async function a(tt,rt){const nt=await et(tt,rt);let it;try{it=await nt.text()}catch{}return{status:nt.status,headers:nt.headers,contentType:nt.headers.get("content-type"),data:it}}async function $(tt,rt={}){const{status:nt,headers:it,contentType:ot,data:st}=await a(tt,{...rt,headers:{Accept:"application/json",...rt.headers}});return(ot?ot.includes("json"):!1)?{status:nt,headers:it,data:st?JSON.parse(st):null}:{status:nt,headers:it,data:st}}async function j(tt,rt={}){const nt=await et(tt,rt);let it;try{it=await nt.blob()}catch{}return{status:nt.status,headers:nt.headers,data:it}}async function et(tt,rt={}){const{baseUrl:nt,headers:it,fetch:ot,...st}={..._,...rt},at=joinUrl(nt,tt);return await(ot||fetch)(at,{...st,headers:stripUndefined({..._.headers,...it})})}return{ok,fetchText:a,fetchJson:$,fetchBlob:j,json({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:JSON.stringify(tt)},headers:{...rt,"Content-Type":"application/json"}}},form({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:form(tt)},headers:{...rt,"Content-Type":"application/x-www-form-urlencoded"}}},multipart({body:tt,...rt}){if(tt==null)return rt;const nt=new(_.formDataConstructor||rt.formDataConstructor||FormData);return Object.entries(tt).forEach(([it,ot])=>{nt.append(it,ot)}),{...rt,body:nt}}}}const jsonParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{if(!(et instanceof Object))throw new Error(`Expected ${_} value to be object, received ${typeof et}`);const{jsonPath:tt,jsonValue:rt}=et;if(rt==null)throw new Error(`Expected jsonValue in ${_} -> ${j}, found: ${rt}`);const it=[_,tt,j].filter(ot=>ot!==void 0).join(".");$[it]=rt}),$},anyofParameter=(_,a)=>{if(!a)return{};const{fields:$}=a;(rt=>{if(!Array.isArray(rt))throw new Error(`Expected ${_} fields to be Array. Received ${typeof rt}.`);return rt.forEach(nt=>{if(typeof nt!="string")throw new Error(`Expected ${_} fields to be strings. Received ${typeof nt}`)}),!0})($);const et={},tt=$.join(".");if(a.value){const rt=`${_}.${tt}`;et[rt]=a.value}for(const rt of["in","eq","null"])if(a[rt]){const nt=`${_}.${tt}.${rt}`;return et[nt]=Array.isArray(a[rt])?a[rt].join(","):a[rt],et}return et},queryParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{const tt=`${_}.${j}`;$[tt]=et}),$},parsers={jsonParameter,queryParameter,anyofParameter},defaults={baseUrl:"https://api.tzkt.io"},oazapfts=runtime$1(defaults);function accountsGet({id:_,address:a,$type:$,kind:j,delegate:et,balance:tt,staked:rt,lastActivity:nt,select:it,sort:ot,offset:st,limit:at}={},ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/accounts${query(explode({limit:at,...parsers.queryParameter("id",_),...parsers.queryParameter("address",a),...parsers.queryParameter("type",$),...parsers.queryParameter("kind",j),...parsers.queryParameter("delegate",et),...parsers.queryParameter("balance",tt),...parsers.queryParameter("staked",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("select",it),...parsers.queryParameter("sort",ot),...parsers.queryParameter("offset",st)}))}`,{...ut}))}function blocksGetCount(_){return oazapfts.ok(oazapfts.fetchJson("/v1/blocks/count",{..._}))}function contractsGet({address:_,kind:a,tzips:$,creator:j,manager:et,delegate:tt,balance:rt,lastActivity:nt,typeHash:it,codeHash:ot,select:st,sort:at,offset:ut,limit:ht,includeStorage:bt}={},Et){return oazapfts.ok(oazapfts.fetchJson(`/v1/contracts${query(explode({limit:ht,includeStorage:bt,...parsers.queryParameter("address",_),...parsers.queryParameter("kind",a),...parsers.queryParameter("tzips",$),...parsers.queryParameter("creator",j),...parsers.queryParameter("manager",et),...parsers.queryParameter("delegate",tt),...parsers.queryParameter("balance",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("typeHash",it),...parsers.queryParameter("codeHash",ot),...parsers.queryParameter("select",st),...parsers.queryParameter("sort",at),...parsers.queryParameter("offset",ut)}))}`,{...Et}))}function delegatesGet({active:_,lastActivity:a,select:$,sort:j,offset:et,limit:tt}={},rt){return oazapfts.ok(oazapfts.fetchJson(`/v1/delegates${query(explode({limit:tt,...parsers.queryParameter("active",_),...parsers.queryParameter("lastActivity",a),...parsers.queryParameter("select",$),...parsers.queryParameter("sort",j),...parsers.queryParameter("offset",et)}))}`,{...rt}))}function operationsGetDelegations({anyof:_,initiator:a,sender:$,prevDelegate:j,newDelegate:et,level:tt,timestamp:rt,senderCodeHash:nt,status:it,select:ot,sort:st,offset:at,limit:ut,quote:ht}={},bt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/delegations${query(explode({limit:ut,quote:ht,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("prevDelegate",j),...parsers.queryParameter("newDelegate",et),...parsers.queryParameter("level",tt),...parsers.queryParameter("timestamp",rt),...parsers.queryParameter("senderCodeHash",nt),...parsers.queryParameter("status",it),...parsers.queryParameter("select",ot),...parsers.queryParameter("sort",st),...parsers.queryParameter("offset",at)}))}`,{...bt}))}function operationsGetOriginations({anyof:_,initiator:a,sender:$,contractManager:j,contractDelegate:et,originatedContract:tt,id:rt,typeHash:nt,codeHash:it,level:ot,timestamp:st,senderCodeHash:at,anyCodeHash:ut,status:ht,select:bt,sort:Et,offset:Ct,limit:Pt,micheline:Tt,quote:It}={},Lt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/originations${query(explode({limit:Pt,micheline:Tt,quote:It,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("contractManager",j),...parsers.queryParameter("contractDelegate",et),...parsers.queryParameter("originatedContract",tt),...parsers.queryParameter("id",rt),...parsers.queryParameter("typeHash",nt),...parsers.queryParameter("codeHash",it),...parsers.queryParameter("level",ot),...parsers.queryParameter("timestamp",st),...parsers.queryParameter("senderCodeHash",at),...parsers.queryParameter("anyCodeHash",ut),...parsers.queryParameter("status",ht),...parsers.queryParameter("select",bt),...parsers.queryParameter("sort",Et),...parsers.queryParameter("offset",Ct)}))}`,{...Lt}))}function operationsGetTransactions({anyof:_,initiator:a,sender:$,target:j,amount:et,id:tt,level:rt,timestamp:nt,senderCodeHash:it,targetCodeHash:ot,codeHash:st,entrypoint:at,parameter:ut,hasInternals:ht,status:bt,select:Et,sort:Ct,offset:Pt,limit:Tt,micheline:It,quote:Lt}={},Nt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/transactions${query(explode({limit:Tt,micheline:It,quote:Lt,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("target",j),...parsers.queryParameter("amount",et),...parsers.queryParameter("id",tt),...parsers.queryParameter("level",rt),...parsers.queryParameter("timestamp",nt),...parsers.queryParameter("senderCodeHash",it),...parsers.queryParameter("targetCodeHash",ot),...parsers.queryParameter("codeHash",st),...parsers.queryParameter("entrypoint",at),...parsers.jsonParameter("parameter",ut),...parsers.queryParameter("hasInternals",ht),...parsers.queryParameter("status",bt),...parsers.queryParameter("select",Et),...parsers.queryParameter("sort",Ct),...parsers.queryParameter("offset",Pt)}))}`,{...Nt}))}function quotesGetLast(_){return oazapfts.ok(oazapfts.fetchJson("/v1/quotes/last",{..._}))}function tokensGetTokenBalances({id:_,account:a,tokenId:$,tokenContract:j,tokenTokenId:et,tokenStandard:tt,tokenMetadata:rt,tokenHasFilters:nt,balance:it,firstLevel:ot,firstTime:st,lastLevel:at,lastTime:ut,indexedAt:ht,sort:bt,offset:Et,limit:Ct,select:Pt}={},Tt){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/balances${query(explode({"token.HasFilters":nt,limit:Ct,...parsers.queryParameter("id",_),...parsers.queryParameter("account",a),...parsers.queryParameter("token.id",$),...parsers.queryParameter("token.contract",j),...parsers.queryParameter("token.tokenId",et),...parsers.queryParameter("token.standard",tt),...parsers.jsonParameter("token.metadata",rt),...parsers.queryParameter("balance",it),...parsers.queryParameter("firstLevel",ot),...parsers.queryParameter("firstTime",st),...parsers.queryParameter("lastLevel",at),...parsers.queryParameter("lastTime",ut),...parsers.queryParameter("indexedAt",ht),...parsers.queryParameter("sort",bt),...parsers.queryParameter("offset",Et),...parsers.queryParameter("select",Pt)}))}`,{...Tt}))}function tokensGetTokenTransfers({id:_,level:a,timestamp:$,tokenId:j,tokenContract:et,tokenTokenId:tt,tokenStandard:rt,tokenMetadata:nt,tokenHasFilters:it,anyof:ot,$from:st,to:at,amount:ut,transactionId:ht,originationId:bt,migrationId:Et,indexedAt:Ct,sort:Pt,offset:Tt,limit:It,select:Lt}={},Nt){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/transfers${query(explode({"token.HasFilters":it,limit:It,...parsers.queryParameter("id",_),...parsers.queryParameter("level",a),...parsers.queryParameter("timestamp",$),...parsers.queryParameter("token.id",j),...parsers.queryParameter("token.contract",et),...parsers.queryParameter("token.tokenId",tt),...parsers.queryParameter("token.standard",rt),...parsers.jsonParameter("token.metadata",nt),...parsers.anyofParameter("anyof",ot),...parsers.queryParameter("from",st),...parsers.queryParameter("to",at),...parsers.queryParameter("amount",ut),...parsers.queryParameter("transactionId",ht),...parsers.queryParameter("originationId",bt),...parsers.queryParameter("migrationId",Et),...parsers.queryParameter("indexedAt",Ct),...parsers.queryParameter("sort",Pt),...parsers.queryParameter("offset",Tt),...parsers.queryParameter("select",Lt)}))}`,{...Nt}))}let e$1=class{constructor(a){this.queue=void 0,this.maxConcurrent=void 0,this.count=void 0,this.queue=[],this.maxConcurrent=a,this.count=0}get canAcquire(){return this.countthis.queue.push(a))}release(){const a=this.queue.shift();a?setTimeout(a,0):this.count--}};const t$4="_default";class s{constructor(a=1){this.semaphoreInstances=void 0,this.maxConcurrent=void 0,this.semaphoreInstances={},this.maxConcurrent=a}hasSemaphoreInstance(a=t$4){return!!this.semaphoreInstances[a]}getSemaphoreInstance(a=t$4){return this.hasSemaphoreInstance(a)||(this.semaphoreInstances[a]=new e$1(this.maxConcurrent)),this.semaphoreInstances[a]}tidy(a=t$4){this.hasSemaphoreInstance(a)&&this.getSemaphoreInstance(a).count===0&&delete this.semaphoreInstances[a]}canAcquire(a=t$4){return this.getSemaphoreInstance(a).canAcquire}acquire(a=t$4){return this.getSemaphoreInstance(a).acquire()}release(a=t$4){this.getSemaphoreInstance(a).release(),this.tidy(a)}count(a=t$4){return this.hasSemaphoreInstance(a)?this.getSemaphoreInstance(a).count:0}hasTasks(a=t$4){return this.count(a)>0}async request(a,$=t$4){try{return await this.acquire($),await a()}finally{this.release($)}}async requestIfAvailable(a,$=t$4){return this.canAcquire($)?this.request(a,$):null}}function assign(_,a){for(const $ in a)Object.defineProperty(_,$,{value:a[$],enumerable:!0,configurable:!0});return _}function createError(_,a,$){if(!_||typeof _=="string")throw new TypeError("Please pass an Error to err-code");$||($={}),typeof a=="object"&&($=a,a=void 0),a!=null&&($.code=a);try{return assign(_,$)}catch{$.message=_.message,$.stack=_.stack;const et=function(){};return et.prototype=Object.create(Object.getPrototypeOf(_)),assign(new et,$)}}var errCode=createError,retry$3={};function RetryOperation(_,a){typeof a=="boolean"&&(a={forever:a}),this._originalTimeouts=JSON.parse(JSON.stringify(_)),this._timeouts=_,this._options=a||{},this._maxRetryTime=a&&a.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(_){if(this._timeout&&clearTimeout(this._timeout),!_)return!1;var a=new Date().getTime();if(_&&a-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(_);var $=this._timeouts.shift();if($===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),$=this._timeouts.shift();else return!1;var j=this,et=setTimeout(function(){j._attempts++,j._operationTimeoutCb&&(j._timeout=setTimeout(function(){j._operationTimeoutCb(j._attempts)},j._operationTimeout),j._options.unref&&j._timeout.unref()),j._fn(j._attempts)},$);return this._options.unref&&et.unref(),!0};RetryOperation.prototype.attempt=function(_,a){this._fn=_,a&&(a.timeout&&(this._operationTimeout=a.timeout),a.cb&&(this._operationTimeoutCb=a.cb));var $=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){$._operationTimeoutCb()},$._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(_){console.log("Using RetryOperation.try() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=function(_){console.log("Using RetryOperation.start() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var _={},a=null,$=0,j=0;j=$&&(a=et,$=rt)}return a};(function(_){var a=retry_operation;_.operation=function($){var j=_.timeouts($);return new a(j,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})},_.timeouts=function($){if($ instanceof Array)return[].concat($);var j={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var et in $)j[et]=$[et];if(j.minTimeout>j.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var tt=[],rt=0;rttzktRateLimiter.acquire().then(()=>promiseRetry$1(a=>_().catch(a),{retries:3,minTimeout:100})).catch(a=>{throw"status"in a&&"data"in a?new Error(`Fetching data from tzkt failed with: ${a.status}, ${a.data}`):a}).finally(()=>tzktRateLimiter.release()),MULTISIG_FETCH_LIMIT=1e4,TYPE_HASH=1963879877,CODE_HASH=-1890025422,getAllMultiSigContracts=async _=>withRateLimit(async()=>{try{const a=`${_.tzktApiUrl}/v1/contracts?typeHash=${TYPE_HASH}&codeHash=${CODE_HASH}&includeStorage=true&limit=${MULTISIG_FETCH_LIMIT}`,{data:$}=await axios.get(a);return $}catch(a){throw new Error(`Error fetching same contracts from tzkt: ${a.message}`)}}),getExistingContracts=(_,a)=>withRateLimit(()=>contractsGet({address:{in:[_.join(",")]},select:{fields:["address"]},limit:Math.min(1e4,_.length)},{baseUrl:a.tzktApiUrl})),getPendingOperations=async(_,a)=>withRateLimit(async()=>{if(_.length===0)return Promise.resolve([]);const $=`${a.tzktApiUrl}/v1/bigmaps/keys?active=true&bigmap.in=${_.join(",")}&limit=${MULTISIG_FETCH_LIMIT}`,{data:j}=await axios.get($);return j}),parseMultisig=_=>({address:parseContractPkh(_.address),threshold:Number(_.storage.threshold),signers:_.storage.signers.map(parseImplicitPkh),pendingOperationsBigmapId:_.storage.pending_ops}),getRelevantMultisigContracts=async(_,a)=>(await getAllMultiSigContracts(a)).filter(({storage:{signers:j}})=>lodashExports.every(j,isValidImplicitPkh)?j.filter(tt=>_.has(tt)).length>0:!1).map(parseMultisig),getNetworksForContracts=async(_,a)=>{const $=new Map;return a.length===0||(await Promise.all(_.map(async et=>(await getExistingContracts(a,et)).map(tt=>[tt,et.name])))).flat().forEach(([et,tt])=>$.set(et,tt)),$},parseMultisigOperation=_=>{const{bigmap:a,key:$,value:j}=_;if($===null||j===null)throw new Error("parseMultisigOperation failed");return{id:$,bigmapId:a,rawActions:j.actions,approvals:j.approvals.map(parseImplicitPkh)}},getPendingOperationsForMultisigs=async(_,a)=>{if(_.length===0)return[];const $=_.map(et=>et.pendingOperationsBigmapId),j=await getPendingOperations($,a);return lodashExports.compact(j.map(parseMultisigOperation))},VERSION$1=6,mainStoreMigrations={0:_=>produce(_,a=>{a.multisigs.labelsMap={}}),1:_=>produce(_,a=>{a.announcement=initialState$9}),2:lodashExports.identity,3:_=>produce(_,a=>{a.networks.current.name==="ghostnet"&&(a.networks.current.buyTezUrl="https://faucet.ghostnet.teztnets.com/");for(const $ of a.networks.available)if($.name==="ghostnet"){$.buyTezUrl="https://faucet.ghostnet.teztnets.com/";break}}),4:lodashExports.identity,5:_=>produce(_,a=>{delete a.assets.transfers.tez}),6:async _=>{const a=Object.values(_.contacts).filter(tt=>isValidImplicitPkh(tt.pkh)).map(tt=>[tt.pkh,{...tt,network:void 0}]),$=Object.values(_.contacts).filter(tt=>isValidContractPkh(tt.pkh)).map(tt=>tt.pkh),et=[...(await getNetworksForContracts(_.networks.available,$)).entries()].map(([tt,rt])=>[tt,{..._.contacts[tt],network:rt}]);return produce(_,tt=>{tt.contacts=lodashExports.fromPairs([...a,...et])})}},accountsMigrations={0:lodashExports.identity,1:lodashExports.identity,2:_=>produce(_,a=>{a.items.forEach($=>{$.type==="secret_key"&&($.curve="ed25519")})}),3:lodashExports.identity,4:_=>produce(_,a=>{a.items.forEach($=>{$.type==="ledger"&&!$.derivationPathTemplate&&($.derivationPathTemplate=void 0,$.derivationPath==="44'/1729'/0'/0'"?$.derivationPathTemplate="44'/1729'/?'/0'":$.derivationPath==="44'/1729'/0'/0'/0'"&&($.derivationPathTemplate="44'/1729'/?'/0'/0'"))})}),5:lodashExports.identity,6:lodashExports.identity},AES_MODE="AES-GCM",BYTE_TO_BIT=8,KEY_SIZE=32,NUM_ITERATIONS_V2=6e5,NUM_ITERATIONS_V1=1e4,derivePasswordBasedKeyV1=async(_,a)=>derivePasswordBasedKey(Buffer$g.alloc(32,_,"utf-8"),a,NUM_ITERATIONS_V1),derivePasswordBasedKeyV2=async(_,a)=>derivePasswordBasedKey(Buffer$g.from(_,"utf-8"),a,NUM_ITERATIONS_V2),derivePasswordBasedKey=async(_,a,$)=>{const j={name:"PBKDF2",salt:a,iterations:$,hash:"SHA-256"},et=await crypto.subtle.importKey("raw",_,j.name,!1,["deriveKey"]);return await crypto.subtle.deriveKey(j,et,{name:AES_MODE,length:KEY_SIZE*BYTE_TO_BIT},!1,["encrypt","decrypt"])},SALT_SIZE=32,IV_SIZE=12,encrypt$1=async(_,a)=>{const $=crypto.getRandomValues(new Uint8Array(SALT_SIZE)),j=await derivePasswordBasedKeyV2(a,$),et=crypto.getRandomValues(new Uint8Array(IV_SIZE)),tt=await crypto.subtle.encrypt({name:AES_MODE,iv:et},j,Buffer$g.from(_,"utf-8"));return{iv:buf2hex(Buffer$g.from(et)),salt:buf2hex(Buffer$g.from($)),data:buf2hex(Buffer$g.from(tt))}},decrypt$1=async(_,a,$="V2")=>{const{iv:j,salt:et,data:tt}=_;try{const rt=$==="V2"?await derivePasswordBasedKeyV2(a,hex2Bytes(et)):await derivePasswordBasedKeyV1(a,hex2Bytes(et)),nt=await crypto.subtle.decrypt({name:AES_MODE,iv:hex2Bytes(j)},rt,hex2Bytes(tt));return Buffer$g.from(nt).toString("utf-8")}catch{throw new Error("Error decrypting data: Invalid password")}},changeMnemonicPassword=createAsyncThunk("accounts/changeMnemonicPassword",async({currentPassword:_,newPassword:a},{getState:$})=>{if(_===a)throw new Error("New password must be different from the current password");const{items:j,seedPhrases:et}=$().accounts;if(j.filter(rt=>rt.type==="mnemonic").length===0)throw new Error("No mnemonic accounts found");const tt=await Promise.all(Object.entries(et).map(async([rt,nt])=>{if(!nt)throw new Error("No encrypted mnemonic found");try{const it=await decrypt$1(nt,_),ot=await encrypt$1(it,a);return[rt,ot]}catch(it){throw new Error(it.message)}}));return{newEncryptedMnemonics:lodashExports.fromPairs(tt)}}),initialState$8={items:[],seedPhrases:{},secretKeys:{}},accountsSlice=createSlice({name:"accounts",initialState:initialState$8,extraReducers:_=>{_.addCase(changeMnemonicPassword.fulfilled,(a,$)=>{const{newEncryptedMnemonics:j}=$.payload;a.seedPhrases=j})},reducers:{reset:()=>initialState$8,removeMnemonicAndAccounts:(_,{payload:a})=>{const{fingerPrint:$}=a,j=_.items.filter(et=>!(et.type==="mnemonic"&&et.seedFingerPrint===$));_.items=j,delete _.seedPhrases[$]},removeNonMnemonicAccounts:(_,{payload:a})=>{_.items=lodashExports.remove(_.items,$=>$.type==="mnemonic"||$.type!==a.accountType),a.accountType==="secret_key"&&(_.secretKeys={})},removeAccount:(_,{payload:a})=>{lodashExports.remove(_.items,$=>$.address.pkh===a.address.pkh),a.type==="secret_key"&&delete _.secretKeys[a.address.pkh]},renameAccount:(_,{payload:a})=>{const{account:$,newName:j}=a;if(j.length===0)throw new Error("Cannot rename account to an empty name.");if(_.items.find(tt=>tt.label===j))throw new Error(`Cannot rename account ${$.address.pkh} to ${j} since the name already exists.`);const et=_.items.find(tt=>tt.address.pkh===$.address.pkh&&tt.label===$.label);et&&(et.label=j)},addAccount:(_,{payload:a})=>{_.items=concatUnique(_.items,[a])},addMnemonicAccounts:(_,{payload:{encryptedMnemonic:a,accounts:$,seedFingerprint:j}})=>{_.items=concatUnique(_.items,$),_.seedPhrases[j]=a},addSecretKey:(_,{payload:{pkh:a,encryptedSecretKey:$}})=>{_.secretKeys[a]=$}}}),concatUnique=(_,a)=>(a.forEach($=>{if(_.some(j=>j.address.pkh===$.address.pkh))throw new Error(`Can't add account with address ${$.address.pkh} because it already exists.`)}),[..._,...a]);accountsSlice.actions;const FA12TokenSchema=z.object({standard:z.string().regex(/^fa1\.2$/i),contract:Schema$1}),FA2TokenSchema=z.object({standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1}),NFTSchema=z.object({id:z.number(),standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1,totalSupply:z.string().optional(),metadata:z.object({displayUri:z.string(),decimals:z.void().or(z.string().regex(/^0$/))})}),fromRaw$1=_=>{const a=_.metadata;if(_.standard==="fa1.2"){const et=FA12TokenSchema.safeParse(_);return et.success?{type:"fa1.2",metadata:a,contract:et.data.contract.address,tokenId:"0"}:(console.warn("Invalid FA1 token: "+JSON.stringify(_)),null)}const $=NFTSchema.safeParse(_);if($.success)return{metadata:a,type:"nft",id:$.data.id,contract:$.data.contract.address,tokenId:$.data.tokenId,displayUri:$.data.metadata.displayUri,totalSupply:$.data.totalSupply};const j=FA2TokenSchema.safeParse(_);return j.success?{type:"fa2",metadata:a,contract:j.data.contract.address,tokenId:j.data.tokenId}:(console.warn("Invalid FA2 token: "+JSON.stringify(_)),null)},fullId=_=>`${_.contract}:${_.tokenId}`,defaultTokenName=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_NAME;case"fa2":return DEFAULT_FA2_NAME;case"nft":return DEFAULT_NFT_NAME}},tokenNameSafe=_=>tokenName(_)||defaultTokenName(_),tokenName=_=>{var a;return(a=_.metadata)==null?void 0:a.name},defaultTokenSymbol=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_SYMBOL;case"fa2":return DEFAULT_FA2_SYMBOL;case"nft":return DEFAULT_NFT_SYMBOL}},tokenSymbolSafe=_=>tokenSymbol(_)||defaultTokenSymbol(_),tokenSymbol=_=>{var a;return(a=_.metadata)==null?void 0:a.symbol},tokenDecimals=_=>{var a;return((a=_.metadata)==null?void 0:a.decimals)??DEFAULT_TOKEN_DECIMALS},getRealAmount=(_,a)=>{const $=new BigNumber(a),j=tokenDecimals(_);return $.multipliedBy(new BigNumber(10).exponentiatedBy(j)).toFixed()},formatTokenAmount=(_,a=DEFAULT_TOKEN_DECIMALS)=>{const $=BigNumber(_).dividedBy(BigNumber(10).pow(a));try{return new Intl.NumberFormat("en-US",{minimumFractionDigits:Number(a),maximumFractionDigits:Number(a)}).format($.toNumber())}catch{return console.warn(`Can't format token amount with decimals = ${a}`),formatTokenAmount(_,"0")}},tokenPrettyAmount=(_,a,$)=>{var nt;if(a.type==="nft")return _;const j=tokenSymbolSafe(a),et=(nt=a.metadata)==null?void 0:nt.decimals,tt=$!=null&&$.showSymbol?` ${j}`:"";return`${formatTokenAmount(_,et)}${tt}`},artifactUri=_=>_.metadata.artifactUri||_.displayUri,thumbnailUri=_=>_.metadata.thumbnailUri||_.displayUri,mimeType=_=>{var a,$;return($=(a=_.metadata.formats)==null?void 0:a.find(j=>j.uri===artifactUri(_)))==null?void 0:$.mimeType},royalties=_=>{const a=_.metadata.royalties;if(!a)return[];const $=Math.pow(10,Number(a.decimals)),j=Object.entries(a.shares).map(([et,tt])=>({address:et,share:Number(tt)*100/$}));return j.sort((et,tt)=>et.share`${tokenUri(_,a)}/metadata`,tokenUri=({contract:_,tokenId:a},$)=>`${$.tzktExplorerUrl}/${_}/tokens/${a}`,DEFAULT_FA1_NAME="FA1.2 token",DEFAULT_FA2_NAME="FA2 token",DEFAULT_NFT_NAME="NFT",DEFAULT_FA1_SYMBOL="FA1.2",DEFAULT_FA2_SYMBOL="FA2",DEFAULT_NFT_SYMBOL="NFT",DEFAULT_TOKEN_DECIMALS="0",fromRaw=_=>{const a=fromRaw$1(_.token);return!a||!_.balance?null:{balance:_.balance,lastLevel:_.lastLevel,...a}},keepNFTs=_=>_.filter(a=>a.type==="nft"),keepFA1s=_=>_.filter(a=>a.type==="fa1.2"),keepFA2s=_=>_.filter(a=>a.type==="fa2"),initialState$7={blockLevel:null,balances:{mutez:{},tokens:{}},transfers:{tokens:{}},delegationLevels:{},bakers:[],conversionRate:void 0,refetchTrigger:0,isLoading:!1,lastTimeUpdated:null},assetsSlice=createSlice({name:"assets",initialState:initialState$7,extraReducers:_=>_.addCase(accountsSlice.actions.reset,()=>initialState$7),reducers:{reset:()=>initialState$7,updateBlockLevel:(_,{payload:a})=>{_.blockLevel=a},updateTokenTransfers:(_,{payload:a})=>{a.forEach($=>{_.transfers.tokens[$.transactionId]=$})},updateTezBalance:(_,{payload:a})=>{_.balances.mutez=a.reduce(($,j)=>({...$,[j.address]:String(j.balance)}),{}),_.delegationLevels=a.reduce(($,j)=>({...$,[j.address]:j.delegationLevel}),{})},updateTokenBalance:(_,{payload:a})=>{const $=lodashExports.groupBy(a,j=>j.account.address);_.balances.tokens=lodashExports.mapValues($,j=>lodashExports.compact(j.map(fromRaw)).map(({balance:et,contract:tt,tokenId:rt,lastLevel:nt})=>({balance:et,contract:tt,tokenId:rt,lastLevel:nt})))},removeAccountsData:(_,{payload:a})=>{a.forEach($=>{delete _.balances.mutez[$],delete _.balances.tokens[$],delete _.delegationLevels[$]})},updateBakers:(_,{payload:a})=>{_.bakers=a},updateConversionRate:(_,{payload:a})=>{_.conversionRate=a},refetch:_=>{_.refetchTrigger+=1},setIsLoading:(_,{payload:a})=>{_.isLoading=a},setLastTimeUpdated:(_,{payload:a})=>{_.lastTimeUpdated=a}}}),assetsActions=assetsSlice.actions,MAINNET={name:"mainnet",rpcUrl:"https://prod.tcinfra.net/rpc/mainnet/",tzktApiUrl:"https://api.mainnet.tzkt.io",tzktExplorerUrl:"https://tzkt.io",buyTezUrl:"https://widget.wert.io"},GHOSTNET={name:"ghostnet",rpcUrl:"https://ghostnet.ecadinfra.com",tzktApiUrl:"https://api.ghostnet.tzkt.io",tzktExplorerUrl:"https://ghostnet.tzkt.io",buyTezUrl:"https://faucet.ghostnet.teztnets.com/"},isDefault=_=>DefaultNetworks.map(a=>a.name).includes(_.name),DefaultNetworks=[MAINNET,GHOSTNET],initialState$6=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,[]])),batchesSlice=createSlice({name:"batches",initialState:initialState$6,reducers:{reset:()=>initialState$6,add:(_,{payload:{operations:a,network:$}})=>{$.name in _||(_[$.name]=[]);const j=_[$.name],et=j.find(tt=>tt.sender.address.pkh===a.sender.address.pkh);if(et){et.operations.push(...a.operations);return}j.push(a)},clear:(_,{payload:{pkh:a,network:$}})=>{const j=_[$.name]||[],et=lodashExports.findIndex(j,tt=>tt.sender.address.pkh===a);et!==-1&&j.splice(et,1)},removeItem:(_,{payload:{pkh:a,index:$,network:j}})=>{const et=_[j.name]||[],tt=lodashExports.findIndex(et,nt=>nt.sender.address.pkh===a);if(tt===-1)return;const rt=et[tt];$lodashExports.fromPairs(Object.entries(_).map(([$,j])=>{const et=(j||[]).filter(tt=>!a.includes(tt.sender.address.pkh));return[$,et]}))}}),batchesActions=batchesSlice.actions,initialState$5={},beaconSlice=createSlice({name:"beacon",initialState:initialState$5,reducers:{reset:()=>initialState$5,addConnection:(_,{payload:a})=>{_[a.dAppId]={accountPkh:a.accountPkh,networkType:a.networkType}},removeConnection:(_,{payload:a})=>{delete _[a]},removeConnections:(_,{payload:a})=>lodashExports.fromPairs(Object.entries(_).filter(([$,j])=>!a.includes(j.accountPkh)))}});beaconSlice.actions;const initialState$4={},contactsSlice=createSlice({name:"contacts",initialState:initialState$4,reducers:{reset:()=>initialState$4,upsert:(_,{payload:a})=>{_[a.pkh]=a},remove:(_,{payload:a})=>{delete _[a]}}}),contactsActions=contactsSlice.actions,MAX_ERRORS_LEN=100,initialState$3=[],errorsSlice=createSlice({name:"errors",initialState:initialState$3,reducers:{reset:()=>initialState$3,add(_,{payload:a}){_.length===MAX_ERRORS_LEN&&_.shift(),_.push(a)}}}),initialState$2={items:[],pendingOperations:{},labelsMap:{}},multisigsSlice=createSlice({name:"multisigs",initialState:initialState$2,reducers:{reset:()=>initialState$2,mockAddAccount:(_,{payload:a})=>{_.items.push({label:`Multisig Account ${_.items.length}`,type:"multisig",...a})},setMultisigs:(_,{payload:a})=>{const $=lodashExports.fromPairs(_.items.map(j=>[j.address.pkh,j.label]));_.items=a.map((j,et)=>({...j,label:$[j.address.pkh]||_.labelsMap[j.address.pkh]||`Multisig Account ${et}`,type:"multisig"}))},addMultisigLabel:(_,{payload:{pkh:a,label:$}})=>{_.labelsMap[a]=$},setPendingOperations:(_,{payload:a})=>{_.pendingOperations=lodashExports.groupBy(a,$=>$.bigmapId)},setName:(_,{payload:a})=>{const{account:{address:{pkh:$}},newName:j}=a,et=_.items.find(tt=>tt.address.pkh===$);et&&(et.label=j)},removeMultisigsData:(_,{payload:a})=>{const $=_.items.filter(j=>a.includes(j.address.pkh)).map(j=>String(j.pendingOperationsBigmapId));_.pendingOperations=lodashExports.omit(_.pendingOperations,$),_.labelsMap=lodashExports.omit(_.labelsMap,a)}}}),multisigActions=multisigsSlice.actions,initialState$1={available:DefaultNetworks,current:MAINNET},networksSlice=createSlice({name:"networks",initialState:initialState$1,reducers:{reset:()=>initialState$1,setCurrent:(_,{payload:a})=>{_.current=a},upsertNetwork:(_,{payload:a})=>{if(isDefault(a))return;const $=_.available.findIndex(j=>j.name===a.name);if(_.current.name===a.name&&(_.current=a),$!==-1){_.available[$]=a;return}_.available.push(a)},removeNetwork:(_,{payload:a})=>{isDefault(a)||lodashExports.remove(_.available,$=>$.name===a.name)}}}),networksActions=networksSlice.actions,initialState=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,{}])),tokensSlice=createSlice({name:"tokens",initialState,reducers:{reset:()=>initialState,addTokens:(_,{payload:{network:a,tokens:$}})=>{lodashExports.compact($.map(fromRaw$1)).forEach(j=>{lodashExports.setWith(_,[a.name,j.contract,j.tokenId],j,Object)})}}}),tokensActions=tokensSlice.actions,rootPersistConfig={key:"root",version:VERSION$1,storage:default_1,blacklist:["accounts"],migrate:createAsyncMigrate(mainStoreMigrations)},accountsPersistConfig={key:"accounts",version:VERSION$1,storage:default_1,migrate:createAsyncMigrate(accountsMigrations)},rootReducers=combineReducers({accounts:persistReducer(accountsPersistConfig,accountsSlice.reducer),announcement:announcementSlice.reducer,assets:assetsSlice.reducer,batches:batchesSlice.reducer,beacon:beaconSlice.reducer,contacts:contactsSlice.reducer,errors:errorsSlice.reducer,multisigs:multisigsSlice.reducer,networks:networksSlice.reducer,tokens:tokensSlice.reducer}),reducer=persistReducer(rootPersistConfig,rootReducers),store=configureStore({reducer,middleware:_=>_({serializableCheck:{ignoredActions:[FLUSH,REHYDRATE,PAUSE,PERSIST,PURGE,REGISTER]}})}),persistor=persistStore(store),FormErrorMessage=({children:_,...a})=>jsxRuntimeExports.jsxs(FormErrorMessage$1,{color:colors.orange,fontSize:"12px",...a,children:[jsxRuntimeExports.jsx(Icon,{as:ExclamationIcon,marginRight:"6px"}),_]}),CONFIRMATION_CODE="wasabi",reset=()=>WalletClient.destroy().catch(lodashExports.noop).finally(()=>{persistor.pause(),localStorage.clear(),window.location.reload()}),OffboardingForm=()=>{const _=useForm({mode:"onBlur"}),{register:a,handleSubmit:$,formState:{isValid:j,errors:et},getValues:tt}=_,rt=()=>{if(!(!tt("check")||tt("confirmationCode")!==CONFIRMATION_CODE))return reset()};return jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(WarningIcon,{width:"40px",height:"40px",marginBottom:"20px"}),jsxRuntimeExports.jsx(Heading,{children:"Off-board Wallet"})]})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"8px",color:colors.gray[400],fontWeight:"bold",textAlign:"center",size:"sm",children:"This will permanently remove any data from this computer."}),jsxRuntimeExports.jsxs(Text,{color:colors.gray[400],textAlign:"center",size:"sm",children:["Please enter « ",CONFIRMATION_CODE," » to confirm. The accounts are still available to be imported in the future; in order to regain access to your accounts, please make sure that you keep the recovery phrase."]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsx(FormControl,{isInvalid:!!et.check,children:jsxRuntimeExports.jsx(Checkbox,{...a("check",{required:!0}),children:jsxRuntimeExports.jsx(Text,{marginLeft:"8px",fontWeight:"bold",children:"I have read the warning and I am certain I want to remove my private keys locally. I also made sure to keep my recovery phrase."})})}),jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.confirmationCode,paddingY:5,children:[jsxRuntimeExports.jsx(Input,{type:"text",...a("confirmationCode",{required:"Confirmation is required",validate:nt=>nt===CONFIRMATION_CODE||"Confirmation code does not match"}),placeholder:"Enter code word to confirm"}),et.confirmationCode&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirmationCode.message})]})]})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:0,children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!j,size:"lg",type:"submit",variant:"warning",children:"Confirm"})})]})})},useOffboardingModal=()=>{const{isOpen:_,onOpen:a,onClose:$}=useDisclosure$1();return{modalElement:jsxRuntimeExports.jsxs(Modal,{isCentered:!0,isOpen:_,onClose:$,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[900],children:jsxRuntimeExports.jsx(OffboardingForm,{})})]}),onOpen:a}},CircleIcon=({icon:_,size:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsx(Box,{width:a,height:a,margin:"auto",background:colors.gray[700],borderRadius:"full",onClick:$,children:jsxRuntimeExports.jsx(Center,{height:"100%",children:_})}),ModalContentWrapper=({children:_,icon:a,title:$,subtitle:j})=>jsxRuntimeExports.jsxs(VStack,{maxHeight:"83vh",spacing:0,children:[jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(CircleIcon,{icon:a,size:"48px"})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",width:"340px",marginBottom:"32px",children:[jsxRuntimeExports.jsx(Heading,{lineHeight:"26px",size:"xl",children:$}),j&&jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],lineHeight:"18px",textAlign:"center",size:"sm",children:j})]}),_]}),name$1="umami",productName="umami",version$1="2.1.0",author$1="Trilitech ",description$1="Tezos Wallet",homepage$1="https://umamiwallet.com",repository$1="https://github.com/trilitech/umami-v2",license$1="MIT",engines={node:">=20 <21.0.0"},type$5="commonjs",main$1="build/electron.js",scripts$1={build:"vite build",dev:"vite dev",preview:"vite preview","electron:package:linux":"electron-builder -l","electron:package:mac":"electron-builder -m","electron:package:mac:debug":"DEBUG=true yarn build && sed -i='' 's@devTools: false@devTools: true@g' build/electron.js && yarn electron:package:mac -c electron-builder.dev.yml && rm -rf build","electron:package:win":"electron-builder -w","electron:start":"electronmon .",docs:"typedoc --tsconfig tsconfig.e2e.json","format:ci":"prettier --check .",format:"prettier --write .","lint:ci":"eslint src --ext .js,.jsx,.ts,.tsx --max-warnings=0",lint:"eslint src --ext .js,.jsx,.ts,.tsx --fix",test:"cross-env TZ=CET jest","test:watch":"cross-env DEV=true yarn test --watch","test:e2e":"cross-env TS_NODE_PROJECT=tsconfig.e2e.json cucumber-js","test:e2e:focus":"yarn test:e2e --tags='@focus'","theme:watch":"chakra-cli tokens src/style/theme.ts --watch",theme:"chakra-cli tokens src/style/theme.ts"},devDependencies$1={"@airgap/beacon-wallet":"^4.2.2","@babel/core":"^7.24.5","@babel/preset-env":"^7.24.5","@babel/preset-react":"^7.24.1","@babel/preset-typescript":"^7.24.1","@babel/runtime":"^7.24.5","@chakra-ui/anatomy":"2.2.2","@chakra-ui/cli":"^2.4.1","@chakra-ui/icons":"^2.1.1","@chakra-ui/react":"^2.8.2","@chakra-ui/styled-system":"2.9.2","@chakra-ui/system":"^2.6.2","@chriscdn/promise-semaphore":"^2.0.9","@cucumber/cucumber":"^10.7.0","@electron/notarize":"^2.3.2","@emotion/react":"^11.11.4","@emotion/styled":"^11.11.5","@ledgerhq/hw-transport-webusb":"^6.28.6","@playwright/test":"^1.44.1","@reduxjs/toolkit":"^2.2.5","@stylistic/eslint-plugin":"^2.1.0","@tanstack/eslint-plugin-query":"^5.35.6","@tanstack/react-query":"^5.37.1","@tanstack/react-query-devtools":"^5.37.1","@taquito/ledger-signer":"^19.2.1","@taquito/michel-codec":"^19.2.1","@taquito/rpc":"^19.2.1","@taquito/signer":"^19.2.1","@taquito/taquito":"19.2.1","@taquito/utils":"^19.2.1","@testing-library/dom":"^10.1.0","@testing-library/jest-dom":"6.4.5","@testing-library/react":"14.3.0","@testing-library/user-event":"14.5.2","@toruslabs/customauth":"^16.0.6","@types/babel__core":"^7","@types/babel__preset-env":"^7","@types/identity-obj-proxy":"^3","@types/jest":"^29.5.12","@types/md5":"^2.3.5","@types/node":"20.12.12","@types/papaparse":"^5.3.14","@types/pluralize":"^0.0.33","@types/promise-retry":"^1.1.6","@types/react":"18.3.2","@types/react-dom":"18.3.0","@types/react-test-renderer":"^18","@typescript-eslint/eslint-plugin":"^7.10.0","@typescript-eslint/parser":"^7.10.0","@tzkt/sdk-api":"^2.2.1","@vitejs/plugin-react":"^4.3.0",axios:"^1.7.2","babel-jest":"^29.7.0","bignumber.js":"^9.1.2",bip39:"^3.1.0",concurrently:"^8.2.2","cross-env":"^7.0.3","date-fns":"^3.6.0",electron:"^30.0.8","electron-builder":"^24.13.3",electronmon:"^2.0.3",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-chakra-ui":"^0.11.0","eslint-plugin-deprecation":"^2.0.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.5.0","eslint-plugin-jest-dom":"^5.4.0","eslint-plugin-react":"^7.34.1","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-react-redux":"^4.1.0","eslint-plugin-testing-library":"^6.2.2","eslint-plugin-tsdoc":"^0.2.17","eslint-plugin-unused-imports":"^3.2.0","framer-motion":"^11.2.6","http-server":"^14.1.1","identity-obj-proxy":"^3.0.0",immer:"^10.1.1",jest:"29.7.0","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.7.0","jest-fail-on-console":"^3.3.0","jest-resolve":"29.7.0","jest-watch-typeahead":"^2.2.2",lodash:"^4.17.21",md5:"^2.3.0",mockdate:"^3.0.5",ordinal:"^1.0.3",papaparse:"^5.4.1",pluralize:"^8.0.0",prettier:"^3.2.5","prettier-plugin-gherkin":"^2.2.1",process:"^0.11.10","promise-retry":"^2.0.1",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.13","react-hook-form":"^7.51.5","react-hooks-testing-library":"^0.6.0","react-player":"^2.16.0","react-qrcode-logo":"^2.10.0","react-redux":"9.1.2","react-refresh":"^0.14.2","react-remove-scroll":"^2.5.10","react-responsive-carousel":"^3.2.23","react-router-dom":"^6.23.1","react-test-renderer":"^18.3.1",redux:"^5.0.1","redux-persist":"^6.0.0","ts-node":"^10.9.2",typedoc:"^0.25.13","typedoc-plugin-missing-exports":"^2.2.0",typescript:"5.4.5",vite:"^5.2.11","vite-plugin-checker":"^0.6.4","vite-plugin-node-polyfills":"^0.22.0",zipurl:"^0.2.18",zod:"^3.23.8"},packageManager="yarn@4.2.2",dependencies$1={"electron-updater":"^6.2.1"},resolutions={jsdom:"^23.0.1","@types/jsdom":"^21.1.6"},packageInfo={name:name$1,productName,version:version$1,author:author$1,description:description$1,homepage:homepage$1,repository:repository$1,license:license$1,engines,type:type$5,main:main$1,scripts:scripts$1,devDependencies:devDependencies$1,packageManager,dependencies:dependencies$1,resolutions};var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** +`+new Array(_.length+4).join(" "):et=4294967296&&et++,_[a]=j,_[a+1]=et}function ADD64AC(_,a,$,j){let et=_[a]+$;$<0&&(et+=4294967296);let tt=_[a+1]+j;et>=4294967296&&tt++,_[a]=et,_[a+1]=tt}function B2B_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2B_G(_,a,$,j,et,tt){const rt=m$1[et],nt=m$1[et+1],it=m$1[tt],at=m$1[tt+1];ADD64AA(v$2,_,a),ADD64AC(v$2,_,rt,nt);let st=v$2[j]^v$2[_],ot=v$2[j+1]^v$2[_+1];v$2[j]=ot,v$2[j+1]=st,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],ot=v$2[a+1]^v$2[$+1],v$2[a]=st>>>24^ot<<8,v$2[a+1]=ot>>>24^st<<8,ADD64AA(v$2,_,a),ADD64AC(v$2,_,it,at),st=v$2[j]^v$2[_],ot=v$2[j+1]^v$2[_+1],v$2[j]=st>>>16^ot<<16,v$2[j+1]=ot>>>16^st<<16,ADD64AA(v$2,$,j),st=v$2[a]^v$2[$],ot=v$2[a+1]^v$2[$+1],v$2[a]=ot>>>31^st<<1,v$2[a+1]=st>>>31^ot<<1}const BLAKE2B_IV32=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),SIGMA8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],SIGMA82=new Uint8Array(SIGMA8.map(function(_){return _*2})),v$2=new Uint32Array(32),m$1=new Uint32Array(32);function blake2bCompress(_,a){let $=0;for($=0;$<16;$++)v$2[$]=_.h[$],v$2[$+16]=BLAKE2B_IV32[$];for(v$2[24]=v$2[24]^_.t,v$2[25]=v$2[25]^_.t/4294967296,a&&(v$2[28]=~v$2[28],v$2[29]=~v$2[29]),$=0;$<32;$++)m$1[$]=B2B_GET32(_.b,4*$);for($=0;$<12;$++)B2B_G(0,8,16,24,SIGMA82[$*16+0],SIGMA82[$*16+1]),B2B_G(2,10,18,26,SIGMA82[$*16+2],SIGMA82[$*16+3]),B2B_G(4,12,20,28,SIGMA82[$*16+4],SIGMA82[$*16+5]),B2B_G(6,14,22,30,SIGMA82[$*16+6],SIGMA82[$*16+7]),B2B_G(0,10,20,30,SIGMA82[$*16+8],SIGMA82[$*16+9]),B2B_G(2,12,22,24,SIGMA82[$*16+10],SIGMA82[$*16+11]),B2B_G(4,14,16,26,SIGMA82[$*16+12],SIGMA82[$*16+13]),B2B_G(6,8,18,28,SIGMA82[$*16+14],SIGMA82[$*16+15]);for($=0;$<16;$++)_.h[$]=_.h[$]^v$2[$]^v$2[$+16]}const parameterBlock=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function blake2bInit(_,a,$,j){if(_===0||_>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(a&&a.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if($&&$.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(j&&j.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const et={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:_};parameterBlock.fill(0),parameterBlock[0]=_,a&&(parameterBlock[1]=a.length),parameterBlock[2]=1,parameterBlock[3]=1,$&¶meterBlock.set($,32),j&¶meterBlock.set(j,48);for(let tt=0;tt<16;tt++)et.h[tt]=BLAKE2B_IV32[tt]^B2B_GET32(parameterBlock,tt*4);return a&&(blake2bUpdate(et,a),et.c=128),et}function blake2bUpdate(_,a){for(let $=0;$>2]>>8*($&3);return a}function blake2b(_,a,$,j,et){$=$||64,_=util$2.normalizeInput(_),j&&(j=util$2.normalizeInput(j)),et&&(et=util$2.normalizeInput(et));const tt=blake2bInit($,a,j,et);return blake2bUpdate(tt,_),blake2bFinal(tt)}function blake2bHex(_,a,$,j,et){const tt=blake2b(_,a,$,j,et);return util$2.toHex(tt)}var blake2b_1={blake2b,blake2bHex,blake2bInit,blake2bUpdate,blake2bFinal};const util$1=util$3;function B2S_GET32(_,a){return _[a]^_[a+1]<<8^_[a+2]<<16^_[a+3]<<24}function B2S_G(_,a,$,j,et,tt){v$1[_]=v$1[_]+v$1[a]+et,v$1[j]=ROTR32(v$1[j]^v$1[_],16),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],12),v$1[_]=v$1[_]+v$1[a]+tt,v$1[j]=ROTR32(v$1[j]^v$1[_],8),v$1[$]=v$1[$]+v$1[j],v$1[a]=ROTR32(v$1[a]^v$1[$],7)}function ROTR32(_,a){return _>>>a^_<<32-a}const BLAKE2S_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),v$1=new Uint32Array(16),m=new Uint32Array(16);function blake2sCompress(_,a){let $=0;for($=0;$<8;$++)v$1[$]=_.h[$],v$1[$+8]=BLAKE2S_IV[$];for(v$1[12]^=_.t,v$1[13]^=_.t/4294967296,a&&(v$1[14]=~v$1[14]),$=0;$<16;$++)m[$]=B2S_GET32(_.b,4*$);for($=0;$<10;$++)B2S_G(0,4,8,12,m[SIGMA[$*16+0]],m[SIGMA[$*16+1]]),B2S_G(1,5,9,13,m[SIGMA[$*16+2]],m[SIGMA[$*16+3]]),B2S_G(2,6,10,14,m[SIGMA[$*16+4]],m[SIGMA[$*16+5]]),B2S_G(3,7,11,15,m[SIGMA[$*16+6]],m[SIGMA[$*16+7]]),B2S_G(0,5,10,15,m[SIGMA[$*16+8]],m[SIGMA[$*16+9]]),B2S_G(1,6,11,12,m[SIGMA[$*16+10]],m[SIGMA[$*16+11]]),B2S_G(2,7,8,13,m[SIGMA[$*16+12]],m[SIGMA[$*16+13]]),B2S_G(3,4,9,14,m[SIGMA[$*16+14]],m[SIGMA[$*16+15]]);for($=0;$<8;$++)_.h[$]^=v$1[$]^v$1[$+8]}function blake2sInit(_,a){if(!(_>0&&_<=32))throw new Error("Incorrect output length, should be in [1, 32]");const $=a?a.length:0;if(a&&!($>0&&$<=32))throw new Error("Incorrect key length, should be in [1, 32]");const j={h:new Uint32Array(BLAKE2S_IV),b:new Uint8Array(64),c:0,t:0,outlen:_};return j.h[0]^=16842752^$<<8^_,$>0&&(blake2sUpdate(j,a),j.c=64),j}function blake2sUpdate(_,a){for(let $=0;$>2]>>8*($&3)&255;return a}function blake2s(_,a,$){$=$||32,_=util$1.normalizeInput(_);const j=blake2sInit($,a);return blake2sUpdate(j,_),blake2sFinal(j)}function blake2sHex(_,a,$){const j=blake2s(_,a,$);return util$1.toHex(j)}var blake2s_1={blake2s,blake2sHex,blake2sInit,blake2sUpdate,blake2sFinal};const b2b=blake2b_1,b2s=blake2s_1;var blakejs={blake2b:b2b.blake2b,blake2bHex:b2b.blake2bHex,blake2bInit:b2b.blake2bInit,blake2bUpdate:b2b.blake2bUpdate,blake2bFinal:b2b.blake2bFinal,blake2s:b2s.blake2s,blake2sHex:b2s.blake2sHex,blake2sInit:b2s.blake2sInit,blake2sUpdate:b2s.blake2sUpdate,blake2sFinal:b2s.blake2sFinal};const blake=getDefaultExportFromCjs$1(blakejs);var sha256$3={},_sha2$1={},_assert$1={};Object.defineProperty(_assert$1,"__esModule",{value:!0});_assert$1.output=_assert$1.exists=_assert$1.hash=_assert$1.bytes=_assert$1.bool=_assert$1.number=void 0;function number$3(_){if(!Number.isSafeInteger(_)||_<0)throw new Error(`Wrong positive integer: ${_}`)}_assert$1.number=number$3;function bool$3(_){if(typeof _!="boolean")throw new Error(`Expected boolean, not ${_}`)}_assert$1.bool=bool$3;function bytes$2(_,...a){if(!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length>0&&!a.includes(_.length))throw new TypeError(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}_assert$1.bytes=bytes$2;function hash$6(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$3(_.outputLen),number$3(_.blockLen)}_assert$1.hash=hash$6;function exists$2(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}_assert$1.exists=exists$2;function output$2(_,a){bytes$2(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert$1.output=output$2;const assert$u={number:number$3,bool:bool$3,bytes:bytes$2,hash:hash$6,exists:exists$2,output:output$2};_assert$1.default=assert$u;var utils$A={},crypto$2={};Object.defineProperty(crypto$2,"__esModule",{value:!0});crypto$2.crypto=void 0;crypto$2.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(_){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_,"__esModule",{value:!0}),_.randomBytes=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;const a=crypto$2,$=Lt=>new Uint8Array(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.u8=$;const j=Lt=>new Uint32Array(Lt.buffer,Lt.byteOffset,Math.floor(Lt.byteLength/4));_.u32=j;const et=Lt=>new DataView(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.createView=et;const tt=(Lt,Nt)=>Lt<<32-Nt|Lt>>>Nt;if(_.rotr=tt,_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!_.isLE)throw new Error("Non little-endian hardware is not supported");const rt=Array.from({length:256},(Lt,Nt)=>Nt.toString(16).padStart(2,"0"));function nt(Lt){if(!(Lt instanceof Uint8Array))throw new Error("Uint8Array expected");let Nt="";for(let zt=0;zt{};_.nextTick=at;async function st(Lt,Nt,zt){let jt=Date.now();for(let Mt=0;Mt=0&&Dtjt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Lt.length===1)return Lt[0];const Nt=Lt.reduce((jt,Mt)=>jt+Mt.length,0),zt=new Uint8Array(Nt);for(let jt=0,Mt=0;jtObject.prototype.toString.call(Lt)==="[object Object]"&&Lt.constructor===Object;function Ct(Lt,Nt){if(Nt!==void 0&&(typeof Nt!="object"||!xt(Nt)))throw new TypeError("Options should be object or undefined");return Object.assign(Lt,Nt)}_.checkOpts=Ct;function Pt(Lt){const Nt=jt=>Lt().update(ut(jt)).digest(),zt=Lt();return Nt.outputLen=zt.outputLen,Nt.blockLen=zt.blockLen,Nt.create=()=>Lt(),Nt}_.wrapConstructor=Pt;function Tt(Lt){const Nt=(jt,Mt)=>Lt(Mt).update(ut(jt)).digest(),zt=Lt({});return Nt.outputLen=zt.outputLen,Nt.blockLen=zt.blockLen,Nt.create=jt=>Lt(jt),Nt}_.wrapConstructorWithOpts=Tt;function kt(Lt=32){if(a.crypto&&typeof a.crypto.getRandomValues=="function")return a.crypto.getRandomValues(new Uint8Array(Lt));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=kt})(utils$A);Object.defineProperty(_sha2$1,"__esModule",{value:!0});_sha2$1.SHA2=void 0;const _assert_js_1$2=_assert$1,utils_js_1$5=utils$A;function setBigUint64$1(_,a,$,j){if(typeof _.setBigUint64=="function")return _.setBigUint64(a,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,at=j?0:4;_.setUint32(a+it,rt,j),_.setUint32(a+at,nt,j)}let SHA2$1=class extends utils_js_1$5.Hash{constructor(a,$,j,et){super(),this.blockLen=a,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,utils_js_1$5.createView)(this.buffer)}update(a){_assert_js_1$2.default.exists(this);const{view:$,buffer:j,blockLen:et}=this;a=(0,utils_js_1$5.toBytes)(a);const tt=a.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let ot=rt;otst.length)throw new Error("_sha2: outputLen bigger than state");for(let ot=0;ot_&a^~_&$,Maj$1=(_,a,$)=>_&a^_&$^a&$,SHA256_K$1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$1=class extends _sha2_js_1$2.SHA2{constructor(){super(64,32,8,!1),this.A=IV$1[0]|0,this.B=IV$1[1]|0,this.C=IV$1[2]|0,this.D=IV$1[3]|0,this.E=IV$1[4]|0,this.F=IV$1[5]|0,this.G=IV$1[6]|0,this.H=IV$1[7]|0}get(){const{A:a,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[a,$,j,et,tt,rt,nt,it]}set(a,$,j,et,tt,rt,nt,it){this.A=a|0,this.B=$|0,this.C=j|0,this.D=et|0,this.E=tt|0,this.F=rt|0,this.G=nt|0,this.H=it|0}process(a,$){for(let ot=0;ot<16;ot++,$+=4)SHA256_W$1[ot]=a.getUint32($,!1);for(let ot=16;ot<64;ot++){const ut=SHA256_W$1[ot-15],dt=SHA256_W$1[ot-2],mt=(0,utils_js_1$4.rotr)(ut,7)^(0,utils_js_1$4.rotr)(ut,18)^ut>>>3,xt=(0,utils_js_1$4.rotr)(dt,17)^(0,utils_js_1$4.rotr)(dt,19)^dt>>>10;SHA256_W$1[ot]=xt+SHA256_W$1[ot-7]+mt+SHA256_W$1[ot-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:at,H:st}=this;for(let ot=0;ot<64;ot++){const ut=(0,utils_js_1$4.rotr)(nt,6)^(0,utils_js_1$4.rotr)(nt,11)^(0,utils_js_1$4.rotr)(nt,25),dt=st+ut+Chi$1(nt,it,at)+SHA256_K$1[ot]+SHA256_W$1[ot]|0,xt=((0,utils_js_1$4.rotr)(j,2)^(0,utils_js_1$4.rotr)(j,13)^(0,utils_js_1$4.rotr)(j,22))+Maj$1(j,et,tt)|0;st=at,at=it,it=nt,nt=rt+dt|0,rt=tt,tt=et,et=j,j=dt+xt|0}j=j+this.A|0,et=et+this.B|0,tt=tt+this.C|0,rt=rt+this.D|0,nt=nt+this.E|0,it=it+this.F|0,at=at+this.G|0,st=st+this.H|0,this.set(j,et,tt,rt,nt,it,at,st)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224$1=class extends SHA256$1{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};sha256$3.sha256=(0,utils_js_1$4.wrapConstructor)(()=>new SHA256$1);sha256$3.sha224=(0,utils_js_1$4.wrapConstructor)(()=>new SHA224$1);function base$4(_){if(_.length>=255)throw new TypeError("Alphabet too long");for(var a=new Uint8Array(256),$=0;$>>0,kt=new Uint8Array(Tt);Ct!==Pt;){for(var Lt=dt[Ct],Nt=0,zt=Tt-1;(Lt!==0||Nt>>0,kt[zt]=Lt%rt>>>0,Lt=Lt/rt>>>0;if(Lt!==0)throw new Error("Non-zero carry");xt=Nt,Ct++}for(var jt=Tt-xt;jt!==Tt&&kt[jt]===0;)jt++;for(var Mt=nt.repeat(mt);jt>>0,Tt=new Uint8Array(Pt);dt[mt];){var kt=a[dt.charCodeAt(mt)];if(kt===255)return;for(var Lt=0,Nt=Pt-1;(kt!==0||Lt>>0,Tt[Nt]=kt%256>>>0,kt=kt/256>>>0;if(kt!==0)throw new Error("Non-zero carry");Ct=Lt,mt++}for(var zt=Pt-Ct;zt!==Pt&&Tt[zt]===0;)zt++;for(var jt=new Uint8Array(xt+(Pt-zt)),Mt=xt;zt!==Pt;)jt[Mt++]=Tt[zt++];return jt}function ut(dt){var mt=ot(dt);if(mt)return mt;throw new Error("Non-base"+rt+" character")}return{encode:st,decodeUnsafe:ot,decode:ut}}var src$1=base$4;const basex=src$1,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58=basex(ALPHABET),base58=bs58,base$3=function(_){function a(tt){var rt=Uint8Array.from(tt),nt=_(rt),it=rt.length+4,at=new Uint8Array(it);return at.set(rt,0),at.set(nt.subarray(0,4),rt.length),base58.encode(at,it)}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=_(rt);if(!(nt[0]^it[0]|nt[1]^it[1]|nt[2]^it[2]|nt[3]^it[3]))return rt}function j(tt){var rt=base58.decodeUnsafe(tt);if(rt)return $(rt)}function et(tt){var rt=base58.decode(tt),nt=$(rt);if(!nt)throw new Error("Invalid checksum");return nt}return{encode:a,decode:et,decodeUnsafe:j}},{sha256:sha256$2}=sha256$3,bs58checkBase=base$3;function sha256x2(_){return sha256$2(sha256$2(_))}var bs58check=bs58checkBase(sha256x2);const bs58check$1=getDefaultExportFromCjs$1(bs58check);class TaquitoError extends Error{}class ParameterValidationError extends TaquitoError{}class RpcError extends TaquitoError{}class TezosToolkitConfigError extends TaquitoError{}class UnsupportedActionError extends TaquitoError{}class NetworkError extends TaquitoError{}class InvalidAddressError extends ParameterValidationError{constructor(a,$){super(),this.address=a,this.errorDetail=$,this.name="InvalidAddressError",this.message=`Invalid address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidBlockHashError extends ParameterValidationError{constructor(a,$){super(),this.blockHash=a,this.errorDetail=$,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidAmountError extends ParameterValidationError{constructor(a){super(),this.amount=a,this.name="InvalidAmountError",this.message=`Invalid amount "${a}"`}}class InvalidDerivationPathError extends ParameterValidationError{constructor(a,$){super(),this.derivationPath=a,this.errorDetail=$,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidHexStringError extends ParameterValidationError{constructor(a,$){super(),this.hexString=a,this.errorDetail=$,this.name="InvalidHexStringError",this.message=`Invalid hex string "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidMessageError extends ParameterValidationError{constructor(a,$){super(),this.msg=a,this.errorDetail=$,this.name="InvalidMessageError",this.message=`Invalid message "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidViewParameterError extends ParameterValidationError{constructor(a,$,j,et){super(),this.viewName=a,this.sigs=$,this.args=j,this.cause=et,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(j)} received for name "${a}" expecting one of the following signatures ${JSON.stringify($)}.`}}class InvalidKeyError extends ParameterValidationError{constructor(a){super(),this.errorDetail=a,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=a?` ${a}.`:"."}}class InvalidPublicKeyError extends ParameterValidationError{constructor(a,$){super(),this.publicKey=a,this.errorDetail=$,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidContractAddressError extends ParameterValidationError{constructor(a,$){super(),this.contractAddress=a,this.errorDetail=$,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidChainIdError extends ParameterValidationError{constructor(a,$){super(),this.chainId=a,this.errorDetail=$,this.name="InvalidChainIdError",this.message=`Invalid chain id "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidKeyHashError extends ParameterValidationError{constructor(a,$){super(),this.keyHash=a,this.errorDetail=$,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationHashError extends ParameterValidationError{constructor(a,$){super(),this.operationHash=a,this.errorDetail=$,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${a}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationKindError extends ParameterValidationError{constructor(a,$){super(),this.operationKind=a,this.errorDetail=$,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${a}"`,this.message+=$?` ${$}.`:"."}}class DeprecationError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="DeprecationError"}}class ProhibitedActionError extends UnsupportedActionError{constructor(a){super(),this.message=a,this.name="ProhibitedActionError"}}class PublicKeyNotFoundError extends TaquitoError{constructor(a,$){super(),this.pkh=a,this.cause=$,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${a}" in either wallet or contract API.`}}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$2=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX$1=1e9;function clone(_){var a,$,j,et=Tt.prototype={constructor:Tt,toString:null,valueOf:null},tt=new Tt(1),rt=20,nt=4,it=-7,at=21,st=-1e7,ot=1e7,ut=!1,dt=1,mt=0,xt={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ct="0123456789abcdefghijklmnopqrstuvwxyz",Pt=!0;function Tt(Mt,Dt){var Ft,Bt,yt,bt,ct,ht,vt,St,Rt=this;if(!(Rt instanceof Tt))return new Tt(Mt,Dt);if(Dt==null){if(Mt&&Mt._isBigNumber===!0){Rt.s=Mt.s,!Mt.c||Mt.e>ot?Rt.c=Rt.e=null:Mt.e=10;ct/=10,bt++);bt>ot?Rt.c=Rt.e=null:(Rt.e=bt,Rt.c=[Mt]);return}St=String(Mt)}else{if(!isNumeric.test(St=String(Mt)))return j(Rt,St,ht);Rt.s=St.charCodeAt(0)==45?(St=St.slice(1),-1):1}(bt=St.indexOf("."))>-1&&(St=St.replace(".","")),(ct=St.search(/e/i))>0?(bt<0&&(bt=ct),bt+=+St.slice(ct+1),St=St.substring(0,ct)):bt<0&&(bt=St.length)}else{if(intCheck(Dt,2,Ct.length,"Base"),Dt==10&&Pt)return Rt=new Tt(Mt),zt(Rt,rt+Rt.e+1,nt);if(St=String(Mt),ht=typeof Mt=="number"){if(Mt*0!=0)return j(Rt,St,ht,Dt);if(Rt.s=1/Mt<0?(St=St.slice(1),-1):1,Tt.DEBUG&&St.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+Mt)}else Rt.s=St.charCodeAt(0)===45?(St=St.slice(1),-1):1;for(Ft=Ct.slice(0,Dt),bt=ct=0,vt=St.length;ctbt){bt=vt;continue}}else if(!yt&&(St==St.toUpperCase()&&(St=St.toLowerCase())||St==St.toLowerCase()&&(St=St.toUpperCase()))){yt=!0,ct=-1,bt=0;continue}return j(Rt,String(Mt),ht,Dt)}ht=!1,St=$(St,Dt,10,Rt.s),(bt=St.indexOf("."))>-1?St=St.replace(".",""):bt=St.length}for(ct=0;St.charCodeAt(ct)===48;ct++);for(vt=St.length;St.charCodeAt(--vt)===48;);if(St=St.slice(ct,++vt)){if(vt-=ct,ht&&Tt.DEBUG&&vt>15&&(Mt>MAX_SAFE_INTEGER$2||Mt!==mathfloor(Mt)))throw Error(tooManyDigits+Rt.s*Mt);if((bt=bt-ct-1)>ot)Rt.c=Rt.e=null;else if(bt=-MAX$1&&yt<=MAX$1&&yt===mathfloor(yt)){if(Bt[0]===0){if(yt===0&&Bt.length===1)return!0;break e}if(Dt=(yt+1)%LOG_BASE,Dt<1&&(Dt+=LOG_BASE),String(Bt[0]).length==Dt){for(Dt=0;Dt=BASE||Ft!==mathfloor(Ft))break e;if(Ft!==0)return!0}}}else if(Bt===null&&yt===null&&(bt===null||bt===1||bt===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+Mt)},Tt.maximum=Tt.max=function(){return Lt(arguments,-1)},Tt.minimum=Tt.min=function(){return Lt(arguments,1)},Tt.random=function(){var Mt=9007199254740992,Dt=Math.random()*Mt&2097151?function(){return mathfloor(Math.random()*Mt)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Ft){var Bt,yt,bt,ct,ht,vt=0,St=[],Rt=new Tt(tt);if(Ft==null?Ft=rt:intCheck(Ft,0,MAX$1),ct=mathceil(Ft/LOG_BASE),ut)if(crypto.getRandomValues){for(Bt=crypto.getRandomValues(new Uint32Array(ct*=2));vt>>11),ht>=9e15?(yt=crypto.getRandomValues(new Uint32Array(2)),Bt[vt]=yt[0],Bt[vt+1]=yt[1]):(St.push(ht%1e14),vt+=2);vt=ct/2}else if(crypto.randomBytes){for(Bt=crypto.randomBytes(ct*=7);vt=9e15?crypto.randomBytes(7).copy(Bt,vt):(St.push(ht%1e14),vt+=7);vt=ct/7}else throw ut=!1,Error(bignumberError+"crypto unavailable");if(!ut)for(;vt=10;ht/=10,vt++);vtyt-1&&(ht[ct+1]==null&&(ht[ct+1]=0),ht[ct+1]+=ht[ct]/yt|0,ht[ct]%=yt)}return ht.reverse()}return function(Ft,Bt,yt,bt,ct){var ht,vt,St,Rt,$t,Et,At,wt,Ot=Ft.indexOf("."),tr=rt,nr=nt;for(Ot>=0&&(Rt=mt,mt=0,Ft=Ft.replace(".",""),wt=new Tt(Bt),Et=wt.pow(Ft.length-Ot),mt=Rt,wt.c=Dt(toFixedPoint(coeffToString(Et.c),Et.e,"0"),10,yt,Mt),wt.e=wt.c.length),At=Dt(Ft,Bt,yt,ct?(ht=Ct,Mt):(ht=Mt,Ct)),St=Rt=At.length;At[--Rt]==0;At.pop());if(!At[0])return ht.charAt(0);if(Ot<0?--St:(Et.c=At,Et.e=St,Et.s=bt,Et=a(Et,wt,tr,nr,yt),At=Et.c,$t=Et.r,St=Et.e),vt=St+tr+1,Ot=At[vt],Rt=yt/2,$t=$t||vt<0||At[vt+1]!=null,$t=nr<4?(Ot!=null||$t)&&(nr==0||nr==(Et.s<0?3:2)):Ot>Rt||Ot==Rt&&(nr==4||$t||nr==6&&At[vt-1]&1||nr==(Et.s<0?8:7)),vt<1||!At[0])Ft=$t?toFixedPoint(ht.charAt(1),-tr,ht.charAt(0)):ht.charAt(0);else{if(At.length=vt,$t)for(--yt;++At[--vt]>yt;)At[vt]=0,vt||(++St,At=[1].concat(At));for(Rt=At.length;!At[--Rt];);for(Ot=0,Ft="";Ot<=Rt;Ft+=ht.charAt(At[Ot++]));Ft=toFixedPoint(Ft,St,ht.charAt(0))}return Ft}}(),a=function(){function Mt(Bt,yt,bt){var ct,ht,vt,St,Rt=0,$t=Bt.length,Et=yt%SQRT_BASE,At=yt/SQRT_BASE|0;for(Bt=Bt.slice();$t--;)vt=Bt[$t]%SQRT_BASE,St=Bt[$t]/SQRT_BASE|0,ct=At*vt+St*Et,ht=Et*vt+ct%SQRT_BASE*SQRT_BASE+Rt,Rt=(ht/bt|0)+(ct/SQRT_BASE|0)+At*St,Bt[$t]=ht%bt;return Rt&&(Bt=[Rt].concat(Bt)),Bt}function Dt(Bt,yt,bt,ct){var ht,vt;if(bt!=ct)vt=bt>ct?1:-1;else for(ht=vt=0;htyt[ht]?1:-1;break}return vt}function Ft(Bt,yt,bt,ct){for(var ht=0;bt--;)Bt[bt]-=ht,ht=Bt[bt]1;Bt.splice(0,1));}return function(Bt,yt,bt,ct,ht){var vt,St,Rt,$t,Et,At,wt,Ot,tr,nr,ir,Wt,Kt,Jt,Ht,Vt,Qt,dr=Bt.s==yt.s?1:-1,xr=Bt.c,pr=yt.c;if(!xr||!xr[0]||!pr||!pr[0])return new Tt(!Bt.s||!yt.s||(xr?pr&&xr[0]==pr[0]:!pr)?NaN:xr&&xr[0]==0||!pr?dr*0:dr/0);for(Ot=new Tt(dr),tr=Ot.c=[],St=Bt.e-yt.e,dr=bt+St+1,ht||(ht=BASE,St=bitFloor(Bt.e/LOG_BASE)-bitFloor(yt.e/LOG_BASE),dr=dr/LOG_BASE|0),Rt=0;pr[Rt]==(xr[Rt]||0);Rt++);if(pr[Rt]>(xr[Rt]||0)&&St--,dr<0)tr.push(1),$t=!0;else{for(Jt=xr.length,Vt=pr.length,Rt=0,dr+=2,Et=mathfloor(ht/(pr[0]+1)),Et>1&&(pr=Mt(pr,Et,ht),xr=Mt(xr,Et,ht),Vt=pr.length,Jt=xr.length),Kt=Vt,nr=xr.slice(0,Vt),ir=nr.length;ir=ht/2&&Ht++;do{if(Et=0,vt=Dt(pr,nr,Vt,ir),vt<0){if(Wt=nr[0],Vt!=ir&&(Wt=Wt*ht+(nr[1]||0)),Et=mathfloor(Wt/Ht),Et>1)for(Et>=ht&&(Et=ht-1),At=Mt(pr,Et,ht),wt=At.length,ir=nr.length;Dt(At,nr,wt,ir)==1;)Et--,Ft(At,Vt=10;dr/=10,Rt++);zt(Ot,bt+(Ot.e=Rt+St*LOG_BASE-1)+1,ct,$t)}else Ot.e=St,Ot.r=+$t;return Ot}}();function kt(Mt,Dt,Ft,Bt){var yt,bt,ct,ht,vt;if(Ft==null?Ft=nt:intCheck(Ft,0,8),!Mt.c)return Mt.toString();if(yt=Mt.c[0],ct=Mt.e,Dt==null)vt=coeffToString(Mt.c),vt=Bt==1||Bt==2&&(ct<=it||ct>=at)?toExponential(vt,ct):toFixedPoint(vt,ct,"0");else if(Mt=zt(new Tt(Mt),Dt,Ft),bt=Mt.e,vt=coeffToString(Mt.c),ht=vt.length,Bt==1||Bt==2&&(Dt<=bt||bt<=it)){for(;htht){if(--Dt>0)for(vt+=".";Dt--;vt+="0");}else if(Dt+=bt-ht,Dt>0)for(bt+1==ht&&(vt+=".");Dt--;vt+="0");return Mt.s<0&&yt?"-"+vt:vt}function Lt(Mt,Dt){for(var Ft,Bt,yt=1,bt=new Tt(Mt[0]);yt=10;yt/=10,Bt++);return(Ft=Bt+Ft*LOG_BASE-1)>ot?Mt.c=Mt.e=null:Ft=10;ht/=10,yt++);if(bt=Dt-yt,bt<0)bt+=LOG_BASE,ct=Dt,vt=$t[St=0],Rt=mathfloor(vt/Et[yt-ct-1]%10);else if(St=mathceil((bt+1)/LOG_BASE),St>=$t.length)if(Bt){for(;$t.length<=St;$t.push(0));vt=Rt=0,yt=1,bt%=LOG_BASE,ct=bt-LOG_BASE+1}else break e;else{for(vt=ht=$t[St],yt=1;ht>=10;ht/=10,yt++);bt%=LOG_BASE,ct=bt-LOG_BASE+yt,Rt=ct<0?0:mathfloor(vt/Et[yt-ct-1]%10)}if(Bt=Bt||Dt<0||$t[St+1]!=null||(ct<0?vt:vt%Et[yt-ct-1]),Bt=Ft<4?(Rt||Bt)&&(Ft==0||Ft==(Mt.s<0?3:2)):Rt>5||Rt==5&&(Ft==4||Bt||Ft==6&&(bt>0?ct>0?vt/Et[yt-ct]:0:$t[St-1])%10&1||Ft==(Mt.s<0?8:7)),Dt<1||!$t[0])return $t.length=0,Bt?(Dt-=Mt.e+1,$t[0]=Et[(LOG_BASE-Dt%LOG_BASE)%LOG_BASE],Mt.e=-Dt||0):$t[0]=Mt.e=0,Mt;if(bt==0?($t.length=St,ht=1,St--):($t.length=St+1,ht=Et[LOG_BASE-bt],$t[St]=ct>0?mathfloor(vt/Et[yt-ct]%Et[ct])*ht:0),Bt)for(;;)if(St==0){for(bt=1,ct=$t[0];ct>=10;ct/=10,bt++);for(ct=$t[0]+=ht,ht=1;ct>=10;ct/=10,ht++);bt!=ht&&(Mt.e++,$t[0]==BASE&&($t[0]=1));break}else{if($t[St]+=ht,$t[St]!=BASE)break;$t[St--]=0,ht=1}for(bt=$t.length;$t[--bt]===0;$t.pop());}Mt.e>ot?Mt.c=Mt.e=null:Mt.e=at?toExponential(Dt,Ft):toFixedPoint(Dt,Ft,"0"),Mt.s<0?"-"+Dt:Dt)}return et.absoluteValue=et.abs=function(){var Mt=new Tt(this);return Mt.s<0&&(Mt.s=1),Mt},et.comparedTo=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))},et.decimalPlaces=et.dp=function(Mt,Dt){var Ft,Bt,yt,bt=this;if(Mt!=null)return intCheck(Mt,0,MAX$1),Dt==null?Dt=nt:intCheck(Dt,0,8),zt(new Tt(bt),Mt+bt.e+1,Dt);if(!(Ft=bt.c))return null;if(Bt=((yt=Ft.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,yt=Ft[yt])for(;yt%10==0;yt/=10,Bt--);return Bt<0&&(Bt=0),Bt},et.dividedBy=et.div=function(Mt,Dt){return a(this,new Tt(Mt,Dt),rt,nt)},et.dividedToIntegerBy=et.idiv=function(Mt,Dt){return a(this,new Tt(Mt,Dt),0,1)},et.exponentiatedBy=et.pow=function(Mt,Dt){var Ft,Bt,yt,bt,ct,ht,vt,St,Rt,$t=this;if(Mt=new Tt(Mt),Mt.c&&!Mt.isInteger())throw Error(bignumberError+"Exponent not an integer: "+jt(Mt));if(Dt!=null&&(Dt=new Tt(Dt)),ht=Mt.e>14,!$t.c||!$t.c[0]||$t.c[0]==1&&!$t.e&&$t.c.length==1||!Mt.c||!Mt.c[0])return Rt=new Tt(Math.pow(+jt($t),ht?Mt.s*(2-isOdd(Mt)):+jt(Mt))),Dt?Rt.mod(Dt):Rt;if(vt=Mt.s<0,Dt){if(Dt.c?!Dt.c[0]:!Dt.s)return new Tt(NaN);Bt=!vt&&$t.isInteger()&&Dt.isInteger(),Bt&&($t=$t.mod(Dt))}else{if(Mt.e>9&&($t.e>0||$t.e<-1||($t.e==0?$t.c[0]>1||ht&&$t.c[1]>=24e7:$t.c[0]<8e13||ht&&$t.c[0]<=9999975e7)))return bt=$t.s<0&&isOdd(Mt)?-0:0,$t.e>-1&&(bt=1/bt),new Tt(vt?1/bt:bt);mt&&(bt=mathceil(mt/LOG_BASE+2))}for(ht?(Ft=new Tt(.5),vt&&(Mt.s=1),St=isOdd(Mt)):(yt=Math.abs(+jt(Mt)),St=yt%2),Rt=new Tt(tt);;){if(St){if(Rt=Rt.times($t),!Rt.c)break;bt?Rt.c.length>bt&&(Rt.c.length=bt):Bt&&(Rt=Rt.mod(Dt))}if(yt){if(yt=mathfloor(yt/2),yt===0)break;St=yt%2}else if(Mt=Mt.times(Ft),zt(Mt,Mt.e+1,1),Mt.e>14)St=isOdd(Mt);else{if(yt=+jt(Mt),yt===0)break;St=yt%2}$t=$t.times($t),bt?$t.c&&$t.c.length>bt&&($t.c.length=bt):Bt&&($t=$t.mod(Dt))}return Bt?Rt:(vt&&(Rt=tt.div(Rt)),Dt?Rt.mod(Dt):bt?zt(Rt,mt,nt,ct):Rt)},et.integerValue=function(Mt){var Dt=new Tt(this);return Mt==null?Mt=nt:intCheck(Mt,0,8),zt(Dt,Dt.e+1,Mt)},et.isEqualTo=et.eq=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))===0},et.isFinite=function(){return!!this.c},et.isGreaterThan=et.gt=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))>0},et.isGreaterThanOrEqualTo=et.gte=function(Mt,Dt){return(Dt=compare$c(this,new Tt(Mt,Dt)))===1||Dt===0},et.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},et.isLessThan=et.lt=function(Mt,Dt){return compare$c(this,new Tt(Mt,Dt))<0},et.isLessThanOrEqualTo=et.lte=function(Mt,Dt){return(Dt=compare$c(this,new Tt(Mt,Dt)))===-1||Dt===0},et.isNaN=function(){return!this.s},et.isNegative=function(){return this.s<0},et.isPositive=function(){return this.s>0},et.isZero=function(){return!!this.c&&this.c[0]==0},et.minus=function(Mt,Dt){var Ft,Bt,yt,bt,ct=this,ht=ct.s;if(Mt=new Tt(Mt,Dt),Dt=Mt.s,!ht||!Dt)return new Tt(NaN);if(ht!=Dt)return Mt.s=-Dt,ct.plus(Mt);var vt=ct.e/LOG_BASE,St=Mt.e/LOG_BASE,Rt=ct.c,$t=Mt.c;if(!vt||!St){if(!Rt||!$t)return Rt?(Mt.s=-Dt,Mt):new Tt($t?ct:NaN);if(!Rt[0]||!$t[0])return $t[0]?(Mt.s=-Dt,Mt):new Tt(Rt[0]?ct:nt==3?-0:0)}if(vt=bitFloor(vt),St=bitFloor(St),Rt=Rt.slice(),ht=vt-St){for((bt=ht<0)?(ht=-ht,yt=Rt):(St=vt,yt=$t),yt.reverse(),Dt=ht;Dt--;yt.push(0));yt.reverse()}else for(Bt=(bt=(ht=Rt.length)<(Dt=$t.length))?ht:Dt,ht=Dt=0;Dt0)for(;Dt--;Rt[Ft++]=0);for(Dt=BASE-1;Bt>ht;){if(Rt[--Bt]<$t[Bt]){for(Ft=Bt;Ft&&!Rt[--Ft];Rt[Ft]=Dt);--Rt[Ft],Rt[Bt]+=BASE}Rt[Bt]-=$t[Bt]}for(;Rt[0]==0;Rt.splice(0,1),--St);return Rt[0]?Nt(Mt,Rt,St):(Mt.s=nt==3?-1:1,Mt.c=[Mt.e=0],Mt)},et.modulo=et.mod=function(Mt,Dt){var Ft,Bt,yt=this;return Mt=new Tt(Mt,Dt),!yt.c||!Mt.s||Mt.c&&!Mt.c[0]?new Tt(NaN):!Mt.c||yt.c&&!yt.c[0]?new Tt(yt):(dt==9?(Bt=Mt.s,Mt.s=1,Ft=a(yt,Mt,0,3),Mt.s=Bt,Ft.s*=Bt):Ft=a(yt,Mt,0,dt),Mt=yt.minus(Ft.times(Mt)),!Mt.c[0]&&dt==1&&(Mt.s=yt.s),Mt)},et.multipliedBy=et.times=function(Mt,Dt){var Ft,Bt,yt,bt,ct,ht,vt,St,Rt,$t,Et,At,wt,Ot,tr,nr=this,ir=nr.c,Wt=(Mt=new Tt(Mt,Dt)).c;if(!ir||!Wt||!ir[0]||!Wt[0])return!nr.s||!Mt.s||ir&&!ir[0]&&!Wt||Wt&&!Wt[0]&&!ir?Mt.c=Mt.e=Mt.s=null:(Mt.s*=nr.s,!ir||!Wt?Mt.c=Mt.e=null:(Mt.c=[0],Mt.e=0)),Mt;for(Bt=bitFloor(nr.e/LOG_BASE)+bitFloor(Mt.e/LOG_BASE),Mt.s*=nr.s,vt=ir.length,$t=Wt.length,vt<$t&&(wt=ir,ir=Wt,Wt=wt,yt=vt,vt=$t,$t=yt),yt=vt+$t,wt=[];yt--;wt.push(0));for(Ot=BASE,tr=SQRT_BASE,yt=$t;--yt>=0;){for(Ft=0,Et=Wt[yt]%tr,At=Wt[yt]/tr|0,ct=vt,bt=yt+ct;bt>yt;)St=ir[--ct]%tr,Rt=ir[ct]/tr|0,ht=At*St+Rt*Et,St=Et*St+ht%tr*tr+wt[bt]+Ft,Ft=(St/Ot|0)+(ht/tr|0)+At*Rt,wt[bt--]=St%Ot;wt[bt]=Ft}return Ft?++Bt:wt.splice(0,1),Nt(Mt,wt,Bt)},et.negated=function(){var Mt=new Tt(this);return Mt.s=-Mt.s||null,Mt},et.plus=function(Mt,Dt){var Ft,Bt=this,yt=Bt.s;if(Mt=new Tt(Mt,Dt),Dt=Mt.s,!yt||!Dt)return new Tt(NaN);if(yt!=Dt)return Mt.s=-Dt,Bt.minus(Mt);var bt=Bt.e/LOG_BASE,ct=Mt.e/LOG_BASE,ht=Bt.c,vt=Mt.c;if(!bt||!ct){if(!ht||!vt)return new Tt(yt/0);if(!ht[0]||!vt[0])return vt[0]?Mt:new Tt(ht[0]?Bt:yt*0)}if(bt=bitFloor(bt),ct=bitFloor(ct),ht=ht.slice(),yt=bt-ct){for(yt>0?(ct=bt,Ft=vt):(yt=-yt,Ft=ht),Ft.reverse();yt--;Ft.push(0));Ft.reverse()}for(yt=ht.length,Dt=vt.length,yt-Dt<0&&(Ft=vt,vt=ht,ht=Ft,Dt=yt),yt=0;Dt;)yt=(ht[--Dt]=ht[Dt]+vt[Dt]+yt)/BASE|0,ht[Dt]=BASE===ht[Dt]?0:ht[Dt]%BASE;return yt&&(ht=[yt].concat(ht),++ct),Nt(Mt,ht,ct)},et.precision=et.sd=function(Mt,Dt){var Ft,Bt,yt,bt=this;if(Mt!=null&&Mt!==!!Mt)return intCheck(Mt,1,MAX$1),Dt==null?Dt=nt:intCheck(Dt,0,8),zt(new Tt(bt),Mt,Dt);if(!(Ft=bt.c))return null;if(yt=Ft.length-1,Bt=yt*LOG_BASE+1,yt=Ft[yt]){for(;yt%10==0;yt/=10,Bt--);for(yt=Ft[0];yt>=10;yt/=10,Bt++);}return Mt&&bt.e+1>Bt&&(Bt=bt.e+1),Bt},et.shiftedBy=function(Mt){return intCheck(Mt,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+Mt)},et.squareRoot=et.sqrt=function(){var Mt,Dt,Ft,Bt,yt,bt=this,ct=bt.c,ht=bt.s,vt=bt.e,St=rt+4,Rt=new Tt("0.5");if(ht!==1||!ct||!ct[0])return new Tt(!ht||ht<0&&(!ct||ct[0])?NaN:ct?bt:1/0);if(ht=Math.sqrt(+jt(bt)),ht==0||ht==1/0?(Dt=coeffToString(ct),(Dt.length+vt)%2==0&&(Dt+="0"),ht=Math.sqrt(+Dt),vt=bitFloor((vt+1)/2)-(vt<0||vt%2),ht==1/0?Dt="5e"+vt:(Dt=ht.toExponential(),Dt=Dt.slice(0,Dt.indexOf("e")+1)+vt),Ft=new Tt(Dt)):Ft=new Tt(ht+""),Ft.c[0]){for(vt=Ft.e,ht=vt+St,ht<3&&(ht=0);;)if(yt=Ft,Ft=Rt.times(yt.plus(a(bt,yt,St,1))),coeffToString(yt.c).slice(0,ht)===(Dt=coeffToString(Ft.c)).slice(0,ht))if(Ft.e0&&wt>0){for(bt=wt%ht||ht,Rt=At.substr(0,bt);bt0&&(Rt+=St+At.slice(bt)),Et&&(Rt="-"+Rt)}Bt=$t?Rt+(Ft.decimalSeparator||"")+((vt=+Ft.fractionGroupSize)?$t.replace(new RegExp("\\d{"+vt+"}\\B","g"),"$&"+(Ft.fractionGroupSeparator||"")):$t):Rt}return(Ft.prefix||"")+Bt+(Ft.suffix||"")},et.toFraction=function(Mt){var Dt,Ft,Bt,yt,bt,ct,ht,vt,St,Rt,$t,Et,At=this,wt=At.c;if(Mt!=null&&(ht=new Tt(Mt),!ht.isInteger()&&(ht.c||ht.s!==1)||ht.lt(tt)))throw Error(bignumberError+"Argument "+(ht.isInteger()?"out of range: ":"not an integer: ")+jt(ht));if(!wt)return new Tt(At);for(Dt=new Tt(tt),St=Ft=new Tt(tt),Bt=vt=new Tt(tt),Et=coeffToString(wt),bt=Dt.e=Et.length-At.e-1,Dt.c[0]=POWS_TEN[(ct=bt%LOG_BASE)<0?LOG_BASE+ct:ct],Mt=!Mt||ht.comparedTo(Dt)>0?bt>0?Dt:St:ht,ct=ot,ot=1/0,ht=new Tt(Et),vt.c[0]=0;Rt=a(ht,Dt,0,1),yt=Ft.plus(Rt.times(Bt)),yt.comparedTo(Mt)!=1;)Ft=Bt,Bt=yt,St=vt.plus(Rt.times(yt=St)),vt=yt,Dt=ht.minus(Rt.times(yt=Dt)),ht=yt;return yt=a(Mt.minus(Ft),Bt,0,1),vt=vt.plus(yt.times(St)),Ft=Ft.plus(yt.times(Bt)),vt.s=St.s=At.s,bt=bt*2,$t=a(St,Bt,bt,nt).minus(At).abs().comparedTo(a(vt,Ft,bt,nt).minus(At).abs())<1?[St,Bt]:[vt,Ft],ot=ct,$t},et.toNumber=function(){return+jt(this)},et.toPrecision=function(Mt,Dt){return Mt!=null&&intCheck(Mt,1,MAX$1),kt(this,Mt,Dt,2)},et.toString=function(Mt){var Dt,Ft=this,Bt=Ft.s,yt=Ft.e;return yt===null?Bt?(Dt="Infinity",Bt<0&&(Dt="-"+Dt)):Dt="NaN":(Mt==null?Dt=yt<=it||yt>=at?toExponential(coeffToString(Ft.c),yt):toFixedPoint(coeffToString(Ft.c),yt,"0"):Mt===10&&Pt?(Ft=zt(new Tt(Ft),rt+yt+1,nt),Dt=toFixedPoint(coeffToString(Ft.c),Ft.e,"0")):(intCheck(Mt,2,Ct.length,"Base"),Dt=$(toFixedPoint(coeffToString(Ft.c),yt,"0"),10,Mt,Bt,!0)),Bt<0&&Ft.c[0]&&(Dt="-"+Dt)),Dt},et.valueOf=et.toJSON=function(){return jt(this)},et._isBigNumber=!0,et[Symbol.toStringTag]="BigNumber",et[Symbol.for("nodejs.util.inspect.custom")]=et.valueOf,_!=null&&Tt.set(_),Tt}function bitFloor(_){var a=_|0;return _>0||_===a?a:a-1}function coeffToString(_){for(var a,$,j=1,et=_.length,tt=_[0]+"";jat^$?1:-1;for(nt=(it=et.length)<(at=tt.length)?it:at,rt=0;rttt[rt]^$?1:-1;return it==at?0:it>at^$?1:-1}function intCheck(_,a,$,j){if(_$||_!==mathfloor(_))throw Error(bignumberError+(j||"Argument")+(typeof _=="number"?_$?" out of range: ":" not an integer: ":" not a primitive number: ")+String(_))}function isOdd(_){var a=_.c.length-1;return bitFloor(_.e/LOG_BASE)==a&&_.c[a]%2!=0}function toExponential(_,a){return(_.length>1?_.charAt(0)+"."+_.slice(1):_)+(a<0?"e":"e+")+a}function toFixedPoint(_,a,$){var j,et;if(a<0){for(et=$+".";++a;et+=$);_=et+_}else if(j=_.length,++a>j){for(et=$,a-=j;--a;et+=$);_+=et}else a",license$3="MIT",bugs$2={url:"https://github.com/indutny/elliptic/issues"},homepage$3="https://github.com/indutny/elliptic",devDependencies$3={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$3={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$3={name:name$3,version:version$3,description:description$3,main:main$3,files:files$2,scripts:scripts$3,repository:repository$3,keywords:keywords$2,author:author$3,license:license$3,bugs:bugs$2,homepage:homepage$3,devDependencies:devDependencies$3,dependencies:dependencies$3};var utils$z={};(function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$R;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,ot,ut){var dt=new Array(Math.max(st.bitLength(),ut)+1);dt.fill(0);for(var mt=1<(mt>>1)-1?Pt=(mt>>1)-Tt:Pt=Tt,xt.isubn(Pt)):Pt=0,dt[Ct]=Pt,xt.iushrn(1)}return dt}a.getNAF=tt;function rt(st,ot){var ut=[[],[]];st=st.clone(),ot=ot.clone();for(var dt=0,mt=0,xt;st.cmpn(-dt)>0||ot.cmpn(-mt)>0;){var Ct=st.andln(3)+dt&3,Pt=ot.andln(3)+mt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(xt=st.andln(7)+dt&7,(xt===3||xt===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var kt;Pt&1?(xt=ot.andln(7)+mt&7,(xt===3||xt===5)&&Ct===2?kt=-Pt:kt=Pt):kt=0,ut[1].push(kt),2*dt===Tt+1&&(dt=1-dt),2*mt===kt+1&&(mt=1-mt),st.iushrn(1),ot.iushrn(1)}return ut}a.getJSF=rt;function nt(st,ot,ut){var dt="_"+ot;st.prototype[ot]=function(){return this[dt]!==void 0?this[dt]:this[dt]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function at(st){return new $(st,"hex","le")}a.intFromLE=at})(utils$z);var curve$2={},BN$o=bnExports$1,utils$y=utils$z,getNAF$2=utils$y.getNAF,getJSF$2=utils$y.getJSF,assert$t=utils$y.assert;function BaseCurve$2(_,a){this.type=_,this.p=new BN$o(a.p,16),this.red=a.prime?BN$o.red(a.prime):BN$o.mont(this.p),this.zero=new BN$o(0).toRed(this.red),this.one=new BN$o(1).toRed(this.red),this.two=new BN$o(2).toRed(this.red),this.n=a.n&&new BN$o(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var $=this.n&&this.p.div(this.n);!$||$.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$2=BaseCurve$2;BaseCurve$2.prototype.point=function _(){throw new Error("Not implemented")};BaseCurve$2.prototype.validate=function _(){throw new Error("Not implemented")};BaseCurve$2.prototype._fixedNafMul=function _(a,$){assert$t(a.precomputed);var j=a._getDoubles(),et=getNAF$2($,1,this._bitLength),tt=(1<=nt;at--)it=(it<<1)+et[at];rt.push(it)}for(var st=this.jpoint(null,null,null),ot=this.jpoint(null,null,null),ut=tt;ut>0;ut--){for(nt=0;nt=0;it--){for(var at=0;it>=0&&rt[it]===0;it--)at++;if(it>=0&&at++,nt=nt.dblp(at),it<0)break;var st=rt[it];assert$t(st!==0),a.type==="affine"?st>0?nt=nt.mixedAdd(tt[st-1>>1]):nt=nt.mixedAdd(tt[-st-1>>1].neg()):st>0?nt=nt.add(tt[st-1>>1]):nt=nt.add(tt[-st-1>>1].neg())}return a.type==="affine"?nt.toP():nt};BaseCurve$2.prototype._wnafMulAdd=function _(a,$,j,et,tt){var rt=this._wnafT1,nt=this._wnafT2,it=this._wnafT3,at=0,st,ot,ut;for(st=0;st=1;st-=2){var mt=st-1,xt=st;if(rt[mt]!==1||rt[xt]!==1){it[mt]=getNAF$2(j[mt],rt[mt],this._bitLength),it[xt]=getNAF$2(j[xt],rt[xt],this._bitLength),at=Math.max(it[mt].length,at),at=Math.max(it[xt].length,at);continue}var Ct=[$[mt],null,null,$[xt]];$[mt].y.cmp($[xt].y)===0?(Ct[1]=$[mt].add($[xt]),Ct[2]=$[mt].toJ().mixedAdd($[xt].neg())):$[mt].y.cmp($[xt].y.redNeg())===0?(Ct[1]=$[mt].toJ().mixedAdd($[xt]),Ct[2]=$[mt].add($[xt].neg())):(Ct[1]=$[mt].toJ().mixedAdd($[xt]),Ct[2]=$[mt].toJ().mixedAdd($[xt].neg()));var Pt=[-3,-1,-5,-7,0,7,5,1,3],Tt=getJSF$2(j[mt],j[xt]);for(at=Math.max(Tt[0].length,at),it[mt]=new Array(at),it[xt]=new Array(at),ot=0;ot=0;st--){for(var jt=0;st>=0;){var Mt=!0;for(ot=0;ot=0&&jt++,Nt=Nt.dblp(jt),st<0)break;for(ot=0;ot0?ut=nt[ot][Dt-1>>1]:Dt<0&&(ut=nt[ot][-Dt-1>>1].neg()),ut.type==="affine"?Nt=Nt.mixedAdd(ut):Nt=Nt.add(ut))}}for(st=0;st=Math.ceil((a.bitLength()+1)/$.step):!1};BasePoint$2.prototype._getDoubles=function _(a,$){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var j=[this],et=this,tt=0;tt<$;tt+=a){for(var rt=0;rt=0&&(dt=at,mt=st),ot.negative&&(ot=ot.neg(),ut=ut.neg()),dt.negative&&(dt=dt.neg(),mt=mt.neg()),[{a:ot,b:ut},{a:dt,b:mt}]};ShortCurve$2.prototype._endoSplit=function _(a){var $=this.endo.basis,j=$[0],et=$[1],tt=et.b.mul(a).divRound(this.n),rt=j.b.neg().mul(a).divRound(this.n),nt=tt.mul(j.a),it=rt.mul(et.a),at=tt.mul(j.b),st=rt.mul(et.b),ot=a.sub(nt).sub(it),ut=at.add(st).neg();return{k1:ot,k2:ut}};ShortCurve$2.prototype.pointFromX=function _(a,$){a=new BN$n(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");var tt=et.fromRed().isOdd();return($&&!tt||!$&&tt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve$2.prototype.validate=function _(a){if(a.inf)return!0;var $=a.x,j=a.y,et=this.a.redMul($),tt=$.redSqr().redMul($).redIAdd(et).redIAdd(this.b);return j.redSqr().redISub(tt).cmpn(0)===0};ShortCurve$2.prototype._endoWnafMulAdd=function _(a,$,j){for(var et=this._endoWnafT1,tt=this._endoWnafT2,rt=0;rt":""};Point$8.prototype.isInfinity=function _(){return this.inf};Point$8.prototype.add=function _(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var $=this.y.redSub(a.y);$.cmpn(0)!==0&&($=$.redMul(this.x.redSub(a.x).redInvm()));var j=$.redSqr().redISub(this.x).redISub(a.x),et=$.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$8.prototype.dbl=function _(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var $=this.curve.a,j=this.x.redSqr(),et=a.redInvm(),tt=j.redAdd(j).redIAdd(j).redIAdd($).redMul(et),rt=tt.redSqr().redISub(this.x.redAdd(this.x)),nt=tt.redMul(this.x.redSub(rt)).redISub(this.y);return this.curve.point(rt,nt)};Point$8.prototype.getX=function _(){return this.x.fromRed()};Point$8.prototype.getY=function _(){return this.y.fromRed()};Point$8.prototype.mul=function _(a){return a=new BN$n(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$8.prototype.mulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt):this.curve._wnafMulAdd(1,et,tt,2)};Point$8.prototype.jmulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt,!0):this.curve._wnafMulAdd(1,et,tt,2,!0)};Point$8.prototype.eq=function _(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$8.prototype.neg=function _(a){if(this.inf)return this;var $=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var j=this.precomputed,et=function(tt){return tt.neg()};$.precomputed={naf:j.naf&&{wnd:j.naf.wnd,points:j.naf.points.map(et)},doubles:j.doubles&&{step:j.doubles.step,points:j.doubles.points.map(et)}}}return $};Point$8.prototype.toJ=function _(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint$2(_,a,$,j){Base$8.BasePoint.call(this,_,"jacobian"),a===null&&$===null&&j===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$n(0)):(this.x=new BN$n(a,16),this.y=new BN$n($,16),this.z=new BN$n(j,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$8(JPoint$2,Base$8.BasePoint);ShortCurve$2.prototype.jpoint=function _(a,$,j){return new JPoint$2(this,a,$,j)};JPoint$2.prototype.toP=function _(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),$=a.redSqr(),j=this.x.redMul($),et=this.y.redMul($).redMul(a);return this.curve.point(j,et)};JPoint$2.prototype.neg=function _(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint$2.prototype.add=function _(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var $=a.z.redSqr(),j=this.z.redSqr(),et=this.x.redMul($),tt=a.x.redMul(j),rt=this.y.redMul($.redMul(a.z)),nt=a.y.redMul(j.redMul(this.z)),it=et.redSub(tt),at=rt.redSub(nt);if(it.cmpn(0)===0)return at.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var st=it.redSqr(),ot=st.redMul(it),ut=et.redMul(st),dt=at.redSqr().redIAdd(ot).redISub(ut).redISub(ut),mt=at.redMul(ut.redISub(dt)).redISub(rt.redMul(ot)),xt=this.z.redMul(a.z).redMul(it);return this.curve.jpoint(dt,mt,xt)};JPoint$2.prototype.mixedAdd=function _(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var $=this.z.redSqr(),j=this.x,et=a.x.redMul($),tt=this.y,rt=a.y.redMul($).redMul(this.z),nt=j.redSub(et),it=tt.redSub(rt);if(nt.cmpn(0)===0)return it.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var at=nt.redSqr(),st=at.redMul(nt),ot=j.redMul(at),ut=it.redSqr().redIAdd(st).redISub(ot).redISub(ot),dt=it.redMul(ot.redISub(ut)).redISub(tt.redMul(st)),mt=this.z.redMul(nt);return this.curve.jpoint(ut,dt,mt)};JPoint$2.prototype.dblp=function _(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var $;if(this.curve.zeroA||this.curve.threeA){var j=this;for($=0;$=0)return!1;if(j.redIAdd(tt),this.x.cmp(j)===0)return!0}};JPoint$2.prototype.inspect=function _(){return this.isInfinity()?"":""};JPoint$2.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};var BN$m=bnExports$1,inherits$7=inherits_browserExports,Base$7=base$2,utils$w=utils$z;function MontCurve$2(_){Base$7.call(this,"mont",_),this.a=new BN$m(_.a,16).toRed(this.red),this.b=new BN$m(_.b,16).toRed(this.red),this.i4=new BN$m(4).toRed(this.red).redInvm(),this.two=new BN$m(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$7(MontCurve$2,Base$7);var mont$2=MontCurve$2;MontCurve$2.prototype.validate=function _(a){var $=a.normalize().x,j=$.redSqr(),et=j.redMul($).redAdd(j.redMul(this.a)).redAdd($),tt=et.redSqrt();return tt.redSqr().cmp(et)===0};function Point$7(_,a,$){Base$7.BasePoint.call(this,_,"projective"),a===null&&$===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$m(a,16),this.z=new BN$m($,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$7(Point$7,Base$7.BasePoint);MontCurve$2.prototype.decodePoint=function _(a,$){return this.point(utils$w.toArray(a,$),1)};MontCurve$2.prototype.point=function _(a,$){return new Point$7(this,a,$)};MontCurve$2.prototype.pointFromJSON=function _(a){return Point$7.fromJSON(this,a)};Point$7.prototype.precompute=function _(){};Point$7.prototype._encode=function _(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$7.fromJSON=function _(a,$){return new Point$7(a,$[0],$[1]||a.one)};Point$7.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$7.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};Point$7.prototype.dbl=function _(){var a=this.x.redAdd(this.z),$=a.redSqr(),j=this.x.redSub(this.z),et=j.redSqr(),tt=$.redSub(et),rt=$.redMul(et),nt=tt.redMul(et.redAdd(this.curve.a24.redMul(tt)));return this.curve.point(rt,nt)};Point$7.prototype.add=function _(){throw new Error("Not supported on Montgomery curve")};Point$7.prototype.diffAdd=function _(a,$){var j=this.x.redAdd(this.z),et=this.x.redSub(this.z),tt=a.x.redAdd(a.z),rt=a.x.redSub(a.z),nt=rt.redMul(j),it=tt.redMul(et),at=$.z.redMul(nt.redAdd(it).redSqr()),st=$.x.redMul(nt.redISub(it).redSqr());return this.curve.point(at,st)};Point$7.prototype.mul=function _(a){for(var $=a.clone(),j=this,et=this.curve.point(null,null),tt=this,rt=[];$.cmpn(0)!==0;$.iushrn(1))rt.push($.andln(1));for(var nt=rt.length-1;nt>=0;nt--)rt[nt]===0?(j=j.diffAdd(et,tt),et=et.dbl()):(et=j.diffAdd(et,tt),j=j.dbl());return et};Point$7.prototype.mulAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$7.prototype.jumlAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$7.prototype.eq=function _(a){return this.getX().cmp(a.getX())===0};Point$7.prototype.normalize=function _(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$7.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};var utils$v=utils$z,BN$l=bnExports$1,inherits$6=inherits_browserExports,Base$6=base$2,assert$r=utils$v.assert;function EdwardsCurve$2(_){this.twisted=(_.a|0)!==1,this.mOneA=this.twisted&&(_.a|0)===-1,this.extended=this.mOneA,Base$6.call(this,"edwards",_),this.a=new BN$l(_.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$l(_.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$l(_.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$r(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(_.c|0)===1}inherits$6(EdwardsCurve$2,Base$6);var edwards$2=EdwardsCurve$2;EdwardsCurve$2.prototype._mulA=function _(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve$2.prototype._mulC=function _(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve$2.prototype.jpoint=function _(a,$,j,et){return this.point(a,$,j,et)};EdwardsCurve$2.prototype.pointFromX=function _(a,$){a=new BN$l(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=this.c2.redSub(this.a.redMul(j)),tt=this.one.redSub(this.c2.redMul(this.d).redMul(j)),rt=et.redMul(tt.redInvm()),nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");var it=nt.fromRed().isOdd();return($&&!it||!$&&it)&&(nt=nt.redNeg()),this.point(a,nt)};EdwardsCurve$2.prototype.pointFromY=function _(a,$){a=new BN$l(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=j.redSub(this.c2),tt=j.redMul(this.d).redMul(this.c2).redSub(this.a),rt=et.redMul(tt.redInvm());if(rt.cmp(this.zero)===0){if($)throw new Error("invalid point");return this.point(this.zero,a)}var nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");return nt.fromRed().isOdd()!==$&&(nt=nt.redNeg()),this.point(nt,a)};EdwardsCurve$2.prototype.validate=function _(a){if(a.isInfinity())return!0;a.normalize();var $=a.x.redSqr(),j=a.y.redSqr(),et=$.redMul(this.a).redAdd(j),tt=this.c2.redMul(this.one.redAdd(this.d.redMul($).redMul(j)));return et.cmp(tt)===0};function Point$6(_,a,$,j,et){Base$6.BasePoint.call(this,_,"projective"),a===null&&$===null&&j===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$l(a,16),this.y=new BN$l($,16),this.z=j?new BN$l(j,16):this.curve.one,this.t=et&&new BN$l(et,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits$6(Point$6,Base$6.BasePoint);EdwardsCurve$2.prototype.pointFromJSON=function _(a){return Point$6.fromJSON(this,a)};EdwardsCurve$2.prototype.point=function _(a,$,j,et){return new Point$6(this,a,$,j,et)};Point$6.fromJSON=function _(a,$){return new Point$6(a,$[0],$[1],$[2])};Point$6.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$6.prototype.isInfinity=function _(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point$6.prototype._extDbl=function _(){var a=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr();j=j.redIAdd(j);var et=this.curve._mulA(a),tt=this.x.redAdd(this.y).redSqr().redISub(a).redISub($),rt=et.redAdd($),nt=rt.redSub(j),it=et.redSub($),at=tt.redMul(nt),st=rt.redMul(it),ot=tt.redMul(it),ut=nt.redMul(rt);return this.curve.point(at,st,ut,ot)};Point$6.prototype._projDbl=function _(){var a=this.x.redAdd(this.y).redSqr(),$=this.x.redSqr(),j=this.y.redSqr(),et,tt,rt,nt,it,at;if(this.curve.twisted){nt=this.curve._mulA($);var st=nt.redAdd(j);this.zOne?(et=a.redSub($).redSub(j).redMul(st.redSub(this.curve.two)),tt=st.redMul(nt.redSub(j)),rt=st.redSqr().redSub(st).redSub(st)):(it=this.z.redSqr(),at=st.redSub(it).redISub(it),et=a.redSub($).redISub(j).redMul(at),tt=st.redMul(nt.redSub(j)),rt=st.redMul(at))}else nt=$.redAdd(j),it=this.curve._mulC(this.z).redSqr(),at=nt.redSub(it).redSub(it),et=this.curve._mulC(a.redISub(nt)).redMul(at),tt=this.curve._mulC(nt).redMul($.redISub(j)),rt=nt.redMul(at);return this.curve.point(et,tt,rt)};Point$6.prototype.dbl=function _(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point$6.prototype._extAdd=function _(a){var $=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),j=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),tt=this.z.redMul(a.z.redAdd(a.z)),rt=j.redSub($),nt=tt.redSub(et),it=tt.redAdd(et),at=j.redAdd($),st=rt.redMul(nt),ot=it.redMul(at),ut=rt.redMul(at),dt=nt.redMul(it);return this.curve.point(st,ot,dt,ut)};Point$6.prototype._projAdd=function _(a){var $=this.z.redMul(a.z),j=$.redSqr(),et=this.x.redMul(a.x),tt=this.y.redMul(a.y),rt=this.curve.d.redMul(et).redMul(tt),nt=j.redSub(rt),it=j.redAdd(rt),at=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(tt),st=$.redMul(nt).redMul(at),ot,ut;return this.curve.twisted?(ot=$.redMul(it).redMul(tt.redSub(this.curve._mulA(et))),ut=nt.redMul(it)):(ot=$.redMul(it).redMul(tt.redSub(et)),ut=this.curve._mulC(nt).redMul(it)),this.curve.point(st,ot,ut)};Point$6.prototype.add=function _(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point$6.prototype.mul=function _(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point$6.prototype.mulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!1)};Point$6.prototype.jmulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!0)};Point$6.prototype.normalize=function _(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point$6.prototype.neg=function _(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point$6.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};Point$6.prototype.getY=function _(){return this.normalize(),this.y.fromRed()};Point$6.prototype.eq=function _(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point$6.prototype.eqXToP=function _(a){var $=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp($)===0)return!0;for(var j=a.clone(),et=this.curve.redN.redMul(this.z);;){if(j.iadd(this.curve.n),j.cmp(this.curve.p)>=0)return!1;if($.redIAdd(et),this.x.cmp($)===0)return!0}};Point$6.prototype.toP=Point$6.prototype.normalize;Point$6.prototype.mixedAdd=Point$6.prototype.add;(function(_){var a=_;a.base=base$2,a.short=short$2,a.mont=mont$2,a.edwards=edwards$2})(curve$2);var curves$8={},secp256k1$2,hasRequiredSecp256k1$2;function requireSecp256k1$2(){return hasRequiredSecp256k1$2||(hasRequiredSecp256k1$2=1,secp256k1$2={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1$2}(function(_){var a=_,$=hash$8,j=curve$2,et=utils$z,tt=et.assert;function rt(at){at.type==="short"?this.curve=new j.short(at):at.type==="edwards"?this.curve=new j.edwards(at):this.curve=new j.mont(at),this.g=this.curve.g,this.n=this.curve.n,this.hash=at.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(at,st){Object.defineProperty(a,at,{configurable:!0,enumerable:!0,get:function(){var ot=new rt(st);return Object.defineProperty(a,at,{configurable:!0,enumerable:!0,value:ot}),ot}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1$2()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})})(curves$8);var BN$k=bnExports$1,utils$u=utils$z,assert$q=utils$u.assert;function KeyPair$b(_,a){this.ec=_,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$5=KeyPair$b;KeyPair$b.fromPublic=function _(a,$,j){return $ instanceof KeyPair$b?$:new KeyPair$b(a,{pub:$,pubEnc:j})};KeyPair$b.fromPrivate=function _(a,$,j){return $ instanceof KeyPair$b?$:new KeyPair$b(a,{priv:$,privEnc:j})};KeyPair$b.prototype.validate=function _(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$b.prototype.getPublic=function _(a,$){return typeof a=="string"&&($=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),$?this.pub.encode($,a):this.pub};KeyPair$b.prototype.getPrivate=function _(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$b.prototype._importPrivate=function _(a,$){this.priv=new BN$k(a,$||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$b.prototype._importPublic=function _(a,$){if(a.x||a.y){this.ec.curve.type==="mont"?assert$q(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$q(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,$)};KeyPair$b.prototype.derive=function _(a){return a.validate()||assert$q(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$b.prototype.sign=function _(a,$,j){return this.ec.sign(a,this,$,j)};KeyPair$b.prototype.verify=function _(a,$){return this.ec.verify(a,$,this)};KeyPair$b.prototype.inspect=function _(){return""};var BN$j=bnExports$1,utils$t=utils$z,assert$p=utils$t.assert;function Signature$b(_,a){if(_ instanceof Signature$b)return _;this._importDER(_,a)||(assert$p(_.r&&_.s,"Signature without r or s"),this.r=new BN$j(_.r,16),this.s=new BN$j(_.s,16),_.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=_.recoveryParam)}var signature$5=Signature$b;function Position$2(){this.place=0}function getLength$2(_,a){var $=_[a.place++];if(!($&128))return $;var j=$&15;if(j===0||j>4)return!1;for(var et=0,tt=0,rt=a.place;tt>>=0;return et<=127?!1:(a.place=rt,et)}function rmPadding$2(_){for(var a=0,$=_.length-1;!_[a]&&!(_[a+1]&128)&&a<$;)a++;return a===0?_:_.slice(a)}Signature$b.prototype._importDER=function _(a,$){a=utils$t.toArray(a,$);var j=new Position$2;if(a[j.place++]!==48)return!1;var et=getLength$2(a,j);if(et===!1||et+j.place!==a.length||a[j.place++]!==2)return!1;var tt=getLength$2(a,j);if(tt===!1)return!1;var rt=a.slice(j.place,tt+j.place);if(j.place+=tt,a[j.place++]!==2)return!1;var nt=getLength$2(a,j);if(nt===!1||a.length!==nt+j.place)return!1;var it=a.slice(j.place,nt+j.place);if(rt[0]===0)if(rt[1]&128)rt=rt.slice(1);else return!1;if(it[0]===0)if(it[1]&128)it=it.slice(1);else return!1;return this.r=new BN$j(rt),this.s=new BN$j(it),this.recoveryParam=null,!0};function constructLength$2(_,a){if(a<128){_.push(a);return}var $=1+(Math.log(a)/Math.LN2>>>3);for(_.push($|128);--$;)_.push(a>>>($<<3)&255);_.push(a)}Signature$b.prototype.toDER=function _(a){var $=this.r.toArray(),j=this.s.toArray();for($[0]&128&&($=[0].concat($)),j[0]&128&&(j=[0].concat(j)),$=rmPadding$2($),j=rmPadding$2(j);!j[0]&&!(j[1]&128);)j=j.slice(1);var et=[2];constructLength$2(et,$.length),et=et.concat($),et.push(2),constructLength$2(et,j.length);var tt=et.concat(j),rt=[48];return constructLength$2(rt,tt.length),rt=rt.concat(tt),utils$t.encode(rt,a)};var BN$i=bnExports$1,HmacDRBG$2=hmacDrbg,utils$s=utils$z,curves$7=curves$8,rand$2=requireBrorand(),assert$o=utils$s.assert,KeyPair$a=key$5,Signature$a=signature$5;function EC$2(_){if(!(this instanceof EC$2))return new EC$2(_);typeof _=="string"&&(assert$o(Object.prototype.hasOwnProperty.call(curves$7,_),"Unknown curve "+_),_=curves$7[_]),_ instanceof curves$7.PresetCurve&&(_={curve:_}),this.curve=_.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=_.curve.g,this.g.precompute(_.curve.n.bitLength()+1),this.hash=_.hash||_.curve.hash}var ec$5=EC$2;EC$2.prototype.keyPair=function _(a){return new KeyPair$a(this,a)};EC$2.prototype.keyFromPrivate=function _(a,$){return KeyPair$a.fromPrivate(this,a,$)};EC$2.prototype.keyFromPublic=function _(a,$){return KeyPair$a.fromPublic(this,a,$)};EC$2.prototype.genKeyPair=function _(a){a||(a={});for(var $=new HmacDRBG$2({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand$2(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),j=this.n.byteLength(),et=this.n.sub(new BN$i(2));;){var tt=new BN$i($.generate(j));if(!(tt.cmp(et)>0))return tt.iaddn(1),this.keyFromPrivate(tt)}};EC$2.prototype._truncateToN=function _(a,$){var j=a.byteLength()*8-this.n.bitLength();return j>0&&(a=a.ushrn(j)),!$&&a.cmp(this.n)>=0?a.sub(this.n):a};EC$2.prototype.sign=function _(a,$,j,et){typeof j=="object"&&(et=j,j=null),et||(et={}),$=this.keyFromPrivate($,j),a=this._truncateToN(new BN$i(a,16));for(var tt=this.n.byteLength(),rt=$.getPrivate().toArray("be",tt),nt=a.toArray("be",tt),it=new HmacDRBG$2({hash:this.hash,entropy:rt,nonce:nt,pers:et.pers,persEnc:et.persEnc||"utf8"}),at=this.n.sub(new BN$i(1)),st=0;;st++){var ot=et.k?et.k(st):new BN$i(it.generate(this.n.byteLength()));if(ot=this._truncateToN(ot,!0),!(ot.cmpn(1)<=0||ot.cmp(at)>=0)){var ut=this.g.mul(ot);if(!ut.isInfinity()){var dt=ut.getX(),mt=dt.umod(this.n);if(mt.cmpn(0)!==0){var xt=ot.invm(this.n).mul(mt.mul($.getPrivate()).iadd(a));if(xt=xt.umod(this.n),xt.cmpn(0)!==0){var Ct=(ut.getY().isOdd()?1:0)|(dt.cmp(mt)!==0?2:0);return et.canonical&&xt.cmp(this.nh)>0&&(xt=this.n.sub(xt),Ct^=1),new Signature$a({r:mt,s:xt,recoveryParam:Ct})}}}}}};EC$2.prototype.verify=function _(a,$,j,et){a=this._truncateToN(new BN$i(a,16)),j=this.keyFromPublic(j,et),$=new Signature$a($,"hex");var tt=$.r,rt=$.s;if(tt.cmpn(1)<0||tt.cmp(this.n)>=0||rt.cmpn(1)<0||rt.cmp(this.n)>=0)return!1;var nt=rt.invm(this.n),it=nt.mul(a).umod(this.n),at=nt.mul(tt).umod(this.n),st;return this.curve._maxwellTrick?(st=this.g.jmulAdd(it,j.getPublic(),at),st.isInfinity()?!1:st.eqXToP(tt)):(st=this.g.mulAdd(it,j.getPublic(),at),st.isInfinity()?!1:st.getX().umod(this.n).cmp(tt)===0)};EC$2.prototype.recoverPubKey=function(_,a,$,j){assert$o((3&$)===$,"The recovery param is more than two bits"),a=new Signature$a(a,j);var et=this.n,tt=new BN$i(_),rt=a.r,nt=a.s,it=$&1,at=$>>1;if(rt.cmp(this.curve.p.umod(this.curve.n))>=0&&at)throw new Error("Unable to find sencond key candinate");at?rt=this.curve.pointFromX(rt.add(this.curve.n),it):rt=this.curve.pointFromX(rt,it);var st=a.r.invm(et),ot=et.sub(tt).mul(st).umod(et),ut=nt.mul(st).umod(et);return this.g.mulAdd(ot,rt,ut)};EC$2.prototype.getKeyRecoveryParam=function(_,a,$,j){if(a=new Signature$a(a,j),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var tt;try{tt=this.recoverPubKey(_,a,et)}catch{continue}if(tt.eq($))return et}throw new Error("Unable to find valid recovery factor")};var utils$r=utils$z,assert$n=utils$r.assert,parseBytes$9=utils$r.parseBytes,cachedProperty$5=utils$r.cachedProperty;function KeyPair$9(_,a){this.eddsa=_,this._secret=parseBytes$9(a.secret),_.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$9(a.pub)}KeyPair$9.fromPublic=function _(a,$){return $ instanceof KeyPair$9?$:new KeyPair$9(a,{pub:$})};KeyPair$9.fromSecret=function _(a,$){return $ instanceof KeyPair$9?$:new KeyPair$9(a,{secret:$})};KeyPair$9.prototype.secret=function _(){return this._secret};cachedProperty$5(KeyPair$9,"pubBytes",function _(){return this.eddsa.encodePoint(this.pub())});cachedProperty$5(KeyPair$9,"pub",function _(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$5(KeyPair$9,"privBytes",function _(){var a=this.eddsa,$=this.hash(),j=a.encodingLength-1,et=$.slice(0,a.encodingLength);return et[0]&=248,et[j]&=127,et[j]|=64,et});cachedProperty$5(KeyPair$9,"priv",function _(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$5(KeyPair$9,"hash",function _(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$5(KeyPair$9,"messagePrefix",function _(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$9.prototype.sign=function _(a){return assert$n(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$9.prototype.verify=function _(a,$){return this.eddsa.verify(a,$,this)};KeyPair$9.prototype.getSecret=function _(a){return assert$n(this._secret,"KeyPair is public only"),utils$r.encode(this.secret(),a)};KeyPair$9.prototype.getPublic=function _(a){return utils$r.encode(this.pubBytes(),a)};var key$4=KeyPair$9,BN$h=bnExports$1,utils$q=utils$z,assert$m=utils$q.assert,cachedProperty$4=utils$q.cachedProperty,parseBytes$8=utils$q.parseBytes;function Signature$9(_,a){this.eddsa=_,typeof a!="object"&&(a=parseBytes$8(a)),Array.isArray(a)&&(a={R:a.slice(0,_.encodingLength),S:a.slice(_.encodingLength)}),assert$m(a.R&&a.S,"Signature without R or S"),_.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN$h&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty$4(Signature$9,"S",function _(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty$4(Signature$9,"R",function _(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty$4(Signature$9,"Rencoded",function _(){return this.eddsa.encodePoint(this.R())});cachedProperty$4(Signature$9,"Sencoded",function _(){return this.eddsa.encodeInt(this.S())});Signature$9.prototype.toBytes=function _(){return this.Rencoded().concat(this.Sencoded())};Signature$9.prototype.toHex=function _(){return utils$q.encode(this.toBytes(),"hex").toUpperCase()};var signature$4=Signature$9,hash$5=hash$8,curves$6=curves$8,utils$p=utils$z,assert$l=utils$p.assert,parseBytes$7=utils$p.parseBytes,KeyPair$8=key$4,Signature$8=signature$4;function EDDSA$2(_){if(assert$l(_==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA$2))return new EDDSA$2(_);_=curves$6[_].curve,this.curve=_,this.g=_.g,this.g.precompute(_.n.bitLength()+1),this.pointClass=_.point().constructor,this.encodingLength=Math.ceil(_.n.bitLength()/8),this.hash=hash$5.sha512}var eddsa$2=EDDSA$2;EDDSA$2.prototype.sign=function _(a,$){a=parseBytes$7(a);var j=this.keyFromSecret($),et=this.hashInt(j.messagePrefix(),a),tt=this.g.mul(et),rt=this.encodePoint(tt),nt=this.hashInt(rt,j.pubBytes(),a).mul(j.priv()),it=et.add(nt).umod(this.curve.n);return this.makeSignature({R:tt,S:it,Rencoded:rt})};EDDSA$2.prototype.verify=function _(a,$,j){a=parseBytes$7(a),$=this.makeSignature($);var et=this.keyFromPublic(j),tt=this.hashInt($.Rencoded(),et.pubBytes(),a),rt=this.g.mul($.S()),nt=$.R().add(et.pub().mul(tt));return nt.eq(rt)};EDDSA$2.prototype.hashInt=function _(){for(var a=this.hash(),$=0;$bs58check$1.decode(_).slice(a.length);function b58decode(_){const a=bs58check$1.decode(_),j={[prefix.tz1.toString()]:"0000",[prefix.tz2.toString()]:"0001",[prefix.tz3.toString()]:"0002"}[new Uint8Array(a.slice(0,3)).toString()];if(j){const et=buf2hex(a.slice(3));return j+et}else return"01"+buf2hex(a.slice(3,42))+"00"}function encodeAddress(_){if(_.substring(0,2)==="0x"&&(_=_.slice(2)),_.substring(0,2)==="00"){const a={"0000":prefix.tz1,"0001":prefix.tz2,"0002":prefix.tz3};return b58cencode(_.substring(4),a[_.substring(0,4)])}return b58cencode(_.substring(2,42),prefix.KT)}function encodeKey(_){if(_[0]==="0"){const a={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}function encodeKeyHash(_){if(_[0]==="0"){const a={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return b58cencode(_.substring(2),a[_.substring(0,2)])}}const hex2buf=_=>{if(_.length%2!==0)throw new InvalidHexStringError(_,": Expecting even number of characters");const a=stripHexPrefix$1(_);if(!a.match(/^([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const $=new Uint8Array(a.length/2);let j=0;for(let et=0;et{const $=new Uint8Array(_.length+a.length);return $.set(_),$.set(a,_.length),$},buf2hex=_=>{const a=[];return _.forEach($=>{const et=`00${$.toString(16)}`.slice(-2);a.push(et)}),a.join("")};function hex2Bytes(_){const a=stripHexPrefix$1(_);if(!a.match(/^(0x)?([\da-f]{2})*$/gi))throw new InvalidHexStringError(_,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return buffer$1.Buffer.from(a,"hex")}function stripHexPrefix$1(_){return _.startsWith("0x")?_.slice(2):_}var util;(function(_){_.assertEqual=et=>et;function a(et){}_.assertIs=a;function $(et){throw new Error}_.assertNever=$,_.arrayToEnum=et=>{const tt={};for(const rt of et)tt[rt]=rt;return tt},_.getValidEnumValues=et=>{const tt=_.objectKeys(et).filter(nt=>typeof et[et[nt]]!="number"),rt={};for(const nt of tt)rt[nt]=et[nt];return _.objectValues(rt)},_.objectValues=et=>_.objectKeys(et).map(function(tt){return et[tt]}),_.objectKeys=typeof Object.keys=="function"?et=>Object.keys(et):et=>{const tt=[];for(const rt in et)Object.prototype.hasOwnProperty.call(et,rt)&&tt.push(rt);return tt},_.find=(et,tt)=>{for(const rt of et)if(tt(rt))return rt},_.isInteger=typeof Number.isInteger=="function"?et=>Number.isInteger(et):et=>typeof et=="number"&&isFinite(et)&&Math.floor(et)===et;function j(et,tt=" | "){return et.map(rt=>typeof rt=="string"?`'${rt}'`:rt).join(tt)}_.joinValues=j,_.jsonStringifyReplacer=(et,tt)=>typeof tt=="bigint"?tt.toString():tt})(util||(util={}));var objectUtil;(function(_){_.mergeShapes=(a,$)=>({...a,...$})})(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=_=>{switch(typeof _){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(_)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(_)?ZodParsedType.array:_===null?ZodParsedType.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&_ instanceof Map?ZodParsedType.map:typeof Set<"u"&&_ instanceof Set?ZodParsedType.set:typeof Date<"u"&&_ instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(a){super(),this.issues=[],this.addIssue=j=>{this.issues=[...this.issues,j]},this.addIssues=(j=[])=>{this.issues=[...this.issues,...j]};const $=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,$):this.__proto__=$,this.name="ZodError",this.issues=a}get errors(){return this.issues}format(a){const $=a||function(tt){return tt.message},j={_errors:[]},et=tt=>{for(const rt of tt.issues)if(rt.code==="invalid_union")rt.unionErrors.map(et);else if(rt.code==="invalid_return_type")et(rt.returnTypeError);else if(rt.code==="invalid_arguments")et(rt.argumentsError);else if(rt.path.length===0)j._errors.push($(rt));else{let nt=j,it=0;for(;it$.message){const $={},j=[];for(const et of this.issues)et.path.length>0?($[et.path[0]]=$[et.path[0]]||[],$[et.path[0]].push(a(et))):j.push(a(et));return{formErrors:j,fieldErrors:$}}get formErrors(){return this.flatten()}}ZodError.create=_=>new ZodError(_);const errorMap=(_,a)=>{let $;switch(_.code){case ZodIssueCode.invalid_type:_.received===ZodParsedType.undefined?$="Required":$=`Expected ${_.expected}, received ${_.received}`;break;case ZodIssueCode.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(_.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:$=`Unrecognized key(s) in object: ${util.joinValues(_.keys,", ")}`;break;case ZodIssueCode.invalid_union:$="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${util.joinValues(_.options)}`;break;case ZodIssueCode.invalid_enum_value:$=`Invalid enum value. Expected ${util.joinValues(_.options)}, received '${_.received}'`;break;case ZodIssueCode.invalid_arguments:$="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:$="Invalid function return type";break;case ZodIssueCode.invalid_date:$="Invalid date";break;case ZodIssueCode.invalid_string:typeof _.validation=="object"?"includes"in _.validation?($=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&($=`${$} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?$=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?$=`Invalid input: must end with "${_.validation.endsWith}"`:util.assertNever(_.validation):_.validation!=="regex"?$=`Invalid ${_.validation}`:$="Invalid";break;case ZodIssueCode.too_small:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:$="Invalid input";break;case ZodIssueCode.too_big:_.type==="array"?$=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?$=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?$=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?$=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?$=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`:$="Invalid input";break;case ZodIssueCode.custom:$="Invalid input";break;case ZodIssueCode.invalid_intersection_types:$="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:$=`Number must be a multiple of ${_.multipleOf}`;break;case ZodIssueCode.not_finite:$="Number must be finite";break;default:$=a.defaultError,util.assertNever(_)}return{message:$}};let overrideErrorMap=errorMap;function setErrorMap(_){overrideErrorMap=_}function getErrorMap(){return overrideErrorMap}const makeIssue=_=>{const{data:a,path:$,errorMaps:j,issueData:et}=_,tt=[...$,...et.path||[]],rt={...et,path:tt};if(et.message!==void 0)return{...et,path:tt,message:et.message};let nt="";const it=j.filter(at=>!!at).slice().reverse();for(const at of it)nt=at(rt,{data:a,defaultError:nt}).message;return{...et,path:tt,message:nt}},EMPTY_PATH=[];function addIssueToContext(_,a){const $=getErrorMap(),j=makeIssue({issueData:a,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,$,$===errorMap?void 0:errorMap].filter(et=>!!et)});_.common.issues.push(j)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,$){const j=[];for(const et of $){if(et.status==="aborted")return INVALID;et.status==="dirty"&&a.dirty(),j.push(et.value)}return{status:a.value,value:j}}static async mergeObjectAsync(a,$){const j=[];for(const et of $){const tt=await et.key,rt=await et.value;j.push({key:tt,value:rt})}return ParseStatus.mergeObjectSync(a,j)}static mergeObjectSync(a,$){const j={};for(const et of $){const{key:tt,value:rt}=et;if(tt.status==="aborted"||rt.status==="aborted")return INVALID;tt.status==="dirty"&&a.dirty(),rt.status==="dirty"&&a.dirty(),tt.value!=="__proto__"&&(typeof rt.value<"u"||et.alwaysSet)&&(j[tt.value]=rt.value)}return{status:a.value,value:j}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=_=>({status:"dirty",value:_}),OK=_=>({status:"valid",value:_}),isAborted=_=>_.status==="aborted",isDirty=_=>_.status==="dirty",isValid$1=_=>_.status==="valid",isAsync=_=>typeof Promise<"u"&&_ instanceof Promise;function __classPrivateFieldGet$1(_,a,$,j){if(typeof a=="function"?_!==a||!j:!a.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a.get(_)}function __classPrivateFieldSet$1(_,a,$,j,et){if(typeof a=="function"?_!==a||!et:!a.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a.set(_,$),$}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(_){_.errToObj=a=>typeof a=="string"?{message:a}:a||{},_.toString=a=>typeof a=="string"?a:a==null?void 0:a.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(a,$,j,et){this._cachedPath=[],this.parent=a,this.data=$,this._path=j,this._key=et}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(_,a)=>{if(isValid$1(a))return{success:!0,data:a.value};if(!_.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const $=new ZodError(_.common.issues);return this._error=$,this._error}}};function processCreateParams(_){if(!_)return{};const{errorMap:a,invalid_type_error:$,required_error:j,description:et}=_;if(a&&($||j))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:et}:{errorMap:(rt,nt)=>{var it,at;const{message:st}=_;return rt.code==="invalid_enum_value"?{message:st??nt.defaultError}:typeof nt.data>"u"?{message:(it=st??j)!==null&&it!==void 0?it:nt.defaultError}:rt.code!=="invalid_type"?{message:nt.defaultError}:{message:(at=st??$)!==null&&at!==void 0?at:nt.defaultError}},description:et}}class ZodType{constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(a){return getParsedType(a.data)}_getOrReturnCtx(a,$){return $||{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new ParseStatus,ctx:{common:a.parent.common,data:a.data,parsedType:getParsedType(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const $=this._parse(a);if(isAsync($))throw new Error("Synchronous parse encountered promise.");return $}_parseAsync(a){const $=this._parse(a);return Promise.resolve($)}parse(a,$){const j=this.safeParse(a,$);if(j.success)return j.data;throw j.error}safeParse(a,$){var j;const et={common:{issues:[],async:(j=$==null?void 0:$.async)!==null&&j!==void 0?j:!1,contextualErrorMap:$==null?void 0:$.errorMap},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},tt=this._parseSync({data:a,path:et.path,parent:et});return handleResult(et,tt)}async parseAsync(a,$){const j=await this.safeParseAsync(a,$);if(j.success)return j.data;throw j.error}async safeParseAsync(a,$){const j={common:{issues:[],contextualErrorMap:$==null?void 0:$.errorMap,async:!0},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:getParsedType(a)},et=this._parse({data:a,path:j.path,parent:j}),tt=await(isAsync(et)?et:Promise.resolve(et));return handleResult(j,tt)}refine(a,$){const j=et=>typeof $=="string"||typeof $>"u"?{message:$}:typeof $=="function"?$(et):$;return this._refinement((et,tt)=>{const rt=a(et),nt=()=>tt.addIssue({code:ZodIssueCode.custom,...j(et)});return typeof Promise<"u"&&rt instanceof Promise?rt.then(it=>it?!0:(nt(),!1)):rt?!0:(nt(),!1)})}refinement(a,$){return this._refinement((j,et)=>a(j)?!0:(et.addIssue(typeof $=="function"?$(j,et):$),!1))}_refinement(a){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(a){return ZodUnion.create([this,a],this._def)}and(a){return ZodIntersection.create(this,a,this._def)}transform(a){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const $=typeof a=="function"?a:()=>a;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:$,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(a){const $=typeof a=="function"?a:()=>a;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:$,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(a){const $=this.constructor;return new $({...this._def,description:a})}pipe(a){return ZodPipeline.create(this,a)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(_){let a="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?a=`${a}\\.\\d{${_.precision}}`:_.precision==null&&(a=`${a}(\\.\\d+)?`),a}function timeRegex(_){return new RegExp(`^${timeRegexSource(_)}$`)}function datetimeRegex(_){let a=`${dateRegexSource}T${timeRegexSource(_)}`;const $=[];return $.push(_.local?"Z?":"Z"),_.offset&&$.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${$.join("|")})`,new RegExp(`^${a}$`)}function isValidIP(_,a){return!!((a==="v4"||!a)&&ipv4Regex.test(_)||(a==="v6"||!a)&&ipv6Regex.test(_))}class ZodString extends ZodType{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==ZodParsedType.string){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:tt.parsedType}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)if(tt.kind==="min")a.data.lengthtt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,maximum:tt.value,type:"string",inclusive:!0,exact:!1,message:tt.message}),j.dirty());else if(tt.kind==="length"){const rt=a.data.length>tt.value,nt=a.data.lengtha.test(et),{validation:$,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(j)})}_addCheck(a){return new ZodString({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...errorUtil.errToObj(a)})}url(a){return this._addCheck({kind:"url",...errorUtil.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...errorUtil.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...errorUtil.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...errorUtil.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...errorUtil.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...errorUtil.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...errorUtil.errToObj(a)})}datetime(a){var $,j;return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,offset:($=a==null?void 0:a.offset)!==null&&$!==void 0?$:!1,local:(j=a==null?void 0:a.local)!==null&&j!==void 0?j:!1,...errorUtil.errToObj(a==null?void 0:a.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof(a==null?void 0:a.precision)>"u"?null:a==null?void 0:a.precision,...errorUtil.errToObj(a==null?void 0:a.message)})}duration(a){return this._addCheck({kind:"duration",...errorUtil.errToObj(a)})}regex(a,$){return this._addCheck({kind:"regex",regex:a,...errorUtil.errToObj($)})}includes(a,$){return this._addCheck({kind:"includes",value:a,position:$==null?void 0:$.position,...errorUtil.errToObj($==null?void 0:$.message)})}startsWith(a,$){return this._addCheck({kind:"startsWith",value:a,...errorUtil.errToObj($)})}endsWith(a,$){return this._addCheck({kind:"endsWith",value:a,...errorUtil.errToObj($)})}min(a,$){return this._addCheck({kind:"min",value:a,...errorUtil.errToObj($)})}max(a,$){return this._addCheck({kind:"max",value:a,...errorUtil.errToObj($)})}length(a,$){return this._addCheck({kind:"length",value:a,...errorUtil.errToObj($)})}nonempty(a){return this.min(1,errorUtil.errToObj(a))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get minLength(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxLength(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};function floatSafeRemainder(_,a){const $=(_.toString().split(".")[1]||"").length,j=(a.toString().split(".")[1]||"").length,et=$>j?$:j,tt=parseInt(_.toFixed(et).replace(".","")),rt=parseInt(a.toFixed(et).replace(".",""));return tt%rt/Math.pow(10,et)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==ZodParsedType.number){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="int"?util.isInteger(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:tt.message}),et.dirty()):tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:tt.value,type:"number",inclusive:tt.inclusive,exact:!1,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?floatSafeRemainder(a.data,tt.value)!==0&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):tt.kind==="finite"?Number.isFinite(a.data)||(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_finite,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodNumber({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:errorUtil.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}finite(a){return this._addCheck({kind:"finite",message:errorUtil.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(a)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuea.kind==="int"||a.kind==="multipleOf"&&util.isInteger(a.value))}get isFinite(){let a=null,$=null;for(const j of this._def.checks){if(j.kind==="finite"||j.kind==="int"||j.kind==="multipleOf")return!0;j.kind==="min"?($===null||j.value>$)&&($=j.value):j.kind==="max"&&(a===null||j.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce&&(a.data=BigInt(a.data)),this._getType(a)!==ZodParsedType.bigint){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:tt.parsedType}),INVALID}let j;const et=new ParseStatus;for(const tt of this._def.checks)tt.kind==="min"?(tt.inclusive?a.datatt.value:a.data>=tt.value)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.too_big,type:"bigint",maximum:tt.value,inclusive:tt.inclusive,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?a.data%tt.value!==BigInt(0)&&(j=this._getOrReturnCtx(a,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:a.data}}gte(a,$){return this.setLimit("min",a,!0,errorUtil.toString($))}gt(a,$){return this.setLimit("min",a,!1,errorUtil.toString($))}lte(a,$){return this.setLimit("max",a,!0,errorUtil.toString($))}lt(a,$){return this.setLimit("max",a,!1,errorUtil.toString($))}setLimit(a,$,j,et){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:a,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(a){return new ZodBigInt({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(a)})}multipleOf(a,$){return this._addCheck({kind:"multipleOf",value:a,message:errorUtil.toString($)})}get minValue(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a}get maxValue(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.value{var a;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(a=_==null?void 0:_.coerce)!==null&&a!==void 0?a:!1,...processCreateParams(_)})};class ZodBoolean extends ZodType{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==ZodParsedType.boolean){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:j.parsedType}),INVALID}return OK(a.data)}}ZodBoolean.create=_=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...processCreateParams(_)});class ZodDate extends ZodType{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==ZodParsedType.date){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:tt.parsedType}),INVALID}if(isNaN(a.data.getTime())){const tt=this._getOrReturnCtx(a);return addIssueToContext(tt,{code:ZodIssueCode.invalid_date}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)tt.kind==="min"?a.data.getTime()tt.value&&(et=this._getOrReturnCtx(a,et),addIssueToContext(et,{code:ZodIssueCode.too_big,message:tt.message,inclusive:!0,exact:!1,maximum:tt.value,type:"date"}),j.dirty()):util.assertNever(tt);return{status:j.value,value:new Date(a.data.getTime())}}_addCheck(a){return new ZodDate({...this._def,checks:[...this._def.checks,a]})}min(a,$){return this._addCheck({kind:"min",value:a.getTime(),message:errorUtil.toString($)})}max(a,$){return this._addCheck({kind:"max",value:a.getTime(),message:errorUtil.toString($)})}get minDate(){let a=null;for(const $ of this._def.checks)$.kind==="min"&&(a===null||$.value>a)&&(a=$.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const $ of this._def.checks)$.kind==="max"&&(a===null||$.valuenew ZodDate({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(_)});class ZodSymbol extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.symbol){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:j.parsedType}),INVALID}return OK(a.data)}}ZodSymbol.create=_=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(_)});class ZodUndefined extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:j.parsedType}),INVALID}return OK(a.data)}}ZodUndefined.create=_=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(_)});class ZodNull extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.null){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:j.parsedType}),INVALID}return OK(a.data)}}ZodNull.create=_=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(_)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(a){return OK(a.data)}}ZodAny.create=_=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(_)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(a){return OK(a.data)}}ZodUnknown.create=_=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(_)});class ZodNever extends ZodType{_parse(a){const $=this._getOrReturnCtx(a);return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:$.parsedType}),INVALID}}ZodNever.create=_=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(_)});class ZodVoid extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:j.parsedType}),INVALID}return OK(a.data)}}ZodVoid.create=_=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(_)});class ZodArray extends ZodType{_parse(a){const{ctx:$,status:j}=this._processInputParams(a),et=this._def;if($.parsedType!==ZodParsedType.array)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:$.parsedType}),INVALID;if(et.exactLength!==null){const rt=$.data.length>et.exactLength.value,nt=$.data.lengthet.maxLength.value&&(addIssueToContext($,{code:ZodIssueCode.too_big,maximum:et.maxLength.value,type:"array",inclusive:!0,exact:!1,message:et.maxLength.message}),j.dirty()),$.common.async)return Promise.all([...$.data].map((rt,nt)=>et.type._parseAsync(new ParseInputLazyPath($,rt,$.path,nt)))).then(rt=>ParseStatus.mergeArray(j,rt));const tt=[...$.data].map((rt,nt)=>et.type._parseSync(new ParseInputLazyPath($,rt,$.path,nt)));return ParseStatus.mergeArray(j,tt)}get element(){return this._def.type}min(a,$){return new ZodArray({...this._def,minLength:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodArray({...this._def,maxLength:{value:a,message:errorUtil.toString($)}})}length(a,$){return new ZodArray({...this._def,exactLength:{value:a,message:errorUtil.toString($)}})}nonempty(a){return this.min(1,a)}}ZodArray.create=(_,a)=>new ZodArray({type:_,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(a)});function deepPartialify(_){if(_ instanceof ZodObject){const a={};for(const $ in _.shape){const j=_.shape[$];a[$]=ZodOptional.create(deepPartialify(j))}return new ZodObject({..._._def,shape:()=>a})}else return _ instanceof ZodArray?new ZodArray({..._._def,type:deepPartialify(_.element)}):_ instanceof ZodOptional?ZodOptional.create(deepPartialify(_.unwrap())):_ instanceof ZodNullable?ZodNullable.create(deepPartialify(_.unwrap())):_ instanceof ZodTuple?ZodTuple.create(_.items.map(a=>deepPartialify(a))):_}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),$=util.objectKeys(a);return this._cached={shape:a,keys:$}}_parse(a){if(this._getType(a)!==ZodParsedType.object){const at=this._getOrReturnCtx(a);return addIssueToContext(at,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:at.parsedType}),INVALID}const{status:j,ctx:et}=this._processInputParams(a),{shape:tt,keys:rt}=this._getCached(),nt=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const at in et.data)rt.includes(at)||nt.push(at);const it=[];for(const at of rt){const st=tt[at],ot=et.data[at];it.push({key:{status:"valid",value:at},value:st._parse(new ParseInputLazyPath(et,ot,et.path,at)),alwaysSet:at in et.data})}if(this._def.catchall instanceof ZodNever){const at=this._def.unknownKeys;if(at==="passthrough")for(const st of nt)it.push({key:{status:"valid",value:st},value:{status:"valid",value:et.data[st]}});else if(at==="strict")nt.length>0&&(addIssueToContext(et,{code:ZodIssueCode.unrecognized_keys,keys:nt}),j.dirty());else if(at!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const at=this._def.catchall;for(const st of nt){const ot=et.data[st];it.push({key:{status:"valid",value:st},value:at._parse(new ParseInputLazyPath(et,ot,et.path,st)),alwaysSet:st in et.data})}}return et.common.async?Promise.resolve().then(async()=>{const at=[];for(const st of it){const ot=await st.key,ut=await st.value;at.push({key:ot,value:ut,alwaysSet:st.alwaysSet})}return at}).then(at=>ParseStatus.mergeObjectSync(j,at)):ParseStatus.mergeObjectSync(j,it)}get shape(){return this._def.shape()}strict(a){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:($,j)=>{var et,tt,rt,nt;const it=(rt=(tt=(et=this._def).errorMap)===null||tt===void 0?void 0:tt.call(et,$,j).message)!==null&&rt!==void 0?rt:j.defaultError;return $.code==="unrecognized_keys"?{message:(nt=errorUtil.errToObj(a).message)!==null&&nt!==void 0?nt:it}:{message:it}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(a){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new ZodObject({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(a,$){return this.augment({[a]:$})}catchall(a){return new ZodObject({...this._def,catchall:a})}pick(a){const $={};return util.objectKeys(a).forEach(j=>{a[j]&&this.shape[j]&&($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}omit(a){const $={};return util.objectKeys(this.shape).forEach(j=>{a[j]||($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}deepPartial(){return deepPartialify(this)}partial(a){const $={};return util.objectKeys(this.shape).forEach(j=>{const et=this.shape[j];a&&!a[j]?$[j]=et:$[j]=et.optional()}),new ZodObject({...this._def,shape:()=>$})}required(a){const $={};return util.objectKeys(this.shape).forEach(j=>{if(a&&!a[j])$[j]=this.shape[j];else{let tt=this.shape[j];for(;tt instanceof ZodOptional;)tt=tt._def.innerType;$[j]=tt}}),new ZodObject({...this._def,shape:()=>$})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.strictCreate=(_,a)=>new ZodObject({shape:()=>_,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});ZodObject.lazycreate=(_,a)=>new ZodObject({shape:_,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(a)});class ZodUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=this._def.options;function et(tt){for(const nt of tt)if(nt.result.status==="valid")return nt.result;for(const nt of tt)if(nt.result.status==="dirty")return $.common.issues.push(...nt.ctx.common.issues),nt.result;const rt=tt.map(nt=>new ZodError(nt.ctx.common.issues));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:rt}),INVALID}if($.common.async)return Promise.all(j.map(async tt=>{const rt={...$,common:{...$.common,issues:[]},parent:null};return{result:await tt._parseAsync({data:$.data,path:$.path,parent:rt}),ctx:rt}})).then(et);{let tt;const rt=[];for(const it of j){const at={...$,common:{...$.common,issues:[]},parent:null},st=it._parseSync({data:$.data,path:$.path,parent:at});if(st.status==="valid")return st;st.status==="dirty"&&!tt&&(tt={result:st,ctx:at}),at.common.issues.length&&rt.push(at.common.issues)}if(tt)return $.common.issues.push(...tt.ctx.common.issues),tt.result;const nt=rt.map(it=>new ZodError(it));return addIssueToContext($,{code:ZodIssueCode.invalid_union,unionErrors:nt}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(_,a)=>new ZodUnion({options:_,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(a)});const getDiscriminator=_=>_ instanceof ZodLazy?getDiscriminator(_.schema):_ instanceof ZodEffects?getDiscriminator(_.innerType()):_ instanceof ZodLiteral?[_.value]:_ instanceof ZodEnum?_.options:_ instanceof ZodNativeEnum?util.objectValues(_.enum):_ instanceof ZodDefault?getDiscriminator(_._def.innerType):_ instanceof ZodUndefined?[void 0]:_ instanceof ZodNull?[null]:_ instanceof ZodOptional?[void 0,...getDiscriminator(_.unwrap())]:_ instanceof ZodNullable?[null,...getDiscriminator(_.unwrap())]:_ instanceof ZodBranded||_ instanceof ZodReadonly?getDiscriminator(_.unwrap()):_ instanceof ZodCatch?getDiscriminator(_._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.object)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:$.parsedType}),INVALID;const j=this.discriminator,et=$.data[j],tt=this.optionsMap.get(et);return tt?$.common.async?tt._parseAsync({data:$.data,path:$.path,parent:$}):tt._parseSync({data:$.data,path:$.path,parent:$}):(addIssueToContext($,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[j]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,$,j){const et=new Map;for(const tt of $){const rt=getDiscriminator(tt.shape[a]);if(!rt.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const nt of rt){if(et.has(nt))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(nt)}`);et.set(nt,tt)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:a,options:$,optionsMap:et,...processCreateParams(j)})}}function mergeValues(_,a){const $=getParsedType(_),j=getParsedType(a);if(_===a)return{valid:!0,data:_};if($===ZodParsedType.object&&j===ZodParsedType.object){const et=util.objectKeys(a),tt=util.objectKeys(_).filter(nt=>et.indexOf(nt)!==-1),rt={..._,...a};for(const nt of tt){const it=mergeValues(_[nt],a[nt]);if(!it.valid)return{valid:!1};rt[nt]=it.data}return{valid:!0,data:rt}}else if($===ZodParsedType.array&&j===ZodParsedType.array){if(_.length!==a.length)return{valid:!1};const et=[];for(let tt=0;tt<_.length;tt++){const rt=_[tt],nt=a[tt],it=mergeValues(rt,nt);if(!it.valid)return{valid:!1};et.push(it.data)}return{valid:!0,data:et}}else return $===ZodParsedType.date&&j===ZodParsedType.date&&+_==+a?{valid:!0,data:_}:{valid:!1}}class ZodIntersection extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=(tt,rt)=>{if(isAborted(tt)||isAborted(rt))return INVALID;const nt=mergeValues(tt.value,rt.value);return nt.valid?((isDirty(tt)||isDirty(rt))&&$.dirty(),{status:$.value,value:nt.data}):(addIssueToContext(j,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return j.common.async?Promise.all([this._def.left._parseAsync({data:j.data,path:j.path,parent:j}),this._def.right._parseAsync({data:j.data,path:j.path,parent:j})]).then(([tt,rt])=>et(tt,rt)):et(this._def.left._parseSync({data:j.data,path:j.path,parent:j}),this._def.right._parseSync({data:j.data,path:j.path,parent:j}))}}ZodIntersection.create=(_,a,$)=>new ZodIntersection({left:_,right:a,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams($)});class ZodTuple extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.array)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:j.parsedType}),INVALID;if(j.data.lengththis._def.items.length&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty());const tt=[...j.data].map((rt,nt)=>{const it=this._def.items[nt]||this._def.rest;return it?it._parse(new ParseInputLazyPath(j,rt,j.path,nt)):null}).filter(rt=>!!rt);return j.common.async?Promise.all(tt).then(rt=>ParseStatus.mergeArray($,rt)):ParseStatus.mergeArray($,tt)}get items(){return this._def.items}rest(a){return new ZodTuple({...this._def,rest:a})}}ZodTuple.create=(_,a)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:_,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(a)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.object)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:j.parsedType}),INVALID;const et=[],tt=this._def.keyType,rt=this._def.valueType;for(const nt in j.data)et.push({key:tt._parse(new ParseInputLazyPath(j,nt,j.path,nt)),value:rt._parse(new ParseInputLazyPath(j,j.data[nt],j.path,nt)),alwaysSet:nt in j.data});return j.common.async?ParseStatus.mergeObjectAsync($,et):ParseStatus.mergeObjectSync($,et)}get element(){return this._def.valueType}static create(a,$,j){return $ instanceof ZodType?new ZodRecord({keyType:a,valueType:$,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(j)}):new ZodRecord({keyType:ZodString.create(),valueType:a,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams($)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.map)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:j.parsedType}),INVALID;const et=this._def.keyType,tt=this._def.valueType,rt=[...j.data.entries()].map(([nt,it],at)=>({key:et._parse(new ParseInputLazyPath(j,nt,j.path,[at,"key"])),value:tt._parse(new ParseInputLazyPath(j,it,j.path,[at,"value"]))}));if(j.common.async){const nt=new Map;return Promise.resolve().then(async()=>{for(const it of rt){const at=await it.key,st=await it.value;if(at.status==="aborted"||st.status==="aborted")return INVALID;(at.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(at.value,st.value)}return{status:$.value,value:nt}})}else{const nt=new Map;for(const it of rt){const at=it.key,st=it.value;if(at.status==="aborted"||st.status==="aborted")return INVALID;(at.status==="dirty"||st.status==="dirty")&&$.dirty(),nt.set(at.value,st.value)}return{status:$.value,value:nt}}}}ZodMap.create=(_,a,$)=>new ZodMap({valueType:a,keyType:_,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams($)});class ZodSet extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.parsedType!==ZodParsedType.set)return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:j.parsedType}),INVALID;const et=this._def;et.minSize!==null&&j.data.sizeet.maxSize.value&&(addIssueToContext(j,{code:ZodIssueCode.too_big,maximum:et.maxSize.value,type:"set",inclusive:!0,exact:!1,message:et.maxSize.message}),$.dirty());const tt=this._def.valueType;function rt(it){const at=new Set;for(const st of it){if(st.status==="aborted")return INVALID;st.status==="dirty"&&$.dirty(),at.add(st.value)}return{status:$.value,value:at}}const nt=[...j.data.values()].map((it,at)=>tt._parse(new ParseInputLazyPath(j,it,j.path,at)));return j.common.async?Promise.all(nt).then(it=>rt(it)):rt(nt)}min(a,$){return new ZodSet({...this._def,minSize:{value:a,message:errorUtil.toString($)}})}max(a,$){return new ZodSet({...this._def,maxSize:{value:a,message:errorUtil.toString($)}})}size(a,$){return this.min(a,$).max(a,$)}nonempty(a){return this.min(1,a)}}ZodSet.create=(_,a)=>new ZodSet({valueType:_,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(a)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.function)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:$.parsedType}),INVALID;function j(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(at=>!!at),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:it}})}function et(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(at=>!!at),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:it}})}const tt={errorMap:$.common.contextualErrorMap},rt=$.data;if(this._def.returns instanceof ZodPromise){const nt=this;return OK(async function(...it){const at=new ZodError([]),st=await nt._def.args.parseAsync(it,tt).catch(dt=>{throw at.addIssue(j(it,dt)),at}),ot=await Reflect.apply(rt,this,st);return await nt._def.returns._def.type.parseAsync(ot,tt).catch(dt=>{throw at.addIssue(et(ot,dt)),at})})}else{const nt=this;return OK(function(...it){const at=nt._def.args.safeParse(it,tt);if(!at.success)throw new ZodError([j(it,at.error)]);const st=Reflect.apply(rt,this,at.data),ot=nt._def.returns.safeParse(st,tt);if(!ot.success)throw new ZodError([et(st,ot.error)]);return ot.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...a){return new ZodFunction({...this._def,args:ZodTuple.create(a).rest(ZodUnknown.create())})}returns(a){return new ZodFunction({...this._def,returns:a})}implement(a){return this.parse(a)}strictImplement(a){return this.parse(a)}static create(a,$,j){return new ZodFunction({args:a||ZodTuple.create([]).rest(ZodUnknown.create()),returns:$||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(j)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(a){const{ctx:$}=this._processInputParams(a);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}ZodLazy.create=(_,a)=>new ZodLazy({getter:_,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(a)});class ZodLiteral extends ZodType{_parse(a){if(a.data!==this._def.value){const $=this._getOrReturnCtx(a);return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:a.data}}get value(){return this._def.value}}ZodLiteral.create=(_,a)=>new ZodLiteral({value:_,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(a)});function createZodEnum(_,a){return new ZodEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(a)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(a){if(typeof a.data!="string"){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{expected:util.joinValues(j),received:$.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodEnum_cache)||__classPrivateFieldSet$1(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet$1(this,_ZodEnum_cache).has(a.data)){const $=this._getOrReturnCtx(a),j=this._def.values;return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_enum_value,options:j}),INVALID}return OK(a.data)}get options(){return this._def.values}get enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Values(){const a={};for(const $ of this._def.values)a[$]=$;return a}get Enum(){const a={};for(const $ of this._def.values)a[$]=$;return a}extract(a,$=this._def){return ZodEnum.create(a,{...this._def,...$})}exclude(a,$=this._def){return ZodEnum.create(this.options.filter(j=>!a.includes(j)),{...this._def,...$})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(a){const $=util.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(a);if(j.parsedType!==ZodParsedType.string&&j.parsedType!==ZodParsedType.number){const et=util.objectValues($);return addIssueToContext(j,{expected:util.joinValues(et),received:j.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet$1(this,_ZodNativeEnum_cache)||__classPrivateFieldSet$1(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet$1(this,_ZodNativeEnum_cache).has(a.data)){const et=util.objectValues($);return addIssueToContext(j,{received:j.data,code:ZodIssueCode.invalid_enum_value,options:et}),INVALID}return OK(a.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(_,a)=>new ZodNativeEnum({values:_,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(a)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(a){const{ctx:$}=this._processInputParams(a);if($.parsedType!==ZodParsedType.promise&&$.common.async===!1)return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:$.parsedType}),INVALID;const j=$.parsedType===ZodParsedType.promise?$.data:Promise.resolve($.data);return OK(j.then(et=>this._def.type.parseAsync(et,{path:$.path,errorMap:$.common.contextualErrorMap})))}}ZodPromise.create=(_,a)=>new ZodPromise({type:_,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(a)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:$,ctx:j}=this._processInputParams(a),et=this._def.effect||null,tt={addIssue:rt=>{addIssueToContext(j,rt),rt.fatal?$.abort():$.dirty()},get path(){return j.path}};if(tt.addIssue=tt.addIssue.bind(tt),et.type==="preprocess"){const rt=et.transform(j.data,tt);if(j.common.async)return Promise.resolve(rt).then(async nt=>{if($.value==="aborted")return INVALID;const it=await this._def.schema._parseAsync({data:nt,path:j.path,parent:j});return it.status==="aborted"?INVALID:it.status==="dirty"||$.value==="dirty"?DIRTY(it.value):it});{if($.value==="aborted")return INVALID;const nt=this._def.schema._parseSync({data:rt,path:j.path,parent:j});return nt.status==="aborted"?INVALID:nt.status==="dirty"||$.value==="dirty"?DIRTY(nt.value):nt}}if(et.type==="refinement"){const rt=nt=>{const it=et.refinement(nt,tt);if(j.common.async)return Promise.resolve(it);if(it instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return nt};if(j.common.async===!1){const nt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});return nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value),{status:$.value,value:nt.value})}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(nt=>nt.status==="aborted"?INVALID:(nt.status==="dirty"&&$.dirty(),rt(nt.value).then(()=>({status:$.value,value:nt.value}))))}if(et.type==="transform")if(j.common.async===!1){const rt=this._def.schema._parseSync({data:j.data,path:j.path,parent:j});if(!isValid$1(rt))return rt;const nt=et.transform(rt.value,tt);if(nt instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:nt}}else return this._def.schema._parseAsync({data:j.data,path:j.path,parent:j}).then(rt=>isValid$1(rt)?Promise.resolve(et.transform(rt.value,tt)).then(nt=>({status:$.value,value:nt})):rt);util.assertNever(et)}}ZodEffects.create=(_,a,$)=>new ZodEffects({schema:_,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:a,...processCreateParams($)});ZodEffects.createWithPreprocess=(_,a,$)=>new ZodEffects({schema:a,effect:{type:"preprocess",transform:_},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams($)});class ZodOptional extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodOptional.create=(_,a)=>new ZodOptional({innerType:_,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(a)});class ZodNullable extends ZodType{_parse(a){return this._getType(a)===ZodParsedType.null?OK(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}ZodNullable.create=(_,a)=>new ZodNullable({innerType:_,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(a)});class ZodDefault extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a);let j=$.data;return $.parsedType===ZodParsedType.undefined&&(j=this._def.defaultValue()),this._def.innerType._parse({data:j,path:$.path,parent:$})}removeDefault(){return this._def.innerType}}ZodDefault.create=(_,a)=>new ZodDefault({innerType:_,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...processCreateParams(a)});class ZodCatch extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j={...$,common:{...$.common,issues:[]}},et=this._def.innerType._parse({data:j.data,path:j.path,parent:{...j}});return isAsync(et)?et.then(tt=>({status:"valid",value:tt.status==="valid"?tt.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})})):{status:"valid",value:et.status==="valid"?et.value:this._def.catchValue({get error(){return new ZodError(j.common.issues)},input:j.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(_,a)=>new ZodCatch({innerType:_,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...processCreateParams(a)});class ZodNaN extends ZodType{_parse(a){if(this._getType(a)!==ZodParsedType.nan){const j=this._getOrReturnCtx(a);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:j.parsedType}),INVALID}return{status:"valid",value:a.data}}}ZodNaN.create=_=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(_)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(a){const{ctx:$}=this._processInputParams(a),j=$.data;return this._def.type._parse({data:j,path:$.path,parent:$})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(a){const{status:$,ctx:j}=this._processInputParams(a);if(j.common.async)return(async()=>{const tt=await this._def.in._parseAsync({data:j.data,path:j.path,parent:j});return tt.status==="aborted"?INVALID:tt.status==="dirty"?($.dirty(),DIRTY(tt.value)):this._def.out._parseAsync({data:tt.value,path:j.path,parent:j})})();{const et=this._def.in._parseSync({data:j.data,path:j.path,parent:j});return et.status==="aborted"?INVALID:et.status==="dirty"?($.dirty(),{status:"dirty",value:et.value}):this._def.out._parseSync({data:et.value,path:j.path,parent:j})}}static create(a,$){return new ZodPipeline({in:a,out:$,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(a){const $=this._def.innerType._parse(a),j=et=>(isValid$1(et)&&(et.value=Object.freeze(et.value)),et);return isAsync($)?$.then(et=>j(et)):j($)}unwrap(){return this._def.innerType}}ZodReadonly.create=(_,a)=>new ZodReadonly({innerType:_,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(a)});function custom(_,a={},$){return _?ZodAny.create().superRefine((j,et)=>{var tt,rt;if(!_(j)){const nt=typeof a=="function"?a(j):typeof a=="string"?{message:a}:a,it=(rt=(tt=nt.fatal)!==null&&tt!==void 0?tt:$)!==null&&rt!==void 0?rt:!0,at=typeof nt=="string"?{message:nt}:nt;et.addIssue({code:"custom",...at,fatal:it})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(_,a={message:`Input not instance of ${_.name}`})=>custom($=>$ instanceof _,a),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType$1=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$2={string:_=>ZodString.create({..._,coerce:!0}),number:_=>ZodNumber.create({..._,coerce:!0}),boolean:_=>ZodBoolean.create({..._,coerce:!0}),bigint:_=>ZodBigInt.create({..._,coerce:!0}),date:_=>ZodDate.create({..._,coerce:!0})},NEVER$1=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid:isValid$1,isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$2,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType$1,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER$1,ZodIssueCode,quotelessJson,ZodError});const Schema$1=z.object({address:z.string()}),parsePkh=_=>{if(isValidContractPkh(_))return parseContractPkh(_);if(isValidImplicitPkh(_))return parseImplicitPkh(_);throw new Error(`Cannot parse address type: ${_}`)},isAddressValid=_=>validateAddress(_)===ValidationResult.VALID,isValidContractPkh=_=>isAddressValid(_)&&_.match(/^KT1\w+/),isValidImplicitPkh=_=>isAddressValid(_)&&_.match(/^tz[1234]\w+/),parseContractPkh=_=>{if(isValidContractPkh(_))return{type:"contract",pkh:_};throw new Error(`Invalid contract address: ${_}`)},parseImplicitPkh=_=>{if(isValidImplicitPkh(_))return{type:"implicit",pkh:_};throw new Error(`Invalid implicit address: ${_}`)},encodeReserved=[encodeURIComponent,encodeURIComponent];function encode$3(_,a=","){const $=(j,et)=>{const tt=_[et%_.length];return typeof j>"u"?"":typeof j=="object"?Array.isArray(j)?j.map(tt).join(a):Object.entries(j).reduce((nt,it)=>[...nt,...it],[]).map(tt).join(a):tt(String(j))};return(j,...et)=>j.reduce((tt,rt,nt)=>`${tt}${rt}${$(et[nt],nt)}`,"")}function delimited(_=","){return(a,$=encodeReserved)=>Object.entries(a).filter(([,j])=>j!==void 0).map(([j,et])=>encode$3($,_)`${j}=${et}`).join("&")}function stripUndefined(_){return _&&JSON.parse(JSON.stringify(_))}function joinUrl(..._){return _.filter(Boolean).map((a,$)=>$===0?a:a.replace(/^\/+/,"")).map((a,$,j)=>$===j.length-1?a:a.replace(/\/+$/,"")).join("/")}function query(..._){const a=_.filter(Boolean).join("&");return a&&`?${a}`}function explode(_,a=encodeReserved){const $=encode$3(a);return Object.entries(_).filter(([,j])=>j!==void 0).map(([j,et])=>Array.isArray(et)?et.map(tt=>$`${j}=${tt}`).join("&"):typeof et=="object"?explode(et,a):$`${j}=${et}`).join("&")}const form=delimited(),SUCCESS_CODES=[200,201,202,204];async function ok(_){const a=await _;if(SUCCESS_CODES.some($=>$==a.status))return a.data;throw new HttpError(a.status,a.data)}class HttpError extends Error{constructor($,j){super(`Error: ${$}`);Yr(this,"status");Yr(this,"data");this.status=$,this.data=j}}function runtime$1(_){async function a(tt,rt){const nt=await et(tt,rt);let it;try{it=await nt.text()}catch{}return{status:nt.status,headers:nt.headers,contentType:nt.headers.get("content-type"),data:it}}async function $(tt,rt={}){const{status:nt,headers:it,contentType:at,data:st}=await a(tt,{...rt,headers:{Accept:"application/json",...rt.headers}});return(at?at.includes("json"):!1)?{status:nt,headers:it,data:st?JSON.parse(st):null}:{status:nt,headers:it,data:st}}async function j(tt,rt={}){const nt=await et(tt,rt);let it;try{it=await nt.blob()}catch{}return{status:nt.status,headers:nt.headers,data:it}}async function et(tt,rt={}){const{baseUrl:nt,headers:it,fetch:at,...st}={..._,...rt},ot=joinUrl(nt,tt);return await(at||fetch)(ot,{...st,headers:stripUndefined({..._.headers,...it})})}return{ok,fetchText:a,fetchJson:$,fetchBlob:j,json({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:JSON.stringify(tt)},headers:{...rt,"Content-Type":"application/json"}}},form({body:tt,headers:rt,...nt}){return{...nt,...tt!=null&&{body:form(tt)},headers:{...rt,"Content-Type":"application/x-www-form-urlencoded"}}},multipart({body:tt,...rt}){if(tt==null)return rt;const nt=new(_.formDataConstructor||rt.formDataConstructor||FormData);return Object.entries(tt).forEach(([it,at])=>{nt.append(it,at)}),{...rt,body:nt}}}}const jsonParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{if(!(et instanceof Object))throw new Error(`Expected ${_} value to be object, received ${typeof et}`);const{jsonPath:tt,jsonValue:rt}=et;if(rt==null)throw new Error(`Expected jsonValue in ${_} -> ${j}, found: ${rt}`);const it=[_,tt,j].filter(at=>at!==void 0).join(".");$[it]=rt}),$},anyofParameter=(_,a)=>{if(!a)return{};const{fields:$}=a;(rt=>{if(!Array.isArray(rt))throw new Error(`Expected ${_} fields to be Array. Received ${typeof rt}.`);return rt.forEach(nt=>{if(typeof nt!="string")throw new Error(`Expected ${_} fields to be strings. Received ${typeof nt}`)}),!0})($);const et={},tt=$.join(".");if(a.value){const rt=`${_}.${tt}`;et[rt]=a.value}for(const rt of["in","eq","null"])if(a[rt]){const nt=`${_}.${tt}.${rt}`;return et[nt]=Array.isArray(a[rt])?a[rt].join(","):a[rt],et}return et},queryParameter=(_,a)=>{if(!a)return{};const $={};return Object.entries(a).forEach(([j,et])=>{const tt=`${_}.${j}`;$[tt]=et}),$},parsers={jsonParameter,queryParameter,anyofParameter},defaults={baseUrl:"https://api.tzkt.io"},oazapfts=runtime$1(defaults);function accountsGet({id:_,address:a,$type:$,kind:j,delegate:et,balance:tt,staked:rt,lastActivity:nt,select:it,sort:at,offset:st,limit:ot}={},ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/accounts${query(explode({limit:ot,...parsers.queryParameter("id",_),...parsers.queryParameter("address",a),...parsers.queryParameter("type",$),...parsers.queryParameter("kind",j),...parsers.queryParameter("delegate",et),...parsers.queryParameter("balance",tt),...parsers.queryParameter("staked",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("select",it),...parsers.queryParameter("sort",at),...parsers.queryParameter("offset",st)}))}`,{...ut}))}function blocksGetCount(_){return oazapfts.ok(oazapfts.fetchJson("/v1/blocks/count",{..._}))}function contractsGet({address:_,kind:a,tzips:$,creator:j,manager:et,delegate:tt,balance:rt,lastActivity:nt,typeHash:it,codeHash:at,select:st,sort:ot,offset:ut,limit:dt,includeStorage:mt}={},xt){return oazapfts.ok(oazapfts.fetchJson(`/v1/contracts${query(explode({limit:dt,includeStorage:mt,...parsers.queryParameter("address",_),...parsers.queryParameter("kind",a),...parsers.queryParameter("tzips",$),...parsers.queryParameter("creator",j),...parsers.queryParameter("manager",et),...parsers.queryParameter("delegate",tt),...parsers.queryParameter("balance",rt),...parsers.queryParameter("lastActivity",nt),...parsers.queryParameter("typeHash",it),...parsers.queryParameter("codeHash",at),...parsers.queryParameter("select",st),...parsers.queryParameter("sort",ot),...parsers.queryParameter("offset",ut)}))}`,{...xt}))}function delegatesGet({active:_,lastActivity:a,select:$,sort:j,offset:et,limit:tt}={},rt){return oazapfts.ok(oazapfts.fetchJson(`/v1/delegates${query(explode({limit:tt,...parsers.queryParameter("active",_),...parsers.queryParameter("lastActivity",a),...parsers.queryParameter("select",$),...parsers.queryParameter("sort",j),...parsers.queryParameter("offset",et)}))}`,{...rt}))}function operationsGetDelegations({anyof:_,initiator:a,sender:$,prevDelegate:j,newDelegate:et,level:tt,timestamp:rt,senderCodeHash:nt,status:it,select:at,sort:st,offset:ot,limit:ut,quote:dt}={},mt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/delegations${query(explode({limit:ut,quote:dt,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("prevDelegate",j),...parsers.queryParameter("newDelegate",et),...parsers.queryParameter("level",tt),...parsers.queryParameter("timestamp",rt),...parsers.queryParameter("senderCodeHash",nt),...parsers.queryParameter("status",it),...parsers.queryParameter("select",at),...parsers.queryParameter("sort",st),...parsers.queryParameter("offset",ot)}))}`,{...mt}))}function operationsGetOriginations({anyof:_,initiator:a,sender:$,contractManager:j,contractDelegate:et,originatedContract:tt,id:rt,typeHash:nt,codeHash:it,level:at,timestamp:st,senderCodeHash:ot,anyCodeHash:ut,status:dt,select:mt,sort:xt,offset:Ct,limit:Pt,micheline:Tt,quote:kt}={},Lt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/originations${query(explode({limit:Pt,micheline:Tt,quote:kt,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("contractManager",j),...parsers.queryParameter("contractDelegate",et),...parsers.queryParameter("originatedContract",tt),...parsers.queryParameter("id",rt),...parsers.queryParameter("typeHash",nt),...parsers.queryParameter("codeHash",it),...parsers.queryParameter("level",at),...parsers.queryParameter("timestamp",st),...parsers.queryParameter("senderCodeHash",ot),...parsers.queryParameter("anyCodeHash",ut),...parsers.queryParameter("status",dt),...parsers.queryParameter("select",mt),...parsers.queryParameter("sort",xt),...parsers.queryParameter("offset",Ct)}))}`,{...Lt}))}function operationsGetTransactions({anyof:_,initiator:a,sender:$,target:j,amount:et,id:tt,level:rt,timestamp:nt,senderCodeHash:it,targetCodeHash:at,codeHash:st,entrypoint:ot,parameter:ut,hasInternals:dt,status:mt,select:xt,sort:Ct,offset:Pt,limit:Tt,micheline:kt,quote:Lt}={},Nt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/transactions${query(explode({limit:Tt,micheline:kt,quote:Lt,...parsers.anyofParameter("anyof",_),...parsers.queryParameter("initiator",a),...parsers.queryParameter("sender",$),...parsers.queryParameter("target",j),...parsers.queryParameter("amount",et),...parsers.queryParameter("id",tt),...parsers.queryParameter("level",rt),...parsers.queryParameter("timestamp",nt),...parsers.queryParameter("senderCodeHash",it),...parsers.queryParameter("targetCodeHash",at),...parsers.queryParameter("codeHash",st),...parsers.queryParameter("entrypoint",ot),...parsers.jsonParameter("parameter",ut),...parsers.queryParameter("hasInternals",dt),...parsers.queryParameter("status",mt),...parsers.queryParameter("select",xt),...parsers.queryParameter("sort",Ct),...parsers.queryParameter("offset",Pt)}))}`,{...Nt}))}function quotesGetLast(_){return oazapfts.ok(oazapfts.fetchJson("/v1/quotes/last",{..._}))}function tokensGetTokenBalances({id:_,account:a,tokenId:$,tokenContract:j,tokenTokenId:et,tokenStandard:tt,tokenMetadata:rt,tokenHasFilters:nt,balance:it,firstLevel:at,firstTime:st,lastLevel:ot,lastTime:ut,indexedAt:dt,sort:mt,offset:xt,limit:Ct,select:Pt}={},Tt){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/balances${query(explode({"token.HasFilters":nt,limit:Ct,...parsers.queryParameter("id",_),...parsers.queryParameter("account",a),...parsers.queryParameter("token.id",$),...parsers.queryParameter("token.contract",j),...parsers.queryParameter("token.tokenId",et),...parsers.queryParameter("token.standard",tt),...parsers.jsonParameter("token.metadata",rt),...parsers.queryParameter("balance",it),...parsers.queryParameter("firstLevel",at),...parsers.queryParameter("firstTime",st),...parsers.queryParameter("lastLevel",ot),...parsers.queryParameter("lastTime",ut),...parsers.queryParameter("indexedAt",dt),...parsers.queryParameter("sort",mt),...parsers.queryParameter("offset",xt),...parsers.queryParameter("select",Pt)}))}`,{...Tt}))}function tokensGetTokenTransfers({id:_,level:a,timestamp:$,tokenId:j,tokenContract:et,tokenTokenId:tt,tokenStandard:rt,tokenMetadata:nt,tokenHasFilters:it,anyof:at,$from:st,to:ot,amount:ut,transactionId:dt,originationId:mt,migrationId:xt,indexedAt:Ct,sort:Pt,offset:Tt,limit:kt,select:Lt}={},Nt){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/transfers${query(explode({"token.HasFilters":it,limit:kt,...parsers.queryParameter("id",_),...parsers.queryParameter("level",a),...parsers.queryParameter("timestamp",$),...parsers.queryParameter("token.id",j),...parsers.queryParameter("token.contract",et),...parsers.queryParameter("token.tokenId",tt),...parsers.queryParameter("token.standard",rt),...parsers.jsonParameter("token.metadata",nt),...parsers.anyofParameter("anyof",at),...parsers.queryParameter("from",st),...parsers.queryParameter("to",ot),...parsers.queryParameter("amount",ut),...parsers.queryParameter("transactionId",dt),...parsers.queryParameter("originationId",mt),...parsers.queryParameter("migrationId",xt),...parsers.queryParameter("indexedAt",Ct),...parsers.queryParameter("sort",Pt),...parsers.queryParameter("offset",Tt),...parsers.queryParameter("select",Lt)}))}`,{...Nt}))}let e$1=class{constructor(a){this.queue=void 0,this.maxConcurrent=void 0,this.count=void 0,this.queue=[],this.maxConcurrent=a,this.count=0}get canAcquire(){return this.countthis.queue.push(a))}release(){const a=this.queue.shift();a?setTimeout(a,0):this.count--}};const t$4="_default";class s{constructor(a=1){this.semaphoreInstances=void 0,this.maxConcurrent=void 0,this.semaphoreInstances={},this.maxConcurrent=a}hasSemaphoreInstance(a=t$4){return!!this.semaphoreInstances[a]}getSemaphoreInstance(a=t$4){return this.hasSemaphoreInstance(a)||(this.semaphoreInstances[a]=new e$1(this.maxConcurrent)),this.semaphoreInstances[a]}tidy(a=t$4){this.hasSemaphoreInstance(a)&&this.getSemaphoreInstance(a).count===0&&delete this.semaphoreInstances[a]}canAcquire(a=t$4){return this.getSemaphoreInstance(a).canAcquire}acquire(a=t$4){return this.getSemaphoreInstance(a).acquire()}release(a=t$4){this.getSemaphoreInstance(a).release(),this.tidy(a)}count(a=t$4){return this.hasSemaphoreInstance(a)?this.getSemaphoreInstance(a).count:0}hasTasks(a=t$4){return this.count(a)>0}async request(a,$=t$4){try{return await this.acquire($),await a()}finally{this.release($)}}async requestIfAvailable(a,$=t$4){return this.canAcquire($)?this.request(a,$):null}}function assign(_,a){for(const $ in a)Object.defineProperty(_,$,{value:a[$],enumerable:!0,configurable:!0});return _}function createError(_,a,$){if(!_||typeof _=="string")throw new TypeError("Please pass an Error to err-code");$||($={}),typeof a=="object"&&($=a,a=void 0),a!=null&&($.code=a);try{return assign(_,$)}catch{$.message=_.message,$.stack=_.stack;const et=function(){};return et.prototype=Object.create(Object.getPrototypeOf(_)),assign(new et,$)}}var errCode=createError,retry$3={};function RetryOperation(_,a){typeof a=="boolean"&&(a={forever:a}),this._originalTimeouts=JSON.parse(JSON.stringify(_)),this._timeouts=_,this._options=a||{},this._maxRetryTime=a&&a.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(_){if(this._timeout&&clearTimeout(this._timeout),!_)return!1;var a=new Date().getTime();if(_&&a-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(_);var $=this._timeouts.shift();if($===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),$=this._timeouts.shift();else return!1;var j=this,et=setTimeout(function(){j._attempts++,j._operationTimeoutCb&&(j._timeout=setTimeout(function(){j._operationTimeoutCb(j._attempts)},j._operationTimeout),j._options.unref&&j._timeout.unref()),j._fn(j._attempts)},$);return this._options.unref&&et.unref(),!0};RetryOperation.prototype.attempt=function(_,a){this._fn=_,a&&(a.timeout&&(this._operationTimeout=a.timeout),a.cb&&(this._operationTimeoutCb=a.cb));var $=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){$._operationTimeoutCb()},$._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(_){console.log("Using RetryOperation.try() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=function(_){console.log("Using RetryOperation.start() is deprecated"),this.attempt(_)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var _={},a=null,$=0,j=0;j=$&&(a=et,$=rt)}return a};(function(_){var a=retry_operation;_.operation=function($){var j=_.timeouts($);return new a(j,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})},_.timeouts=function($){if($ instanceof Array)return[].concat($);var j={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var et in $)j[et]=$[et];if(j.minTimeout>j.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var tt=[],rt=0;rttzktRateLimiter.acquire().then(()=>promiseRetry$1(a=>_().catch(a),{retries:3,minTimeout:100})).catch(a=>{throw"status"in a&&"data"in a?new Error(`Fetching data from tzkt failed with: ${a.status}, ${a.data}`):a}).finally(()=>tzktRateLimiter.release()),MULTISIG_FETCH_LIMIT=1e4,TYPE_HASH=1963879877,CODE_HASH=-1890025422,getAllMultiSigContracts=async _=>withRateLimit(async()=>{try{const a=`${_.tzktApiUrl}/v1/contracts?typeHash=${TYPE_HASH}&codeHash=${CODE_HASH}&includeStorage=true&limit=${MULTISIG_FETCH_LIMIT}`,{data:$}=await axios.get(a);return $}catch(a){throw new Error(`Error fetching same contracts from tzkt: ${a.message}`)}}),getExistingContracts=(_,a)=>withRateLimit(()=>contractsGet({address:{in:[_.join(",")]},select:{fields:["address"]},limit:Math.min(1e4,_.length)},{baseUrl:a.tzktApiUrl})),getPendingOperations=async(_,a)=>withRateLimit(async()=>{if(_.length===0)return Promise.resolve([]);const $=`${a.tzktApiUrl}/v1/bigmaps/keys?active=true&bigmap.in=${_.join(",")}&limit=${MULTISIG_FETCH_LIMIT}`,{data:j}=await axios.get($);return j}),parseMultisig=_=>({address:parseContractPkh(_.address),threshold:Number(_.storage.threshold),signers:_.storage.signers.map(parseImplicitPkh),pendingOperationsBigmapId:_.storage.pending_ops}),getRelevantMultisigContracts=async(_,a)=>(await getAllMultiSigContracts(a)).filter(({storage:{signers:j}})=>lodashExports.every(j,isValidImplicitPkh)?j.filter(tt=>_.has(tt)).length>0:!1).map(parseMultisig),getNetworksForContracts=async(_,a)=>{const $=new Map;return a.length===0||(await Promise.all(_.map(async et=>(await getExistingContracts(a,et)).map(tt=>[tt,et.name])))).flat().forEach(([et,tt])=>$.set(et,tt)),$},parseMultisigOperation=_=>{const{bigmap:a,key:$,value:j}=_;if($===null||j===null)throw new Error("parseMultisigOperation failed");return{id:$,bigmapId:a,rawActions:j.actions,approvals:j.approvals.map(parseImplicitPkh)}},getPendingOperationsForMultisigs=async(_,a)=>{if(_.length===0)return[];const $=_.map(et=>et.pendingOperationsBigmapId),j=await getPendingOperations($,a);return lodashExports.compact(j.map(parseMultisigOperation))},VERSION$1=6,mainStoreMigrations={0:_=>produce(_,a=>{a.multisigs.labelsMap={}}),1:_=>produce(_,a=>{a.announcement=initialState$9}),2:lodashExports.identity,3:_=>produce(_,a=>{a.networks.current.name==="ghostnet"&&(a.networks.current.buyTezUrl="https://faucet.ghostnet.teztnets.com/");for(const $ of a.networks.available)if($.name==="ghostnet"){$.buyTezUrl="https://faucet.ghostnet.teztnets.com/";break}}),4:lodashExports.identity,5:_=>produce(_,a=>{delete a.assets.transfers.tez}),6:async _=>{const a=Object.values(_.contacts).filter(tt=>isValidImplicitPkh(tt.pkh)).map(tt=>[tt.pkh,{...tt,network:void 0}]),$=Object.values(_.contacts).filter(tt=>isValidContractPkh(tt.pkh)).map(tt=>tt.pkh),et=[...(await getNetworksForContracts(_.networks.available,$)).entries()].map(([tt,rt])=>[tt,{..._.contacts[tt],network:rt}]);return produce(_,tt=>{tt.contacts=lodashExports.fromPairs([...a,...et])})}},accountsMigrations={0:lodashExports.identity,1:lodashExports.identity,2:_=>produce(_,a=>{a.items.forEach($=>{$.type==="secret_key"&&($.curve="ed25519")})}),3:lodashExports.identity,4:_=>produce(_,a=>{a.items.forEach($=>{$.type==="ledger"&&!$.derivationPathTemplate&&($.derivationPathTemplate=void 0,$.derivationPath==="44'/1729'/0'/0'"?$.derivationPathTemplate="44'/1729'/?'/0'":$.derivationPath==="44'/1729'/0'/0'/0'"&&($.derivationPathTemplate="44'/1729'/?'/0'/0'"))})}),5:lodashExports.identity,6:lodashExports.identity},AES_MODE="AES-GCM",BYTE_TO_BIT=8,KEY_SIZE=32,NUM_ITERATIONS_V2=6e5,NUM_ITERATIONS_V1=1e4,derivePasswordBasedKeyV1=async(_,a)=>derivePasswordBasedKey(Buffer$g.alloc(32,_,"utf-8"),a,NUM_ITERATIONS_V1),derivePasswordBasedKeyV2=async(_,a)=>derivePasswordBasedKey(Buffer$g.from(_,"utf-8"),a,NUM_ITERATIONS_V2),derivePasswordBasedKey=async(_,a,$)=>{const j={name:"PBKDF2",salt:a,iterations:$,hash:"SHA-256"},et=await crypto.subtle.importKey("raw",_,j.name,!1,["deriveKey"]);return await crypto.subtle.deriveKey(j,et,{name:AES_MODE,length:KEY_SIZE*BYTE_TO_BIT},!1,["encrypt","decrypt"])},SALT_SIZE=32,IV_SIZE=12,encrypt$1=async(_,a)=>{const $=crypto.getRandomValues(new Uint8Array(SALT_SIZE)),j=await derivePasswordBasedKeyV2(a,$),et=crypto.getRandomValues(new Uint8Array(IV_SIZE)),tt=await crypto.subtle.encrypt({name:AES_MODE,iv:et},j,Buffer$g.from(_,"utf-8"));return{iv:buf2hex(Buffer$g.from(et)),salt:buf2hex(Buffer$g.from($)),data:buf2hex(Buffer$g.from(tt))}},decrypt$1=async(_,a,$="V2")=>{const{iv:j,salt:et,data:tt}=_;try{const rt=$==="V2"?await derivePasswordBasedKeyV2(a,hex2Bytes(et)):await derivePasswordBasedKeyV1(a,hex2Bytes(et)),nt=await crypto.subtle.decrypt({name:AES_MODE,iv:hex2Bytes(j)},rt,hex2Bytes(tt));return Buffer$g.from(nt).toString("utf-8")}catch{throw new Error("Error decrypting data: Invalid password")}},changeMnemonicPassword=createAsyncThunk("accounts/changeMnemonicPassword",async({currentPassword:_,newPassword:a},{getState:$})=>{if(_===a)throw new Error("New password must be different from the current password");const{items:j,seedPhrases:et}=$().accounts;if(j.filter(rt=>rt.type==="mnemonic").length===0)throw new Error("No mnemonic accounts found");const tt=await Promise.all(Object.entries(et).map(async([rt,nt])=>{if(!nt)throw new Error("No encrypted mnemonic found");try{const it=await decrypt$1(nt,_),at=await encrypt$1(it,a);return[rt,at]}catch(it){throw new Error(it.message)}}));return{newEncryptedMnemonics:lodashExports.fromPairs(tt)}}),initialState$8={items:[],seedPhrases:{},secretKeys:{}},accountsSlice=createSlice({name:"accounts",initialState:initialState$8,extraReducers:_=>{_.addCase(changeMnemonicPassword.fulfilled,(a,$)=>{const{newEncryptedMnemonics:j}=$.payload;a.seedPhrases=j})},reducers:{reset:()=>initialState$8,removeMnemonicAndAccounts:(_,{payload:a})=>{const{fingerPrint:$}=a,j=_.items.filter(et=>!(et.type==="mnemonic"&&et.seedFingerPrint===$));_.items=j,delete _.seedPhrases[$]},removeNonMnemonicAccounts:(_,{payload:a})=>{_.items=lodashExports.remove(_.items,$=>$.type==="mnemonic"||$.type!==a.accountType),a.accountType==="secret_key"&&(_.secretKeys={})},removeAccount:(_,{payload:a})=>{lodashExports.remove(_.items,$=>$.address.pkh===a.address.pkh),a.type==="secret_key"&&delete _.secretKeys[a.address.pkh]},renameAccount:(_,{payload:a})=>{const{account:$,newName:j}=a;if(j.length===0)throw new Error("Cannot rename account to an empty name.");if(_.items.find(tt=>tt.label===j))throw new Error(`Cannot rename account ${$.address.pkh} to ${j} since the name already exists.`);const et=_.items.find(tt=>tt.address.pkh===$.address.pkh&&tt.label===$.label);et&&(et.label=j)},addAccount:(_,{payload:a})=>{_.items=concatUnique(_.items,[a])},addMnemonicAccounts:(_,{payload:{encryptedMnemonic:a,accounts:$,seedFingerprint:j}})=>{_.items=concatUnique(_.items,$),_.seedPhrases[j]=a},addSecretKey:(_,{payload:{pkh:a,encryptedSecretKey:$}})=>{_.secretKeys[a]=$}}}),concatUnique=(_,a)=>(a.forEach($=>{if(_.some(j=>j.address.pkh===$.address.pkh))throw new Error(`Can't add account with address ${$.address.pkh} because it already exists.`)}),[..._,...a]);accountsSlice.actions;const FA12TokenSchema=z.object({standard:z.string().regex(/^fa1\.2$/i),contract:Schema$1}),FA2TokenSchema=z.object({standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1}),NFTSchema=z.object({id:z.number(),standard:z.string().regex(/^fa2$/i),tokenId:z.string(),contract:Schema$1,totalSupply:z.string().optional(),metadata:z.object({displayUri:z.string(),decimals:z.void().or(z.string().regex(/^0$/))})}),fromRaw$1=_=>{const a=_.metadata;if(_.standard==="fa1.2"){const et=FA12TokenSchema.safeParse(_);return et.success?{type:"fa1.2",metadata:a,contract:et.data.contract.address,tokenId:"0"}:(console.warn("Invalid FA1 token: "+JSON.stringify(_)),null)}const $=NFTSchema.safeParse(_);if($.success)return{metadata:a,type:"nft",id:$.data.id,contract:$.data.contract.address,tokenId:$.data.tokenId,displayUri:$.data.metadata.displayUri,totalSupply:$.data.totalSupply};const j=FA2TokenSchema.safeParse(_);return j.success?{type:"fa2",metadata:a,contract:j.data.contract.address,tokenId:j.data.tokenId}:(console.warn("Invalid FA2 token: "+JSON.stringify(_)),null)},fullId=_=>`${_.contract}:${_.tokenId}`,defaultTokenName=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_NAME;case"fa2":return DEFAULT_FA2_NAME;case"nft":return DEFAULT_NFT_NAME}},tokenNameSafe=_=>tokenName(_)||defaultTokenName(_),tokenName=_=>{var a;return(a=_.metadata)==null?void 0:a.name},defaultTokenSymbol=_=>{switch(_.type){case"fa1.2":return DEFAULT_FA1_SYMBOL;case"fa2":return DEFAULT_FA2_SYMBOL;case"nft":return DEFAULT_NFT_SYMBOL}},tokenSymbolSafe=_=>tokenSymbol(_)||defaultTokenSymbol(_),tokenSymbol=_=>{var a;return(a=_.metadata)==null?void 0:a.symbol},tokenDecimals=_=>{var a;return((a=_.metadata)==null?void 0:a.decimals)??DEFAULT_TOKEN_DECIMALS},getRealAmount=(_,a)=>{const $=new BigNumber(a),j=tokenDecimals(_);return $.multipliedBy(new BigNumber(10).exponentiatedBy(j)).toFixed()},formatTokenAmount=(_,a=DEFAULT_TOKEN_DECIMALS)=>{const $=BigNumber(_).dividedBy(BigNumber(10).pow(a));try{return new Intl.NumberFormat("en-US",{minimumFractionDigits:Number(a),maximumFractionDigits:Number(a)}).format($.toNumber())}catch{return console.warn(`Can't format token amount with decimals = ${a}`),formatTokenAmount(_,"0")}},tokenPrettyAmount=(_,a,$)=>{var nt;if(a.type==="nft")return _;const j=tokenSymbolSafe(a),et=(nt=a.metadata)==null?void 0:nt.decimals,tt=$!=null&&$.showSymbol?` ${j}`:"";return`${formatTokenAmount(_,et)}${tt}`},artifactUri=_=>_.metadata.artifactUri||_.displayUri,thumbnailUri=_=>_.metadata.thumbnailUri||_.displayUri,mimeType=_=>{var a,$;return($=(a=_.metadata.formats)==null?void 0:a.find(j=>j.uri===artifactUri(_)))==null?void 0:$.mimeType},royalties=_=>{const a=_.metadata.royalties;if(!a)return[];const $=Math.pow(10,Number(a.decimals)),j=Object.entries(a.shares).map(([et,tt])=>({address:et,share:Number(tt)*100/$}));return j.sort((et,tt)=>et.share`${tokenUri(_,a)}/metadata`,tokenUri=({contract:_,tokenId:a},$)=>`${$.tzktExplorerUrl}/${_}/tokens/${a}`,DEFAULT_FA1_NAME="FA1.2 token",DEFAULT_FA2_NAME="FA2 token",DEFAULT_NFT_NAME="NFT",DEFAULT_FA1_SYMBOL="FA1.2",DEFAULT_FA2_SYMBOL="FA2",DEFAULT_NFT_SYMBOL="NFT",DEFAULT_TOKEN_DECIMALS="0",fromRaw=_=>{const a=fromRaw$1(_.token);return!a||!_.balance?null:{balance:_.balance,lastLevel:_.lastLevel,...a}},keepNFTs=_=>_.filter(a=>a.type==="nft"),keepFA1s=_=>_.filter(a=>a.type==="fa1.2"),keepFA2s=_=>_.filter(a=>a.type==="fa2"),initialState$7={blockLevel:null,balances:{mutez:{},tokens:{}},transfers:{tokens:{}},delegationLevels:{},bakers:[],conversionRate:void 0,refetchTrigger:0,isLoading:!1,lastTimeUpdated:null},assetsSlice=createSlice({name:"assets",initialState:initialState$7,extraReducers:_=>_.addCase(accountsSlice.actions.reset,()=>initialState$7),reducers:{reset:()=>initialState$7,updateBlockLevel:(_,{payload:a})=>{_.blockLevel=a},updateTokenTransfers:(_,{payload:a})=>{a.forEach($=>{_.transfers.tokens[$.transactionId]=$})},updateTezBalance:(_,{payload:a})=>{_.balances.mutez=a.reduce(($,j)=>({...$,[j.address]:String(j.balance)}),{}),_.delegationLevels=a.reduce(($,j)=>({...$,[j.address]:j.delegationLevel}),{})},updateTokenBalance:(_,{payload:a})=>{const $=lodashExports.groupBy(a,j=>j.account.address);_.balances.tokens=lodashExports.mapValues($,j=>lodashExports.compact(j.map(fromRaw)).map(({balance:et,contract:tt,tokenId:rt,lastLevel:nt})=>({balance:et,contract:tt,tokenId:rt,lastLevel:nt})))},removeAccountsData:(_,{payload:a})=>{a.forEach($=>{delete _.balances.mutez[$],delete _.balances.tokens[$],delete _.delegationLevels[$]})},updateBakers:(_,{payload:a})=>{_.bakers=a},updateConversionRate:(_,{payload:a})=>{_.conversionRate=a},refetch:_=>{_.refetchTrigger+=1},setIsLoading:(_,{payload:a})=>{_.isLoading=a},setLastTimeUpdated:(_,{payload:a})=>{_.lastTimeUpdated=a}}}),assetsActions=assetsSlice.actions,MAINNET={name:"mainnet",rpcUrl:"https://prod.tcinfra.net/rpc/mainnet/",tzktApiUrl:"https://api.mainnet.tzkt.io",tzktExplorerUrl:"https://tzkt.io",buyTezUrl:"https://widget.wert.io"},GHOSTNET={name:"ghostnet",rpcUrl:"https://ghostnet.ecadinfra.com",tzktApiUrl:"https://api.ghostnet.tzkt.io",tzktExplorerUrl:"https://ghostnet.tzkt.io",buyTezUrl:"https://faucet.ghostnet.teztnets.com/"},isDefault=_=>DefaultNetworks.map(a=>a.name).includes(_.name),DefaultNetworks=[MAINNET,GHOSTNET],initialState$6=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,[]])),batchesSlice=createSlice({name:"batches",initialState:initialState$6,reducers:{reset:()=>initialState$6,add:(_,{payload:{operations:a,network:$}})=>{$.name in _||(_[$.name]=[]);const j=_[$.name],et=j.find(tt=>tt.sender.address.pkh===a.sender.address.pkh);if(et){et.operations.push(...a.operations);return}j.push(a)},clear:(_,{payload:{pkh:a,network:$}})=>{const j=_[$.name]||[],et=lodashExports.findIndex(j,tt=>tt.sender.address.pkh===a);et!==-1&&j.splice(et,1)},removeItem:(_,{payload:{pkh:a,index:$,network:j}})=>{const et=_[j.name]||[],tt=lodashExports.findIndex(et,nt=>nt.sender.address.pkh===a);if(tt===-1)return;const rt=et[tt];$lodashExports.fromPairs(Object.entries(_).map(([$,j])=>{const et=(j||[]).filter(tt=>!a.includes(tt.sender.address.pkh));return[$,et]}))}}),batchesActions=batchesSlice.actions,initialState$5={},beaconSlice=createSlice({name:"beacon",initialState:initialState$5,reducers:{reset:()=>initialState$5,addConnection:(_,{payload:a})=>{_[a.dAppId]={accountPkh:a.accountPkh,networkType:a.networkType}},removeConnection:(_,{payload:a})=>{delete _[a]},removeConnections:(_,{payload:a})=>lodashExports.fromPairs(Object.entries(_).filter(([$,j])=>!a.includes(j.accountPkh)))}});beaconSlice.actions;const initialState$4={},contactsSlice=createSlice({name:"contacts",initialState:initialState$4,reducers:{reset:()=>initialState$4,upsert:(_,{payload:a})=>{_[a.pkh]=a},remove:(_,{payload:a})=>{delete _[a]}}}),contactsActions=contactsSlice.actions,MAX_ERRORS_LEN=100,initialState$3=[],errorsSlice=createSlice({name:"errors",initialState:initialState$3,reducers:{reset:()=>initialState$3,add(_,{payload:a}){_.length===MAX_ERRORS_LEN&&_.shift(),_.push(a)}}}),initialState$2={items:[],pendingOperations:{},labelsMap:{}},multisigsSlice=createSlice({name:"multisigs",initialState:initialState$2,reducers:{reset:()=>initialState$2,mockAddAccount:(_,{payload:a})=>{_.items.push({label:`Multisig Account ${_.items.length}`,type:"multisig",...a})},setMultisigs:(_,{payload:a})=>{const $=lodashExports.fromPairs(_.items.map(j=>[j.address.pkh,j.label]));_.items=a.map((j,et)=>({...j,label:$[j.address.pkh]||_.labelsMap[j.address.pkh]||`Multisig Account ${et}`,type:"multisig"}))},addMultisigLabel:(_,{payload:{pkh:a,label:$}})=>{_.labelsMap[a]=$},setPendingOperations:(_,{payload:a})=>{_.pendingOperations=lodashExports.groupBy(a,$=>$.bigmapId)},setName:(_,{payload:a})=>{const{account:{address:{pkh:$}},newName:j}=a,et=_.items.find(tt=>tt.address.pkh===$);et&&(et.label=j)},removeMultisigsData:(_,{payload:a})=>{const $=_.items.filter(j=>a.includes(j.address.pkh)).map(j=>String(j.pendingOperationsBigmapId));_.pendingOperations=lodashExports.omit(_.pendingOperations,$),_.labelsMap=lodashExports.omit(_.labelsMap,a)}}}),multisigActions=multisigsSlice.actions,initialState$1={available:DefaultNetworks,current:MAINNET},networksSlice=createSlice({name:"networks",initialState:initialState$1,reducers:{reset:()=>initialState$1,setCurrent:(_,{payload:a})=>{_.current=a},upsertNetwork:(_,{payload:a})=>{if(isDefault(a))return;const $=_.available.findIndex(j=>j.name===a.name);if(_.current.name===a.name&&(_.current=a),$!==-1){_.available[$]=a;return}_.available.push(a)},removeNetwork:(_,{payload:a})=>{isDefault(a)||lodashExports.remove(_.available,$=>$.name===a.name)}}}),networksActions=networksSlice.actions,initialState=lodashExports.fromPairs(DefaultNetworks.map(_=>[_.name,{}])),tokensSlice=createSlice({name:"tokens",initialState,reducers:{reset:()=>initialState,addTokens:(_,{payload:{network:a,tokens:$}})=>{lodashExports.compact($.map(fromRaw$1)).forEach(j=>{lodashExports.setWith(_,[a.name,j.contract,j.tokenId],j,Object)})}}}),tokensActions=tokensSlice.actions,rootPersistConfig={key:"root",version:VERSION$1,storage:default_1,blacklist:["accounts"],migrate:createAsyncMigrate(mainStoreMigrations)},accountsPersistConfig={key:"accounts",version:VERSION$1,storage:default_1,migrate:createAsyncMigrate(accountsMigrations)},rootReducers=combineReducers({accounts:persistReducer(accountsPersistConfig,accountsSlice.reducer),announcement:announcementSlice.reducer,assets:assetsSlice.reducer,batches:batchesSlice.reducer,beacon:beaconSlice.reducer,contacts:contactsSlice.reducer,errors:errorsSlice.reducer,multisigs:multisigsSlice.reducer,networks:networksSlice.reducer,tokens:tokensSlice.reducer}),reducer=persistReducer(rootPersistConfig,rootReducers),store=configureStore({reducer,middleware:_=>_({serializableCheck:{ignoredActions:[FLUSH,REHYDRATE,PAUSE,PERSIST,PURGE,REGISTER]}})}),persistor=persistStore(store),FormErrorMessage=({children:_,...a})=>jsxRuntimeExports.jsxs(FormErrorMessage$1,{color:colors.orange,fontSize:"12px",...a,children:[jsxRuntimeExports.jsx(Icon,{as:ExclamationIcon,marginRight:"6px"}),_]}),CONFIRMATION_CODE="wasabi",reset=()=>WalletClient.destroy().catch(lodashExports.noop).finally(()=>{persistor.pause(),localStorage.clear(),window.location.reload()}),OffboardingForm=()=>{const _=useForm({mode:"onBlur"}),{register:a,handleSubmit:$,formState:{isValid:j,errors:et},getValues:tt}=_,rt=()=>{if(!(!tt("check")||tt("confirmationCode")!==CONFIRMATION_CODE))return reset()};return jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsxs("form",{onSubmit:$(rt),children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"10px",textAlign:"center",children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(WarningIcon,{width:"40px",height:"40px",marginBottom:"20px"}),jsxRuntimeExports.jsx(Heading,{children:"Off-board Wallet"})]})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Text,{marginBottom:"8px",color:colors.gray[400],fontWeight:"bold",textAlign:"center",size:"sm",children:"This will permanently remove any data from this computer."}),jsxRuntimeExports.jsxs(Text,{color:colors.gray[400],textAlign:"center",size:"sm",children:["Please enter « ",CONFIRMATION_CODE," » to confirm. The accounts are still available to be imported in the future; in order to regain access to your accounts, please make sure that you keep the recovery phrase."]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsx(FormControl,{isInvalid:!!et.check,children:jsxRuntimeExports.jsx(Checkbox,{...a("check",{required:!0}),children:jsxRuntimeExports.jsx(Text,{marginLeft:"8px",fontWeight:"bold",children:"I have read the warning and I am certain I want to remove my private keys locally. I also made sure to keep my recovery phrase."})})}),jsxRuntimeExports.jsx(Divider,{borderColor:colors.gray[700],marginY:"20px"}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!et.confirmationCode,paddingY:5,children:[jsxRuntimeExports.jsx(Input,{type:"text",...a("confirmationCode",{required:"Confirmation is required",validate:nt=>nt===CONFIRMATION_CODE||"Confirmation code does not match"}),placeholder:"Enter code word to confirm"}),et.confirmationCode&&jsxRuntimeExports.jsx(FormErrorMessage,{children:et.confirmationCode.message})]})]})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:0,children:jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"8px",isDisabled:!j,size:"lg",type:"submit",variant:"warning",children:"Confirm"})})]})})},useOffboardingModal=()=>{const{isOpen:_,onOpen:a,onClose:$}=useDisclosure$1();return{modalElement:jsxRuntimeExports.jsxs(Modal,{isCentered:!0,isOpen:_,onClose:$,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[900],children:jsxRuntimeExports.jsx(OffboardingForm,{})})]}),onOpen:a}},CircleIcon=({icon:_,size:a,onClick:$=()=>{}})=>jsxRuntimeExports.jsx(Box,{width:a,height:a,margin:"auto",background:colors.gray[700],borderRadius:"full",onClick:$,children:jsxRuntimeExports.jsx(Center,{height:"100%",children:_})}),ModalContentWrapper=({children:_,icon:a,title:$,subtitle:j})=>jsxRuntimeExports.jsxs(VStack,{maxHeight:"83vh",spacing:0,children:[jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(CircleIcon,{icon:a,size:"48px"})}),jsxRuntimeExports.jsxs(Center,{flexDirection:"column",width:"340px",marginBottom:"32px",children:[jsxRuntimeExports.jsx(Heading,{lineHeight:"26px",size:"xl",children:$}),j&&jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],lineHeight:"18px",textAlign:"center",size:"sm",children:j})]}),_]}),name$2="umami",productName="umami",version$2="2.1.0",author$2="Trilitech ",description$2="Tezos Wallet",homepage$2="https://umamiwallet.com",repository$2="https://github.com/trilitech/umami-v2",license$2="MIT",engines={node:">=20 <21.0.0"},type$5="commonjs",main$2="build/electron.js",scripts$2={build:"vite build",dev:"vite dev",preview:"vite preview","electron:package:linux":"electron-builder -l","electron:package:mac":"electron-builder -m","electron:package:mac:debug":"DEBUG=true yarn build && sed -i='' 's@devTools: false@devTools: true@g' build/electron.js && yarn electron:package:mac -c electron-builder.dev.yml && rm -rf build","electron:package:win":"electron-builder -w","electron:start":"electronmon .",docs:"typedoc --tsconfig tsconfig.e2e.json","format:ci":"prettier --check .",format:"prettier --write .","lint:ci":"eslint src --ext .js,.jsx,.ts,.tsx --max-warnings=0",lint:"eslint src --ext .js,.jsx,.ts,.tsx --fix",test:"cross-env TZ=CET jest","test:watch":"cross-env DEV=true yarn test --watch","test:e2e":"cross-env TS_NODE_PROJECT=tsconfig.e2e.json cucumber-js","test:e2e:focus":"yarn test:e2e --tags='@focus'","theme:watch":"chakra-cli tokens src/style/theme.ts --watch",theme:"chakra-cli tokens src/style/theme.ts"},devDependencies$2={"@airgap/beacon-wallet":"^4.2.2","@babel/core":"^7.24.6","@babel/preset-env":"^7.24.6","@babel/preset-react":"^7.24.6","@babel/preset-typescript":"^7.24.6","@babel/runtime":"^7.24.6","@chakra-ui/anatomy":"2.2.2","@chakra-ui/cli":"^2.4.1","@chakra-ui/icons":"^2.1.1","@chakra-ui/react":"^2.8.2","@chakra-ui/styled-system":"2.9.2","@chakra-ui/system":"^2.6.2","@chriscdn/promise-semaphore":"^2.0.9","@cucumber/cucumber":"^10.7.0","@electron/notarize":"^2.3.2","@emotion/react":"^11.11.4","@emotion/styled":"^11.11.5","@ledgerhq/hw-transport-webusb":"^6.28.6","@playwright/test":"^1.44.1","@reduxjs/toolkit":"^2.2.5","@stylistic/eslint-plugin":"^2.1.0","@tanstack/eslint-plugin-query":"^5.35.6","@tanstack/react-query":"^5.37.1","@tanstack/react-query-devtools":"^5.37.1","@taquito/ledger-signer":"^19.2.1","@taquito/michel-codec":"^19.2.1","@taquito/rpc":"^19.2.1","@taquito/signer":"^19.2.1","@taquito/taquito":"19.2.1","@taquito/utils":"^19.2.1","@testing-library/dom":"^10.1.0","@testing-library/jest-dom":"6.4.5","@testing-library/react":"14.3.0","@testing-library/user-event":"14.5.2","@toruslabs/customauth":"^16.0.6","@types/babel__core":"^7","@types/babel__preset-env":"^7","@types/identity-obj-proxy":"^3","@types/jest":"^29.5.12","@types/md5":"^2.3.5","@types/node":"20.12.12","@types/papaparse":"^5.3.14","@types/pluralize":"^0.0.33","@types/promise-retry":"^1.1.6","@types/react":"18.3.3","@types/react-dom":"18.3.0","@types/react-test-renderer":"^18","@typescript-eslint/eslint-plugin":"^7.10.0","@typescript-eslint/parser":"^7.10.0","@tzkt/sdk-api":"^2.2.1","@vitejs/plugin-react":"^4.3.0",axios:"^1.7.2","babel-jest":"^29.7.0","bignumber.js":"^9.1.2",bip39:"^3.1.0",concurrently:"^8.2.2","cross-env":"^7.0.3","date-fns":"^3.6.0",electron:"^30.0.8","electron-builder":"^24.13.3",electronmon:"^2.0.3",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-chakra-ui":"^0.11.0","eslint-plugin-deprecation":"^2.0.0","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.5.0","eslint-plugin-jest-dom":"^5.4.0","eslint-plugin-react":"^7.34.1","eslint-plugin-react-hooks":"^4.6.2","eslint-plugin-react-redux":"^4.1.0","eslint-plugin-testing-library":"^6.2.2","eslint-plugin-tsdoc":"^0.2.17","eslint-plugin-unused-imports":"^3.2.0","framer-motion":"^11.2.6","http-server":"^14.1.1","identity-obj-proxy":"^3.0.0",immer:"^10.1.1",jest:"29.7.0","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.7.0","jest-fail-on-console":"^3.3.0","jest-resolve":"29.7.0","jest-watch-typeahead":"^2.2.2",lodash:"^4.17.21",md5:"^2.3.0",mockdate:"^3.0.5",ordinal:"^1.0.3",papaparse:"^5.4.1",pluralize:"^8.0.0",prettier:"^3.2.5","prettier-plugin-gherkin":"^2.2.1",process:"^0.11.10","promise-retry":"^2.0.1",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.13","react-hook-form":"^7.51.5","react-hooks-testing-library":"^0.6.0","react-player":"^2.16.0","react-qrcode-logo":"^2.10.0","react-redux":"9.1.2","react-refresh":"^0.14.2","react-remove-scroll":"^2.5.10","react-responsive-carousel":"^3.2.23","react-router-dom":"^6.23.1","react-test-renderer":"^18.3.1",redux:"^5.0.1","redux-persist":"^6.0.0","ts-node":"^10.9.2",typedoc:"^0.25.13","typedoc-plugin-missing-exports":"^2.2.0",typescript:"5.4.5",vite:"^5.2.11","vite-plugin-checker":"^0.6.4","vite-plugin-node-polyfills":"^0.22.0",zipurl:"^0.2.18",zod:"^3.23.8"},packageManager="yarn@4.2.2",dependencies$2={"electron-updater":"^6.2.1"},resolutions={jsdom:"^23.0.1","@types/jsdom":"^21.1.6"},packageInfo={name:name$2,productName,version:version$2,author:author$2,description:description$2,homepage:homepage$2,repository:repository$2,license:license$2,engines,type:type$5,main:main$2,scripts:scripts$2,devDependencies:devDependencies$2,packageManager,dependencies:dependencies$2,resolutions};var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** * @license React * use-sync-external-store-with-selector.production.min.js * @@ -461,12 +461,12 @@ use chrome, FireFox or Internet Explorer 11`)}var a=safeBufferExports,$=requireB * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var g=reactExports;function n$1(_,a){return _===a&&(_!==0||1/_===1/a)||_!==_&&a!==a}var p=typeof Object.is=="function"?Object.is:n$1,q=g.useSyncExternalStore,r$1=g.useRef,t$3=g.useEffect,u=g.useMemo,v=g.useDebugValue;useSyncExternalStoreWithSelector_production_min.useSyncExternalStoreWithSelector=function(_,a,$,j,et){var tt=r$1(null);if(tt.current===null){var rt={hasValue:!1,value:null};tt.current=rt}else rt=tt.current;tt=u(function(){function it(ht){if(!ot){if(ot=!0,st=ht,ht=j(ht),et!==void 0&&rt.hasValue){var bt=rt.value;if(et(bt,ht))return at=bt}return at=ht}if(bt=at,p(st,ht))return bt;var Et=j(ht);return et!==void 0&&et(bt,Et)?bt:(st=ht,at=Et)}var ot=!1,st,at,ut=$===void 0?null:$;return[function(){return it(a())},ut===null?void 0:function(){return it(ut())}]},[a,$,j,et]);var nt=q(_,tt[0],tt[1]);return t$3(function(){rt.hasValue=!0,rt.value=nt},[nt]),v(nt),nt};withSelector.exports=useSyncExternalStoreWithSelector_production_min;var withSelectorExports=withSelector.exports,React$1="default"in React$3?React$2:React$3,ContextKey=Symbol.for("react-redux-context"),gT=typeof globalThis<"u"?globalThis:{};function getContext(){if(!React$1.createContext)return{};const _=gT[ContextKey]??(gT[ContextKey]=new Map);let a=_.get(React$1.createContext);return a||(a=React$1.createContext(null),_.set(React$1.createContext,a)),a}var ReactReduxContext=getContext(),notInitialized=()=>{throw new Error("uSES not initialized!")};function createReduxContextHook(_=ReactReduxContext){return function(){return React$1.useContext(_)}}var useReduxContext=createReduxContextHook(),useSyncExternalStoreWithSelector=notInitialized,initializeUseSelector=_=>{useSyncExternalStoreWithSelector=_},refEquality=(_,a)=>_===a;function createSelectorHook(_=ReactReduxContext){const a=_===ReactReduxContext?useReduxContext:createReduxContextHook(_),$=(j,et={})=>{const{equalityFn:tt=refEquality,devModeChecks:rt={}}=typeof et=="function"?{equalityFn:et}:et,{store:nt,subscription:it,getServerState:ot,stabilityCheck:st,identityFunctionCheck:at}=a();React$1.useRef(!0);const ut=React$1.useCallback({[j.name](bt){return j(bt)}}[j.name],[j,st,rt.stabilityCheck]),ht=useSyncExternalStoreWithSelector(it.addNestedSub,nt.getState,ot||nt.getState,ut,tt);return React$1.useDebugValue(ht),ht};return Object.assign($,{withTypes:()=>$}),$}var useSelector=createSelectorHook();function defaultNoopBatch(_){_()}function createListenerCollection(){let _=null,a=null;return{clear(){_=null,a=null},notify(){defaultNoopBatch(()=>{let $=_;for(;$;)$.callback(),$=$.next})},get(){const $=[];let j=_;for(;j;)$.push(j),j=j.next;return $},subscribe($){let j=!0;const et=a={callback:$,next:null,prev:a};return et.prev?et.prev.next=et:_=et,function(){!j||_===null||(j=!1,et.next?et.next.prev=et.prev:a=et.prev,et.prev?et.prev.next=et.next:_=et.next)}}}}var nullListeners={notify(){},get:()=>[]};function createSubscription(_,a){let $,j=nullListeners,et=0,tt=!1;function rt(Et){st();const Ct=j.subscribe(Et);let Pt=!1;return()=>{Pt||(Pt=!0,Ct(),at())}}function nt(){j.notify()}function it(){bt.onStateChange&&bt.onStateChange()}function ot(){return tt}function st(){et++,$||($=_.subscribe(it),j=createListenerCollection())}function at(){et--,$&&et===0&&($(),$=void 0,j.clear(),j=nullListeners)}function ut(){tt||(tt=!0,st())}function ht(){tt&&(tt=!1,at())}const bt={addNestedSub:rt,notifyNestedSubs:nt,handleChangeWrapper:it,isSubscribed:ot,trySubscribe:ut,tryUnsubscribe:ht,getListeners:()=>j};return bt}var canUseDOM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",isReactNative$1=typeof navigator<"u"&&navigator.product==="ReactNative",useIsomorphicLayoutEffect$1=canUseDOM||isReactNative$1?React$1.useLayoutEffect:React$1.useEffect;function Provider$1({store:_,context:a,children:$,serverState:j,stabilityCheck:et="once",identityFunctionCheck:tt="once"}){const rt=React$1.useMemo(()=>{const ot=createSubscription(_);return{store:_,subscription:ot,getServerState:j?()=>j:void 0,stabilityCheck:et,identityFunctionCheck:tt}},[_,j,et,tt]),nt=React$1.useMemo(()=>_.getState(),[_]);useIsomorphicLayoutEffect$1(()=>{const{subscription:ot}=rt;return ot.onStateChange=ot.notifyNestedSubs,ot.trySubscribe(),nt!==_.getState()&&ot.notifyNestedSubs(),()=>{ot.tryUnsubscribe(),ot.onStateChange=void 0}},[rt,nt]);const it=a||ReactReduxContext;return React$1.createElement(it.Provider,{value:rt},$)}var Provider_default=Provider$1;function createStoreHook(_=ReactReduxContext){const a=_===ReactReduxContext?useReduxContext:createReduxContextHook(_),$=()=>{const{store:j}=a();return j};return Object.assign($,{withTypes:()=>$}),$}var useStore=createStoreHook();function createDispatchHook(_=ReactReduxContext){const a=_===ReactReduxContext?useStore:createStoreHook(_),$=()=>a().dispatch;return Object.assign($,{withTypes:()=>$}),$}var useDispatch=createDispatchHook();initializeUseSelector(withSelectorExports.useSyncExternalStoreWithSelector);const useAppDispatch=useDispatch,useAppSelector=useSelector,useSelectedNetwork=()=>useAppSelector(_=>_.networks.current),useAvailableNetworks=()=>useAppSelector(_=>_.networks.available),useFindNetwork=()=>{const _=useAvailableNetworks();return a=>_.find($=>$.name.toLowerCase()===a.toLowerCase())},useSelectNetwork=()=>{const _=useAvailableNetworks(),a=useDispatch();return $=>{const j=_.find(et=>et.name===$);j&&a(networksActions.setCurrent(j))}},useGetToken=()=>{const _=useSelectedNetwork(),a=useAppSelector($=>$.tokens[_.name]);return($,j)=>lodashExports.get(a,[$,j])},useGetTokenType=_=>{const a=useAppSelector($=>$.tokens[_.name]);return $=>{if(!(a&&$ in a))return;const j=a[$],et=Object.keys(j)[0];if(et)return j[et].type}},errorClasses={},deserializers={},addCustomErrorDeserializer=(_,a)=>{deserializers[_]=a},createCustomErrorClass=_=>{class a extends Error{constructor(j,et,tt){if(super(j||_,tt),Object.setPrototypeOf(this,a.prototype),this.name=_,et)for(const rt in et)this[rt]=et[rt];if(tt&&isObject$1(tt)&&"cause"in tt&&!("cause"in this)){const rt=tt.cause;this.cause=rt,"stack"in rt&&(this.stack=this.stack+` -CAUSE: `+rt.stack)}}}return errorClasses[_]=a,a};function isObject$1(_){return typeof _=="object"}createCustomErrorClass("AccountNameRequired");createCustomErrorClass("AccountNotSupported");createCustomErrorClass("AmountRequired");createCustomErrorClass("BluetoothRequired");createCustomErrorClass("BtcUnmatchedApp");createCustomErrorClass("CantOpenDevice");createCustomErrorClass("CashAddrNotSupported");createCustomErrorClass("ClaimRewardsFeesWarning");createCustomErrorClass("CurrencyNotSupported");createCustomErrorClass("DeviceAppVerifyNotSupported");createCustomErrorClass("DeviceGenuineSocketEarlyClose");createCustomErrorClass("DeviceNotGenuine");createCustomErrorClass("DeviceOnDashboardExpected");createCustomErrorClass("DeviceOnDashboardUnexpected");createCustomErrorClass("DeviceInOSUExpected");createCustomErrorClass("DeviceHalted");createCustomErrorClass("DeviceNameInvalid");createCustomErrorClass("DeviceSocketFail");createCustomErrorClass("DeviceSocketNoBulkStatus");createCustomErrorClass("DeviceSocketNoBulkStatus");createCustomErrorClass("UnresponsiveDeviceError");const DisconnectedDevice=createCustomErrorClass("DisconnectedDevice"),DisconnectedDeviceDuringOperation=createCustomErrorClass("DisconnectedDeviceDuringOperation");createCustomErrorClass("DeviceExtractOnboardingStateError");createCustomErrorClass("DeviceOnboardingStatePollingError");createCustomErrorClass("EnpointConfig");createCustomErrorClass("EthAppPleaseEnableContractData");createCustomErrorClass("FeeEstimationFailed");createCustomErrorClass("FirmwareNotRecognized");createCustomErrorClass("HardResetFail");createCustomErrorClass("InvalidXRPTag");createCustomErrorClass("InvalidAddress");createCustomErrorClass("InvalidNonce");createCustomErrorClass("InvalidAddressBecauseDestinationIsAlsoSource");createCustomErrorClass("LatestMCUInstalledError");createCustomErrorClass("UnknownMCU");createCustomErrorClass("LedgerAPIError");createCustomErrorClass("LedgerAPIErrorWithMessage");createCustomErrorClass("LedgerAPINotAvailable");createCustomErrorClass("ManagerAppAlreadyInstalled");createCustomErrorClass("ManagerAppRelyOnBTC");createCustomErrorClass("ManagerAppDepInstallRequired");createCustomErrorClass("ManagerAppDepUninstallRequired");createCustomErrorClass("ManagerDeviceLocked");createCustomErrorClass("ManagerFirmwareNotEnoughSpace");createCustomErrorClass("ManagerNotEnoughSpace");createCustomErrorClass("ManagerUninstallBTCDep");createCustomErrorClass("NetworkDown");createCustomErrorClass("NetworkError");createCustomErrorClass("NoAddressesFound");createCustomErrorClass("NotEnoughBalance");createCustomErrorClass("NotEnoughBalanceToDelegate");createCustomErrorClass("NotEnoughBalanceInParentAccount");createCustomErrorClass("NotEnoughSpendableBalance");createCustomErrorClass("NotEnoughBalanceBecauseDestinationNotCreated");createCustomErrorClass("NoAccessToCamera");createCustomErrorClass("NotEnoughGas");createCustomErrorClass("NotEnoughGasSwap");createCustomErrorClass("NotSupportedLegacyAddress");createCustomErrorClass("GasLessThanEstimate");createCustomErrorClass("PriorityFeeTooLow");createCustomErrorClass("PriorityFeeTooHigh");createCustomErrorClass("PriorityFeeHigherThanMaxFee");createCustomErrorClass("MaxFeeTooLow");createCustomErrorClass("PasswordsDontMatch");createCustomErrorClass("PasswordIncorrect");createCustomErrorClass("RecommendSubAccountsToEmpty");createCustomErrorClass("RecommendUndelegation");createCustomErrorClass("TimeoutTagged");createCustomErrorClass("UnexpectedBootloader");createCustomErrorClass("MCUNotGenuineToDashboard");createCustomErrorClass("RecipientRequired");createCustomErrorClass("UnavailableTezosOriginatedAccountReceive");createCustomErrorClass("UnavailableTezosOriginatedAccountSend");createCustomErrorClass("UpdateFetchFileFail");createCustomErrorClass("UpdateIncorrectHash");createCustomErrorClass("UpdateIncorrectSig");createCustomErrorClass("UpdateYourApp");createCustomErrorClass("UserRefusedDeviceNameChange");createCustomErrorClass("UserRefusedAddress");createCustomErrorClass("UserRefusedFirmwareUpdate");createCustomErrorClass("UserRefusedAllowManager");createCustomErrorClass("UserRefusedOnDevice");createCustomErrorClass("ExpertModeRequired");const TransportOpenUserCancelled=createCustomErrorClass("TransportOpenUserCancelled"),TransportInterfaceNotAvailable=createCustomErrorClass("TransportInterfaceNotAvailable"),TransportPendingOperation=createCustomErrorClass("TransportPendingOperation"),TransportWebUSBGestureRequired=createCustomErrorClass("TransportWebUSBGestureRequired");createCustomErrorClass("TransactionHasBeenValidatedError");createCustomErrorClass("TransportExchangeTimeoutError");createCustomErrorClass("DeviceShouldStayInApp");createCustomErrorClass("WebsocketConnectionError");createCustomErrorClass("WebsocketConnectionFailed");createCustomErrorClass("WrongDeviceForAccount");createCustomErrorClass("WrongDeviceForAccountPayout");createCustomErrorClass("WrongDeviceForAccountRefund");createCustomErrorClass("WrongAppForCurrency");createCustomErrorClass("ETHAddressNonEIP");createCustomErrorClass("CantScanQRCode");createCustomErrorClass("FeeNotLoaded");createCustomErrorClass("FeeNotLoadedSwap");createCustomErrorClass("FeeRequired");createCustomErrorClass("FeeTooHigh");createCustomErrorClass("PendingOperation");createCustomErrorClass("SyncError");createCustomErrorClass("PairingFailed");createCustomErrorClass("PeerRemovedPairing");createCustomErrorClass("GenuineCheckFailed");createCustomErrorClass("LedgerAPI4xx");createCustomErrorClass("LedgerAPI5xx");createCustomErrorClass("FirmwareOrAppUpdateRequired");createCustomErrorClass("ReplacementTransactionUnderpriced");createCustomErrorClass("OpReturnSizeLimit");createCustomErrorClass("DustLimit");createCustomErrorClass("LanguageNotFound");createCustomErrorClass("NoDBPathGiven");createCustomErrorClass("DBWrongPassword");createCustomErrorClass("DBNotReset");createCustomErrorClass("SequenceNumberError");createCustomErrorClass("DisabledTransactionBroadcastError");var HwTransportErrorType;(function(_){_.Unknown="Unknown",_.LocationServicesDisabled="LocationServicesDisabled",_.LocationServicesUnauthorized="LocationServicesUnauthorized",_.BluetoothScanStartFailed="BluetoothScanStartFailed"})(HwTransportErrorType||(HwTransportErrorType={}));let TransportError$1=class extends Error{constructor(a,$){const j="TransportError";super(a||j),this.name=j,this.message=a,this.stack=new Error(a).stack,this.id=$}};addCustomErrorDeserializer("TransportError",_=>new TransportError$1(_.message,_.id));const StatusCodes={ACCESS_CONDITION_NOT_FULFILLED:38916,ALGORITHM_NOT_SUPPORTED:38020,CLA_NOT_SUPPORTED:28160,CODE_BLOCKED:38976,CODE_NOT_INITIALIZED:38914,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,CONDITIONS_OF_USE_NOT_SATISFIED:27013,CONTRADICTION_INVALIDATION:38928,CONTRADICTION_SECRET_CODE_STATUS:38920,CUSTOM_IMAGE_BOOTLOADER:26159,CUSTOM_IMAGE_EMPTY:26158,FILE_ALREADY_EXISTS:27273,FILE_NOT_FOUND:37892,GP_AUTH_FAILED:25344,HALTED:28586,INCONSISTENT_FILE:37896,INCORRECT_DATA:27264,INCORRECT_LENGTH:26368,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,DEVICE_NOT_ONBOARDED:27911,DEVICE_NOT_ONBOARDED_2:26129,INVALID_KCV:38021,INVALID_OFFSET:37890,LICENSING:28482,LOCKED_DEVICE:21781,MAX_VALUE_REACHED:38992,MEMORY_PROBLEM:37440,MISSING_CRITICAL_PARAMETER:26624,NO_EF_SELECTED:37888,NOT_ENOUGH_MEMORY_SPACE:27268,OK:36864,PIN_REMAINING_ATTEMPTS:25536,REFERENCED_DATA_NOT_FOUND:27272,SECURITY_STATUS_NOT_SATISFIED:27010,TECHNICAL_PROBLEM:28416,UNKNOWN_APDU:27906,USER_REFUSED_ON_DEVICE:21761,NOT_ENOUGH_SPACE:20738};function getAltStatusMessage(_){switch(_){case 26368:return"Incorrect length";case 26624:return"Missing critical parameter";case 27010:return"Security not satisfied (dongle locked or have invalid access rights)";case 27013:return"Condition of use not satisfied (denied by the user?)";case 27264:return"Invalid data received";case 27392:return"Invalid parameter received";case 21781:return"Locked device"}if(28416<=_&&_<=28671)return"Internal error, please report"}class TransportStatusError extends Error{constructor(a,{canBeMappedToChildError:$=!0}={}){const j=Object.keys(StatusCodes).find(nt=>StatusCodes[nt]===a)||"UNKNOWN_ERROR",et=getAltStatusMessage(a)||j,tt=a.toString(16),rt=`Ledger device: ${et} (0x${tt})`;if(super(rt),this.name="TransportStatusError",this.statusCode=a,this.statusText=j,Object.setPrototypeOf(this,TransportStatusError.prototype),$&&a===StatusCodes.LOCKED_DEVICE)return new LockedDeviceError(rt)}}class LockedDeviceError extends TransportStatusError{constructor(a){super(StatusCodes.LOCKED_DEVICE,{canBeMappedToChildError:!1}),a&&(this.message=a),this.name="LockedDeviceError",Object.setPrototypeOf(this,LockedDeviceError.prototype)}}addCustomErrorDeserializer("TransportStatusError",_=>new TransportStatusError(_.statusCode));let id=0;const subscribers=[],log$7=(_,a,$)=>{const j={type:_,id:String(++id),date:new Date};a&&(j.message=a),dispatch(j)},trace=({type:_,message:a,data:$,context:j})=>{const et={type:_,id:String(++id),date:new Date};a&&(et.message=a),$&&(et.data=$),j&&(et.context=j),dispatch(et)};class LocalTracer{constructor(a,$){this.type=a,this.context=$}trace(a,$){trace({type:this.type,message:a,data:$,context:this.context})}getContext(){return this.context}setContext(a){this.context=a}updateContext(a){this.context=Object.assign(Object.assign({},this.context),a)}getType(){return this.type}setType(a){this.type=a}withType(a){return new LocalTracer(a,this.context)}withContext(a){return new LocalTracer(this.type,a)}withUpdatedContext(a){return new LocalTracer(this.type,Object.assign(Object.assign({},this.context),a))}}const listen=_=>(subscribers.push(_),()=>{const a=subscribers.indexOf(_);a!==-1&&(subscribers[a]=subscribers[subscribers.length-1],subscribers.pop())});function dispatch(_){for(let a=0;a__awaiter$7(this,void 0,void 0,function*(){const st=this.tracer.withUpdatedContext({function:"send"});if(nt.length>=256)throw st.trace("data.length exceeded 256 bytes limit",{dataLength:nt.length}),new TransportError$1("data.length exceed 256 bytes limit. Got: "+nt.length,"DataLengthTooBig");st.trace("Starting an exchange",{abortTimeoutMs:ot});const at=yield this.exchange(Buffer$g.concat([Buffer$g.from([j,et,tt,rt]),Buffer$g.from([nt.length]),nt]),{abortTimeoutMs:ot});st.trace("Received response from exchange");const ut=at.readUInt16BE(at.length-2);if(!it.some(ht=>ht===ut))throw new TransportStatusError(ut);return at}),this._appAPIlock=null,this.tracer=new LocalTracer($??DEFAULT_LOG_TYPE,a)}exchange(a,{abortTimeoutMs:$}={}){throw new Error("exchange not implemented")}exchangeBulk(a,$){let j=!1;const et=()=>{j=!0};return __awaiter$7(this,void 0,void 0,function*(){if(!j)for(const rt of a){const nt=yield this.exchange(rt);if(j)return;const it=nt.readUInt16BE(nt.length-2);if(it!==StatusCodes.OK)throw new TransportStatusError(it);$.next(nt)}}).then(()=>!j&&$.complete(),rt=>!j&&$.error(rt)),{unsubscribe:et}}setScrambleKey(a){}close(){return Promise.resolve()}on(a,$){this._events.on(a,$)}off(a,$){this._events.removeListener(a,$)}emit(a,...$){this._events.emit(a,...$)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(a){this.exchangeTimeout=a}setExchangeUnresponsiveTimeout(a){this.unresponsiveTimeout=a}static create(a=3e3,$){return new Promise((j,et)=>{let tt=!1;const rt=this.listen({next:it=>{tt=!0,rt&&rt.unsubscribe(),nt&&clearTimeout(nt),this.open(it.descriptor,a).then(j,et)},error:it=>{nt&&clearTimeout(nt),et(it)},complete:()=>{nt&&clearTimeout(nt),tt||et(new TransportError$1(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),nt=$?setTimeout(()=>{rt.unsubscribe(),et(new TransportError$1(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},$):null})}exchangeAtomicImpl(a){return __awaiter$7(this,void 0,void 0,function*(){const $=this.tracer.withUpdatedContext({function:"exchangeAtomicImpl",unresponsiveTimeout:this.unresponsiveTimeout});if(this.exchangeBusyPromise)throw $.trace("Atomic exchange is already busy"),new TransportPendingOperation("An action was already pending on the Ledger device. Please deny or reconnect.");let j;const et=new Promise(nt=>{j=nt});this.exchangeBusyPromise=et;let tt=!1;const rt=setTimeout(()=>{$.trace('Timeout reached, emitting Transport event "unresponsive"',{unresponsiveTimeout:this.unresponsiveTimeout}),tt=!0,this.emit("unresponsive")},this.unresponsiveTimeout);try{const nt=yield a();return tt&&($.trace("Device was unresponsive, emitting responsive"),this.emit("responsive")),nt}finally{$.trace("Finalize, clearing busy guard"),clearTimeout(rt),j&&j(),this.exchangeBusyPromise=null}})}decorateAppAPIMethods(a,$,j){for(const et of $)a[et]=this.decorateAppAPIMethod(et,a[et],a,j)}decorateAppAPIMethod(a,$,j,et){return(...tt)=>__awaiter$7(this,void 0,void 0,function*(){const{_appAPIlock:rt}=this;if(rt)return Promise.reject(new TransportError$1("Ledger Device is busy (lock "+rt+")","TransportLocked"));try{return this._appAPIlock=a,this.setScrambleKey(et),yield $.apply(j,tt)}finally{this._appAPIlock=null}})}setTraceContext(a){this.tracer=this.tracer.withContext(a)}updateTraceContext(a){this.tracer.updateContext(a)}getTraceContext(){return this.tracer.getContext()}};Transport$1.ErrorMessage_ListenTimeout="No Ledger device found (timeout)";Transport$1.ErrorMessage_NoDeviceFound="No Ledger device found";const Tag$1=5;function asUInt16BE(_){const a=Buffer$g.alloc(2);return a.writeUInt16BE(_,0),a}const initialAcc={data:Buffer$g.alloc(0),dataLength:0,sequence:0},createHIDframing=(_,a)=>({makeBlocks($){let j=Buffer$g.concat([asUInt16BE($.length),$]);const et=a-5,tt=Math.ceil(j.length/et);j=Buffer$g.concat([j,Buffer$g.alloc(tt*et-j.length+1).fill(0)]);const rt=[];for(let nt=0;nttt&&(et=et.slice(0,tt)),{data:et,dataLength:tt,sequence:rt}},getReducedResult($){if($&&$.dataLength===$.data.length)return $.data}});var re$3={exports:{}};const SEMVER_SPEC_VERSION="2.0.0",MAX_LENGTH$1=256,MAX_SAFE_INTEGER$1=Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH=16,MAX_SAFE_BUILD_LENGTH=MAX_LENGTH$1-6,RELEASE_TYPES=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var constants$1={MAX_LENGTH:MAX_LENGTH$1,MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_SAFE_INTEGER:MAX_SAFE_INTEGER$1,RELEASE_TYPES,SEMVER_SPEC_VERSION,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},define_process_env_default={};const debug$1=typeof process$1$1=="object"&&define_process_env_default&&define_process_env_default.NODE_DEBUG&&/\bsemver\b/i.test(define_process_env_default.NODE_DEBUG)?(..._)=>console.error("SEMVER",..._):()=>{};var debug_1=debug$1;(function(_,a){const{MAX_SAFE_COMPONENT_LENGTH:$,MAX_SAFE_BUILD_LENGTH:j,MAX_LENGTH:et}=constants$1,tt=debug_1;a=_.exports={};const rt=a.re=[],nt=a.safeRe=[],it=a.src=[],ot=a.t={};let st=0;const at="[a-zA-Z0-9-]",ut=[["\\s",1],["\\d",et],[at,j]],ht=Et=>{for(const[Ct,Pt]of ut)Et=Et.split(`${Ct}*`).join(`${Ct}{0,${Pt}}`).split(`${Ct}+`).join(`${Ct}{1,${Pt}}`);return Et},bt=(Et,Ct,Pt)=>{const Tt=ht(Ct),It=st++;tt(Et,It,Ct),ot[Et]=It,it[It]=Ct,rt[It]=new RegExp(Ct,Pt?"g":void 0),nt[It]=new RegExp(Tt,Pt?"g":void 0)};bt("NUMERICIDENTIFIER","0|[1-9]\\d*"),bt("NUMERICIDENTIFIERLOOSE","\\d+"),bt("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${at}*`),bt("MAINVERSION",`(${it[ot.NUMERICIDENTIFIER]})\\.(${it[ot.NUMERICIDENTIFIER]})\\.(${it[ot.NUMERICIDENTIFIER]})`),bt("MAINVERSIONLOOSE",`(${it[ot.NUMERICIDENTIFIERLOOSE]})\\.(${it[ot.NUMERICIDENTIFIERLOOSE]})\\.(${it[ot.NUMERICIDENTIFIERLOOSE]})`),bt("PRERELEASEIDENTIFIER",`(?:${it[ot.NUMERICIDENTIFIER]}|${it[ot.NONNUMERICIDENTIFIER]})`),bt("PRERELEASEIDENTIFIERLOOSE",`(?:${it[ot.NUMERICIDENTIFIERLOOSE]}|${it[ot.NONNUMERICIDENTIFIER]})`),bt("PRERELEASE",`(?:-(${it[ot.PRERELEASEIDENTIFIER]}(?:\\.${it[ot.PRERELEASEIDENTIFIER]})*))`),bt("PRERELEASELOOSE",`(?:-?(${it[ot.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${it[ot.PRERELEASEIDENTIFIERLOOSE]})*))`),bt("BUILDIDENTIFIER",`${at}+`),bt("BUILD",`(?:\\+(${it[ot.BUILDIDENTIFIER]}(?:\\.${it[ot.BUILDIDENTIFIER]})*))`),bt("FULLPLAIN",`v?${it[ot.MAINVERSION]}${it[ot.PRERELEASE]}?${it[ot.BUILD]}?`),bt("FULL",`^${it[ot.FULLPLAIN]}$`),bt("LOOSEPLAIN",`[v=\\s]*${it[ot.MAINVERSIONLOOSE]}${it[ot.PRERELEASELOOSE]}?${it[ot.BUILD]}?`),bt("LOOSE",`^${it[ot.LOOSEPLAIN]}$`),bt("GTLT","((?:<|>)?=?)"),bt("XRANGEIDENTIFIERLOOSE",`${it[ot.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),bt("XRANGEIDENTIFIER",`${it[ot.NUMERICIDENTIFIER]}|x|X|\\*`),bt("XRANGEPLAIN",`[v=\\s]*(${it[ot.XRANGEIDENTIFIER]})(?:\\.(${it[ot.XRANGEIDENTIFIER]})(?:\\.(${it[ot.XRANGEIDENTIFIER]})(?:${it[ot.PRERELEASE]})?${it[ot.BUILD]}?)?)?`),bt("XRANGEPLAINLOOSE",`[v=\\s]*(${it[ot.XRANGEIDENTIFIERLOOSE]})(?:\\.(${it[ot.XRANGEIDENTIFIERLOOSE]})(?:\\.(${it[ot.XRANGEIDENTIFIERLOOSE]})(?:${it[ot.PRERELEASELOOSE]})?${it[ot.BUILD]}?)?)?`),bt("XRANGE",`^${it[ot.GTLT]}\\s*${it[ot.XRANGEPLAIN]}$`),bt("XRANGELOOSE",`^${it[ot.GTLT]}\\s*${it[ot.XRANGEPLAINLOOSE]}$`),bt("COERCE",`(^|[^\\d])(\\d{1,${$}})(?:\\.(\\d{1,${$}}))?(?:\\.(\\d{1,${$}}))?(?:$|[^\\d])`),bt("COERCERTL",it[ot.COERCE],!0),bt("LONETILDE","(?:~>?)"),bt("TILDETRIM",`(\\s*)${it[ot.LONETILDE]}\\s+`,!0),a.tildeTrimReplace="$1~",bt("TILDE",`^${it[ot.LONETILDE]}${it[ot.XRANGEPLAIN]}$`),bt("TILDELOOSE",`^${it[ot.LONETILDE]}${it[ot.XRANGEPLAINLOOSE]}$`),bt("LONECARET","(?:\\^)"),bt("CARETTRIM",`(\\s*)${it[ot.LONECARET]}\\s+`,!0),a.caretTrimReplace="$1^",bt("CARET",`^${it[ot.LONECARET]}${it[ot.XRANGEPLAIN]}$`),bt("CARETLOOSE",`^${it[ot.LONECARET]}${it[ot.XRANGEPLAINLOOSE]}$`),bt("COMPARATORLOOSE",`^${it[ot.GTLT]}\\s*(${it[ot.LOOSEPLAIN]})$|^$`),bt("COMPARATOR",`^${it[ot.GTLT]}\\s*(${it[ot.FULLPLAIN]})$|^$`),bt("COMPARATORTRIM",`(\\s*)${it[ot.GTLT]}\\s*(${it[ot.LOOSEPLAIN]}|${it[ot.XRANGEPLAIN]})`,!0),a.comparatorTrimReplace="$1$2$3",bt("HYPHENRANGE",`^\\s*(${it[ot.XRANGEPLAIN]})\\s+-\\s+(${it[ot.XRANGEPLAIN]})\\s*$`),bt("HYPHENRANGELOOSE",`^\\s*(${it[ot.XRANGEPLAINLOOSE]})\\s+-\\s+(${it[ot.XRANGEPLAINLOOSE]})\\s*$`),bt("STAR","(<|>)?=?\\s*\\*"),bt("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),bt("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(re$3,re$3.exports);var reExports=re$3.exports;const looseOption=Object.freeze({loose:!0}),emptyOpts=Object.freeze({}),parseOptions$1=_=>_?typeof _!="object"?looseOption:_:emptyOpts;var parseOptions_1=parseOptions$1;const numeric=/^[0-9]+$/,compareIdentifiers$1=(_,a)=>{const $=numeric.test(_),j=numeric.test(a);return $&&j&&(_=+_,a=+a),_===a?0:$&&!j?-1:j&&!$?1:_compareIdentifiers$1(a,_);var identifiers$1={compareIdentifiers:compareIdentifiers$1,rcompareIdentifiers};const debug=debug_1,{MAX_LENGTH,MAX_SAFE_INTEGER}=constants$1,{safeRe:re$2,t:t$2}=reExports,parseOptions=parseOptions_1,{compareIdentifiers}=identifiers$1;let SemVer$d=class zo{constructor(a,$){if($=parseOptions($),a instanceof zo){if(a.loose===!!$.loose&&a.includePrerelease===!!$.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>MAX_LENGTH)throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);debug("SemVer",a,$),this.options=$,this.loose=!!$.loose,this.includePrerelease=!!$.includePrerelease;const j=a.trim().match($.loose?re$2[t$2.LOOSE]:re$2[t$2.FULL]);if(!j)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+j[1],this.minor=+j[2],this.patch=+j[3],this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");j[4]?this.prerelease=j[4].split(".").map(et=>{if(/^[0-9]+$/.test(et)){const tt=+et;if(tt>=0&&tt=0;)typeof this.prerelease[tt]=="number"&&(this.prerelease[tt]++,tt=-2);if(tt===-1){if($===this.prerelease.join(".")&&j===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(et)}}if($){let tt=[$,et];j===!1&&(tt=[$]),compareIdentifiers(this.prerelease[0],$)===0?isNaN(this.prerelease[1])&&(this.prerelease=tt):this.prerelease=tt}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var semver$2=SemVer$d;const SemVer$c=semver$2,parse$a=(_,a,$=!1)=>{if(_ instanceof SemVer$c)return _;try{return new SemVer$c(_,a)}catch(j){if(!$)return null;throw j}};var parse_1=parse$a;const parse$9=parse_1,valid$2=(_,a)=>{const $=parse$9(_,a);return $?$.version:null};var valid_1=valid$2;const parse$8=parse_1,clean$1=(_,a)=>{const $=parse$8(_.trim().replace(/^[=v]+/,""),a);return $?$.version:null};var clean_1=clean$1;const SemVer$b=semver$2,inc$1=(_,a,$,j,et)=>{typeof $=="string"&&(et=j,j=$,$=void 0);try{return new SemVer$b(_ instanceof SemVer$b?_.version:_,$).inc(a,j,et).version}catch{return null}};var inc_1=inc$1;const parse$7=parse_1,diff$1=(_,a)=>{const $=parse$7(_,null,!0),j=parse$7(a,null,!0),et=$.compare(j);if(et===0)return null;const tt=et>0,rt=tt?$:j,nt=tt?j:$,it=!!rt.prerelease.length;if(!!nt.prerelease.length&&!it)return!nt.patch&&!nt.minor?"major":rt.patch?"patch":rt.minor?"minor":"major";const st=it?"pre":"";return $.major!==j.major?st+"major":$.minor!==j.minor?st+"minor":$.patch!==j.patch?st+"patch":"prerelease"};var diff_1=diff$1;const SemVer$a=semver$2,major$1=(_,a)=>new SemVer$a(_,a).major;var major_1=major$1;const SemVer$9=semver$2,minor$1=(_,a)=>new SemVer$9(_,a).minor;var minor_1=minor$1;const SemVer$8=semver$2,patch$1=(_,a)=>new SemVer$8(_,a).patch;var patch_1=patch$1;const parse$6=parse_1,prerelease$1=(_,a)=>{const $=parse$6(_,a);return $&&$.prerelease.length?$.prerelease:null};var prerelease_1=prerelease$1;const SemVer$7=semver$2,compare$b=(_,a,$)=>new SemVer$7(_,$).compare(new SemVer$7(a,$));var compare_1=compare$b;const compare$a=compare_1,rcompare$1=(_,a,$)=>compare$a(a,_,$);var rcompare_1=rcompare$1;const compare$9=compare_1,compareLoose$1=(_,a)=>compare$9(_,a,!0);var compareLoose_1=compareLoose$1;const SemVer$6=semver$2,compareBuild$3=(_,a,$)=>{const j=new SemVer$6(_,$),et=new SemVer$6(a,$);return j.compare(et)||j.compareBuild(et)};var compareBuild_1=compareBuild$3;const compareBuild$2=compareBuild_1,sort$1=(_,a)=>_.sort(($,j)=>compareBuild$2($,j,a));var sort_1=sort$1;const compareBuild$1=compareBuild_1,rsort$1=(_,a)=>_.sort(($,j)=>compareBuild$1(j,$,a));var rsort_1=rsort$1;const compare$8=compare_1,gt$4=(_,a,$)=>compare$8(_,a,$)>0;var gt_1=gt$4;const compare$7=compare_1,lt$3=(_,a,$)=>compare$7(_,a,$)<0;var lt_1=lt$3;const compare$6=compare_1,eq$2=(_,a,$)=>compare$6(_,a,$)===0;var eq_1=eq$2;const compare$5=compare_1,neq$2=(_,a,$)=>compare$5(_,a,$)!==0;var neq_1=neq$2;const compare$4=compare_1,gte$3=(_,a,$)=>compare$4(_,a,$)>=0;var gte_1=gte$3;const compare$3=compare_1,lte$3=(_,a,$)=>compare$3(_,a,$)<=0;var lte_1=lte$3;const eq$1=eq_1,neq$1=neq_1,gt$3=gt_1,gte$2=gte_1,lt$2=lt_1,lte$2=lte_1,cmp$1=(_,a,$,j)=>{switch(a){case"===":return typeof _=="object"&&(_=_.version),typeof $=="object"&&($=$.version),_===$;case"!==":return typeof _=="object"&&(_=_.version),typeof $=="object"&&($=$.version),_!==$;case"":case"=":case"==":return eq$1(_,$,j);case"!=":return neq$1(_,$,j);case">":return gt$3(_,$,j);case">=":return gte$2(_,$,j);case"<":return lt$2(_,$,j);case"<=":return lte$2(_,$,j);default:throw new TypeError(`Invalid operator: ${a}`)}};var cmp_1=cmp$1;const SemVer$5=semver$2,parse$5=parse_1,{safeRe:re$1,t:t$1}=reExports,coerce$1=(_,a)=>{if(_ instanceof SemVer$5)return _;if(typeof _=="number"&&(_=String(_)),typeof _!="string")return null;a=a||{};let $=null;if(!a.rtl)$=_.match(re$1[t$1.COERCE]);else{let j;for(;(j=re$1[t$1.COERCERTL].exec(_))&&(!$||$.index+$[0].length!==_.length);)(!$||j.index+j[0].length!==$.index+$[0].length)&&($=j),re$1[t$1.COERCERTL].lastIndex=j.index+j[1].length+j[2].length;re$1[t$1.COERCERTL].lastIndex=-1}return $===null?null:parse$5(`${$[2]}.${$[3]||"0"}.${$[4]||"0"}`,a)};var coerce_1=coerce$1,iterator$1,hasRequiredIterator;function requireIterator(){return hasRequiredIterator||(hasRequiredIterator=1,iterator$1=function(_){_.prototype[Symbol.iterator]=function*(){for(let a=this.head;a;a=a.next)yield a.value}}),iterator$1}var yallist=Yallist$1;Yallist$1.Node=Node$1;Yallist$1.create=Yallist$1;function Yallist$1(_){var a=this;if(a instanceof Yallist$1||(a=new Yallist$1),a.tail=null,a.head=null,a.length=0,_&&typeof _.forEach=="function")_.forEach(function(et){a.push(et)});else if(arguments.length>0)for(var $=0,j=arguments.length;$1)$=a;else if(this.head)j=this.head.next,$=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var et=0;j!==null;et++)$=_($,j.value,et),j=j.next;return $};Yallist$1.prototype.reduceReverse=function(_,a){var $,j=this.tail;if(arguments.length>1)$=a;else if(this.tail)j=this.tail.prev,$=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var et=this.length-1;j!==null;et--)$=_($,j.value,et),j=j.prev;return $};Yallist$1.prototype.toArray=function(){for(var _=new Array(this.length),a=0,$=this.head;$!==null;a++)_[a]=$.value,$=$.next;return _};Yallist$1.prototype.toArrayReverse=function(){for(var _=new Array(this.length),a=0,$=this.tail;$!==null;a++)_[a]=$.value,$=$.prev;return _};Yallist$1.prototype.slice=function(_,a){a=a||this.length,a<0&&(a+=this.length),_=_||0,_<0&&(_+=this.length);var $=new Yallist$1;if(a<_||a<0)return $;_<0&&(_=0),a>this.length&&(a=this.length);for(var j=0,et=this.head;et!==null&&j<_;j++)et=et.next;for(;et!==null&&jthis.length&&(a=this.length);for(var j=this.length,et=this.tail;et!==null&&j>a;j--)et=et.prev;for(;et!==null&&j>_;j--,et=et.prev)$.push(et.value);return $};Yallist$1.prototype.splice=function(_,a,...$){_>this.length&&(_=this.length-1),_<0&&(_=this.length+_);for(var j=0,et=this.head;et!==null&&j<_;j++)et=et.next;for(var tt=[],j=0;et&&j1;class LRUCache{constructor(a){if(typeof a=="number"&&(a={max:a}),a||(a={}),a.max&&(typeof a.max!="number"||a.max<0))throw new TypeError("max must be a non-negative number");this[MAX]=a.max||1/0;const $=a.length||naiveLength;if(this[LENGTH_CALCULATOR]=typeof $!="function"?naiveLength:$,this[ALLOW_STALE]=a.stale||!1,a.maxAge&&typeof a.maxAge!="number")throw new TypeError("maxAge must be a number");this[MAX_AGE]=a.maxAge||0,this[DISPOSE]=a.dispose,this[NO_DISPOSE_ON_SET]=a.noDisposeOnSet||!1,this[UPDATE_AGE_ON_GET]=a.updateAgeOnGet||!1,this.reset()}set max(a){if(typeof a!="number"||a<0)throw new TypeError("max must be a non-negative number");this[MAX]=a||1/0,trim(this)}get max(){return this[MAX]}set allowStale(a){this[ALLOW_STALE]=!!a}get allowStale(){return this[ALLOW_STALE]}set maxAge(a){if(typeof a!="number")throw new TypeError("maxAge must be a non-negative number");this[MAX_AGE]=a,trim(this)}get maxAge(){return this[MAX_AGE]}set lengthCalculator(a){typeof a!="function"&&(a=naiveLength),a!==this[LENGTH_CALCULATOR]&&(this[LENGTH_CALCULATOR]=a,this[LENGTH]=0,this[LRU_LIST].forEach($=>{$.length=this[LENGTH_CALCULATOR]($.value,$.key),this[LENGTH]+=$.length})),trim(this)}get lengthCalculator(){return this[LENGTH_CALCULATOR]}get length(){return this[LENGTH]}get itemCount(){return this[LRU_LIST].length}rforEach(a,$){$=$||this;for(let j=this[LRU_LIST].tail;j!==null;){const et=j.prev;forEachStep(this,a,j,$),j=et}}forEach(a,$){$=$||this;for(let j=this[LRU_LIST].head;j!==null;){const et=j.next;forEachStep(this,a,j,$),j=et}}keys(){return this[LRU_LIST].toArray().map(a=>a.key)}values(){return this[LRU_LIST].toArray().map(a=>a.value)}reset(){this[DISPOSE]&&this[LRU_LIST]&&this[LRU_LIST].length&&this[LRU_LIST].forEach(a=>this[DISPOSE](a.key,a.value)),this[CACHE]=new Map,this[LRU_LIST]=new Yallist,this[LENGTH]=0}dump(){return this[LRU_LIST].map(a=>isStale$1(this,a)?!1:{k:a.key,v:a.value,e:a.now+(a.maxAge||0)}).toArray().filter(a=>a)}dumpLru(){return this[LRU_LIST]}set(a,$,j){if(j=j||this[MAX_AGE],j&&typeof j!="number")throw new TypeError("maxAge must be a number");const et=j?Date.now():0,tt=this[LENGTH_CALCULATOR]($,a);if(this[CACHE].has(a)){if(tt>this[MAX])return del(this,this[CACHE].get(a)),!1;const it=this[CACHE].get(a).value;return this[DISPOSE]&&(this[NO_DISPOSE_ON_SET]||this[DISPOSE](a,it.value)),it.now=et,it.maxAge=j,it.value=$,this[LENGTH]+=tt-it.length,it.length=tt,this.get(a),trim(this),!0}const rt=new Entry(a,$,tt,et,j);return rt.length>this[MAX]?(this[DISPOSE]&&this[DISPOSE](a,$),!1):(this[LENGTH]+=rt.length,this[LRU_LIST].unshift(rt),this[CACHE].set(a,this[LRU_LIST].head),trim(this),!0)}has(a){if(!this[CACHE].has(a))return!1;const $=this[CACHE].get(a).value;return!isStale$1(this,$)}get(a){return get$3(this,a,!0)}peek(a){return get$3(this,a,!1)}pop(){const a=this[LRU_LIST].tail;return a?(del(this,a),a.value):null}del(a){del(this,this[CACHE].get(a))}load(a){this.reset();const $=Date.now();for(let j=a.length-1;j>=0;j--){const et=a[j],tt=et.e||0;if(tt===0)this.set(et.k,et.v);else{const rt=tt-$;rt>0&&this.set(et.k,et.v,rt)}}}prune(){this[CACHE].forEach((a,$)=>get$3(this,$,!1))}}const get$3=(_,a,$)=>{const j=_[CACHE].get(a);if(j){const et=j.value;if(isStale$1(_,et)){if(del(_,j),!_[ALLOW_STALE])return}else $&&(_[UPDATE_AGE_ON_GET]&&(j.value.now=Date.now()),_[LRU_LIST].unshiftNode(j));return et.value}},isStale$1=(_,a)=>{if(!a||!a.maxAge&&!_[MAX_AGE])return!1;const $=Date.now()-a.now;return a.maxAge?$>a.maxAge:_[MAX_AGE]&&$>_[MAX_AGE]},trim=_=>{if(_[LENGTH]>_[MAX])for(let a=_[LRU_LIST].tail;_[LENGTH]>_[MAX]&&a!==null;){const $=a.prev;del(_,a),a=$}},del=(_,a)=>{if(a){const $=a.value;_[DISPOSE]&&_[DISPOSE]($.key,$.value),_[LENGTH]-=$.length,_[CACHE].delete($.key),_[LRU_LIST].removeNode(a)}};class Entry{constructor(a,$,j,et,tt){this.key=a,this.value=$,this.length=j,this.now=et,this.maxAge=tt||0}}const forEachStep=(_,a,$,j)=>{let et=$.value;isStale$1(_,et)&&(del(_,$),_[ALLOW_STALE]||(et=void 0)),et&&a.call(j,et.value,et.key,_)};var lruCache=LRUCache,range$1,hasRequiredRange;function requireRange(){if(hasRequiredRange)return range$1;hasRequiredRange=1;class _{constructor(ct,dt){if(dt=j(dt),ct instanceof _)return ct.loose===!!dt.loose&&ct.includePrerelease===!!dt.includePrerelease?ct:new _(ct.raw,dt);if(ct instanceof et)return this.raw=ct.value,this.set=[[ct]],this.format(),this;if(this.options=dt,this.loose=!!dt.loose,this.includePrerelease=!!dt.includePrerelease,this.raw=ct.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(vt=>this.parseRange(vt.trim())).filter(vt=>vt.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const vt=this.set[0];if(this.set=this.set.filter(St=>!bt(St[0])),this.set.length===0)this.set=[vt];else if(this.set.length>1){for(const St of this.set)if(St.length===1&&Et(St[0])){this.set=[St];break}}}this.format()}format(){return this.range=this.set.map(ct=>ct.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(ct){const vt=((this.options.includePrerelease&&ut)|(this.options.loose&&ht))+":"+ct,St=$.get(vt);if(St)return St;const Rt=this.options.loose,$t=Rt?nt[it.HYPHENRANGELOOSE]:nt[it.HYPHENRANGE];ct=ct.replace($t,Bt(this.options.includePrerelease)),tt("hyphen replace",ct),ct=ct.replace(nt[it.COMPARATORTRIM],ot),tt("comparator trim",ct),ct=ct.replace(nt[it.TILDETRIM],st),tt("tilde trim",ct),ct=ct.replace(nt[it.CARETTRIM],at),tt("caret trim",ct);let xt=ct.split(" ").map(tr=>Pt(tr,this.options)).join(" ").split(/\s+/).map(tr=>Ft(tr,this.options));Rt&&(xt=xt.filter(tr=>(tt("loose invalid filter",tr,this.options),!!tr.match(nt[it.COMPARATORLOOSE])))),tt("range list",xt);const At=new Map,wt=xt.map(tr=>new et(tr,this.options));for(const tr of wt){if(bt(tr))return[tr];At.set(tr.value,tr)}At.size>1&&At.has("")&&At.delete("");const Ot=[...At.values()];return $.set(vt,Ot),Ot}intersects(ct,dt){if(!(ct instanceof _))throw new TypeError("a Range is required");return this.set.some(vt=>Ct(vt,dt)&&ct.set.some(St=>Ct(St,dt)&&vt.every(Rt=>St.every($t=>Rt.intersects($t,dt)))))}test(ct){if(!ct)return!1;if(typeof ct=="string")try{ct=new rt(ct,this.options)}catch{return!1}for(let dt=0;dtmt.value==="<0.0.0-0",Et=mt=>mt.value==="",Ct=(mt,ct)=>{let dt=!0;const vt=mt.slice();let St=vt.pop();for(;dt&&vt.length;)dt=vt.every(Rt=>St.intersects(Rt,ct)),St=vt.pop();return dt},Pt=(mt,ct)=>(tt("comp",mt,ct),mt=Nt(mt,ct),tt("caret",mt),mt=It(mt,ct),tt("tildes",mt),mt=jt(mt,ct),tt("xrange",mt),mt=Dt(mt,ct),tt("stars",mt),mt),Tt=mt=>!mt||mt.toLowerCase()==="x"||mt==="*",It=(mt,ct)=>mt.trim().split(/\s+/).map(dt=>Lt(dt,ct)).join(" "),Lt=(mt,ct)=>{const dt=ct.loose?nt[it.TILDELOOSE]:nt[it.TILDE];return mt.replace(dt,(vt,St,Rt,$t,xt)=>{tt("tilde",mt,vt,St,Rt,$t,xt);let At;return Tt(St)?At="":Tt(Rt)?At=`>=${St}.0.0 <${+St+1}.0.0-0`:Tt($t)?At=`>=${St}.${Rt}.0 <${St}.${+Rt+1}.0-0`:xt?(tt("replaceTilde pr",xt),At=`>=${St}.${Rt}.${$t}-${xt} <${St}.${+Rt+1}.0-0`):At=`>=${St}.${Rt}.${$t} <${St}.${+Rt+1}.0-0`,tt("tilde return",At),At})},Nt=(mt,ct)=>mt.trim().split(/\s+/).map(dt=>Ut(dt,ct)).join(" "),Ut=(mt,ct)=>{tt("caret",mt,ct);const dt=ct.loose?nt[it.CARETLOOSE]:nt[it.CARET],vt=ct.includePrerelease?"-0":"";return mt.replace(dt,(St,Rt,$t,xt,At)=>{tt("caret",mt,St,Rt,$t,xt,At);let wt;return Tt(Rt)?wt="":Tt($t)?wt=`>=${Rt}.0.0${vt} <${+Rt+1}.0.0-0`:Tt(xt)?Rt==="0"?wt=`>=${Rt}.${$t}.0${vt} <${Rt}.${+$t+1}.0-0`:wt=`>=${Rt}.${$t}.0${vt} <${+Rt+1}.0.0-0`:At?(tt("replaceCaret pr",At),Rt==="0"?$t==="0"?wt=`>=${Rt}.${$t}.${xt}-${At} <${Rt}.${$t}.${+xt+1}-0`:wt=`>=${Rt}.${$t}.${xt}-${At} <${Rt}.${+$t+1}.0-0`:wt=`>=${Rt}.${$t}.${xt}-${At} <${+Rt+1}.0.0-0`):(tt("no pr"),Rt==="0"?$t==="0"?wt=`>=${Rt}.${$t}.${xt}${vt} <${Rt}.${$t}.${+xt+1}-0`:wt=`>=${Rt}.${$t}.${xt}${vt} <${Rt}.${+$t+1}.0-0`:wt=`>=${Rt}.${$t}.${xt} <${+Rt+1}.0.0-0`),tt("caret return",wt),wt})},jt=(mt,ct)=>(tt("replaceXRanges",mt,ct),mt.split(/\s+/).map(dt=>Mt(dt,ct)).join(" ")),Mt=(mt,ct)=>{mt=mt.trim();const dt=ct.loose?nt[it.XRANGELOOSE]:nt[it.XRANGE];return mt.replace(dt,(vt,St,Rt,$t,xt,At)=>{tt("xRange",mt,vt,St,Rt,$t,xt,At);const wt=Tt(Rt),Ot=wt||Tt($t),tr=Ot||Tt(xt),nr=tr;return St==="="&&nr&&(St=""),At=ct.includePrerelease?"-0":"",wt?St===">"||St==="<"?vt="<0.0.0-0":vt="*":St&&nr?(Ot&&($t=0),xt=0,St===">"?(St=">=",Ot?(Rt=+Rt+1,$t=0,xt=0):($t=+$t+1,xt=0)):St==="<="&&(St="<",Ot?Rt=+Rt+1:$t=+$t+1),St==="<"&&(At="-0"),vt=`${St+Rt}.${$t}.${xt}${At}`):Ot?vt=`>=${Rt}.0.0${At} <${+Rt+1}.0.0-0`:tr&&(vt=`>=${Rt}.${$t}.0${At} <${Rt}.${+$t+1}.0-0`),tt("xRange return",vt),vt})},Dt=(mt,ct)=>(tt("replaceStars",mt,ct),mt.trim().replace(nt[it.STAR],"")),Ft=(mt,ct)=>(tt("replaceGTE0",mt,ct),mt.trim().replace(nt[ct.includePrerelease?it.GTE0PRE:it.GTE0],"")),Bt=mt=>(ct,dt,vt,St,Rt,$t,xt,At,wt,Ot,tr,nr,ir)=>(Tt(vt)?dt="":Tt(St)?dt=`>=${vt}.0.0${mt?"-0":""}`:Tt(Rt)?dt=`>=${vt}.${St}.0${mt?"-0":""}`:$t?dt=`>=${dt}`:dt=`>=${dt}${mt?"-0":""}`,Tt(wt)?At="":Tt(Ot)?At=`<${+wt+1}.0.0-0`:Tt(tr)?At=`<${wt}.${+Ot+1}.0-0`:nr?At=`<=${wt}.${Ot}.${tr}-${nr}`:mt?At=`<${wt}.${Ot}.${+tr+1}-0`:At=`<=${At}`,`${dt} ${At}`.trim()),yt=(mt,ct,dt)=>{for(let vt=0;vt0){const St=mt[vt].semver;if(St.major===ct.major&&St.minor===ct.minor&&St.patch===ct.patch)return!0}return!1}return!0};return range$1}var comparator,hasRequiredComparator;function requireComparator(){if(hasRequiredComparator)return comparator;hasRequiredComparator=1;const _=Symbol("SemVer ANY");class a{static get ANY(){return _}constructor(st,at){if(at=$(at),st instanceof a){if(st.loose===!!at.loose)return st;st=st.value}st=st.trim().split(/\s+/).join(" "),rt("comparator",st,at),this.options=at,this.loose=!!at.loose,this.parse(st),this.semver===_?this.value="":this.value=this.operator+this.semver.version,rt("comp",this)}parse(st){const at=this.options.loose?j[et.COMPARATORLOOSE]:j[et.COMPARATOR],ut=st.match(at);if(!ut)throw new TypeError(`Invalid comparator: ${st}`);this.operator=ut[1]!==void 0?ut[1]:"",this.operator==="="&&(this.operator=""),ut[2]?this.semver=new nt(ut[2],this.options.loose):this.semver=_}toString(){return this.value}test(st){if(rt("Comparator.test",st,this.options.loose),this.semver===_||st===_)return!0;if(typeof st=="string")try{st=new nt(st,this.options)}catch{return!1}return tt(st,this.operator,this.semver,this.options)}intersects(st,at){if(!(st instanceof a))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new it(st.value,at).test(this.value):st.operator===""?st.value===""?!0:new it(this.value,at).test(st.semver):(at=$(at),at.includePrerelease&&(this.value==="<0.0.0-0"||st.value==="<0.0.0-0")||!at.includePrerelease&&(this.value.startsWith("<0.0.0")||st.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&st.operator.startsWith(">")||this.operator.startsWith("<")&&st.operator.startsWith("<")||this.semver.version===st.semver.version&&this.operator.includes("=")&&st.operator.includes("=")||tt(this.semver,"<",st.semver,at)&&this.operator.startsWith(">")&&st.operator.startsWith("<")||tt(this.semver,">",st.semver,at)&&this.operator.startsWith("<")&&st.operator.startsWith(">")))}}comparator=a;const $=parseOptions_1,{safeRe:j,t:et}=reExports,tt=cmp_1,rt=debug_1,nt=semver$2,it=requireRange();return comparator}const Range$9=requireRange(),satisfies$4=(_,a,$)=>{try{a=new Range$9(a,$)}catch{return!1}return a.test(_)};var satisfies_1=satisfies$4;const Range$8=requireRange(),toComparators$1=(_,a)=>new Range$8(_,a).set.map($=>$.map(j=>j.value).join(" ").trim().split(" "));var toComparators_1=toComparators$1;const SemVer$4=semver$2,Range$7=requireRange(),maxSatisfying$1=(_,a,$)=>{let j=null,et=null,tt=null;try{tt=new Range$7(a,$)}catch{return null}return _.forEach(rt=>{tt.test(rt)&&(!j||et.compare(rt)===-1)&&(j=rt,et=new SemVer$4(j,$))}),j};var maxSatisfying_1=maxSatisfying$1;const SemVer$3=semver$2,Range$6=requireRange(),minSatisfying$1=(_,a,$)=>{let j=null,et=null,tt=null;try{tt=new Range$6(a,$)}catch{return null}return _.forEach(rt=>{tt.test(rt)&&(!j||et.compare(rt)===1)&&(j=rt,et=new SemVer$3(j,$))}),j};var minSatisfying_1=minSatisfying$1;const SemVer$2=semver$2,Range$5=requireRange(),gt$2=gt_1,minVersion$1=(_,a)=>{_=new Range$5(_,a);let $=new SemVer$2("0.0.0");if(_.test($)||($=new SemVer$2("0.0.0-0"),_.test($)))return $;$=null;for(let j=0;j<_.set.length;++j){const et=_.set[j];let tt=null;et.forEach(rt=>{const nt=new SemVer$2(rt.semver.version);switch(rt.operator){case">":nt.prerelease.length===0?nt.patch++:nt.prerelease.push(0),nt.raw=nt.format();case"":case">=":(!tt||gt$2(nt,tt))&&(tt=nt);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${rt.operator}`)}}),tt&&(!$||gt$2($,tt))&&($=tt)}return $&&_.test($)?$:null};var minVersion_1=minVersion$1;const Range$4=requireRange(),validRange$1=(_,a)=>{try{return new Range$4(_,a).range||"*"}catch{return null}};var valid$1=validRange$1;const SemVer$1=semver$2,Comparator$2=requireComparator(),{ANY:ANY$1}=Comparator$2,Range$3=requireRange(),satisfies$3=satisfies_1,gt$1=gt_1,lt$1=lt_1,lte$1=lte_1,gte$1=gte_1,outside$3=(_,a,$,j)=>{_=new SemVer$1(_,j),a=new Range$3(a,j);let et,tt,rt,nt,it;switch($){case">":et=gt$1,tt=lte$1,rt=lt$1,nt=">",it=">=";break;case"<":et=lt$1,tt=gte$1,rt=gt$1,nt="<",it="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies$3(_,a,j))return!1;for(let ot=0;ot{ht.semver===ANY$1&&(ht=new Comparator$2(">=0.0.0")),at=at||ht,ut=ut||ht,et(ht.semver,at.semver,j)?at=ht:rt(ht.semver,ut.semver,j)&&(ut=ht)}),at.operator===nt||at.operator===it||(!ut.operator||ut.operator===nt)&&tt(_,ut.semver))return!1;if(ut.operator===it&&rt(_,ut.semver))return!1}return!0};var outside_1=outside$3;const outside$2=outside_1,gtr$1=(_,a,$)=>outside$2(_,a,">",$);var gtr_1=gtr$1;const outside$1=outside_1,ltr$1=(_,a,$)=>outside$1(_,a,"<",$);var ltr_1=ltr$1;const Range$2=requireRange(),intersects$1=(_,a,$)=>(_=new Range$2(_,$),a=new Range$2(a,$),_.intersects(a,$));var intersects_1=intersects$1;const satisfies$2=satisfies_1,compare$2=compare_1;var simplify=(_,a,$)=>{const j=[];let et=null,tt=null;const rt=_.sort((st,at)=>compare$2(st,at,$));for(const st of rt)satisfies$2(st,a,$)?(tt=st,et||(et=st)):(tt&&j.push([et,tt]),tt=null,et=null);et&&j.push([et,null]);const nt=[];for(const[st,at]of j)st===at?nt.push(st):!at&&st===rt[0]?nt.push("*"):at?st===rt[0]?nt.push(`<=${at}`):nt.push(`${st} - ${at}`):nt.push(`>=${st}`);const it=nt.join(" || "),ot=typeof a.raw=="string"?a.raw:String(a);return it.length{if(_===a)return!0;_=new Range$1(_,$),a=new Range$1(a,$);let j=!1;e:for(const et of _.set){for(const tt of a.set){const rt=simpleSubset(et,tt,$);if(j=j||rt!==null,rt)continue e}if(j)return!1}return!0},minimumVersionWithPreRelease=[new Comparator$1(">=0.0.0-0")],minimumVersion=[new Comparator$1(">=0.0.0")],simpleSubset=(_,a,$)=>{if(_===a)return!0;if(_.length===1&&_[0].semver===ANY){if(a.length===1&&a[0].semver===ANY)return!0;$.includePrerelease?_=minimumVersionWithPreRelease:_=minimumVersion}if(a.length===1&&a[0].semver===ANY){if($.includePrerelease)return!0;a=minimumVersion}const j=new Set;let et,tt;for(const ht of _)ht.operator===">"||ht.operator===">="?et=higherGT(et,ht,$):ht.operator==="<"||ht.operator==="<="?tt=lowerLT(tt,ht,$):j.add(ht.semver);if(j.size>1)return null;let rt;if(et&&tt){if(rt=compare$1(et.semver,tt.semver,$),rt>0)return null;if(rt===0&&(et.operator!==">="||tt.operator!=="<="))return null}for(const ht of j){if(et&&!satisfies$1(ht,String(et),$)||tt&&!satisfies$1(ht,String(tt),$))return null;for(const bt of a)if(!satisfies$1(ht,String(bt),$))return!1;return!0}let nt,it,ot,st,at=tt&&!$.includePrerelease&&tt.semver.prerelease.length?tt.semver:!1,ut=et&&!$.includePrerelease&&et.semver.prerelease.length?et.semver:!1;at&&at.prerelease.length===1&&tt.operator==="<"&&at.prerelease[0]===0&&(at=!1);for(const ht of a){if(st=st||ht.operator===">"||ht.operator===">=",ot=ot||ht.operator==="<"||ht.operator==="<=",et){if(ut&&ht.semver.prerelease&&ht.semver.prerelease.length&&ht.semver.major===ut.major&&ht.semver.minor===ut.minor&&ht.semver.patch===ut.patch&&(ut=!1),ht.operator===">"||ht.operator===">="){if(nt=higherGT(et,ht,$),nt===ht&&nt!==et)return!1}else if(et.operator===">="&&!satisfies$1(et.semver,String(ht),$))return!1}if(tt){if(at&&ht.semver.prerelease&&ht.semver.prerelease.length&&ht.semver.major===at.major&&ht.semver.minor===at.minor&&ht.semver.patch===at.patch&&(at=!1),ht.operator==="<"||ht.operator==="<="){if(it=lowerLT(tt,ht,$),it===ht&&it!==tt)return!1}else if(tt.operator==="<="&&!satisfies$1(tt.semver,String(ht),$))return!1}if(!ht.operator&&(tt||et)&&rt!==0)return!1}return!(et&&ot&&!tt&&rt!==0||tt&&st&&!et&&rt!==0||ut||at)},higherGT=(_,a,$)=>{if(!_)return a;const j=compare$1(_.semver,a.semver,$);return j>0?_:j<0||a.operator===">"&&_.operator===">="?a:_},lowerLT=(_,a,$)=>{if(!_)return a;const j=compare$1(_.semver,a.semver,$);return j<0?_:j>0||a.operator==="<"&&_.operator==="<="?a:_};var subset_1=subset$1;const internalRe=reExports,constants=constants$1,SemVer=semver$2,identifiers=identifiers$1,parse$4=parse_1,valid=valid_1,clean=clean_1,inc=inc_1,diff=diff_1,major=major_1,minor=minor_1,patch=patch_1,prerelease=prerelease_1,compare=compare_1,rcompare=rcompare_1,compareLoose=compareLoose_1,compareBuild=compareBuild_1,sort=sort_1,rsort=rsort_1,gt=gt_1,lt=lt_1,eq=eq_1,neq=neq_1,gte=gte_1,lte=lte_1,cmp=cmp_1,coerce=coerce_1,Comparator=requireComparator(),Range=requireRange(),satisfies=satisfies_1,toComparators=toComparators_1,maxSatisfying=maxSatisfying_1,minSatisfying=minSatisfying_1,minVersion=minVersion_1,validRange=valid$1,outside=outside_1,gtr=gtr_1,ltr=ltr_1,intersects=intersects_1,simplifyRange=simplify,subset=subset_1;var semver={parse:parse$4,valid,clean,inc,diff,major,minor,patch,prerelease,compare,rcompare,compareLoose,compareBuild,sort,rsort,gt,lt,eq,neq,gte,lte,cmp,coerce,Comparator,Range,satisfies,toComparators,maxSatisfying,minSatisfying,minVersion,validRange,outside,gtr,ltr,intersects,simplifyRange,subset,SemVer,re:internalRe.re,src:internalRe.src,tokens:internalRe.t,SEMVER_SPEC_VERSION:constants.SEMVER_SPEC_VERSION,RELEASE_TYPES:constants.RELEASE_TYPES,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers};const semver$1=getDefaultExportFromCjs$1(semver);var DeviceModelId;(function(_){_.blue="blue",_.nanoS="nanoS",_.nanoSP="nanoSP",_.nanoX="nanoX",_.stax="stax",_.europa="europa"})(DeviceModelId||(DeviceModelId={}));const devices={[DeviceModelId.blue]:{id:DeviceModelId.blue,productName:"Ledger Blue",productIdMM:0,legacyUsbProductId:0,usbOnly:!0,memorySize:480*1024,masks:[822083584,822149120],getBlockSize:_=>4*1024},[DeviceModelId.nanoS]:{id:DeviceModelId.nanoS,productName:"Ledger Nano S",productIdMM:16,legacyUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160],getBlockSize:_=>{var a;return semver$1.lt((a=semver$1.coerce(_))!==null&&a!==void 0?a:"","2.0.0")?4*1024:2*1024}},[DeviceModelId.nanoX]:{id:DeviceModelId.nanoX,productName:"Ledger Nano X",productIdMM:64,legacyUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],getBlockSize:_=>4*1024,bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]},[DeviceModelId.nanoSP]:{id:DeviceModelId.nanoSP,productName:"Ledger Nano S Plus",productIdMM:80,legacyUsbProductId:5,usbOnly:!0,memorySize:1533*1024,masks:[856686592],getBlockSize:_=>32},[DeviceModelId.stax]:{id:DeviceModelId.stax,productName:"Ledger Stax",productIdMM:96,legacyUsbProductId:6,usbOnly:!1,memorySize:1533*1024,masks:[857735168],getBlockSize:_=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]},[DeviceModelId.europa]:{id:DeviceModelId.europa,productName:"Ledger Europa",productIdMM:112,legacyUsbProductId:7,usbOnly:!1,memorySize:1533*1024,masks:[858783744],getBlockSize:_=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}};DeviceModelId.blue,DeviceModelId.nanoS,DeviceModelId.nanoSP,DeviceModelId.nanoX,DeviceModelId.stax,DeviceModelId.europa;const devicesList=Object.values(devices),ledgerUSBVendorId=11415,identifyUSBProductId=_=>{const a=devicesList.find(et=>et.legacyUsbProductId===_);if(a)return a;const $=_>>8;return devicesList.find(et=>et.productIdMM===$)},bluetoothServices=[],serviceUuidToInfos={};for(const _ in devices){const a=devices[_],{bluetoothSpec:$}=a;if($)for(let j=0;j<$.length;j++){const et=$[j];bluetoothServices.push(et.serviceUuid),serviceUuidToInfos[et.serviceUuid]=serviceUuidToInfos[et.serviceUuid.replace(/-/g,"")]=Object.assign({deviceModel:a},et)}}var __awaiter$6=function(_,a,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(st){try{ot(j.next(st))}catch(at){rt(at)}}function it(st){try{ot(j.throw(st))}catch(at){rt(at)}}function ot(st){st.done?tt(st.value):et(st.value).then(nt,it)}ot((j=j.apply(_,a||[])).next())})};const ledgerDevices=[{vendorId:ledgerUSBVendorId}];function requestLedgerDevice(){return __awaiter$6(this,void 0,void 0,function*(){return yield navigator.usb.requestDevice({filters:ledgerDevices})})}function getLedgerDevices(){return __awaiter$6(this,void 0,void 0,function*(){return(yield navigator.usb.getDevices()).filter(a=>a.vendorId===ledgerUSBVendorId)})}function getFirstLedgerDevice(){return __awaiter$6(this,void 0,void 0,function*(){const _=yield getLedgerDevices();return _.length>0?_[0]:requestLedgerDevice()})}const isSupported=()=>Promise.resolve(!!navigator&&!!navigator.usb&&typeof navigator.usb.getDevices=="function");var __awaiter$5=function(_,a,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(st){try{ot(j.next(st))}catch(at){rt(at)}}function it(st){try{ot(j.throw(st))}catch(at){rt(at)}}function ot(st){st.done?tt(st.value):et(st.value).then(nt,it)}ot((j=j.apply(_,a||[])).next())})};const configurationValue=1,endpointNumber=3;class TransportWebUSB extends Transport$1{constructor(a,$){super(),this.channel=Math.floor(Math.random()*65535),this.packetSize=64,this._disconnectEmitted=!1,this._emitDisconnect=j=>{this._disconnectEmitted||(this._disconnectEmitted=!0,this.emit("disconnect",j))},this.device=a,this.interfaceNumber=$,this.deviceModel=identifyUSBProductId(a.productId)}static request(){return __awaiter$5(this,void 0,void 0,function*(){const a=yield requestLedgerDevice();return TransportWebUSB.open(a)})}static openConnected(){return __awaiter$5(this,void 0,void 0,function*(){const a=yield getLedgerDevices();return a.length===0?null:TransportWebUSB.open(a[0])})}static open(a){return __awaiter$5(this,void 0,void 0,function*(){yield a.open(),a.configuration===null&&(yield a.selectConfiguration(configurationValue)),yield gracefullyResetDevice(a);const $=a.configurations[0].interfaces.find(({alternates:rt})=>rt.some(nt=>nt.interfaceClass===255));if(!$)throw new TransportInterfaceNotAvailable("No WebUSB interface found for your Ledger device. Please upgrade firmware or contact techsupport.");const j=$.interfaceNumber;try{yield a.claimInterface(j)}catch(rt){throw yield a.close(),new TransportInterfaceNotAvailable(rt.message)}const et=new TransportWebUSB(a,j),tt=rt=>{a===rt.device&&(navigator.usb.removeEventListener("disconnect",tt),et._emitDisconnect(new DisconnectedDevice))};return navigator.usb.addEventListener("disconnect",tt),et})}close(){return __awaiter$5(this,void 0,void 0,function*(){yield this.exchangeBusyPromise,yield this.device.releaseInterface(this.interfaceNumber),yield gracefullyResetDevice(this.device),yield this.device.close()})}exchange(a){return __awaiter$5(this,void 0,void 0,function*(){return yield this.exchangeAtomicImpl(()=>__awaiter$5(this,void 0,void 0,function*(){const{channel:j,packetSize:et}=this;log$7("apdu","=> "+a.toString("hex"));const tt=createHIDframing(j,et),rt=tt.makeBlocks(a);for(let ot=0;ot{throw j&&j.message&&j.message.includes("disconnected")?(this._emitDisconnect(j),new DisconnectedDeviceDuringOperation(j.message)):j})})}setScrambleKey(){}}TransportWebUSB.isSupported=isSupported;TransportWebUSB.list=getLedgerDevices;TransportWebUSB.listen=_=>{let a=!1;getFirstLedgerDevice().then(j=>{if(!a){const et=identifyUSBProductId(j.productId);_.next({type:"add",descriptor:j,deviceModel:et}),_.complete()}},j=>{window.DOMException&&j instanceof window.DOMException&&j.code===18?_.error(new TransportWebUSBGestureRequired(j.message)):_.error(new TransportOpenUserCancelled(j.message))});function $(){a=!0}return{unsubscribe:$}};function gracefullyResetDevice(_){return __awaiter$5(this,void 0,void 0,function*(){try{yield _.reset()}catch(a){console.warn(a)}})}function __awaiter$4(_,a,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(st){try{ot(j.next(st))}catch(at){rt(at)}}function it(st){try{ot(j.throw(st))}catch(at){rt(at)}}function ot(st){st.done?tt(st.value):et(st.value).then(nt,it)}ot((j=j.apply(_,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const MAX_CHUNK_SIZE=230;function transformPathToBuffer(_){const a=[];_.split("/").forEach(et=>{let tt=parseInt(et,10);Number.isNaN(tt)||(et.length>1&&et[et.length-1]==="'"&&(tt+=2147483648),a.push(tt))});const j=Buffer$g.alloc(1+a.length*4);return j[0]=a.length,a.forEach((et,tt)=>{j.writeUInt32BE(et,1+4*tt)}),j}function compressPublicKey(_,a){return a===0||a===3?_=_.slice(1):(_[0]=2+(_[64]&1),_=_.slice(0,33)),_}function appendWatermark(_,a){let $=_;return typeof a<"u"&&($=Buffer$g.from(a).toString("hex").concat(_)),$}function chunkOperation(_,a){let $=0;for(;$!==a.length;){const j=$+MAX_CHUNK_SIZE>=a.length?a.length-$:MAX_CHUNK_SIZE,et=Buffer$g.alloc(j);a.copy(et,0,$,$+j),_.push(et),$+=j}return _}function validateResponse(_){let a=!0;_[0]!==49&&_[0]!==48&&(a=!1),_[1]+4!==_.length&&(a=!1),_[2]!==2&&(a=!1);const $=_[3];_[4+$]!==2&&(a=!1);const j=5+$,et=_[j];return j+1+et+2!==_.length&&(a=!1),a}function extractValue(_,a){const $=Buffer$g.alloc(32);$.fill(0);let j=a[_],et=_+1;return j>32&&(et+=j-32,j=32),a.copy($,32-j,et,et+j),{buffer:$,idxValueStart:et,length:j}}class InvalidLedgerResponseError extends TaquitoError{constructor(a){super(),this.message=a,this.name="InvalidLedgerResponseError"}}class PublicKeyRetrievalError extends TaquitoError{constructor(a){super(),this.cause=a,this.name="PublicKeyRetrievalError",this.message="Unable to retrieve Public Key from Ledger"}}class PublicKeyHashRetrievalError extends TaquitoError{constructor(){super(),this.name="PublicKeyHashRetrievalError",this.message="Unable to retrieve Public Key Hash from Ledger"}}class InvalidDerivationTypeError extends ParameterValidationError{constructor(a){super(),this.derivationType=a,this.name="InvalidDerivationTypeError",this.message=`Invalid derivation type ${a} expecting one of the following: DerivationType.ED25519, DerivationType.SECP256K1, DerivationType.P256 or DerivationType.BIP32_ED25519`}}var DerivationType;(function(_){_[_.ED25519=0]="ED25519",_[_.SECP256K1=1]="SECP256K1",_[_.P256=2]="P256",_[_.BIP32_ED25519=3]="BIP32_ED25519"})(DerivationType||(DerivationType={}));class LedgerSigner{constructor(a,$="44'/1729'/0'/0'",j=!0,et=DerivationType.ED25519){if(this.transport=a,this.path=$,this.prompt=j,this.derivationType=et,this.CLA=128,this.INS_GET_PUBLIC_KEY=2,this.INS_PROMPT_PUBLIC_KEY=3,this.INS_SIGN=4,this.FIRST_MESSAGE_SEQUENCE=0,this.LAST_MESSAGE_SEQUENCE=129,this.OTHER_MESSAGE_SEQUENCE=1,this.transport.setScrambleKey("XTZ"),!$.startsWith("44'/1729'"))throw new InvalidDerivationPathError($,`${invalidDetail(ValidationResult.NO_PREFIX_MATCHED)} expecting prefix "44'/1729'".`);if(!Object.values(DerivationType).includes(et))throw new InvalidDerivationTypeError(et.toString())}publicKeyHash(){return __awaiter$4(this,void 0,void 0,function*(){if(this._publicKeyHash||(yield this.publicKey()),this._publicKeyHash)return this._publicKeyHash;throw new PublicKeyHashRetrievalError})}publicKey(){return __awaiter$4(this,void 0,void 0,function*(){if(this._publicKey)return this._publicKey;const a=yield this.getLedgerPublicKey(),$=a[0],j=a.slice(1,1+$),et=compressPublicKey(j,this.derivationType),tt=this.getPrefixes(),rt=b58cencode(et,tt.prefPk),nt=b58cencode(blake2b$1.hash(et,20),tt.prefPkh);return this._publicKey=rt,this._publicKeyHash=nt,rt})}getLedgerPublicKey(){return __awaiter$4(this,void 0,void 0,function*(){try{let a=this.INS_PROMPT_PUBLIC_KEY;return this.prompt===!1&&(a=this.INS_GET_PUBLIC_KEY),yield this.transport.send(this.CLA,a,this.FIRST_MESSAGE_SEQUENCE,this.derivationType,transformPathToBuffer(this.path))}catch(a){throw new PublicKeyRetrievalError(a)}})}secretKey(){return __awaiter$4(this,void 0,void 0,function*(){throw new ProhibitedActionError("Secret key cannot be exposed")})}sign(a,$){return __awaiter$4(this,void 0,void 0,function*(){const j=appendWatermark(a,$),et=Buffer$g.from(j,"hex");let tt=[];tt.push(transformPathToBuffer(this.path)),tt=chunkOperation(tt,et);const rt=yield this.signWithLedger(tt);let nt;if(this.derivationType===DerivationType.ED25519||this.derivationType===DerivationType.BIP32_ED25519)nt=rt.slice(0,rt.length-2).toString("hex");else{if(!validateResponse(rt))throw new InvalidLedgerResponseError("Invalid signature return by ledger unable to parse the response");const ot=extractValue(3,rt),st=ot.idxValueStart+ot.length+1,at=extractValue(st,rt);nt=Buffer$g.concat([ot.buffer,at.buffer]).toString("hex")}return{bytes:a,sig:b58cencode(nt,prefix[Prefix.SIG]),prefixSig:b58cencode(nt,this.getPrefixes().prefSig),sbytes:a+nt}})}signWithLedger(a){return __awaiter$4(this,void 0,void 0,function*(){let $=yield this.transport.send(this.CLA,this.INS_SIGN,this.FIRST_MESSAGE_SEQUENCE,this.derivationType,a[0]);for(let j=1;j{$.push(encodeURIComponent(et)+"="+encodeURIComponent(rt))});continue}$.push(encodeURIComponent(et)+"="+encodeURIComponent(tt))}const j=$.join("&");return j?`?${j}`:""}createRequest({url:a,method:$,timeout:j=this.timeout,query:et,headers:tt={},json:rt=!0},nt){return __awaiter$3(this,void 0,void 0,function*(){const it=a+this.serialize(et);tt["Content-Type"]||(tt["Content-Type"]="application/json");const ot=new AbortController,st=setTimeout(()=>ot.abort(),j);try{const at=yield fetch$1(it,{method:$,headers:tt,body:JSON.stringify(nt),signal:ot.signal});if(typeof at>"u")throw new Error("Response is undefined");if(at.status>=400){const ut=yield at.text();throw new HttpResponseError(`Http error response: (${at.status}) ${ut}`,at.status,at.statusText,ut,it)}return rt?at.json():at.text()}catch(at){throw at instanceof Error&&at.name==="AbortError"?new HttpTimeoutError(j,it):at instanceof HttpResponseError?at:new HttpRequestFailed(String($),it,at)}finally{clearTimeout(st)}})}}function __rest$2(_,a){var $={};for(var j in _)Object.prototype.hasOwnProperty.call(_,j)&&a.indexOf(j)<0&&($[j]=_[j]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(_);et"u"&&(a=Object.keys(_));const j=$?[]:{};return a.forEach(et=>{const tt=_[et];let rt;if(!(typeof tt>"u")){if(Array.isArray(tt)){rt=castToBigNumber(tt),j[et]=rt;return}rt=new BigNumber(tt),j[et]=rt}}),j}var OPERATION_METADATA;(function(_){_.TOO_LARGE="too large"})(OPERATION_METADATA||(OPERATION_METADATA={}));var METADATA_BALANCE_UPDATES_CATEGORY;(function(_){_.BAKING_BONUSES="baking bonuses",_.BAKING_REWARDS="baking rewards",_.BLOCK_FEES="block fees",_.BONDS="bonds",_.BOOTSTRAP="bootstrap",_.BURNED="burned",_.COMMITMENT="commitment",_.DELEGATE_DENOMINATOR="delegate_denominator",_.DELEGATOR_NUMERATOR="delegator_numerator",_.DEPOSITS="deposits",_.ENDORSING_REWARDS="endorsing rewards",_.INVOICE="invoice",_.LOST_ENDORSING_REWARDS="lost endorsing rewards",_.MINTED="minted",_.NONCE_REVELATION_REWARDS="nonce revelation rewards",_.PUNISHMENTS="punishments",_.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",_.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",_.STORAGE_FEES="storage fees",_.SUBSIDY="subsidy",_.UNSTAKED_DEPOSITS="unstaked_deposits"})(METADATA_BALANCE_UPDATES_CATEGORY||(METADATA_BALANCE_UPDATES_CATEGORY={}));var PvmKind;(function(_){_.WASM2="wasm_2_0_0",_.ARITH="arith",_.RISCV="riscv"})(PvmKind||(PvmKind={}));var SmartRollupRefutationOptions;(function(_){_.START="start",_.MOVE="move"})(SmartRollupRefutationOptions||(SmartRollupRefutationOptions={}));var SmartRollupInputProofKind;(function(_){_.INBOX_PROOF="inbox_proof",_.REVEAL_PROOF="reveal_proof",_.FIRST_INPUT="first_input"})(SmartRollupInputProofKind||(SmartRollupInputProofKind={}));var SmartRollupRefuteRevealProofKind;(function(_){_.RAW_DATA_PROOF="raw_data_proof",_.METADATA_PROOF="metadata_proof",_.DAL_PAGE_PROOF="dal_page_proof"})(SmartRollupRefuteRevealProofKind||(SmartRollupRefuteRevealProofKind={}));var SmartRollupRefuteGameStatusOptions;(function(_){_.ONGOING="ongoing",_.ENDED="ended"})(SmartRollupRefuteGameStatusOptions||(SmartRollupRefuteGameStatusOptions={}));var SmartRollupRefuteGameEndedPlayerOutcomes;(function(_){_.LOSER="loser",_.DRAW="draw"})(SmartRollupRefuteGameEndedPlayerOutcomes||(SmartRollupRefuteGameEndedPlayerOutcomes={}));var SmartRollupRefuteGameEndedReason;(function(_){_.CONFLICT_RESOLVED="conflict_resolved",_.TIMEOUT="timeout"})(SmartRollupRefuteGameEndedReason||(SmartRollupRefuteGameEndedReason={}));var OpKind;(function(_){_.ORIGINATION="origination",_.DELEGATION="delegation",_.REVEAL="reveal",_.TRANSACTION="transaction",_.ACTIVATION="activate_account",_.ATTESTATION="attestation",_.ENDORSEMENT="endorsement",_.PREATTESTATION="preattestation",_.PREENDORSEMENT="preendorsement",_.SET_DEPOSITS_LIMIT="set_deposits_limit",_.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",_.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",_.ATTESTATION_WITH_SLOT="attestation_with_slot",_.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",_.SEED_NONCE_REVELATION="seed_nonce_revelation",_.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",_.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",_.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",_.PROPOSALS="proposals",_.BALLOT="ballot",_.FAILING_NOOP="failing_noop",_.REGISTER_GLOBAL_CONSTANT="register_global_constant",_.TRANSFER_TICKET="transfer_ticket",_.INCREASE_PAID_STORAGE="increase_paid_storage",_.UPDATE_CONSENSUS_KEY="update_consensus_key",_.DRAIN_DELEGATE="drain_delegate",_.VDF_REVELATION="vdf_revelation",_.EVENT="event",_.TICKET_UPDATES="ticket_updates",_.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",_.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",_.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",_.SMART_ROLLUP_PUBLISH="smart_rollup_publish",_.SMART_ROLLUP_CEMENT="smart_rollup_cement",_.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",_.SMART_ROLLUP_REFUTE="smart_rollup_refute",_.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout"})(OpKind||(OpKind={}));class RpcClient{constructor(a,$=defaultChain,j=new HttpBackend){this.url=a,this.chain=$,this.httpBackend=j}createURL(a){let $=this.url;for(;$.endsWith("/");)$=$.slice(0,-1);return`${$}${a}`}validateAddress(a){const $=validateAddress(a);if($!==ValidationResult.VALID)throw new InvalidAddressError(a,invalidDetail($))}validateContract(a){const $=validateContractAddress(a);if($!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail($))}getBlockHash({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/hash`),method:"GET"})})}getLiveBlocks({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/live_blocks`),method:"GET"})})}getBalance(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/balance`),method:"GET"});return new BigNumber(j)})}getStorage(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/storage`),method:"GET"})})}getScript(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/script`),method:"GET"})})}getNormalizedScript(a,$={unparsing_mode:"Readable"},{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${a}/script/normalized`),method:"POST"},$)})}getContract(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}`),method:"GET"});return Object.assign(Object.assign({},j),{balance:new BigNumber(j.balance)})})}getManagerKey(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/manager_key`),method:"GET"})})}getDelegate(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);let j;try{j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/delegate`),method:"GET"})}catch(et){if(et instanceof HttpResponseError&&et.status===STATUS_CODE.NOT_FOUND)j=null;else throw et}return j})}getBigMapKey(a,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${a}/big_map_get`),method:"POST"},$)})}getBigMapExpr(a,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/big_maps/${a}/${$}`),method:"GET"})})}getDelegates(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/delegates/${a}`),method:"GET"}),et=castToBigNumber(j,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance","voting_power","total_delegated_stake","staking_denominator"]);return Object.assign(Object.assign(Object.assign({},j),et),{frozen_balance_by_cycle:j.frozen_balance_by_cycle?j.frozen_balance_by_cycle.map(tt=>{var{deposit:rt,deposits:nt,fees:it,rewards:ot}=tt,st=__rest$2(tt,["deposit","deposits","fees","rewards"]);const at=castToBigNumber({deposit:rt,deposits:nt,fees:it,rewards:ot},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},st),{deposit:at.deposit,deposits:at.deposits,fees:at.fees,rewards:at.rewards})}):void 0})})}getVotingInfo(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(a),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/delegates/${a}/voting_info`),method:"GET"})})}getConstants({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/context/constants`),method:"GET"}),j=castToBigNumber($,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_endorsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round","tx_rollup_commitment_bond","vdf_difficulty","sc_rollup_stake_amount","minimal_stake"]);return Object.assign(Object.assign({},$),j)})}getBlock({block:a,version:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j={url:this.createURL(`/chains/${this.chain}/blocks/${a}`),method:"GET"};return $!==void 0&&(j.query={version:$}),yield this.httpBackend.createRequest(j)})}getBlockHeader({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/header`),method:"GET"})})}getBlockMetadata({block:a,version:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j={url:this.createURL(`/chains/${this.chain}/blocks/${a}/metadata`),method:"GET"};return $!==void 0&&(j.query={version:$}),yield this.httpBackend.createRequest(j)})}getBakingRights(a={},{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/baking_rights`),method:"GET",query:a})})}getAttestationRights(a={},{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/attestation_rights`),method:"GET",query:a})})}getEndorsingRights(a={},{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/endorsing_rights`),method:"GET",query:a})})}getBallotList({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/ballot_list`),method:"GET"})})}getBallots({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/ballots`),method:"GET"});return castToBigNumber($,["yay","nay","pass"])})}getCurrentProposal({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/current_proposal`),method:"GET"})})}getCurrentQuorum({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/current_quorum`),method:"GET"})})}getVotesListings({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/listings`),method:"GET"});return $.map(j=>(j.voting_power&&(j.voting_power=new BigNumber(j.voting_power)),j)),$})}getProposals({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/proposals`),method:"GET"});return $.map(j=>j[1]=new BigNumber(j[1])),$})}forgeOperations(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/forge/operations`),method:"POST"},a)})}injectOperation(a){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},a)})}preapplyOperations(a,{block:$,version:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const et={url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/preapply/operations`),method:"POST"};return j!==void 0&&(et.query={version:j}),yield this.httpBackend.createRequest(et,a)})}getEntrypoints(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/entrypoints`),method:"GET"})})}runOperation(a,{block:$,version:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const et={url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/run_operation`),method:"POST"};return j!==void 0&&(et.query={version:j}),yield this.httpBackend.createRequest(et,a)})}simulateOperation(a,{block:$,version:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const et={url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/simulate_operation`),method:"POST"};return j!==void 0&&(et.query={version:j}),yield this.httpBackend.createRequest(et,a)})}runCode(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/run_code`),method:"POST"},a)})}runScriptView(a,$){var{unparsing_mode:j="Readable"}=a,et=__rest$2(a,["unparsing_mode"]),tt=$===void 0?defaultRPCOptions:$,rt=tt.block;return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${rt}/helpers/scripts/run_script_view`),method:"POST"},Object.assign({unparsing_mode:j},et))})}runView(a,$){var{unparsing_mode:j="Readable"}=a,et=__rest$2(a,["unparsing_mode"]),tt=$===void 0?defaultRPCOptions:$,rt=tt.block;return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${rt}/helpers/scripts/run_view`),method:"POST"},Object.assign({unparsing_mode:j},et))})}getChainId(){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})})}packData(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/pack_data`),method:"POST"},a),{gas:et}=j,tt=__rest$2(j,["gas"]);let rt=et;const nt=new BigNumber(et||"");return nt.isNaN()||(rt=nt),Object.assign({gas:rt},tt)})}getRpcUrl(){return this.url}getCurrentPeriod({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/current_period`),method:"GET"})})}getSuccessorPeriod({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/successor_period`),method:"GET"})})}getSaplingDiffById(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/sapling/${a}/get_diff`),method:"GET"})})}getSaplingDiffByContract(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/single_sapling_get_diff`),method:"GET"})})}getProtocols({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/protocols`),method:"GET"})})}getStorageUsedSpace(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/storage/used_space`),method:"GET"})})}getStoragePaidSpace(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/storage/paid_space`),method:"GET"})})}getTicketBalance(a,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${a}/ticket_balance`),method:"POST"},$)})}getAllTicketBalances(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/all_ticket_balances`),method:"GET"})})}getPendingOperations(a={}){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/pending_operations`),method:"GET",query:a})})}}var src={},sha256$1={},_sha2={},_assert={};Object.defineProperty(_assert,"__esModule",{value:!0});_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function number$2(_){if(!Number.isSafeInteger(_)||_<0)throw new Error(`Wrong positive integer: ${_}`)}_assert.number=number$2;function bool$2(_){if(typeof _!="boolean")throw new Error(`Expected boolean, not ${_}`)}_assert.bool=bool$2;function bytes$1(_,...a){if(!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length>0&&!a.includes(_.length))throw new TypeError(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}_assert.bytes=bytes$1;function hash$3(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(_.outputLen),number$2(_.blockLen)}_assert.hash=hash$3;function exists$1(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=exists$1;function output$1(_,a){bytes$1(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert.output=output$1;const assert$b={number:number$2,bool:bool$2,bytes:bytes$1,hash:hash$3,exists:exists$1,output:output$1};_assert.default=assert$b;var utils$d={},crypto$1={};Object.defineProperty(crypto$1,"__esModule",{value:!0});crypto$1.crypto=void 0;crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(_){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_,"__esModule",{value:!0}),_.randomBytes=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;const a=crypto$1,$=Lt=>new Uint8Array(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.u8=$;const j=Lt=>new Uint32Array(Lt.buffer,Lt.byteOffset,Math.floor(Lt.byteLength/4));_.u32=j;const et=Lt=>new DataView(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.createView=et;const tt=(Lt,Nt)=>Lt<<32-Nt|Lt>>>Nt;if(_.rotr=tt,_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!_.isLE)throw new Error("Non little-endian hardware is not supported");const rt=Array.from({length:256},(Lt,Nt)=>Nt.toString(16).padStart(2,"0"));function nt(Lt){if(!(Lt instanceof Uint8Array))throw new Error("Uint8Array expected");let Nt="";for(let Ut=0;Ut{};_.nextTick=ot;async function st(Lt,Nt,Ut){let jt=Date.now();for(let Mt=0;Mt=0&&Dtjt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Lt.length===1)return Lt[0];const Nt=Lt.reduce((jt,Mt)=>jt+Mt.length,0),Ut=new Uint8Array(Nt);for(let jt=0,Mt=0;jtObject.prototype.toString.call(Lt)==="[object Object]"&&Lt.constructor===Object;function Ct(Lt,Nt){if(Nt!==void 0&&(typeof Nt!="object"||!Et(Nt)))throw new TypeError("Options should be object or undefined");return Object.assign(Lt,Nt)}_.checkOpts=Ct;function Pt(Lt){const Nt=jt=>Lt().update(ut(jt)).digest(),Ut=Lt();return Nt.outputLen=Ut.outputLen,Nt.blockLen=Ut.blockLen,Nt.create=()=>Lt(),Nt}_.wrapConstructor=Pt;function Tt(Lt){const Nt=(jt,Mt)=>Lt(Mt).update(ut(jt)).digest(),Ut=Lt({});return Nt.outputLen=Ut.outputLen,Nt.blockLen=Ut.blockLen,Nt.create=jt=>Lt(jt),Nt}_.wrapConstructorWithOpts=Tt;function It(Lt=32){if(a.crypto&&typeof a.crypto.getRandomValues=="function")return a.crypto.getRandomValues(new Uint8Array(Lt));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=It})(utils$d);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1$1=_assert,utils_js_1$3=utils$d;function setBigUint64(_,a,$,j){if(typeof _.setBigUint64=="function")return _.setBigUint64(a,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,ot=j?0:4;_.setUint32(a+it,rt,j),_.setUint32(a+ot,nt,j)}class SHA2 extends utils_js_1$3.Hash{constructor(a,$,j,et){super(),this.blockLen=a,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,utils_js_1$3.createView)(this.buffer)}update(a){_assert_js_1$1.default.exists(this);const{view:$,buffer:j,blockLen:et}=this;a=(0,utils_js_1$3.toBytes)(a);const tt=a.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let at=rt;atst.length)throw new Error("_sha2: outputLen bigger than state");for(let at=0;at_&a^~_&$,Maj=(_,a,$)=>_&a^_&$^a&$,SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends _sha2_js_1$1.SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:a,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[a,$,j,et,tt,rt,nt,it]}set(a,$,j,et,tt,rt,nt,it){this.A=a|0,this.B=$|0,this.C=j|0,this.D=et|0,this.E=tt|0,this.F=rt|0,this.G=nt|0,this.H=it|0}process(a,$){for(let at=0;at<16;at++,$+=4)SHA256_W[at]=a.getUint32($,!1);for(let at=16;at<64;at++){const ut=SHA256_W[at-15],ht=SHA256_W[at-2],bt=(0,utils_js_1$2.rotr)(ut,7)^(0,utils_js_1$2.rotr)(ut,18)^ut>>>3,Et=(0,utils_js_1$2.rotr)(ht,17)^(0,utils_js_1$2.rotr)(ht,19)^ht>>>10;SHA256_W[at]=Et+SHA256_W[at-7]+bt+SHA256_W[at-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:ot,H:st}=this;for(let at=0;at<64;at++){const ut=(0,utils_js_1$2.rotr)(nt,6)^(0,utils_js_1$2.rotr)(nt,11)^(0,utils_js_1$2.rotr)(nt,25),ht=st+ut+Chi(nt,it,ot)+SHA256_K[at]+SHA256_W[at]|0,Et=((0,utils_js_1$2.rotr)(j,2)^(0,utils_js_1$2.rotr)(j,13)^(0,utils_js_1$2.rotr)(j,22))+Maj(j,et,tt)|0;st=ot,ot=it,it=nt,nt=rt+ht|0,rt=tt,tt=et,et=j,j=ht+Et|0}j=j+this.A|0,et=et+this.B|0,tt=tt+this.C|0,rt=rt+this.D|0,nt=nt+this.E|0,it=it+this.F|0,ot=ot+this.G|0,st=st+this.H|0,this.set(j,et,tt,rt,nt,it,ot,st)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class SHA224 extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}sha256$1.sha256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA256);sha256$1.sha224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA224);var sha512$1={},_u64={};(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.add=_.toBig=_.split=_.fromBig=void 0;const a=BigInt(2**32-1),$=BigInt(32);function j(Ft,Bt=!1){return Bt?{h:Number(Ft&a),l:Number(Ft>>$&a)}:{h:Number(Ft>>$&a)|0,l:Number(Ft&a)|0}}_.fromBig=j;function et(Ft,Bt=!1){let yt=new Uint32Array(Ft.length),mt=new Uint32Array(Ft.length);for(let ct=0;ctBigInt(Ft>>>0)<<$|BigInt(Bt>>>0);_.toBig=tt;const rt=(Ft,Bt,yt)=>Ft>>>yt,nt=(Ft,Bt,yt)=>Ft<<32-yt|Bt>>>yt,it=(Ft,Bt,yt)=>Ft>>>yt|Bt<<32-yt,ot=(Ft,Bt,yt)=>Ft<<32-yt|Bt>>>yt,st=(Ft,Bt,yt)=>Ft<<64-yt|Bt>>>yt-32,at=(Ft,Bt,yt)=>Ft>>>yt-32|Bt<<64-yt,ut=(Ft,Bt)=>Bt,ht=(Ft,Bt)=>Ft,bt=(Ft,Bt,yt)=>Ft<>>32-yt,Et=(Ft,Bt,yt)=>Bt<>>32-yt,Ct=(Ft,Bt,yt)=>Bt<>>64-yt,Pt=(Ft,Bt,yt)=>Ft<>>64-yt;function Tt(Ft,Bt,yt,mt){const ct=(Bt>>>0)+(mt>>>0);return{h:Ft+yt+(ct/2**32|0)|0,l:ct|0}}_.add=Tt;const It=(Ft,Bt,yt)=>(Ft>>>0)+(Bt>>>0)+(yt>>>0),Lt=(Ft,Bt,yt,mt)=>Bt+yt+mt+(Ft/2**32|0)|0,Nt=(Ft,Bt,yt,mt)=>(Ft>>>0)+(Bt>>>0)+(yt>>>0)+(mt>>>0),Ut=(Ft,Bt,yt,mt,ct)=>Bt+yt+mt+ct+(Ft/2**32|0)|0,jt=(Ft,Bt,yt,mt,ct)=>(Ft>>>0)+(Bt>>>0)+(yt>>>0)+(mt>>>0)+(ct>>>0),Mt=(Ft,Bt,yt,mt,ct,dt)=>Bt+yt+mt+ct+dt+(Ft/2**32|0)|0,Dt={fromBig:j,split:et,toBig:_.toBig,shrSH:rt,shrSL:nt,rotrSH:it,rotrSL:ot,rotrBH:st,rotrBL:at,rotr32H:ut,rotr32L:ht,rotlSH:bt,rotlSL:Et,rotlBH:Ct,rotlBL:Pt,add:Tt,add3L:It,add3H:Lt,add4L:Nt,add4H:Ut,add5H:Mt,add5L:jt};_.default=Dt})(_u64);Object.defineProperty(sha512$1,"__esModule",{value:!0});sha512$1.sha384=sha512$1.sha512_256=sha512$1.sha512_224=sha512$1.sha512=sha512$1.SHA512=void 0;const _sha2_js_1=_sha2,_u64_js_1=_u64,utils_js_1$1=utils$d,[SHA512_Kh,SHA512_Kl]=_u64_js_1.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(_=>BigInt(_))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends _sha2_js_1.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:a,Al:$,Bh:j,Bl:et,Ch:tt,Cl:rt,Dh:nt,Dl:it,Eh:ot,El:st,Fh:at,Fl:ut,Gh:ht,Gl:bt,Hh:Et,Hl:Ct}=this;return[a,$,j,et,tt,rt,nt,it,ot,st,at,ut,ht,bt,Et,Ct]}set(a,$,j,et,tt,rt,nt,it,ot,st,at,ut,ht,bt,Et,Ct){this.Ah=a|0,this.Al=$|0,this.Bh=j|0,this.Bl=et|0,this.Ch=tt|0,this.Cl=rt|0,this.Dh=nt|0,this.Dl=it|0,this.Eh=ot|0,this.El=st|0,this.Fh=at|0,this.Fl=ut|0,this.Gh=ht|0,this.Gl=bt|0,this.Hh=Et|0,this.Hl=Ct|0}process(a,$){for(let It=0;It<16;It++,$+=4)SHA512_W_H[It]=a.getUint32($),SHA512_W_L[It]=a.getUint32($+=4);for(let It=16;It<80;It++){const Lt=SHA512_W_H[It-15]|0,Nt=SHA512_W_L[It-15]|0,Ut=_u64_js_1.default.rotrSH(Lt,Nt,1)^_u64_js_1.default.rotrSH(Lt,Nt,8)^_u64_js_1.default.shrSH(Lt,Nt,7),jt=_u64_js_1.default.rotrSL(Lt,Nt,1)^_u64_js_1.default.rotrSL(Lt,Nt,8)^_u64_js_1.default.shrSL(Lt,Nt,7),Mt=SHA512_W_H[It-2]|0,Dt=SHA512_W_L[It-2]|0,Ft=_u64_js_1.default.rotrSH(Mt,Dt,19)^_u64_js_1.default.rotrBH(Mt,Dt,61)^_u64_js_1.default.shrSH(Mt,Dt,6),Bt=_u64_js_1.default.rotrSL(Mt,Dt,19)^_u64_js_1.default.rotrBL(Mt,Dt,61)^_u64_js_1.default.shrSL(Mt,Dt,6),yt=_u64_js_1.default.add4L(jt,Bt,SHA512_W_L[It-7],SHA512_W_L[It-16]),mt=_u64_js_1.default.add4H(yt,Ut,Ft,SHA512_W_H[It-7],SHA512_W_H[It-16]);SHA512_W_H[It]=mt|0,SHA512_W_L[It]=yt|0}let{Ah:j,Al:et,Bh:tt,Bl:rt,Ch:nt,Cl:it,Dh:ot,Dl:st,Eh:at,El:ut,Fh:ht,Fl:bt,Gh:Et,Gl:Ct,Hh:Pt,Hl:Tt}=this;for(let It=0;It<80;It++){const Lt=_u64_js_1.default.rotrSH(at,ut,14)^_u64_js_1.default.rotrSH(at,ut,18)^_u64_js_1.default.rotrBH(at,ut,41),Nt=_u64_js_1.default.rotrSL(at,ut,14)^_u64_js_1.default.rotrSL(at,ut,18)^_u64_js_1.default.rotrBL(at,ut,41),Ut=at&ht^~at&Et,jt=ut&bt^~ut&Ct,Mt=_u64_js_1.default.add5L(Tt,Nt,jt,SHA512_Kl[It],SHA512_W_L[It]),Dt=_u64_js_1.default.add5H(Mt,Pt,Lt,Ut,SHA512_Kh[It],SHA512_W_H[It]),Ft=Mt|0,Bt=_u64_js_1.default.rotrSH(j,et,28)^_u64_js_1.default.rotrBH(j,et,34)^_u64_js_1.default.rotrBH(j,et,39),yt=_u64_js_1.default.rotrSL(j,et,28)^_u64_js_1.default.rotrBL(j,et,34)^_u64_js_1.default.rotrBL(j,et,39),mt=j&tt^j&nt^tt&nt,ct=et&rt^et&it^rt⁢Pt=Et|0,Tt=Ct|0,Et=ht|0,Ct=bt|0,ht=at|0,bt=ut|0,{h:at,l:ut}=_u64_js_1.default.add(ot|0,st|0,Dt|0,Ft|0),ot=nt|0,st=it|0,nt=tt|0,it=rt|0,tt=j|0,rt=et|0;const dt=_u64_js_1.default.add3L(Ft,yt,ct);j=_u64_js_1.default.add3H(dt,Dt,Bt,mt),et=dt|0}({h:j,l:et}=_u64_js_1.default.add(this.Ah|0,this.Al|0,j|0,et|0)),{h:tt,l:rt}=_u64_js_1.default.add(this.Bh|0,this.Bl|0,tt|0,rt|0),{h:nt,l:it}=_u64_js_1.default.add(this.Ch|0,this.Cl|0,nt|0,it|0),{h:ot,l:st}=_u64_js_1.default.add(this.Dh|0,this.Dl|0,ot|0,st|0),{h:at,l:ut}=_u64_js_1.default.add(this.Eh|0,this.El|0,at|0,ut|0),{h:ht,l:bt}=_u64_js_1.default.add(this.Fh|0,this.Fl|0,ht|0,bt|0),{h:Et,l:Ct}=_u64_js_1.default.add(this.Gh|0,this.Gl|0,Et|0,Ct|0),{h:Pt,l:Tt}=_u64_js_1.default.add(this.Hh|0,this.Hl|0,Pt|0,Tt|0),this.set(j,et,tt,rt,nt,it,ot,st,at,ut,ht,bt,Et,Ct,Pt,Tt)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha512$1.SHA512=SHA512;class SHA512_224 extends SHA512{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class SHA512_256 extends SHA512{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class SHA384 extends SHA512{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}sha512$1.sha512=(0,utils_js_1$1.wrapConstructor)(()=>new SHA512);sha512$1.sha512_224=(0,utils_js_1$1.wrapConstructor)(()=>new SHA512_224);sha512$1.sha512_256=(0,utils_js_1$1.wrapConstructor)(()=>new SHA512_256);sha512$1.sha384=(0,utils_js_1$1.wrapConstructor)(()=>new SHA384);var pbkdf2$1={},hmac$2={};(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.hmac=void 0;const a=_assert,$=utils$d;class j extends $.Hash{constructor(rt,nt){super(),this.finished=!1,this.destroyed=!1,a.default.hash(rt);const it=(0,$.toBytes)(nt);if(this.iHash=rt.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const ot=this.blockLen,st=new Uint8Array(ot);st.set(it.length>ot?rt.create().update(it).digest():it);for(let at=0;atnew j(tt,rt).update(nt).digest();_.hmac=et,_.hmac.create=(tt,rt)=>new j(tt,rt)})(hmac$2);Object.defineProperty(pbkdf2$1,"__esModule",{value:!0});pbkdf2$1.pbkdf2Async=pbkdf2$1.pbkdf2=void 0;const _assert_js_1=_assert,hmac_js_1=hmac$2,utils_js_1=utils$d;function pbkdf2Init(_,a,$,j){_assert_js_1.default.hash(_);const et=(0,utils_js_1.checkOpts)({dkLen:32,asyncTick:10},j),{c:tt,dkLen:rt,asyncTick:nt}=et;if(_assert_js_1.default.number(tt),_assert_js_1.default.number(rt),_assert_js_1.default.number(nt),tt<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const it=(0,utils_js_1.toBytes)(a),ot=(0,utils_js_1.toBytes)($),st=new Uint8Array(rt),at=hmac_js_1.hmac.create(_,it),ut=at._cloneInto().update(ot);return{c:tt,dkLen:rt,asyncTick:nt,DK:st,PRF:at,PRFSalt:ut}}function pbkdf2Output(_,a,$,j,et){return _.destroy(),a.destroy(),j&&j.destroy(),et.fill(0),$}function pbkdf2(_,a,$,j){const{c:et,dkLen:tt,DK:rt,PRF:nt,PRFSalt:it}=pbkdf2Init(_,a,$,j);let ot;const st=new Uint8Array(4),at=(0,utils_js_1.createView)(st),ut=new Uint8Array(nt.outputLen);for(let ht=1,bt=0;bt{it._cloneInto(st).update(ht).digestInto(ht);for(let Tt=0;Ttlpad(a.toString(2),"0",8)).join("")}function deriveChecksumBits(_){const $=_.length*8/32,j=sha256_1.sha256(Uint8Array.from(_));return bytesToBinary(Array.from(j)).slice(0,$)}function salt(_){return"mnemonic"+(_||"")}function mnemonicToSeedSync(_,a){const $=Uint8Array.from(Buffer$g.from(normalize(_),"utf8")),j=Uint8Array.from(Buffer$g.from(salt(normalize(a)),"utf8")),et=pbkdf2_1.pbkdf2(sha512_1.sha512,$,j,{c:2048,dkLen:64});return Buffer$g.from(et)}var mnemonicToSeedSync_1=src.mnemonicToSeedSync=mnemonicToSeedSync;function mnemonicToSeed(_,a){const $=Uint8Array.from(Buffer$g.from(normalize(_),"utf8")),j=Uint8Array.from(Buffer$g.from(salt(normalize(a)),"utf8"));return pbkdf2_1.pbkdf2Async(sha512_1.sha512,$,j,{c:2048,dkLen:64}).then(et=>Buffer$g.from(et))}src.mnemonicToSeed=mnemonicToSeed;function mnemonicToEntropy(_,a){if(a=a||DEFAULT_WORDLIST,!a)throw new Error(WORDLIST_REQUIRED);const $=normalize(_).split(" ");if($.length%3!==0)throw new Error(INVALID_MNEMONIC);const j=$.map(st=>{const at=a.indexOf(st);if(at===-1)throw new Error(INVALID_MNEMONIC);return lpad(at.toString(2),"0",11)}).join(""),et=Math.floor(j.length/33)*32,tt=j.slice(0,et),rt=j.slice(et),nt=tt.match(/(.{1,8})/g).map(binaryToByte);if(nt.length<16)throw new Error(INVALID_ENTROPY);if(nt.length>32)throw new Error(INVALID_ENTROPY);if(nt.length%4!==0)throw new Error(INVALID_ENTROPY);const it=Buffer$g.from(nt);if(deriveChecksumBits(it)!==rt)throw new Error(INVALID_CHECKSUM);return it.toString("hex")}src.mnemonicToEntropy=mnemonicToEntropy;function entropyToMnemonic(_,a){if(Buffer$g.isBuffer(_)||(_=Buffer$g.from(_,"hex")),a=a||DEFAULT_WORDLIST,!a)throw new Error(WORDLIST_REQUIRED);if(_.length<16)throw new TypeError(INVALID_ENTROPY);if(_.length>32)throw new TypeError(INVALID_ENTROPY);if(_.length%4!==0)throw new TypeError(INVALID_ENTROPY);const $=bytesToBinary(Array.from(_)),j=deriveChecksumBits(_),rt=($+j).match(/(.{1,11})/g).map(nt=>{const it=binaryToByte(nt);return a[it]});return a[0]==="あいこくしん"?rt.join(" "):rt.join(" ")}src.entropyToMnemonic=entropyToMnemonic;function generateMnemonic(_,a,$){if(_=_||128,_%32!==0)throw new TypeError(INVALID_ENTROPY);return a=a||(j=>Buffer$g.from(utils_1.randomBytes(j))),entropyToMnemonic(a(_/8),$)}var generateMnemonic_1=src.generateMnemonic=generateMnemonic;function validateMnemonic(_,a){try{mnemonicToEntropy(_,a)}catch{return!1}return!0}var validateMnemonic_1=src.validateMnemonic=validateMnemonic;function setDefaultWordlist(_){const a=_wordlists_1.wordlists[_];if(a)DEFAULT_WORDLIST=a;else throw new Error('Could not find wordlist for language "'+_+'"')}src.setDefaultWordlist=setDefaultWordlist;function getDefaultWordlist(){if(!DEFAULT_WORDLIST)throw new Error("No Default Wordlist set");return Object.keys(_wordlists_1.wordlists).filter(_=>_==="JA"||_==="EN"?!1:_wordlists_1.wordlists[_].every((a,$)=>a===DEFAULT_WORDLIST[$]))[0]}src.getDefaultWordlist=getDefaultWordlist;var _wordlists_2=_wordlists,wordlists=src.wordlists=_wordlists_2.wordlists,hmac$1={},hash$2={};Object.defineProperty(hash$2,"__esModule",{value:!0});function isSerializableHash(_){return typeof _.saveState<"u"&&typeof _.restoreState<"u"&&typeof _.cleanSavedState<"u"}hash$2.isSerializableHash=isSerializableHash;Object.defineProperty(hmac$1,"__esModule",{value:!0});var hash_1=hash$2,constant_time_1=constantTime,wipe_1=wipe$1,HMAC=function(){function _(a,$){this._finished=!1,this._inner=new a,this._outer=new a,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var j=new Uint8Array(this.blockSize);$.length>this.blockSize?this._inner.update($).finish(j).clean():j.set($);for(var et=0;etmaxSeedSize$1)throw new InvalidSeedLengthError(tt.length);if(!Object.prototype.hasOwnProperty.call(seedKey,$))throw new InvalidCurveError(`Unsupported curve "${$}" expecting either "p256" or "secp256k1"`);const rt=new elliptic$2.ec($);if(((j=rt.n)===null||j===void 0?void 0:j.bitLength())!==256)throw new InvalidBitSize(`Invalid curve "${$}" with bit size "${(et=rt.n)===null||et===void 0?void 0:et.bitLength()}" expecting bit size "256"`);const nt=new TextEncoder().encode(seedKey[$]);let it=null,ot=new Uint8Array,st=0;for(;st===0;){const ut=new HMAC_1(sha512$2.SHA512,nt).update(tt).digest();it=new BN$h(ut.subarray(0,32)),ot=ut.subarray(32),it.isZero()||it.cmp(rt.n)>=0?tt=ut:st++}const at=rt.keyPair({});return at.priv=it,new lm(at,ot)}derive(a){const $=new Uint8Array(37);a&Hard?$.set(this.keyPair.getPrivate().toArray(),1):$.set(this.keyPair.getPublic().encodeCompressed(),0),new DataView($.buffer).setUint32(33,a);let j=new BN$h(0),et=new Uint8Array,tt=0;for(;tt===0;){const nt=new HMAC_1(sha512$2.SHA512,this.chainCode).update($).digest();j=new BN$h(nt.subarray(0,32)),et=nt.subarray(32),this.keyPair.ec.n&&j.cmp(this.keyPair.ec.n)<0&&(j=j.add(this.keyPair.getPrivate()).mod(this.keyPair.ec.n),j.isZero()||tt++),$.set(et,1),$[0]=1}const rt=this.keyPair.ec.keyPair({});return rt.priv=j,new lm(rt,et)}derivePath(a){let $=this;for(const j of a)$=$.derive(j);return $}bytes(){if(!this.keyPair.priv)throw new InvalidKeyError("missing private key");const a=this.keyPair.priv.toArray(),$=new Uint8Array(32);return $.set(a,$.length-a.length),$}};const Hard=2147483648;class Path extends Array{static from(a){return super.from(a).map($=>$>>>0)}static fromString(a){if(a.length===0)return new Path;let $=a.split("/");const j=[];$[0]==="m"&&($=$.slice(1));for(let et of $){if(et.length===0)throw new InvalidDerivationPathError(a,": Invalid BIP32 path");let tt=0;const rt=et[et.length-1];(rt==="'"||rt==="h"||rt==="H")&&(tt=Hard,et=et.slice(0,et.length-1));const nt=(parseInt(et,10)|tt)>>>0;j.push(nt)}return Path.from(j)}}const minSeedSize=16,maxSeedSize=64,ed25519Key="ed25519 seed";class PrivateKey{constructor(a,$){this.priv=a,this.chainCode=$}static fromSeed(a){const $=typeof a=="string"?parseHex(a):a;if($.lengthmaxSeedSize)throw new InvalidSeedLengthError($.length);const j=new TextEncoder().encode(ed25519Key),et=new HMAC_1(sha512$2.SHA512,j).update($).digest();return new PrivateKey(ed25519.generateKeyPairFromSeed(et.subarray(0,32)).secretKey,et.subarray(32))}seed(){return this.priv.subarray(0,32)}derive(a){if(!(a&Hard))throw new InvalidDerivationPathError(a.toString(),": Non-hardened derivation path.");const $=new Uint8Array(37);$.set(this.seed(),1),new DataView($.buffer).setUint32(33,a);const j=new HMAC_1(sha512$2.SHA512,this.chainCode).update($).digest();return new PrivateKey(ed25519.generateKeyPairFromSeed(j.subarray(0,32)).secretKey,j.subarray(32))}derivePath(a){let $=this;for(const j of a)$=$.derive(j);return $}}const generateSecretKey=(_,a,$)=>{const j=Path.fromString(a);let et;switch($){case"ed25519":return et=PrivateKey.fromSeed(_).derivePath(j),b58cencode(et.seed().slice(0,32),prefix.edsk2);case"secp256k1":case"p256":{const tt=$==="secp256k1"?prefix.spsk:prefix.p2sk;let rt=PrivateKey$1.fromSeed(_,$);rt=rt.derivePath(j);const nt=new Uint8Array(rt.keyPair.getPrivate().toArray());return b58cencode(nt,tt)}case"bip25519":throw new ToBeImplemented;default:throw new InvalidCurveError(`Unsupported curve "${$}" expecting one of the following "ed25519", "secp256k1", "p256"`)}};class InMemorySigner{static fromFundraiser(a,$,j){if(!validateMnemonic_1(j))throw new InvalidMnemonicError(j);const et=mnemonicToSeedSync_1(j,`${a}${$}`),tt=b58cencode(et.slice(0,32),prefix.edsk2);return new InMemorySigner(tt)}static fromSecretKey(a,$){return __awaiter$1(this,void 0,void 0,function*(){return new InMemorySigner(a,$)})}static fromMnemonic({mnemonic:a,password:$="",derivationPath:j="44'/1729'/0'/0'",curve:et="ed25519"}){if(!validateMnemonic_1(a))throw new InvalidMnemonicError(a);const tt=mnemonicToSeedSync_1(a,$),rt=generateSecretKey(tt,j,et);return new InMemorySigner(rt)}constructor(a,$){const j=a.substring(2,3)==="e";let et=tt=>tt;if(j){if(!$)throw new InvalidPassphraseError("No passphrase provided to decrypt encrypted key");et=tt=>{const rt=toBuffer$1(tt.slice(0,8)),nt=tt.slice(8),it=browser$7.pbkdf2Sync($,rt,32768,32,"sha512");return nacl.openSecretBox(new Uint8Array(it),new Uint8Array(24),new Uint8Array(nt))}}switch(a.substring(0,4)){case"edes":case"edsk":this._key=new Tz1(a,j,et);break;case"spsk":case"spes":this._key=new Tz2(a,j,et);break;case"p2sk":case"p2es":this._key=new Tz3(a,j,et);break;default:throw new InvalidKeyError(`${invalidDetail(ValidationResult.NO_PREFIX_MATCHED)} expecting one of the following '${Prefix.EDESK}', '${Prefix.EDSK}', '${Prefix.SPSK}', '${Prefix.SPESK}', '${Prefix.P2SK}' or '${Prefix.P2ESK}'.`)}}sign(a,$){return __awaiter$1(this,void 0,void 0,function*(){let j=hex2buf(a);typeof $<"u"&&(j=mergebuf($,j));const et=blake2b$1.hash(j,32);return this._key.sign(a,et)})}publicKey(){return __awaiter$1(this,void 0,void 0,function*(){return this._key.publicKey()})}publicKeyHash(){return __awaiter$1(this,void 0,void 0,function*(){return this._key.publicKeyHash()})}secretKey(){return __awaiter$1(this,void 0,void 0,function*(){return this._key.secretKey()})}}function isFunction$1(_){return typeof _=="function"}function createErrorClass(_){var a=function(j){Error.call(j),j.stack=new Error().stack},$=_(a);return $.prototype=Object.create(Error.prototype),$.prototype.constructor=$,$}var UnsubscriptionError=createErrorClass(function(_){return function($){_(this),this.message=$?$.length+` errors occurred during unsubscription: + */var g=reactExports;function n$1(_,a){return _===a&&(_!==0||1/_===1/a)||_!==_&&a!==a}var p=typeof Object.is=="function"?Object.is:n$1,q=g.useSyncExternalStore,r$1=g.useRef,t$3=g.useEffect,u=g.useMemo,v=g.useDebugValue;useSyncExternalStoreWithSelector_production_min.useSyncExternalStoreWithSelector=function(_,a,$,j,et){var tt=r$1(null);if(tt.current===null){var rt={hasValue:!1,value:null};tt.current=rt}else rt=tt.current;tt=u(function(){function it(dt){if(!at){if(at=!0,st=dt,dt=j(dt),et!==void 0&&rt.hasValue){var mt=rt.value;if(et(mt,dt))return ot=mt}return ot=dt}if(mt=ot,p(st,dt))return mt;var xt=j(dt);return et!==void 0&&et(mt,xt)?mt:(st=dt,ot=xt)}var at=!1,st,ot,ut=$===void 0?null:$;return[function(){return it(a())},ut===null?void 0:function(){return it(ut())}]},[a,$,j,et]);var nt=q(_,tt[0],tt[1]);return t$3(function(){rt.hasValue=!0,rt.value=nt},[nt]),v(nt),nt};withSelector.exports=useSyncExternalStoreWithSelector_production_min;var withSelectorExports=withSelector.exports,React$1="default"in React$3?React$2:React$3,ContextKey=Symbol.for("react-redux-context"),gT=typeof globalThis<"u"?globalThis:{};function getContext(){if(!React$1.createContext)return{};const _=gT[ContextKey]??(gT[ContextKey]=new Map);let a=_.get(React$1.createContext);return a||(a=React$1.createContext(null),_.set(React$1.createContext,a)),a}var ReactReduxContext=getContext(),notInitialized=()=>{throw new Error("uSES not initialized!")};function createReduxContextHook(_=ReactReduxContext){return function(){return React$1.useContext(_)}}var useReduxContext=createReduxContextHook(),useSyncExternalStoreWithSelector=notInitialized,initializeUseSelector=_=>{useSyncExternalStoreWithSelector=_},refEquality=(_,a)=>_===a;function createSelectorHook(_=ReactReduxContext){const a=_===ReactReduxContext?useReduxContext:createReduxContextHook(_),$=(j,et={})=>{const{equalityFn:tt=refEquality,devModeChecks:rt={}}=typeof et=="function"?{equalityFn:et}:et,{store:nt,subscription:it,getServerState:at,stabilityCheck:st,identityFunctionCheck:ot}=a();React$1.useRef(!0);const ut=React$1.useCallback({[j.name](mt){return j(mt)}}[j.name],[j,st,rt.stabilityCheck]),dt=useSyncExternalStoreWithSelector(it.addNestedSub,nt.getState,at||nt.getState,ut,tt);return React$1.useDebugValue(dt),dt};return Object.assign($,{withTypes:()=>$}),$}var useSelector=createSelectorHook();function defaultNoopBatch(_){_()}function createListenerCollection(){let _=null,a=null;return{clear(){_=null,a=null},notify(){defaultNoopBatch(()=>{let $=_;for(;$;)$.callback(),$=$.next})},get(){const $=[];let j=_;for(;j;)$.push(j),j=j.next;return $},subscribe($){let j=!0;const et=a={callback:$,next:null,prev:a};return et.prev?et.prev.next=et:_=et,function(){!j||_===null||(j=!1,et.next?et.next.prev=et.prev:a=et.prev,et.prev?et.prev.next=et.next:_=et.next)}}}}var nullListeners={notify(){},get:()=>[]};function createSubscription(_,a){let $,j=nullListeners,et=0,tt=!1;function rt(xt){st();const Ct=j.subscribe(xt);let Pt=!1;return()=>{Pt||(Pt=!0,Ct(),ot())}}function nt(){j.notify()}function it(){mt.onStateChange&&mt.onStateChange()}function at(){return tt}function st(){et++,$||($=_.subscribe(it),j=createListenerCollection())}function ot(){et--,$&&et===0&&($(),$=void 0,j.clear(),j=nullListeners)}function ut(){tt||(tt=!0,st())}function dt(){tt&&(tt=!1,ot())}const mt={addNestedSub:rt,notifyNestedSubs:nt,handleChangeWrapper:it,isSubscribed:at,trySubscribe:ut,tryUnsubscribe:dt,getListeners:()=>j};return mt}var canUseDOM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",isReactNative$1=typeof navigator<"u"&&navigator.product==="ReactNative",useIsomorphicLayoutEffect$1=canUseDOM||isReactNative$1?React$1.useLayoutEffect:React$1.useEffect;function Provider$1({store:_,context:a,children:$,serverState:j,stabilityCheck:et="once",identityFunctionCheck:tt="once"}){const rt=React$1.useMemo(()=>{const at=createSubscription(_);return{store:_,subscription:at,getServerState:j?()=>j:void 0,stabilityCheck:et,identityFunctionCheck:tt}},[_,j,et,tt]),nt=React$1.useMemo(()=>_.getState(),[_]);useIsomorphicLayoutEffect$1(()=>{const{subscription:at}=rt;return at.onStateChange=at.notifyNestedSubs,at.trySubscribe(),nt!==_.getState()&&at.notifyNestedSubs(),()=>{at.tryUnsubscribe(),at.onStateChange=void 0}},[rt,nt]);const it=a||ReactReduxContext;return React$1.createElement(it.Provider,{value:rt},$)}var Provider_default=Provider$1;function createStoreHook(_=ReactReduxContext){const a=_===ReactReduxContext?useReduxContext:createReduxContextHook(_),$=()=>{const{store:j}=a();return j};return Object.assign($,{withTypes:()=>$}),$}var useStore=createStoreHook();function createDispatchHook(_=ReactReduxContext){const a=_===ReactReduxContext?useStore:createStoreHook(_),$=()=>a().dispatch;return Object.assign($,{withTypes:()=>$}),$}var useDispatch=createDispatchHook();initializeUseSelector(withSelectorExports.useSyncExternalStoreWithSelector);const useAppDispatch=useDispatch,useAppSelector=useSelector,useSelectedNetwork=()=>useAppSelector(_=>_.networks.current),useAvailableNetworks=()=>useAppSelector(_=>_.networks.available),useFindNetwork=()=>{const _=useAvailableNetworks();return a=>_.find($=>$.name.toLowerCase()===a.toLowerCase())},useSelectNetwork=()=>{const _=useAvailableNetworks(),a=useDispatch();return $=>{const j=_.find(et=>et.name===$);j&&a(networksActions.setCurrent(j))}},useGetToken=()=>{const _=useSelectedNetwork(),a=useAppSelector($=>$.tokens[_.name]);return($,j)=>lodashExports.get(a,[$,j])},useGetTokenType=_=>{const a=useAppSelector($=>$.tokens[_.name]);return $=>{if(!(a&&$ in a))return;const j=a[$],et=Object.keys(j)[0];if(et)return j[et].type}},errorClasses={},deserializers={},addCustomErrorDeserializer=(_,a)=>{deserializers[_]=a},createCustomErrorClass=_=>{class a extends Error{constructor(j,et,tt){if(super(j||_,tt),Object.setPrototypeOf(this,a.prototype),this.name=_,et)for(const rt in et)this[rt]=et[rt];if(tt&&isObject$1(tt)&&"cause"in tt&&!("cause"in this)){const rt=tt.cause;this.cause=rt,"stack"in rt&&(this.stack=this.stack+` +CAUSE: `+rt.stack)}}}return errorClasses[_]=a,a};function isObject$1(_){return typeof _=="object"}createCustomErrorClass("AccountNameRequired");createCustomErrorClass("AccountNotSupported");createCustomErrorClass("AmountRequired");createCustomErrorClass("BluetoothRequired");createCustomErrorClass("BtcUnmatchedApp");createCustomErrorClass("CantOpenDevice");createCustomErrorClass("CashAddrNotSupported");createCustomErrorClass("ClaimRewardsFeesWarning");createCustomErrorClass("CurrencyNotSupported");createCustomErrorClass("DeviceAppVerifyNotSupported");createCustomErrorClass("DeviceGenuineSocketEarlyClose");createCustomErrorClass("DeviceNotGenuine");createCustomErrorClass("DeviceOnDashboardExpected");createCustomErrorClass("DeviceOnDashboardUnexpected");createCustomErrorClass("DeviceInOSUExpected");createCustomErrorClass("DeviceHalted");createCustomErrorClass("DeviceNameInvalid");createCustomErrorClass("DeviceSocketFail");createCustomErrorClass("DeviceSocketNoBulkStatus");createCustomErrorClass("DeviceSocketNoBulkStatus");createCustomErrorClass("UnresponsiveDeviceError");const DisconnectedDevice=createCustomErrorClass("DisconnectedDevice"),DisconnectedDeviceDuringOperation=createCustomErrorClass("DisconnectedDeviceDuringOperation");createCustomErrorClass("DeviceExtractOnboardingStateError");createCustomErrorClass("DeviceOnboardingStatePollingError");createCustomErrorClass("EnpointConfig");createCustomErrorClass("EthAppPleaseEnableContractData");createCustomErrorClass("FeeEstimationFailed");createCustomErrorClass("FirmwareNotRecognized");createCustomErrorClass("HardResetFail");createCustomErrorClass("InvalidXRPTag");createCustomErrorClass("InvalidAddress");createCustomErrorClass("InvalidNonce");createCustomErrorClass("InvalidAddressBecauseDestinationIsAlsoSource");createCustomErrorClass("LatestMCUInstalledError");createCustomErrorClass("UnknownMCU");createCustomErrorClass("LedgerAPIError");createCustomErrorClass("LedgerAPIErrorWithMessage");createCustomErrorClass("LedgerAPINotAvailable");createCustomErrorClass("ManagerAppAlreadyInstalled");createCustomErrorClass("ManagerAppRelyOnBTC");createCustomErrorClass("ManagerAppDepInstallRequired");createCustomErrorClass("ManagerAppDepUninstallRequired");createCustomErrorClass("ManagerDeviceLocked");createCustomErrorClass("ManagerFirmwareNotEnoughSpace");createCustomErrorClass("ManagerNotEnoughSpace");createCustomErrorClass("ManagerUninstallBTCDep");createCustomErrorClass("NetworkDown");createCustomErrorClass("NetworkError");createCustomErrorClass("NoAddressesFound");createCustomErrorClass("NotEnoughBalance");createCustomErrorClass("NotEnoughBalanceToDelegate");createCustomErrorClass("NotEnoughBalanceInParentAccount");createCustomErrorClass("NotEnoughSpendableBalance");createCustomErrorClass("NotEnoughBalanceBecauseDestinationNotCreated");createCustomErrorClass("NoAccessToCamera");createCustomErrorClass("NotEnoughGas");createCustomErrorClass("NotEnoughGasSwap");createCustomErrorClass("NotSupportedLegacyAddress");createCustomErrorClass("GasLessThanEstimate");createCustomErrorClass("PriorityFeeTooLow");createCustomErrorClass("PriorityFeeTooHigh");createCustomErrorClass("PriorityFeeHigherThanMaxFee");createCustomErrorClass("MaxFeeTooLow");createCustomErrorClass("PasswordsDontMatch");createCustomErrorClass("PasswordIncorrect");createCustomErrorClass("RecommendSubAccountsToEmpty");createCustomErrorClass("RecommendUndelegation");createCustomErrorClass("TimeoutTagged");createCustomErrorClass("UnexpectedBootloader");createCustomErrorClass("MCUNotGenuineToDashboard");createCustomErrorClass("RecipientRequired");createCustomErrorClass("UnavailableTezosOriginatedAccountReceive");createCustomErrorClass("UnavailableTezosOriginatedAccountSend");createCustomErrorClass("UpdateFetchFileFail");createCustomErrorClass("UpdateIncorrectHash");createCustomErrorClass("UpdateIncorrectSig");createCustomErrorClass("UpdateYourApp");createCustomErrorClass("UserRefusedDeviceNameChange");createCustomErrorClass("UserRefusedAddress");createCustomErrorClass("UserRefusedFirmwareUpdate");createCustomErrorClass("UserRefusedAllowManager");createCustomErrorClass("UserRefusedOnDevice");createCustomErrorClass("ExpertModeRequired");const TransportOpenUserCancelled=createCustomErrorClass("TransportOpenUserCancelled"),TransportInterfaceNotAvailable=createCustomErrorClass("TransportInterfaceNotAvailable"),TransportPendingOperation=createCustomErrorClass("TransportPendingOperation"),TransportWebUSBGestureRequired=createCustomErrorClass("TransportWebUSBGestureRequired");createCustomErrorClass("TransactionHasBeenValidatedError");createCustomErrorClass("TransportExchangeTimeoutError");createCustomErrorClass("DeviceShouldStayInApp");createCustomErrorClass("WebsocketConnectionError");createCustomErrorClass("WebsocketConnectionFailed");createCustomErrorClass("WrongDeviceForAccount");createCustomErrorClass("WrongDeviceForAccountPayout");createCustomErrorClass("WrongDeviceForAccountRefund");createCustomErrorClass("WrongAppForCurrency");createCustomErrorClass("ETHAddressNonEIP");createCustomErrorClass("CantScanQRCode");createCustomErrorClass("FeeNotLoaded");createCustomErrorClass("FeeNotLoadedSwap");createCustomErrorClass("FeeRequired");createCustomErrorClass("FeeTooHigh");createCustomErrorClass("PendingOperation");createCustomErrorClass("SyncError");createCustomErrorClass("PairingFailed");createCustomErrorClass("PeerRemovedPairing");createCustomErrorClass("GenuineCheckFailed");createCustomErrorClass("LedgerAPI4xx");createCustomErrorClass("LedgerAPI5xx");createCustomErrorClass("FirmwareOrAppUpdateRequired");createCustomErrorClass("ReplacementTransactionUnderpriced");createCustomErrorClass("OpReturnSizeLimit");createCustomErrorClass("DustLimit");createCustomErrorClass("LanguageNotFound");createCustomErrorClass("NoDBPathGiven");createCustomErrorClass("DBWrongPassword");createCustomErrorClass("DBNotReset");createCustomErrorClass("SequenceNumberError");createCustomErrorClass("DisabledTransactionBroadcastError");var HwTransportErrorType;(function(_){_.Unknown="Unknown",_.LocationServicesDisabled="LocationServicesDisabled",_.LocationServicesUnauthorized="LocationServicesUnauthorized",_.BluetoothScanStartFailed="BluetoothScanStartFailed"})(HwTransportErrorType||(HwTransportErrorType={}));let TransportError$1=class extends Error{constructor(a,$){const j="TransportError";super(a||j),this.name=j,this.message=a,this.stack=new Error(a).stack,this.id=$}};addCustomErrorDeserializer("TransportError",_=>new TransportError$1(_.message,_.id));const StatusCodes={ACCESS_CONDITION_NOT_FULFILLED:38916,ALGORITHM_NOT_SUPPORTED:38020,CLA_NOT_SUPPORTED:28160,CODE_BLOCKED:38976,CODE_NOT_INITIALIZED:38914,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,CONDITIONS_OF_USE_NOT_SATISFIED:27013,CONTRADICTION_INVALIDATION:38928,CONTRADICTION_SECRET_CODE_STATUS:38920,CUSTOM_IMAGE_BOOTLOADER:26159,CUSTOM_IMAGE_EMPTY:26158,FILE_ALREADY_EXISTS:27273,FILE_NOT_FOUND:37892,GP_AUTH_FAILED:25344,HALTED:28586,INCONSISTENT_FILE:37896,INCORRECT_DATA:27264,INCORRECT_LENGTH:26368,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,DEVICE_NOT_ONBOARDED:27911,DEVICE_NOT_ONBOARDED_2:26129,INVALID_KCV:38021,INVALID_OFFSET:37890,LICENSING:28482,LOCKED_DEVICE:21781,MAX_VALUE_REACHED:38992,MEMORY_PROBLEM:37440,MISSING_CRITICAL_PARAMETER:26624,NO_EF_SELECTED:37888,NOT_ENOUGH_MEMORY_SPACE:27268,OK:36864,PIN_REMAINING_ATTEMPTS:25536,REFERENCED_DATA_NOT_FOUND:27272,SECURITY_STATUS_NOT_SATISFIED:27010,TECHNICAL_PROBLEM:28416,UNKNOWN_APDU:27906,USER_REFUSED_ON_DEVICE:21761,NOT_ENOUGH_SPACE:20738};function getAltStatusMessage(_){switch(_){case 26368:return"Incorrect length";case 26624:return"Missing critical parameter";case 27010:return"Security not satisfied (dongle locked or have invalid access rights)";case 27013:return"Condition of use not satisfied (denied by the user?)";case 27264:return"Invalid data received";case 27392:return"Invalid parameter received";case 21781:return"Locked device"}if(28416<=_&&_<=28671)return"Internal error, please report"}class TransportStatusError extends Error{constructor(a,{canBeMappedToChildError:$=!0}={}){const j=Object.keys(StatusCodes).find(nt=>StatusCodes[nt]===a)||"UNKNOWN_ERROR",et=getAltStatusMessage(a)||j,tt=a.toString(16),rt=`Ledger device: ${et} (0x${tt})`;if(super(rt),this.name="TransportStatusError",this.statusCode=a,this.statusText=j,Object.setPrototypeOf(this,TransportStatusError.prototype),$&&a===StatusCodes.LOCKED_DEVICE)return new LockedDeviceError(rt)}}class LockedDeviceError extends TransportStatusError{constructor(a){super(StatusCodes.LOCKED_DEVICE,{canBeMappedToChildError:!1}),a&&(this.message=a),this.name="LockedDeviceError",Object.setPrototypeOf(this,LockedDeviceError.prototype)}}addCustomErrorDeserializer("TransportStatusError",_=>new TransportStatusError(_.statusCode));let id=0;const subscribers=[],log$8=(_,a,$)=>{const j={type:_,id:String(++id),date:new Date};a&&(j.message=a),dispatch(j)},trace=({type:_,message:a,data:$,context:j})=>{const et={type:_,id:String(++id),date:new Date};a&&(et.message=a),$&&(et.data=$),j&&(et.context=j),dispatch(et)};class LocalTracer{constructor(a,$){this.type=a,this.context=$}trace(a,$){trace({type:this.type,message:a,data:$,context:this.context})}getContext(){return this.context}setContext(a){this.context=a}updateContext(a){this.context=Object.assign(Object.assign({},this.context),a)}getType(){return this.type}setType(a){this.type=a}withType(a){return new LocalTracer(a,this.context)}withContext(a){return new LocalTracer(this.type,a)}withUpdatedContext(a){return new LocalTracer(this.type,Object.assign(Object.assign({},this.context),a))}}const listen=_=>(subscribers.push(_),()=>{const a=subscribers.indexOf(_);a!==-1&&(subscribers[a]=subscribers[subscribers.length-1],subscribers.pop())});function dispatch(_){for(let a=0;a__awaiter$7(this,void 0,void 0,function*(){const st=this.tracer.withUpdatedContext({function:"send"});if(nt.length>=256)throw st.trace("data.length exceeded 256 bytes limit",{dataLength:nt.length}),new TransportError$1("data.length exceed 256 bytes limit. Got: "+nt.length,"DataLengthTooBig");st.trace("Starting an exchange",{abortTimeoutMs:at});const ot=yield this.exchange(Buffer$g.concat([Buffer$g.from([j,et,tt,rt]),Buffer$g.from([nt.length]),nt]),{abortTimeoutMs:at});st.trace("Received response from exchange");const ut=ot.readUInt16BE(ot.length-2);if(!it.some(dt=>dt===ut))throw new TransportStatusError(ut);return ot}),this._appAPIlock=null,this.tracer=new LocalTracer($??DEFAULT_LOG_TYPE,a)}exchange(a,{abortTimeoutMs:$}={}){throw new Error("exchange not implemented")}exchangeBulk(a,$){let j=!1;const et=()=>{j=!0};return __awaiter$7(this,void 0,void 0,function*(){if(!j)for(const rt of a){const nt=yield this.exchange(rt);if(j)return;const it=nt.readUInt16BE(nt.length-2);if(it!==StatusCodes.OK)throw new TransportStatusError(it);$.next(nt)}}).then(()=>!j&&$.complete(),rt=>!j&&$.error(rt)),{unsubscribe:et}}setScrambleKey(a){}close(){return Promise.resolve()}on(a,$){this._events.on(a,$)}off(a,$){this._events.removeListener(a,$)}emit(a,...$){this._events.emit(a,...$)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(a){this.exchangeTimeout=a}setExchangeUnresponsiveTimeout(a){this.unresponsiveTimeout=a}static create(a=3e3,$){return new Promise((j,et)=>{let tt=!1;const rt=this.listen({next:it=>{tt=!0,rt&&rt.unsubscribe(),nt&&clearTimeout(nt),this.open(it.descriptor,a).then(j,et)},error:it=>{nt&&clearTimeout(nt),et(it)},complete:()=>{nt&&clearTimeout(nt),tt||et(new TransportError$1(this.ErrorMessage_NoDeviceFound,"NoDeviceFound"))}}),nt=$?setTimeout(()=>{rt.unsubscribe(),et(new TransportError$1(this.ErrorMessage_ListenTimeout,"ListenTimeout"))},$):null})}exchangeAtomicImpl(a){return __awaiter$7(this,void 0,void 0,function*(){const $=this.tracer.withUpdatedContext({function:"exchangeAtomicImpl",unresponsiveTimeout:this.unresponsiveTimeout});if(this.exchangeBusyPromise)throw $.trace("Atomic exchange is already busy"),new TransportPendingOperation("An action was already pending on the Ledger device. Please deny or reconnect.");let j;const et=new Promise(nt=>{j=nt});this.exchangeBusyPromise=et;let tt=!1;const rt=setTimeout(()=>{$.trace('Timeout reached, emitting Transport event "unresponsive"',{unresponsiveTimeout:this.unresponsiveTimeout}),tt=!0,this.emit("unresponsive")},this.unresponsiveTimeout);try{const nt=yield a();return tt&&($.trace("Device was unresponsive, emitting responsive"),this.emit("responsive")),nt}finally{$.trace("Finalize, clearing busy guard"),clearTimeout(rt),j&&j(),this.exchangeBusyPromise=null}})}decorateAppAPIMethods(a,$,j){for(const et of $)a[et]=this.decorateAppAPIMethod(et,a[et],a,j)}decorateAppAPIMethod(a,$,j,et){return(...tt)=>__awaiter$7(this,void 0,void 0,function*(){const{_appAPIlock:rt}=this;if(rt)return Promise.reject(new TransportError$1("Ledger Device is busy (lock "+rt+")","TransportLocked"));try{return this._appAPIlock=a,this.setScrambleKey(et),yield $.apply(j,tt)}finally{this._appAPIlock=null}})}setTraceContext(a){this.tracer=this.tracer.withContext(a)}updateTraceContext(a){this.tracer.updateContext(a)}getTraceContext(){return this.tracer.getContext()}};Transport$1.ErrorMessage_ListenTimeout="No Ledger device found (timeout)";Transport$1.ErrorMessage_NoDeviceFound="No Ledger device found";const Tag$1=5;function asUInt16BE(_){const a=Buffer$g.alloc(2);return a.writeUInt16BE(_,0),a}const initialAcc={data:Buffer$g.alloc(0),dataLength:0,sequence:0},createHIDframing=(_,a)=>({makeBlocks($){let j=Buffer$g.concat([asUInt16BE($.length),$]);const et=a-5,tt=Math.ceil(j.length/et);j=Buffer$g.concat([j,Buffer$g.alloc(tt*et-j.length+1).fill(0)]);const rt=[];for(let nt=0;nttt&&(et=et.slice(0,tt)),{data:et,dataLength:tt,sequence:rt}},getReducedResult($){if($&&$.dataLength===$.data.length)return $.data}});var re$3={exports:{}};const SEMVER_SPEC_VERSION="2.0.0",MAX_LENGTH$1=256,MAX_SAFE_INTEGER$1=Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH=16,MAX_SAFE_BUILD_LENGTH=MAX_LENGTH$1-6,RELEASE_TYPES=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var constants$1={MAX_LENGTH:MAX_LENGTH$1,MAX_SAFE_COMPONENT_LENGTH,MAX_SAFE_BUILD_LENGTH,MAX_SAFE_INTEGER:MAX_SAFE_INTEGER$1,RELEASE_TYPES,SEMVER_SPEC_VERSION,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},define_process_env_default={};const debug$1=typeof process$1$1=="object"&&define_process_env_default&&define_process_env_default.NODE_DEBUG&&/\bsemver\b/i.test(define_process_env_default.NODE_DEBUG)?(..._)=>console.error("SEMVER",..._):()=>{};var debug_1=debug$1;(function(_,a){const{MAX_SAFE_COMPONENT_LENGTH:$,MAX_SAFE_BUILD_LENGTH:j,MAX_LENGTH:et}=constants$1,tt=debug_1;a=_.exports={};const rt=a.re=[],nt=a.safeRe=[],it=a.src=[],at=a.t={};let st=0;const ot="[a-zA-Z0-9-]",ut=[["\\s",1],["\\d",et],[ot,j]],dt=xt=>{for(const[Ct,Pt]of ut)xt=xt.split(`${Ct}*`).join(`${Ct}{0,${Pt}}`).split(`${Ct}+`).join(`${Ct}{1,${Pt}}`);return xt},mt=(xt,Ct,Pt)=>{const Tt=dt(Ct),kt=st++;tt(xt,kt,Ct),at[xt]=kt,it[kt]=Ct,rt[kt]=new RegExp(Ct,Pt?"g":void 0),nt[kt]=new RegExp(Tt,Pt?"g":void 0)};mt("NUMERICIDENTIFIER","0|[1-9]\\d*"),mt("NUMERICIDENTIFIERLOOSE","\\d+"),mt("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ot}*`),mt("MAINVERSION",`(${it[at.NUMERICIDENTIFIER]})\\.(${it[at.NUMERICIDENTIFIER]})\\.(${it[at.NUMERICIDENTIFIER]})`),mt("MAINVERSIONLOOSE",`(${it[at.NUMERICIDENTIFIERLOOSE]})\\.(${it[at.NUMERICIDENTIFIERLOOSE]})\\.(${it[at.NUMERICIDENTIFIERLOOSE]})`),mt("PRERELEASEIDENTIFIER",`(?:${it[at.NUMERICIDENTIFIER]}|${it[at.NONNUMERICIDENTIFIER]})`),mt("PRERELEASEIDENTIFIERLOOSE",`(?:${it[at.NUMERICIDENTIFIERLOOSE]}|${it[at.NONNUMERICIDENTIFIER]})`),mt("PRERELEASE",`(?:-(${it[at.PRERELEASEIDENTIFIER]}(?:\\.${it[at.PRERELEASEIDENTIFIER]})*))`),mt("PRERELEASELOOSE",`(?:-?(${it[at.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${it[at.PRERELEASEIDENTIFIERLOOSE]})*))`),mt("BUILDIDENTIFIER",`${ot}+`),mt("BUILD",`(?:\\+(${it[at.BUILDIDENTIFIER]}(?:\\.${it[at.BUILDIDENTIFIER]})*))`),mt("FULLPLAIN",`v?${it[at.MAINVERSION]}${it[at.PRERELEASE]}?${it[at.BUILD]}?`),mt("FULL",`^${it[at.FULLPLAIN]}$`),mt("LOOSEPLAIN",`[v=\\s]*${it[at.MAINVERSIONLOOSE]}${it[at.PRERELEASELOOSE]}?${it[at.BUILD]}?`),mt("LOOSE",`^${it[at.LOOSEPLAIN]}$`),mt("GTLT","((?:<|>)?=?)"),mt("XRANGEIDENTIFIERLOOSE",`${it[at.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),mt("XRANGEIDENTIFIER",`${it[at.NUMERICIDENTIFIER]}|x|X|\\*`),mt("XRANGEPLAIN",`[v=\\s]*(${it[at.XRANGEIDENTIFIER]})(?:\\.(${it[at.XRANGEIDENTIFIER]})(?:\\.(${it[at.XRANGEIDENTIFIER]})(?:${it[at.PRERELEASE]})?${it[at.BUILD]}?)?)?`),mt("XRANGEPLAINLOOSE",`[v=\\s]*(${it[at.XRANGEIDENTIFIERLOOSE]})(?:\\.(${it[at.XRANGEIDENTIFIERLOOSE]})(?:\\.(${it[at.XRANGEIDENTIFIERLOOSE]})(?:${it[at.PRERELEASELOOSE]})?${it[at.BUILD]}?)?)?`),mt("XRANGE",`^${it[at.GTLT]}\\s*${it[at.XRANGEPLAIN]}$`),mt("XRANGELOOSE",`^${it[at.GTLT]}\\s*${it[at.XRANGEPLAINLOOSE]}$`),mt("COERCE",`(^|[^\\d])(\\d{1,${$}})(?:\\.(\\d{1,${$}}))?(?:\\.(\\d{1,${$}}))?(?:$|[^\\d])`),mt("COERCERTL",it[at.COERCE],!0),mt("LONETILDE","(?:~>?)"),mt("TILDETRIM",`(\\s*)${it[at.LONETILDE]}\\s+`,!0),a.tildeTrimReplace="$1~",mt("TILDE",`^${it[at.LONETILDE]}${it[at.XRANGEPLAIN]}$`),mt("TILDELOOSE",`^${it[at.LONETILDE]}${it[at.XRANGEPLAINLOOSE]}$`),mt("LONECARET","(?:\\^)"),mt("CARETTRIM",`(\\s*)${it[at.LONECARET]}\\s+`,!0),a.caretTrimReplace="$1^",mt("CARET",`^${it[at.LONECARET]}${it[at.XRANGEPLAIN]}$`),mt("CARETLOOSE",`^${it[at.LONECARET]}${it[at.XRANGEPLAINLOOSE]}$`),mt("COMPARATORLOOSE",`^${it[at.GTLT]}\\s*(${it[at.LOOSEPLAIN]})$|^$`),mt("COMPARATOR",`^${it[at.GTLT]}\\s*(${it[at.FULLPLAIN]})$|^$`),mt("COMPARATORTRIM",`(\\s*)${it[at.GTLT]}\\s*(${it[at.LOOSEPLAIN]}|${it[at.XRANGEPLAIN]})`,!0),a.comparatorTrimReplace="$1$2$3",mt("HYPHENRANGE",`^\\s*(${it[at.XRANGEPLAIN]})\\s+-\\s+(${it[at.XRANGEPLAIN]})\\s*$`),mt("HYPHENRANGELOOSE",`^\\s*(${it[at.XRANGEPLAINLOOSE]})\\s+-\\s+(${it[at.XRANGEPLAINLOOSE]})\\s*$`),mt("STAR","(<|>)?=?\\s*\\*"),mt("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),mt("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(re$3,re$3.exports);var reExports=re$3.exports;const looseOption=Object.freeze({loose:!0}),emptyOpts=Object.freeze({}),parseOptions$1=_=>_?typeof _!="object"?looseOption:_:emptyOpts;var parseOptions_1=parseOptions$1;const numeric=/^[0-9]+$/,compareIdentifiers$1=(_,a)=>{const $=numeric.test(_),j=numeric.test(a);return $&&j&&(_=+_,a=+a),_===a?0:$&&!j?-1:j&&!$?1:_compareIdentifiers$1(a,_);var identifiers$1={compareIdentifiers:compareIdentifiers$1,rcompareIdentifiers};const debug=debug_1,{MAX_LENGTH,MAX_SAFE_INTEGER}=constants$1,{safeRe:re$2,t:t$2}=reExports,parseOptions=parseOptions_1,{compareIdentifiers}=identifiers$1;let SemVer$d=class No{constructor(a,$){if($=parseOptions($),a instanceof No){if(a.loose===!!$.loose&&a.includePrerelease===!!$.includePrerelease)return a;a=a.version}else if(typeof a!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>MAX_LENGTH)throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);debug("SemVer",a,$),this.options=$,this.loose=!!$.loose,this.includePrerelease=!!$.includePrerelease;const j=a.trim().match($.loose?re$2[t$2.LOOSE]:re$2[t$2.FULL]);if(!j)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+j[1],this.minor=+j[2],this.patch=+j[3],this.major>MAX_SAFE_INTEGER||this.major<0)throw new TypeError("Invalid major version");if(this.minor>MAX_SAFE_INTEGER||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>MAX_SAFE_INTEGER||this.patch<0)throw new TypeError("Invalid patch version");j[4]?this.prerelease=j[4].split(".").map(et=>{if(/^[0-9]+$/.test(et)){const tt=+et;if(tt>=0&&tt=0;)typeof this.prerelease[tt]=="number"&&(this.prerelease[tt]++,tt=-2);if(tt===-1){if($===this.prerelease.join(".")&&j===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(et)}}if($){let tt=[$,et];j===!1&&(tt=[$]),compareIdentifiers(this.prerelease[0],$)===0?isNaN(this.prerelease[1])&&(this.prerelease=tt):this.prerelease=tt}break}default:throw new Error(`invalid increment argument: ${a}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var semver$2=SemVer$d;const SemVer$c=semver$2,parse$a=(_,a,$=!1)=>{if(_ instanceof SemVer$c)return _;try{return new SemVer$c(_,a)}catch(j){if(!$)return null;throw j}};var parse_1=parse$a;const parse$9=parse_1,valid$2=(_,a)=>{const $=parse$9(_,a);return $?$.version:null};var valid_1=valid$2;const parse$8=parse_1,clean$1=(_,a)=>{const $=parse$8(_.trim().replace(/^[=v]+/,""),a);return $?$.version:null};var clean_1=clean$1;const SemVer$b=semver$2,inc$1=(_,a,$,j,et)=>{typeof $=="string"&&(et=j,j=$,$=void 0);try{return new SemVer$b(_ instanceof SemVer$b?_.version:_,$).inc(a,j,et).version}catch{return null}};var inc_1=inc$1;const parse$7=parse_1,diff$1=(_,a)=>{const $=parse$7(_,null,!0),j=parse$7(a,null,!0),et=$.compare(j);if(et===0)return null;const tt=et>0,rt=tt?$:j,nt=tt?j:$,it=!!rt.prerelease.length;if(!!nt.prerelease.length&&!it)return!nt.patch&&!nt.minor?"major":rt.patch?"patch":rt.minor?"minor":"major";const st=it?"pre":"";return $.major!==j.major?st+"major":$.minor!==j.minor?st+"minor":$.patch!==j.patch?st+"patch":"prerelease"};var diff_1=diff$1;const SemVer$a=semver$2,major$1=(_,a)=>new SemVer$a(_,a).major;var major_1=major$1;const SemVer$9=semver$2,minor$1=(_,a)=>new SemVer$9(_,a).minor;var minor_1=minor$1;const SemVer$8=semver$2,patch$1=(_,a)=>new SemVer$8(_,a).patch;var patch_1=patch$1;const parse$6=parse_1,prerelease$1=(_,a)=>{const $=parse$6(_,a);return $&&$.prerelease.length?$.prerelease:null};var prerelease_1=prerelease$1;const SemVer$7=semver$2,compare$b=(_,a,$)=>new SemVer$7(_,$).compare(new SemVer$7(a,$));var compare_1=compare$b;const compare$a=compare_1,rcompare$1=(_,a,$)=>compare$a(a,_,$);var rcompare_1=rcompare$1;const compare$9=compare_1,compareLoose$1=(_,a)=>compare$9(_,a,!0);var compareLoose_1=compareLoose$1;const SemVer$6=semver$2,compareBuild$3=(_,a,$)=>{const j=new SemVer$6(_,$),et=new SemVer$6(a,$);return j.compare(et)||j.compareBuild(et)};var compareBuild_1=compareBuild$3;const compareBuild$2=compareBuild_1,sort$1=(_,a)=>_.sort(($,j)=>compareBuild$2($,j,a));var sort_1=sort$1;const compareBuild$1=compareBuild_1,rsort$1=(_,a)=>_.sort(($,j)=>compareBuild$1(j,$,a));var rsort_1=rsort$1;const compare$8=compare_1,gt$4=(_,a,$)=>compare$8(_,a,$)>0;var gt_1=gt$4;const compare$7=compare_1,lt$3=(_,a,$)=>compare$7(_,a,$)<0;var lt_1=lt$3;const compare$6=compare_1,eq$2=(_,a,$)=>compare$6(_,a,$)===0;var eq_1=eq$2;const compare$5=compare_1,neq$2=(_,a,$)=>compare$5(_,a,$)!==0;var neq_1=neq$2;const compare$4=compare_1,gte$3=(_,a,$)=>compare$4(_,a,$)>=0;var gte_1=gte$3;const compare$3=compare_1,lte$3=(_,a,$)=>compare$3(_,a,$)<=0;var lte_1=lte$3;const eq$1=eq_1,neq$1=neq_1,gt$3=gt_1,gte$2=gte_1,lt$2=lt_1,lte$2=lte_1,cmp$1=(_,a,$,j)=>{switch(a){case"===":return typeof _=="object"&&(_=_.version),typeof $=="object"&&($=$.version),_===$;case"!==":return typeof _=="object"&&(_=_.version),typeof $=="object"&&($=$.version),_!==$;case"":case"=":case"==":return eq$1(_,$,j);case"!=":return neq$1(_,$,j);case">":return gt$3(_,$,j);case">=":return gte$2(_,$,j);case"<":return lt$2(_,$,j);case"<=":return lte$2(_,$,j);default:throw new TypeError(`Invalid operator: ${a}`)}};var cmp_1=cmp$1;const SemVer$5=semver$2,parse$5=parse_1,{safeRe:re$1,t:t$1}=reExports,coerce$1=(_,a)=>{if(_ instanceof SemVer$5)return _;if(typeof _=="number"&&(_=String(_)),typeof _!="string")return null;a=a||{};let $=null;if(!a.rtl)$=_.match(re$1[t$1.COERCE]);else{let j;for(;(j=re$1[t$1.COERCERTL].exec(_))&&(!$||$.index+$[0].length!==_.length);)(!$||j.index+j[0].length!==$.index+$[0].length)&&($=j),re$1[t$1.COERCERTL].lastIndex=j.index+j[1].length+j[2].length;re$1[t$1.COERCERTL].lastIndex=-1}return $===null?null:parse$5(`${$[2]}.${$[3]||"0"}.${$[4]||"0"}`,a)};var coerce_1=coerce$1,iterator$1,hasRequiredIterator;function requireIterator(){return hasRequiredIterator||(hasRequiredIterator=1,iterator$1=function(_){_.prototype[Symbol.iterator]=function*(){for(let a=this.head;a;a=a.next)yield a.value}}),iterator$1}var yallist=Yallist$1;Yallist$1.Node=Node$1;Yallist$1.create=Yallist$1;function Yallist$1(_){var a=this;if(a instanceof Yallist$1||(a=new Yallist$1),a.tail=null,a.head=null,a.length=0,_&&typeof _.forEach=="function")_.forEach(function(et){a.push(et)});else if(arguments.length>0)for(var $=0,j=arguments.length;$1)$=a;else if(this.head)j=this.head.next,$=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var et=0;j!==null;et++)$=_($,j.value,et),j=j.next;return $};Yallist$1.prototype.reduceReverse=function(_,a){var $,j=this.tail;if(arguments.length>1)$=a;else if(this.tail)j=this.tail.prev,$=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var et=this.length-1;j!==null;et--)$=_($,j.value,et),j=j.prev;return $};Yallist$1.prototype.toArray=function(){for(var _=new Array(this.length),a=0,$=this.head;$!==null;a++)_[a]=$.value,$=$.next;return _};Yallist$1.prototype.toArrayReverse=function(){for(var _=new Array(this.length),a=0,$=this.tail;$!==null;a++)_[a]=$.value,$=$.prev;return _};Yallist$1.prototype.slice=function(_,a){a=a||this.length,a<0&&(a+=this.length),_=_||0,_<0&&(_+=this.length);var $=new Yallist$1;if(a<_||a<0)return $;_<0&&(_=0),a>this.length&&(a=this.length);for(var j=0,et=this.head;et!==null&&j<_;j++)et=et.next;for(;et!==null&&jthis.length&&(a=this.length);for(var j=this.length,et=this.tail;et!==null&&j>a;j--)et=et.prev;for(;et!==null&&j>_;j--,et=et.prev)$.push(et.value);return $};Yallist$1.prototype.splice=function(_,a,...$){_>this.length&&(_=this.length-1),_<0&&(_=this.length+_);for(var j=0,et=this.head;et!==null&&j<_;j++)et=et.next;for(var tt=[],j=0;et&&j1;class LRUCache{constructor(a){if(typeof a=="number"&&(a={max:a}),a||(a={}),a.max&&(typeof a.max!="number"||a.max<0))throw new TypeError("max must be a non-negative number");this[MAX]=a.max||1/0;const $=a.length||naiveLength;if(this[LENGTH_CALCULATOR]=typeof $!="function"?naiveLength:$,this[ALLOW_STALE]=a.stale||!1,a.maxAge&&typeof a.maxAge!="number")throw new TypeError("maxAge must be a number");this[MAX_AGE]=a.maxAge||0,this[DISPOSE]=a.dispose,this[NO_DISPOSE_ON_SET]=a.noDisposeOnSet||!1,this[UPDATE_AGE_ON_GET]=a.updateAgeOnGet||!1,this.reset()}set max(a){if(typeof a!="number"||a<0)throw new TypeError("max must be a non-negative number");this[MAX]=a||1/0,trim(this)}get max(){return this[MAX]}set allowStale(a){this[ALLOW_STALE]=!!a}get allowStale(){return this[ALLOW_STALE]}set maxAge(a){if(typeof a!="number")throw new TypeError("maxAge must be a non-negative number");this[MAX_AGE]=a,trim(this)}get maxAge(){return this[MAX_AGE]}set lengthCalculator(a){typeof a!="function"&&(a=naiveLength),a!==this[LENGTH_CALCULATOR]&&(this[LENGTH_CALCULATOR]=a,this[LENGTH]=0,this[LRU_LIST].forEach($=>{$.length=this[LENGTH_CALCULATOR]($.value,$.key),this[LENGTH]+=$.length})),trim(this)}get lengthCalculator(){return this[LENGTH_CALCULATOR]}get length(){return this[LENGTH]}get itemCount(){return this[LRU_LIST].length}rforEach(a,$){$=$||this;for(let j=this[LRU_LIST].tail;j!==null;){const et=j.prev;forEachStep(this,a,j,$),j=et}}forEach(a,$){$=$||this;for(let j=this[LRU_LIST].head;j!==null;){const et=j.next;forEachStep(this,a,j,$),j=et}}keys(){return this[LRU_LIST].toArray().map(a=>a.key)}values(){return this[LRU_LIST].toArray().map(a=>a.value)}reset(){this[DISPOSE]&&this[LRU_LIST]&&this[LRU_LIST].length&&this[LRU_LIST].forEach(a=>this[DISPOSE](a.key,a.value)),this[CACHE]=new Map,this[LRU_LIST]=new Yallist,this[LENGTH]=0}dump(){return this[LRU_LIST].map(a=>isStale$1(this,a)?!1:{k:a.key,v:a.value,e:a.now+(a.maxAge||0)}).toArray().filter(a=>a)}dumpLru(){return this[LRU_LIST]}set(a,$,j){if(j=j||this[MAX_AGE],j&&typeof j!="number")throw new TypeError("maxAge must be a number");const et=j?Date.now():0,tt=this[LENGTH_CALCULATOR]($,a);if(this[CACHE].has(a)){if(tt>this[MAX])return del(this,this[CACHE].get(a)),!1;const it=this[CACHE].get(a).value;return this[DISPOSE]&&(this[NO_DISPOSE_ON_SET]||this[DISPOSE](a,it.value)),it.now=et,it.maxAge=j,it.value=$,this[LENGTH]+=tt-it.length,it.length=tt,this.get(a),trim(this),!0}const rt=new Entry(a,$,tt,et,j);return rt.length>this[MAX]?(this[DISPOSE]&&this[DISPOSE](a,$),!1):(this[LENGTH]+=rt.length,this[LRU_LIST].unshift(rt),this[CACHE].set(a,this[LRU_LIST].head),trim(this),!0)}has(a){if(!this[CACHE].has(a))return!1;const $=this[CACHE].get(a).value;return!isStale$1(this,$)}get(a){return get$3(this,a,!0)}peek(a){return get$3(this,a,!1)}pop(){const a=this[LRU_LIST].tail;return a?(del(this,a),a.value):null}del(a){del(this,this[CACHE].get(a))}load(a){this.reset();const $=Date.now();for(let j=a.length-1;j>=0;j--){const et=a[j],tt=et.e||0;if(tt===0)this.set(et.k,et.v);else{const rt=tt-$;rt>0&&this.set(et.k,et.v,rt)}}}prune(){this[CACHE].forEach((a,$)=>get$3(this,$,!1))}}const get$3=(_,a,$)=>{const j=_[CACHE].get(a);if(j){const et=j.value;if(isStale$1(_,et)){if(del(_,j),!_[ALLOW_STALE])return}else $&&(_[UPDATE_AGE_ON_GET]&&(j.value.now=Date.now()),_[LRU_LIST].unshiftNode(j));return et.value}},isStale$1=(_,a)=>{if(!a||!a.maxAge&&!_[MAX_AGE])return!1;const $=Date.now()-a.now;return a.maxAge?$>a.maxAge:_[MAX_AGE]&&$>_[MAX_AGE]},trim=_=>{if(_[LENGTH]>_[MAX])for(let a=_[LRU_LIST].tail;_[LENGTH]>_[MAX]&&a!==null;){const $=a.prev;del(_,a),a=$}},del=(_,a)=>{if(a){const $=a.value;_[DISPOSE]&&_[DISPOSE]($.key,$.value),_[LENGTH]-=$.length,_[CACHE].delete($.key),_[LRU_LIST].removeNode(a)}};class Entry{constructor(a,$,j,et,tt){this.key=a,this.value=$,this.length=j,this.now=et,this.maxAge=tt||0}}const forEachStep=(_,a,$,j)=>{let et=$.value;isStale$1(_,et)&&(del(_,$),_[ALLOW_STALE]||(et=void 0)),et&&a.call(j,et.value,et.key,_)};var lruCache=LRUCache,range$1,hasRequiredRange;function requireRange(){if(hasRequiredRange)return range$1;hasRequiredRange=1;class _{constructor(ct,ht){if(ht=j(ht),ct instanceof _)return ct.loose===!!ht.loose&&ct.includePrerelease===!!ht.includePrerelease?ct:new _(ct.raw,ht);if(ct instanceof et)return this.raw=ct.value,this.set=[[ct]],this.format(),this;if(this.options=ht,this.loose=!!ht.loose,this.includePrerelease=!!ht.includePrerelease,this.raw=ct.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(vt=>this.parseRange(vt.trim())).filter(vt=>vt.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const vt=this.set[0];if(this.set=this.set.filter(St=>!mt(St[0])),this.set.length===0)this.set=[vt];else if(this.set.length>1){for(const St of this.set)if(St.length===1&&xt(St[0])){this.set=[St];break}}}this.format()}format(){return this.range=this.set.map(ct=>ct.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(ct){const vt=((this.options.includePrerelease&&ut)|(this.options.loose&&dt))+":"+ct,St=$.get(vt);if(St)return St;const Rt=this.options.loose,$t=Rt?nt[it.HYPHENRANGELOOSE]:nt[it.HYPHENRANGE];ct=ct.replace($t,Bt(this.options.includePrerelease)),tt("hyphen replace",ct),ct=ct.replace(nt[it.COMPARATORTRIM],at),tt("comparator trim",ct),ct=ct.replace(nt[it.TILDETRIM],st),tt("tilde trim",ct),ct=ct.replace(nt[it.CARETTRIM],ot),tt("caret trim",ct);let Et=ct.split(" ").map(tr=>Pt(tr,this.options)).join(" ").split(/\s+/).map(tr=>Ft(tr,this.options));Rt&&(Et=Et.filter(tr=>(tt("loose invalid filter",tr,this.options),!!tr.match(nt[it.COMPARATORLOOSE])))),tt("range list",Et);const At=new Map,wt=Et.map(tr=>new et(tr,this.options));for(const tr of wt){if(mt(tr))return[tr];At.set(tr.value,tr)}At.size>1&&At.has("")&&At.delete("");const Ot=[...At.values()];return $.set(vt,Ot),Ot}intersects(ct,ht){if(!(ct instanceof _))throw new TypeError("a Range is required");return this.set.some(vt=>Ct(vt,ht)&&ct.set.some(St=>Ct(St,ht)&&vt.every(Rt=>St.every($t=>Rt.intersects($t,ht)))))}test(ct){if(!ct)return!1;if(typeof ct=="string")try{ct=new rt(ct,this.options)}catch{return!1}for(let ht=0;htbt.value==="<0.0.0-0",xt=bt=>bt.value==="",Ct=(bt,ct)=>{let ht=!0;const vt=bt.slice();let St=vt.pop();for(;ht&&vt.length;)ht=vt.every(Rt=>St.intersects(Rt,ct)),St=vt.pop();return ht},Pt=(bt,ct)=>(tt("comp",bt,ct),bt=Nt(bt,ct),tt("caret",bt),bt=kt(bt,ct),tt("tildes",bt),bt=jt(bt,ct),tt("xrange",bt),bt=Dt(bt,ct),tt("stars",bt),bt),Tt=bt=>!bt||bt.toLowerCase()==="x"||bt==="*",kt=(bt,ct)=>bt.trim().split(/\s+/).map(ht=>Lt(ht,ct)).join(" "),Lt=(bt,ct)=>{const ht=ct.loose?nt[it.TILDELOOSE]:nt[it.TILDE];return bt.replace(ht,(vt,St,Rt,$t,Et)=>{tt("tilde",bt,vt,St,Rt,$t,Et);let At;return Tt(St)?At="":Tt(Rt)?At=`>=${St}.0.0 <${+St+1}.0.0-0`:Tt($t)?At=`>=${St}.${Rt}.0 <${St}.${+Rt+1}.0-0`:Et?(tt("replaceTilde pr",Et),At=`>=${St}.${Rt}.${$t}-${Et} <${St}.${+Rt+1}.0-0`):At=`>=${St}.${Rt}.${$t} <${St}.${+Rt+1}.0-0`,tt("tilde return",At),At})},Nt=(bt,ct)=>bt.trim().split(/\s+/).map(ht=>zt(ht,ct)).join(" "),zt=(bt,ct)=>{tt("caret",bt,ct);const ht=ct.loose?nt[it.CARETLOOSE]:nt[it.CARET],vt=ct.includePrerelease?"-0":"";return bt.replace(ht,(St,Rt,$t,Et,At)=>{tt("caret",bt,St,Rt,$t,Et,At);let wt;return Tt(Rt)?wt="":Tt($t)?wt=`>=${Rt}.0.0${vt} <${+Rt+1}.0.0-0`:Tt(Et)?Rt==="0"?wt=`>=${Rt}.${$t}.0${vt} <${Rt}.${+$t+1}.0-0`:wt=`>=${Rt}.${$t}.0${vt} <${+Rt+1}.0.0-0`:At?(tt("replaceCaret pr",At),Rt==="0"?$t==="0"?wt=`>=${Rt}.${$t}.${Et}-${At} <${Rt}.${$t}.${+Et+1}-0`:wt=`>=${Rt}.${$t}.${Et}-${At} <${Rt}.${+$t+1}.0-0`:wt=`>=${Rt}.${$t}.${Et}-${At} <${+Rt+1}.0.0-0`):(tt("no pr"),Rt==="0"?$t==="0"?wt=`>=${Rt}.${$t}.${Et}${vt} <${Rt}.${$t}.${+Et+1}-0`:wt=`>=${Rt}.${$t}.${Et}${vt} <${Rt}.${+$t+1}.0-0`:wt=`>=${Rt}.${$t}.${Et} <${+Rt+1}.0.0-0`),tt("caret return",wt),wt})},jt=(bt,ct)=>(tt("replaceXRanges",bt,ct),bt.split(/\s+/).map(ht=>Mt(ht,ct)).join(" ")),Mt=(bt,ct)=>{bt=bt.trim();const ht=ct.loose?nt[it.XRANGELOOSE]:nt[it.XRANGE];return bt.replace(ht,(vt,St,Rt,$t,Et,At)=>{tt("xRange",bt,vt,St,Rt,$t,Et,At);const wt=Tt(Rt),Ot=wt||Tt($t),tr=Ot||Tt(Et),nr=tr;return St==="="&&nr&&(St=""),At=ct.includePrerelease?"-0":"",wt?St===">"||St==="<"?vt="<0.0.0-0":vt="*":St&&nr?(Ot&&($t=0),Et=0,St===">"?(St=">=",Ot?(Rt=+Rt+1,$t=0,Et=0):($t=+$t+1,Et=0)):St==="<="&&(St="<",Ot?Rt=+Rt+1:$t=+$t+1),St==="<"&&(At="-0"),vt=`${St+Rt}.${$t}.${Et}${At}`):Ot?vt=`>=${Rt}.0.0${At} <${+Rt+1}.0.0-0`:tr&&(vt=`>=${Rt}.${$t}.0${At} <${Rt}.${+$t+1}.0-0`),tt("xRange return",vt),vt})},Dt=(bt,ct)=>(tt("replaceStars",bt,ct),bt.trim().replace(nt[it.STAR],"")),Ft=(bt,ct)=>(tt("replaceGTE0",bt,ct),bt.trim().replace(nt[ct.includePrerelease?it.GTE0PRE:it.GTE0],"")),Bt=bt=>(ct,ht,vt,St,Rt,$t,Et,At,wt,Ot,tr,nr,ir)=>(Tt(vt)?ht="":Tt(St)?ht=`>=${vt}.0.0${bt?"-0":""}`:Tt(Rt)?ht=`>=${vt}.${St}.0${bt?"-0":""}`:$t?ht=`>=${ht}`:ht=`>=${ht}${bt?"-0":""}`,Tt(wt)?At="":Tt(Ot)?At=`<${+wt+1}.0.0-0`:Tt(tr)?At=`<${wt}.${+Ot+1}.0-0`:nr?At=`<=${wt}.${Ot}.${tr}-${nr}`:bt?At=`<${wt}.${Ot}.${+tr+1}-0`:At=`<=${At}`,`${ht} ${At}`.trim()),yt=(bt,ct,ht)=>{for(let vt=0;vt0){const St=bt[vt].semver;if(St.major===ct.major&&St.minor===ct.minor&&St.patch===ct.patch)return!0}return!1}return!0};return range$1}var comparator,hasRequiredComparator;function requireComparator(){if(hasRequiredComparator)return comparator;hasRequiredComparator=1;const _=Symbol("SemVer ANY");class a{static get ANY(){return _}constructor(st,ot){if(ot=$(ot),st instanceof a){if(st.loose===!!ot.loose)return st;st=st.value}st=st.trim().split(/\s+/).join(" "),rt("comparator",st,ot),this.options=ot,this.loose=!!ot.loose,this.parse(st),this.semver===_?this.value="":this.value=this.operator+this.semver.version,rt("comp",this)}parse(st){const ot=this.options.loose?j[et.COMPARATORLOOSE]:j[et.COMPARATOR],ut=st.match(ot);if(!ut)throw new TypeError(`Invalid comparator: ${st}`);this.operator=ut[1]!==void 0?ut[1]:"",this.operator==="="&&(this.operator=""),ut[2]?this.semver=new nt(ut[2],this.options.loose):this.semver=_}toString(){return this.value}test(st){if(rt("Comparator.test",st,this.options.loose),this.semver===_||st===_)return!0;if(typeof st=="string")try{st=new nt(st,this.options)}catch{return!1}return tt(st,this.operator,this.semver,this.options)}intersects(st,ot){if(!(st instanceof a))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new it(st.value,ot).test(this.value):st.operator===""?st.value===""?!0:new it(this.value,ot).test(st.semver):(ot=$(ot),ot.includePrerelease&&(this.value==="<0.0.0-0"||st.value==="<0.0.0-0")||!ot.includePrerelease&&(this.value.startsWith("<0.0.0")||st.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&st.operator.startsWith(">")||this.operator.startsWith("<")&&st.operator.startsWith("<")||this.semver.version===st.semver.version&&this.operator.includes("=")&&st.operator.includes("=")||tt(this.semver,"<",st.semver,ot)&&this.operator.startsWith(">")&&st.operator.startsWith("<")||tt(this.semver,">",st.semver,ot)&&this.operator.startsWith("<")&&st.operator.startsWith(">")))}}comparator=a;const $=parseOptions_1,{safeRe:j,t:et}=reExports,tt=cmp_1,rt=debug_1,nt=semver$2,it=requireRange();return comparator}const Range$9=requireRange(),satisfies$4=(_,a,$)=>{try{a=new Range$9(a,$)}catch{return!1}return a.test(_)};var satisfies_1=satisfies$4;const Range$8=requireRange(),toComparators$1=(_,a)=>new Range$8(_,a).set.map($=>$.map(j=>j.value).join(" ").trim().split(" "));var toComparators_1=toComparators$1;const SemVer$4=semver$2,Range$7=requireRange(),maxSatisfying$1=(_,a,$)=>{let j=null,et=null,tt=null;try{tt=new Range$7(a,$)}catch{return null}return _.forEach(rt=>{tt.test(rt)&&(!j||et.compare(rt)===-1)&&(j=rt,et=new SemVer$4(j,$))}),j};var maxSatisfying_1=maxSatisfying$1;const SemVer$3=semver$2,Range$6=requireRange(),minSatisfying$1=(_,a,$)=>{let j=null,et=null,tt=null;try{tt=new Range$6(a,$)}catch{return null}return _.forEach(rt=>{tt.test(rt)&&(!j||et.compare(rt)===1)&&(j=rt,et=new SemVer$3(j,$))}),j};var minSatisfying_1=minSatisfying$1;const SemVer$2=semver$2,Range$5=requireRange(),gt$2=gt_1,minVersion$1=(_,a)=>{_=new Range$5(_,a);let $=new SemVer$2("0.0.0");if(_.test($)||($=new SemVer$2("0.0.0-0"),_.test($)))return $;$=null;for(let j=0;j<_.set.length;++j){const et=_.set[j];let tt=null;et.forEach(rt=>{const nt=new SemVer$2(rt.semver.version);switch(rt.operator){case">":nt.prerelease.length===0?nt.patch++:nt.prerelease.push(0),nt.raw=nt.format();case"":case">=":(!tt||gt$2(nt,tt))&&(tt=nt);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${rt.operator}`)}}),tt&&(!$||gt$2($,tt))&&($=tt)}return $&&_.test($)?$:null};var minVersion_1=minVersion$1;const Range$4=requireRange(),validRange$1=(_,a)=>{try{return new Range$4(_,a).range||"*"}catch{return null}};var valid$1=validRange$1;const SemVer$1=semver$2,Comparator$2=requireComparator(),{ANY:ANY$1}=Comparator$2,Range$3=requireRange(),satisfies$3=satisfies_1,gt$1=gt_1,lt$1=lt_1,lte$1=lte_1,gte$1=gte_1,outside$3=(_,a,$,j)=>{_=new SemVer$1(_,j),a=new Range$3(a,j);let et,tt,rt,nt,it;switch($){case">":et=gt$1,tt=lte$1,rt=lt$1,nt=">",it=">=";break;case"<":et=lt$1,tt=gte$1,rt=gt$1,nt="<",it="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies$3(_,a,j))return!1;for(let at=0;at{dt.semver===ANY$1&&(dt=new Comparator$2(">=0.0.0")),ot=ot||dt,ut=ut||dt,et(dt.semver,ot.semver,j)?ot=dt:rt(dt.semver,ut.semver,j)&&(ut=dt)}),ot.operator===nt||ot.operator===it||(!ut.operator||ut.operator===nt)&&tt(_,ut.semver))return!1;if(ut.operator===it&&rt(_,ut.semver))return!1}return!0};var outside_1=outside$3;const outside$2=outside_1,gtr$1=(_,a,$)=>outside$2(_,a,">",$);var gtr_1=gtr$1;const outside$1=outside_1,ltr$1=(_,a,$)=>outside$1(_,a,"<",$);var ltr_1=ltr$1;const Range$2=requireRange(),intersects$1=(_,a,$)=>(_=new Range$2(_,$),a=new Range$2(a,$),_.intersects(a,$));var intersects_1=intersects$1;const satisfies$2=satisfies_1,compare$2=compare_1;var simplify=(_,a,$)=>{const j=[];let et=null,tt=null;const rt=_.sort((st,ot)=>compare$2(st,ot,$));for(const st of rt)satisfies$2(st,a,$)?(tt=st,et||(et=st)):(tt&&j.push([et,tt]),tt=null,et=null);et&&j.push([et,null]);const nt=[];for(const[st,ot]of j)st===ot?nt.push(st):!ot&&st===rt[0]?nt.push("*"):ot?st===rt[0]?nt.push(`<=${ot}`):nt.push(`${st} - ${ot}`):nt.push(`>=${st}`);const it=nt.join(" || "),at=typeof a.raw=="string"?a.raw:String(a);return it.length{if(_===a)return!0;_=new Range$1(_,$),a=new Range$1(a,$);let j=!1;e:for(const et of _.set){for(const tt of a.set){const rt=simpleSubset(et,tt,$);if(j=j||rt!==null,rt)continue e}if(j)return!1}return!0},minimumVersionWithPreRelease=[new Comparator$1(">=0.0.0-0")],minimumVersion=[new Comparator$1(">=0.0.0")],simpleSubset=(_,a,$)=>{if(_===a)return!0;if(_.length===1&&_[0].semver===ANY){if(a.length===1&&a[0].semver===ANY)return!0;$.includePrerelease?_=minimumVersionWithPreRelease:_=minimumVersion}if(a.length===1&&a[0].semver===ANY){if($.includePrerelease)return!0;a=minimumVersion}const j=new Set;let et,tt;for(const dt of _)dt.operator===">"||dt.operator===">="?et=higherGT(et,dt,$):dt.operator==="<"||dt.operator==="<="?tt=lowerLT(tt,dt,$):j.add(dt.semver);if(j.size>1)return null;let rt;if(et&&tt){if(rt=compare$1(et.semver,tt.semver,$),rt>0)return null;if(rt===0&&(et.operator!==">="||tt.operator!=="<="))return null}for(const dt of j){if(et&&!satisfies$1(dt,String(et),$)||tt&&!satisfies$1(dt,String(tt),$))return null;for(const mt of a)if(!satisfies$1(dt,String(mt),$))return!1;return!0}let nt,it,at,st,ot=tt&&!$.includePrerelease&&tt.semver.prerelease.length?tt.semver:!1,ut=et&&!$.includePrerelease&&et.semver.prerelease.length?et.semver:!1;ot&&ot.prerelease.length===1&&tt.operator==="<"&&ot.prerelease[0]===0&&(ot=!1);for(const dt of a){if(st=st||dt.operator===">"||dt.operator===">=",at=at||dt.operator==="<"||dt.operator==="<=",et){if(ut&&dt.semver.prerelease&&dt.semver.prerelease.length&&dt.semver.major===ut.major&&dt.semver.minor===ut.minor&&dt.semver.patch===ut.patch&&(ut=!1),dt.operator===">"||dt.operator===">="){if(nt=higherGT(et,dt,$),nt===dt&&nt!==et)return!1}else if(et.operator===">="&&!satisfies$1(et.semver,String(dt),$))return!1}if(tt){if(ot&&dt.semver.prerelease&&dt.semver.prerelease.length&&dt.semver.major===ot.major&&dt.semver.minor===ot.minor&&dt.semver.patch===ot.patch&&(ot=!1),dt.operator==="<"||dt.operator==="<="){if(it=lowerLT(tt,dt,$),it===dt&&it!==tt)return!1}else if(tt.operator==="<="&&!satisfies$1(tt.semver,String(dt),$))return!1}if(!dt.operator&&(tt||et)&&rt!==0)return!1}return!(et&&at&&!tt&&rt!==0||tt&&st&&!et&&rt!==0||ut||ot)},higherGT=(_,a,$)=>{if(!_)return a;const j=compare$1(_.semver,a.semver,$);return j>0?_:j<0||a.operator===">"&&_.operator===">="?a:_},lowerLT=(_,a,$)=>{if(!_)return a;const j=compare$1(_.semver,a.semver,$);return j<0?_:j>0||a.operator==="<"&&_.operator==="<="?a:_};var subset_1=subset$1;const internalRe=reExports,constants=constants$1,SemVer=semver$2,identifiers=identifiers$1,parse$4=parse_1,valid=valid_1,clean=clean_1,inc=inc_1,diff=diff_1,major=major_1,minor=minor_1,patch=patch_1,prerelease=prerelease_1,compare=compare_1,rcompare=rcompare_1,compareLoose=compareLoose_1,compareBuild=compareBuild_1,sort=sort_1,rsort=rsort_1,gt=gt_1,lt=lt_1,eq=eq_1,neq=neq_1,gte=gte_1,lte=lte_1,cmp=cmp_1,coerce=coerce_1,Comparator=requireComparator(),Range=requireRange(),satisfies=satisfies_1,toComparators=toComparators_1,maxSatisfying=maxSatisfying_1,minSatisfying=minSatisfying_1,minVersion=minVersion_1,validRange=valid$1,outside=outside_1,gtr=gtr_1,ltr=ltr_1,intersects=intersects_1,simplifyRange=simplify,subset=subset_1;var semver={parse:parse$4,valid,clean,inc,diff,major,minor,patch,prerelease,compare,rcompare,compareLoose,compareBuild,sort,rsort,gt,lt,eq,neq,gte,lte,cmp,coerce,Comparator,Range,satisfies,toComparators,maxSatisfying,minSatisfying,minVersion,validRange,outside,gtr,ltr,intersects,simplifyRange,subset,SemVer,re:internalRe.re,src:internalRe.src,tokens:internalRe.t,SEMVER_SPEC_VERSION:constants.SEMVER_SPEC_VERSION,RELEASE_TYPES:constants.RELEASE_TYPES,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers};const semver$1=getDefaultExportFromCjs$1(semver);var DeviceModelId;(function(_){_.blue="blue",_.nanoS="nanoS",_.nanoSP="nanoSP",_.nanoX="nanoX",_.stax="stax",_.europa="europa"})(DeviceModelId||(DeviceModelId={}));const devices={[DeviceModelId.blue]:{id:DeviceModelId.blue,productName:"Ledger Blue",productIdMM:0,legacyUsbProductId:0,usbOnly:!0,memorySize:480*1024,masks:[822083584,822149120],getBlockSize:_=>4*1024},[DeviceModelId.nanoS]:{id:DeviceModelId.nanoS,productName:"Ledger Nano S",productIdMM:16,legacyUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160],getBlockSize:_=>{var a;return semver$1.lt((a=semver$1.coerce(_))!==null&&a!==void 0?a:"","2.0.0")?4*1024:2*1024}},[DeviceModelId.nanoX]:{id:DeviceModelId.nanoX,productName:"Ledger Nano X",productIdMM:64,legacyUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,masks:[855638016],getBlockSize:_=>4*1024,bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]},[DeviceModelId.nanoSP]:{id:DeviceModelId.nanoSP,productName:"Ledger Nano S Plus",productIdMM:80,legacyUsbProductId:5,usbOnly:!0,memorySize:1533*1024,masks:[856686592],getBlockSize:_=>32},[DeviceModelId.stax]:{id:DeviceModelId.stax,productName:"Ledger Stax",productIdMM:96,legacyUsbProductId:6,usbOnly:!1,memorySize:1533*1024,masks:[857735168],getBlockSize:_=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]},[DeviceModelId.europa]:{id:DeviceModelId.europa,productName:"Ledger Europa",productIdMM:112,legacyUsbProductId:7,usbOnly:!1,memorySize:1533*1024,masks:[858783744],getBlockSize:_=>32,bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}};DeviceModelId.blue,DeviceModelId.nanoS,DeviceModelId.nanoSP,DeviceModelId.nanoX,DeviceModelId.stax,DeviceModelId.europa;const devicesList=Object.values(devices),ledgerUSBVendorId=11415,identifyUSBProductId=_=>{const a=devicesList.find(et=>et.legacyUsbProductId===_);if(a)return a;const $=_>>8;return devicesList.find(et=>et.productIdMM===$)},bluetoothServices=[],serviceUuidToInfos={};for(const _ in devices){const a=devices[_],{bluetoothSpec:$}=a;if($)for(let j=0;j<$.length;j++){const et=$[j];bluetoothServices.push(et.serviceUuid),serviceUuidToInfos[et.serviceUuid]=serviceUuidToInfos[et.serviceUuid.replace(/-/g,"")]=Object.assign({deviceModel:a},et)}}var __awaiter$6=function(_,a,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(st){try{at(j.next(st))}catch(ot){rt(ot)}}function it(st){try{at(j.throw(st))}catch(ot){rt(ot)}}function at(st){st.done?tt(st.value):et(st.value).then(nt,it)}at((j=j.apply(_,a||[])).next())})};const ledgerDevices=[{vendorId:ledgerUSBVendorId}];function requestLedgerDevice(){return __awaiter$6(this,void 0,void 0,function*(){return yield navigator.usb.requestDevice({filters:ledgerDevices})})}function getLedgerDevices(){return __awaiter$6(this,void 0,void 0,function*(){return(yield navigator.usb.getDevices()).filter(a=>a.vendorId===ledgerUSBVendorId)})}function getFirstLedgerDevice(){return __awaiter$6(this,void 0,void 0,function*(){const _=yield getLedgerDevices();return _.length>0?_[0]:requestLedgerDevice()})}const isSupported=()=>Promise.resolve(!!navigator&&!!navigator.usb&&typeof navigator.usb.getDevices=="function");var __awaiter$5=function(_,a,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(st){try{at(j.next(st))}catch(ot){rt(ot)}}function it(st){try{at(j.throw(st))}catch(ot){rt(ot)}}function at(st){st.done?tt(st.value):et(st.value).then(nt,it)}at((j=j.apply(_,a||[])).next())})};const configurationValue=1,endpointNumber=3;class TransportWebUSB extends Transport$1{constructor(a,$){super(),this.channel=Math.floor(Math.random()*65535),this.packetSize=64,this._disconnectEmitted=!1,this._emitDisconnect=j=>{this._disconnectEmitted||(this._disconnectEmitted=!0,this.emit("disconnect",j))},this.device=a,this.interfaceNumber=$,this.deviceModel=identifyUSBProductId(a.productId)}static request(){return __awaiter$5(this,void 0,void 0,function*(){const a=yield requestLedgerDevice();return TransportWebUSB.open(a)})}static openConnected(){return __awaiter$5(this,void 0,void 0,function*(){const a=yield getLedgerDevices();return a.length===0?null:TransportWebUSB.open(a[0])})}static open(a){return __awaiter$5(this,void 0,void 0,function*(){yield a.open(),a.configuration===null&&(yield a.selectConfiguration(configurationValue)),yield gracefullyResetDevice(a);const $=a.configurations[0].interfaces.find(({alternates:rt})=>rt.some(nt=>nt.interfaceClass===255));if(!$)throw new TransportInterfaceNotAvailable("No WebUSB interface found for your Ledger device. Please upgrade firmware or contact techsupport.");const j=$.interfaceNumber;try{yield a.claimInterface(j)}catch(rt){throw yield a.close(),new TransportInterfaceNotAvailable(rt.message)}const et=new TransportWebUSB(a,j),tt=rt=>{a===rt.device&&(navigator.usb.removeEventListener("disconnect",tt),et._emitDisconnect(new DisconnectedDevice))};return navigator.usb.addEventListener("disconnect",tt),et})}close(){return __awaiter$5(this,void 0,void 0,function*(){yield this.exchangeBusyPromise,yield this.device.releaseInterface(this.interfaceNumber),yield gracefullyResetDevice(this.device),yield this.device.close()})}exchange(a){return __awaiter$5(this,void 0,void 0,function*(){return yield this.exchangeAtomicImpl(()=>__awaiter$5(this,void 0,void 0,function*(){const{channel:j,packetSize:et}=this;log$8("apdu","=> "+a.toString("hex"));const tt=createHIDframing(j,et),rt=tt.makeBlocks(a);for(let at=0;at{throw j&&j.message&&j.message.includes("disconnected")?(this._emitDisconnect(j),new DisconnectedDeviceDuringOperation(j.message)):j})})}setScrambleKey(){}}TransportWebUSB.isSupported=isSupported;TransportWebUSB.list=getLedgerDevices;TransportWebUSB.listen=_=>{let a=!1;getFirstLedgerDevice().then(j=>{if(!a){const et=identifyUSBProductId(j.productId);_.next({type:"add",descriptor:j,deviceModel:et}),_.complete()}},j=>{window.DOMException&&j instanceof window.DOMException&&j.code===18?_.error(new TransportWebUSBGestureRequired(j.message)):_.error(new TransportOpenUserCancelled(j.message))});function $(){a=!0}return{unsubscribe:$}};function gracefullyResetDevice(_){return __awaiter$5(this,void 0,void 0,function*(){try{yield _.reset()}catch(a){console.warn(a)}})}function __awaiter$4(_,a,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(st){try{at(j.next(st))}catch(ot){rt(ot)}}function it(st){try{at(j.throw(st))}catch(ot){rt(ot)}}function at(st){st.done?tt(st.value):et(st.value).then(nt,it)}at((j=j.apply(_,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const MAX_CHUNK_SIZE=230;function transformPathToBuffer(_){const a=[];_.split("/").forEach(et=>{let tt=parseInt(et,10);Number.isNaN(tt)||(et.length>1&&et[et.length-1]==="'"&&(tt+=2147483648),a.push(tt))});const j=Buffer$g.alloc(1+a.length*4);return j[0]=a.length,a.forEach((et,tt)=>{j.writeUInt32BE(et,1+4*tt)}),j}function compressPublicKey(_,a){return a===0||a===3?_=_.slice(1):(_[0]=2+(_[64]&1),_=_.slice(0,33)),_}function appendWatermark(_,a){let $=_;return typeof a<"u"&&($=Buffer$g.from(a).toString("hex").concat(_)),$}function chunkOperation(_,a){let $=0;for(;$!==a.length;){const j=$+MAX_CHUNK_SIZE>=a.length?a.length-$:MAX_CHUNK_SIZE,et=Buffer$g.alloc(j);a.copy(et,0,$,$+j),_.push(et),$+=j}return _}function validateResponse(_){let a=!0;_[0]!==49&&_[0]!==48&&(a=!1),_[1]+4!==_.length&&(a=!1),_[2]!==2&&(a=!1);const $=_[3];_[4+$]!==2&&(a=!1);const j=5+$,et=_[j];return j+1+et+2!==_.length&&(a=!1),a}function extractValue(_,a){const $=Buffer$g.alloc(32);$.fill(0);let j=a[_],et=_+1;return j>32&&(et+=j-32,j=32),a.copy($,32-j,et,et+j),{buffer:$,idxValueStart:et,length:j}}class InvalidLedgerResponseError extends TaquitoError{constructor(a){super(),this.message=a,this.name="InvalidLedgerResponseError"}}class PublicKeyRetrievalError extends TaquitoError{constructor(a){super(),this.cause=a,this.name="PublicKeyRetrievalError",this.message="Unable to retrieve Public Key from Ledger"}}class PublicKeyHashRetrievalError extends TaquitoError{constructor(){super(),this.name="PublicKeyHashRetrievalError",this.message="Unable to retrieve Public Key Hash from Ledger"}}class InvalidDerivationTypeError extends ParameterValidationError{constructor(a){super(),this.derivationType=a,this.name="InvalidDerivationTypeError",this.message=`Invalid derivation type ${a} expecting one of the following: DerivationType.ED25519, DerivationType.SECP256K1, DerivationType.P256 or DerivationType.BIP32_ED25519`}}var DerivationType;(function(_){_[_.ED25519=0]="ED25519",_[_.SECP256K1=1]="SECP256K1",_[_.P256=2]="P256",_[_.BIP32_ED25519=3]="BIP32_ED25519"})(DerivationType||(DerivationType={}));class LedgerSigner{constructor(a,$="44'/1729'/0'/0'",j=!0,et=DerivationType.ED25519){if(this.transport=a,this.path=$,this.prompt=j,this.derivationType=et,this.CLA=128,this.INS_GET_PUBLIC_KEY=2,this.INS_PROMPT_PUBLIC_KEY=3,this.INS_SIGN=4,this.FIRST_MESSAGE_SEQUENCE=0,this.LAST_MESSAGE_SEQUENCE=129,this.OTHER_MESSAGE_SEQUENCE=1,this.transport.setScrambleKey("XTZ"),!$.startsWith("44'/1729'"))throw new InvalidDerivationPathError($,`${invalidDetail(ValidationResult.NO_PREFIX_MATCHED)} expecting prefix "44'/1729'".`);if(!Object.values(DerivationType).includes(et))throw new InvalidDerivationTypeError(et.toString())}publicKeyHash(){return __awaiter$4(this,void 0,void 0,function*(){if(this._publicKeyHash||(yield this.publicKey()),this._publicKeyHash)return this._publicKeyHash;throw new PublicKeyHashRetrievalError})}publicKey(){return __awaiter$4(this,void 0,void 0,function*(){if(this._publicKey)return this._publicKey;const a=yield this.getLedgerPublicKey(),$=a[0],j=a.slice(1,1+$),et=compressPublicKey(j,this.derivationType),tt=this.getPrefixes(),rt=b58cencode(et,tt.prefPk),nt=b58cencode(blake2b$1.hash(et,20),tt.prefPkh);return this._publicKey=rt,this._publicKeyHash=nt,rt})}getLedgerPublicKey(){return __awaiter$4(this,void 0,void 0,function*(){try{let a=this.INS_PROMPT_PUBLIC_KEY;return this.prompt===!1&&(a=this.INS_GET_PUBLIC_KEY),yield this.transport.send(this.CLA,a,this.FIRST_MESSAGE_SEQUENCE,this.derivationType,transformPathToBuffer(this.path))}catch(a){throw new PublicKeyRetrievalError(a)}})}secretKey(){return __awaiter$4(this,void 0,void 0,function*(){throw new ProhibitedActionError("Secret key cannot be exposed")})}sign(a,$){return __awaiter$4(this,void 0,void 0,function*(){const j=appendWatermark(a,$),et=Buffer$g.from(j,"hex");let tt=[];tt.push(transformPathToBuffer(this.path)),tt=chunkOperation(tt,et);const rt=yield this.signWithLedger(tt);let nt;if(this.derivationType===DerivationType.ED25519||this.derivationType===DerivationType.BIP32_ED25519)nt=rt.slice(0,rt.length-2).toString("hex");else{if(!validateResponse(rt))throw new InvalidLedgerResponseError("Invalid signature return by ledger unable to parse the response");const at=extractValue(3,rt),st=at.idxValueStart+at.length+1,ot=extractValue(st,rt);nt=Buffer$g.concat([at.buffer,ot.buffer]).toString("hex")}return{bytes:a,sig:b58cencode(nt,prefix[Prefix.SIG]),prefixSig:b58cencode(nt,this.getPrefixes().prefSig),sbytes:a+nt}})}signWithLedger(a){return __awaiter$4(this,void 0,void 0,function*(){let $=yield this.transport.send(this.CLA,this.INS_SIGN,this.FIRST_MESSAGE_SEQUENCE,this.derivationType,a[0]);for(let j=1;j{$.push(encodeURIComponent(et)+"="+encodeURIComponent(rt))});continue}$.push(encodeURIComponent(et)+"="+encodeURIComponent(tt))}const j=$.join("&");return j?`?${j}`:""}createRequest({url:a,method:$,timeout:j=this.timeout,query:et,headers:tt={},json:rt=!0},nt){return __awaiter$3(this,void 0,void 0,function*(){const it=a+this.serialize(et);tt["Content-Type"]||(tt["Content-Type"]="application/json");const at=new AbortController,st=setTimeout(()=>at.abort(),j);try{const ot=yield fetch$1(it,{method:$,headers:tt,body:JSON.stringify(nt),signal:at.signal});if(typeof ot>"u")throw new Error("Response is undefined");if(ot.status>=400){const ut=yield ot.text();throw new HttpResponseError(`Http error response: (${ot.status}) ${ut}`,ot.status,ot.statusText,ut,it)}return rt?ot.json():ot.text()}catch(ot){throw ot instanceof Error&&ot.name==="AbortError"?new HttpTimeoutError(j,it):ot instanceof HttpResponseError?ot:new HttpRequestFailed(String($),it,ot)}finally{clearTimeout(st)}})}}function __rest$2(_,a){var $={};for(var j in _)Object.prototype.hasOwnProperty.call(_,j)&&a.indexOf(j)<0&&($[j]=_[j]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(_);et"u"&&(a=Object.keys(_));const j=$?[]:{};return a.forEach(et=>{const tt=_[et];let rt;if(!(typeof tt>"u")){if(Array.isArray(tt)){rt=castToBigNumber(tt),j[et]=rt;return}rt=new BigNumber(tt),j[et]=rt}}),j}var OPERATION_METADATA;(function(_){_.TOO_LARGE="too large"})(OPERATION_METADATA||(OPERATION_METADATA={}));var METADATA_BALANCE_UPDATES_CATEGORY;(function(_){_.BAKING_BONUSES="baking bonuses",_.BAKING_REWARDS="baking rewards",_.BLOCK_FEES="block fees",_.BONDS="bonds",_.BOOTSTRAP="bootstrap",_.BURNED="burned",_.COMMITMENT="commitment",_.DELEGATE_DENOMINATOR="delegate_denominator",_.DELEGATOR_NUMERATOR="delegator_numerator",_.DEPOSITS="deposits",_.ENDORSING_REWARDS="endorsing rewards",_.INVOICE="invoice",_.LOST_ENDORSING_REWARDS="lost endorsing rewards",_.MINTED="minted",_.NONCE_REVELATION_REWARDS="nonce revelation rewards",_.PUNISHMENTS="punishments",_.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",_.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",_.STORAGE_FEES="storage fees",_.SUBSIDY="subsidy",_.UNSTAKED_DEPOSITS="unstaked_deposits"})(METADATA_BALANCE_UPDATES_CATEGORY||(METADATA_BALANCE_UPDATES_CATEGORY={}));var PvmKind;(function(_){_.WASM2="wasm_2_0_0",_.ARITH="arith",_.RISCV="riscv"})(PvmKind||(PvmKind={}));var SmartRollupRefutationOptions;(function(_){_.START="start",_.MOVE="move"})(SmartRollupRefutationOptions||(SmartRollupRefutationOptions={}));var SmartRollupInputProofKind;(function(_){_.INBOX_PROOF="inbox_proof",_.REVEAL_PROOF="reveal_proof",_.FIRST_INPUT="first_input"})(SmartRollupInputProofKind||(SmartRollupInputProofKind={}));var SmartRollupRefuteRevealProofKind;(function(_){_.RAW_DATA_PROOF="raw_data_proof",_.METADATA_PROOF="metadata_proof",_.DAL_PAGE_PROOF="dal_page_proof"})(SmartRollupRefuteRevealProofKind||(SmartRollupRefuteRevealProofKind={}));var SmartRollupRefuteGameStatusOptions;(function(_){_.ONGOING="ongoing",_.ENDED="ended"})(SmartRollupRefuteGameStatusOptions||(SmartRollupRefuteGameStatusOptions={}));var SmartRollupRefuteGameEndedPlayerOutcomes;(function(_){_.LOSER="loser",_.DRAW="draw"})(SmartRollupRefuteGameEndedPlayerOutcomes||(SmartRollupRefuteGameEndedPlayerOutcomes={}));var SmartRollupRefuteGameEndedReason;(function(_){_.CONFLICT_RESOLVED="conflict_resolved",_.TIMEOUT="timeout"})(SmartRollupRefuteGameEndedReason||(SmartRollupRefuteGameEndedReason={}));var OpKind;(function(_){_.ORIGINATION="origination",_.DELEGATION="delegation",_.REVEAL="reveal",_.TRANSACTION="transaction",_.ACTIVATION="activate_account",_.ATTESTATION="attestation",_.ENDORSEMENT="endorsement",_.PREATTESTATION="preattestation",_.PREENDORSEMENT="preendorsement",_.SET_DEPOSITS_LIMIT="set_deposits_limit",_.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",_.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",_.ATTESTATION_WITH_SLOT="attestation_with_slot",_.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",_.SEED_NONCE_REVELATION="seed_nonce_revelation",_.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",_.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",_.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",_.PROPOSALS="proposals",_.BALLOT="ballot",_.FAILING_NOOP="failing_noop",_.REGISTER_GLOBAL_CONSTANT="register_global_constant",_.TRANSFER_TICKET="transfer_ticket",_.INCREASE_PAID_STORAGE="increase_paid_storage",_.UPDATE_CONSENSUS_KEY="update_consensus_key",_.DRAIN_DELEGATE="drain_delegate",_.VDF_REVELATION="vdf_revelation",_.EVENT="event",_.TICKET_UPDATES="ticket_updates",_.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",_.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",_.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",_.SMART_ROLLUP_PUBLISH="smart_rollup_publish",_.SMART_ROLLUP_CEMENT="smart_rollup_cement",_.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",_.SMART_ROLLUP_REFUTE="smart_rollup_refute",_.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout"})(OpKind||(OpKind={}));class RpcClient{constructor(a,$=defaultChain,j=new HttpBackend){this.url=a,this.chain=$,this.httpBackend=j}createURL(a){let $=this.url;for(;$.endsWith("/");)$=$.slice(0,-1);return`${$}${a}`}validateAddress(a){const $=validateAddress(a);if($!==ValidationResult.VALID)throw new InvalidAddressError(a,invalidDetail($))}validateContract(a){const $=validateContractAddress(a);if($!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail($))}getBlockHash({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/hash`),method:"GET"})})}getLiveBlocks({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/live_blocks`),method:"GET"})})}getBalance(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/balance`),method:"GET"});return new BigNumber(j)})}getStorage(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/storage`),method:"GET"})})}getScript(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/script`),method:"GET"})})}getNormalizedScript(a,$={unparsing_mode:"Readable"},{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${a}/script/normalized`),method:"POST"},$)})}getContract(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}`),method:"GET"});return Object.assign(Object.assign({},j),{balance:new BigNumber(j.balance)})})}getManagerKey(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/manager_key`),method:"GET"})})}getDelegate(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);let j;try{j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/delegate`),method:"GET"})}catch(et){if(et instanceof HttpResponseError&&et.status===STATUS_CODE.NOT_FOUND)j=null;else throw et}return j})}getBigMapKey(a,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(a),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${a}/big_map_get`),method:"POST"},$)})}getBigMapExpr(a,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/big_maps/${a}/${$}`),method:"GET"})})}getDelegates(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(a);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/delegates/${a}`),method:"GET"}),et=castToBigNumber(j,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance","voting_power","total_delegated_stake","staking_denominator"]);return Object.assign(Object.assign(Object.assign({},j),et),{frozen_balance_by_cycle:j.frozen_balance_by_cycle?j.frozen_balance_by_cycle.map(tt=>{var{deposit:rt,deposits:nt,fees:it,rewards:at}=tt,st=__rest$2(tt,["deposit","deposits","fees","rewards"]);const ot=castToBigNumber({deposit:rt,deposits:nt,fees:it,rewards:at},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},st),{deposit:ot.deposit,deposits:ot.deposits,fees:ot.fees,rewards:ot.rewards})}):void 0})})}getVotingInfo(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(a),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/delegates/${a}/voting_info`),method:"GET"})})}getConstants({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/context/constants`),method:"GET"}),j=castToBigNumber($,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_endorsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round","tx_rollup_commitment_bond","vdf_difficulty","sc_rollup_stake_amount","minimal_stake"]);return Object.assign(Object.assign({},$),j)})}getBlock({block:a,version:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j={url:this.createURL(`/chains/${this.chain}/blocks/${a}`),method:"GET"};return $!==void 0&&(j.query={version:$}),yield this.httpBackend.createRequest(j)})}getBlockHeader({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/header`),method:"GET"})})}getBlockMetadata({block:a,version:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j={url:this.createURL(`/chains/${this.chain}/blocks/${a}/metadata`),method:"GET"};return $!==void 0&&(j.query={version:$}),yield this.httpBackend.createRequest(j)})}getBakingRights(a={},{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/baking_rights`),method:"GET",query:a})})}getAttestationRights(a={},{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/attestation_rights`),method:"GET",query:a})})}getEndorsingRights(a={},{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/endorsing_rights`),method:"GET",query:a})})}getBallotList({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/ballot_list`),method:"GET"})})}getBallots({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/ballots`),method:"GET"});return castToBigNumber($,["yay","nay","pass"])})}getCurrentProposal({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/current_proposal`),method:"GET"})})}getCurrentQuorum({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/current_quorum`),method:"GET"})})}getVotesListings({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/listings`),method:"GET"});return $.map(j=>(j.voting_power&&(j.voting_power=new BigNumber(j.voting_power)),j)),$})}getProposals({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/proposals`),method:"GET"});return $.map(j=>j[1]=new BigNumber(j[1])),$})}forgeOperations(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/forge/operations`),method:"POST"},a)})}injectOperation(a){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},a)})}preapplyOperations(a,{block:$,version:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const et={url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/preapply/operations`),method:"POST"};return j!==void 0&&(et.query={version:j}),yield this.httpBackend.createRequest(et,a)})}getEntrypoints(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(a),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/entrypoints`),method:"GET"})})}runOperation(a,{block:$,version:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const et={url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/run_operation`),method:"POST"};return j!==void 0&&(et.query={version:j}),yield this.httpBackend.createRequest(et,a)})}simulateOperation(a,{block:$,version:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const et={url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/simulate_operation`),method:"POST"};return j!==void 0&&(et.query={version:j}),yield this.httpBackend.createRequest(et,a)})}runCode(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/run_code`),method:"POST"},a)})}runScriptView(a,$){var{unparsing_mode:j="Readable"}=a,et=__rest$2(a,["unparsing_mode"]),tt=$===void 0?defaultRPCOptions:$,rt=tt.block;return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${rt}/helpers/scripts/run_script_view`),method:"POST"},Object.assign({unparsing_mode:j},et))})}runView(a,$){var{unparsing_mode:j="Readable"}=a,et=__rest$2(a,["unparsing_mode"]),tt=$===void 0?defaultRPCOptions:$,rt=tt.block;return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${rt}/helpers/scripts/run_view`),method:"POST"},Object.assign({unparsing_mode:j},et))})}getChainId(){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})})}packData(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/helpers/scripts/pack_data`),method:"POST"},a),{gas:et}=j,tt=__rest$2(j,["gas"]);let rt=et;const nt=new BigNumber(et||"");return nt.isNaN()||(rt=nt),Object.assign({gas:rt},tt)})}getRpcUrl(){return this.url}getCurrentPeriod({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/current_period`),method:"GET"})})}getSuccessorPeriod({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/votes/successor_period`),method:"GET"})})}getSaplingDiffById(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/sapling/${a}/get_diff`),method:"GET"})})}getSaplingDiffByContract(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/single_sapling_get_diff`),method:"GET"})})}getProtocols({block:a}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${a}/protocols`),method:"GET"})})}getStorageUsedSpace(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/storage/used_space`),method:"GET"})})}getStoragePaidSpace(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/storage/paid_space`),method:"GET"})})}getTicketBalance(a,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${a}/ticket_balance`),method:"POST"},$)})}getAllTicketBalances(a,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${a}/all_ticket_balances`),method:"GET"})})}getPendingOperations(a={}){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/pending_operations`),method:"GET",query:a})})}}var src={},sha256$1={},_sha2={},_assert={};Object.defineProperty(_assert,"__esModule",{value:!0});_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function number$2(_){if(!Number.isSafeInteger(_)||_<0)throw new Error(`Wrong positive integer: ${_}`)}_assert.number=number$2;function bool$2(_){if(typeof _!="boolean")throw new Error(`Expected boolean, not ${_}`)}_assert.bool=bool$2;function bytes$1(_,...a){if(!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length>0&&!a.includes(_.length))throw new TypeError(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}_assert.bytes=bytes$1;function hash$4(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(_.outputLen),number$2(_.blockLen)}_assert.hash=hash$4;function exists$1(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=exists$1;function output$1(_,a){bytes$1(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert.output=output$1;const assert$k={number:number$2,bool:bool$2,bytes:bytes$1,hash:hash$4,exists:exists$1,output:output$1};_assert.default=assert$k;var utils$o={},crypto$1={};Object.defineProperty(crypto$1,"__esModule",{value:!0});crypto$1.crypto=void 0;crypto$1.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(_){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_,"__esModule",{value:!0}),_.randomBytes=_.wrapConstructorWithOpts=_.wrapConstructor=_.checkOpts=_.Hash=_.concatBytes=_.toBytes=_.utf8ToBytes=_.asyncLoop=_.nextTick=_.hexToBytes=_.bytesToHex=_.isLE=_.rotr=_.createView=_.u32=_.u8=void 0;const a=crypto$1,$=Lt=>new Uint8Array(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.u8=$;const j=Lt=>new Uint32Array(Lt.buffer,Lt.byteOffset,Math.floor(Lt.byteLength/4));_.u32=j;const et=Lt=>new DataView(Lt.buffer,Lt.byteOffset,Lt.byteLength);_.createView=et;const tt=(Lt,Nt)=>Lt<<32-Nt|Lt>>>Nt;if(_.rotr=tt,_.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!_.isLE)throw new Error("Non little-endian hardware is not supported");const rt=Array.from({length:256},(Lt,Nt)=>Nt.toString(16).padStart(2,"0"));function nt(Lt){if(!(Lt instanceof Uint8Array))throw new Error("Uint8Array expected");let Nt="";for(let zt=0;zt{};_.nextTick=at;async function st(Lt,Nt,zt){let jt=Date.now();for(let Mt=0;Mt=0&&Dtjt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Lt.length===1)return Lt[0];const Nt=Lt.reduce((jt,Mt)=>jt+Mt.length,0),zt=new Uint8Array(Nt);for(let jt=0,Mt=0;jtObject.prototype.toString.call(Lt)==="[object Object]"&&Lt.constructor===Object;function Ct(Lt,Nt){if(Nt!==void 0&&(typeof Nt!="object"||!xt(Nt)))throw new TypeError("Options should be object or undefined");return Object.assign(Lt,Nt)}_.checkOpts=Ct;function Pt(Lt){const Nt=jt=>Lt().update(ut(jt)).digest(),zt=Lt();return Nt.outputLen=zt.outputLen,Nt.blockLen=zt.blockLen,Nt.create=()=>Lt(),Nt}_.wrapConstructor=Pt;function Tt(Lt){const Nt=(jt,Mt)=>Lt(Mt).update(ut(jt)).digest(),zt=Lt({});return Nt.outputLen=zt.outputLen,Nt.blockLen=zt.blockLen,Nt.create=jt=>Lt(jt),Nt}_.wrapConstructorWithOpts=Tt;function kt(Lt=32){if(a.crypto&&typeof a.crypto.getRandomValues=="function")return a.crypto.getRandomValues(new Uint8Array(Lt));throw new Error("crypto.getRandomValues must be defined")}_.randomBytes=kt})(utils$o);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1$1=_assert,utils_js_1$3=utils$o;function setBigUint64(_,a,$,j){if(typeof _.setBigUint64=="function")return _.setBigUint64(a,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,at=j?0:4;_.setUint32(a+it,rt,j),_.setUint32(a+at,nt,j)}class SHA2 extends utils_js_1$3.Hash{constructor(a,$,j,et){super(),this.blockLen=a,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,utils_js_1$3.createView)(this.buffer)}update(a){_assert_js_1$1.default.exists(this);const{view:$,buffer:j,blockLen:et}=this;a=(0,utils_js_1$3.toBytes)(a);const tt=a.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let ot=rt;otst.length)throw new Error("_sha2: outputLen bigger than state");for(let ot=0;ot_&a^~_&$,Maj=(_,a,$)=>_&a^_&$^a&$,SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends _sha2_js_1$1.SHA2{constructor(){super(64,32,8,!1),this.A=IV[0]|0,this.B=IV[1]|0,this.C=IV[2]|0,this.D=IV[3]|0,this.E=IV[4]|0,this.F=IV[5]|0,this.G=IV[6]|0,this.H=IV[7]|0}get(){const{A:a,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[a,$,j,et,tt,rt,nt,it]}set(a,$,j,et,tt,rt,nt,it){this.A=a|0,this.B=$|0,this.C=j|0,this.D=et|0,this.E=tt|0,this.F=rt|0,this.G=nt|0,this.H=it|0}process(a,$){for(let ot=0;ot<16;ot++,$+=4)SHA256_W[ot]=a.getUint32($,!1);for(let ot=16;ot<64;ot++){const ut=SHA256_W[ot-15],dt=SHA256_W[ot-2],mt=(0,utils_js_1$2.rotr)(ut,7)^(0,utils_js_1$2.rotr)(ut,18)^ut>>>3,xt=(0,utils_js_1$2.rotr)(dt,17)^(0,utils_js_1$2.rotr)(dt,19)^dt>>>10;SHA256_W[ot]=xt+SHA256_W[ot-7]+mt+SHA256_W[ot-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:at,H:st}=this;for(let ot=0;ot<64;ot++){const ut=(0,utils_js_1$2.rotr)(nt,6)^(0,utils_js_1$2.rotr)(nt,11)^(0,utils_js_1$2.rotr)(nt,25),dt=st+ut+Chi(nt,it,at)+SHA256_K[ot]+SHA256_W[ot]|0,xt=((0,utils_js_1$2.rotr)(j,2)^(0,utils_js_1$2.rotr)(j,13)^(0,utils_js_1$2.rotr)(j,22))+Maj(j,et,tt)|0;st=at,at=it,it=nt,nt=rt+dt|0,rt=tt,tt=et,et=j,j=dt+xt|0}j=j+this.A|0,et=et+this.B|0,tt=tt+this.C|0,rt=rt+this.D|0,nt=nt+this.E|0,it=it+this.F|0,at=at+this.G|0,st=st+this.H|0,this.set(j,et,tt,rt,nt,it,at,st)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class SHA224 extends SHA256{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}sha256$1.sha256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA256);sha256$1.sha224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA224);var sha512$1={},_u64={};(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.add=_.toBig=_.split=_.fromBig=void 0;const a=BigInt(2**32-1),$=BigInt(32);function j(Ft,Bt=!1){return Bt?{h:Number(Ft&a),l:Number(Ft>>$&a)}:{h:Number(Ft>>$&a)|0,l:Number(Ft&a)|0}}_.fromBig=j;function et(Ft,Bt=!1){let yt=new Uint32Array(Ft.length),bt=new Uint32Array(Ft.length);for(let ct=0;ctBigInt(Ft>>>0)<<$|BigInt(Bt>>>0);_.toBig=tt;const rt=(Ft,Bt,yt)=>Ft>>>yt,nt=(Ft,Bt,yt)=>Ft<<32-yt|Bt>>>yt,it=(Ft,Bt,yt)=>Ft>>>yt|Bt<<32-yt,at=(Ft,Bt,yt)=>Ft<<32-yt|Bt>>>yt,st=(Ft,Bt,yt)=>Ft<<64-yt|Bt>>>yt-32,ot=(Ft,Bt,yt)=>Ft>>>yt-32|Bt<<64-yt,ut=(Ft,Bt)=>Bt,dt=(Ft,Bt)=>Ft,mt=(Ft,Bt,yt)=>Ft<>>32-yt,xt=(Ft,Bt,yt)=>Bt<>>32-yt,Ct=(Ft,Bt,yt)=>Bt<>>64-yt,Pt=(Ft,Bt,yt)=>Ft<>>64-yt;function Tt(Ft,Bt,yt,bt){const ct=(Bt>>>0)+(bt>>>0);return{h:Ft+yt+(ct/2**32|0)|0,l:ct|0}}_.add=Tt;const kt=(Ft,Bt,yt)=>(Ft>>>0)+(Bt>>>0)+(yt>>>0),Lt=(Ft,Bt,yt,bt)=>Bt+yt+bt+(Ft/2**32|0)|0,Nt=(Ft,Bt,yt,bt)=>(Ft>>>0)+(Bt>>>0)+(yt>>>0)+(bt>>>0),zt=(Ft,Bt,yt,bt,ct)=>Bt+yt+bt+ct+(Ft/2**32|0)|0,jt=(Ft,Bt,yt,bt,ct)=>(Ft>>>0)+(Bt>>>0)+(yt>>>0)+(bt>>>0)+(ct>>>0),Mt=(Ft,Bt,yt,bt,ct,ht)=>Bt+yt+bt+ct+ht+(Ft/2**32|0)|0,Dt={fromBig:j,split:et,toBig:_.toBig,shrSH:rt,shrSL:nt,rotrSH:it,rotrSL:at,rotrBH:st,rotrBL:ot,rotr32H:ut,rotr32L:dt,rotlSH:mt,rotlSL:xt,rotlBH:Ct,rotlBL:Pt,add:Tt,add3L:kt,add3H:Lt,add4L:Nt,add4H:zt,add5H:Mt,add5L:jt};_.default=Dt})(_u64);Object.defineProperty(sha512$1,"__esModule",{value:!0});sha512$1.sha384=sha512$1.sha512_256=sha512$1.sha512_224=sha512$1.sha512=sha512$1.SHA512=void 0;const _sha2_js_1=_sha2,_u64_js_1=_u64,utils_js_1$1=utils$o,[SHA512_Kh,SHA512_Kl]=_u64_js_1.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(_=>BigInt(_))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends _sha2_js_1.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:a,Al:$,Bh:j,Bl:et,Ch:tt,Cl:rt,Dh:nt,Dl:it,Eh:at,El:st,Fh:ot,Fl:ut,Gh:dt,Gl:mt,Hh:xt,Hl:Ct}=this;return[a,$,j,et,tt,rt,nt,it,at,st,ot,ut,dt,mt,xt,Ct]}set(a,$,j,et,tt,rt,nt,it,at,st,ot,ut,dt,mt,xt,Ct){this.Ah=a|0,this.Al=$|0,this.Bh=j|0,this.Bl=et|0,this.Ch=tt|0,this.Cl=rt|0,this.Dh=nt|0,this.Dl=it|0,this.Eh=at|0,this.El=st|0,this.Fh=ot|0,this.Fl=ut|0,this.Gh=dt|0,this.Gl=mt|0,this.Hh=xt|0,this.Hl=Ct|0}process(a,$){for(let kt=0;kt<16;kt++,$+=4)SHA512_W_H[kt]=a.getUint32($),SHA512_W_L[kt]=a.getUint32($+=4);for(let kt=16;kt<80;kt++){const Lt=SHA512_W_H[kt-15]|0,Nt=SHA512_W_L[kt-15]|0,zt=_u64_js_1.default.rotrSH(Lt,Nt,1)^_u64_js_1.default.rotrSH(Lt,Nt,8)^_u64_js_1.default.shrSH(Lt,Nt,7),jt=_u64_js_1.default.rotrSL(Lt,Nt,1)^_u64_js_1.default.rotrSL(Lt,Nt,8)^_u64_js_1.default.shrSL(Lt,Nt,7),Mt=SHA512_W_H[kt-2]|0,Dt=SHA512_W_L[kt-2]|0,Ft=_u64_js_1.default.rotrSH(Mt,Dt,19)^_u64_js_1.default.rotrBH(Mt,Dt,61)^_u64_js_1.default.shrSH(Mt,Dt,6),Bt=_u64_js_1.default.rotrSL(Mt,Dt,19)^_u64_js_1.default.rotrBL(Mt,Dt,61)^_u64_js_1.default.shrSL(Mt,Dt,6),yt=_u64_js_1.default.add4L(jt,Bt,SHA512_W_L[kt-7],SHA512_W_L[kt-16]),bt=_u64_js_1.default.add4H(yt,zt,Ft,SHA512_W_H[kt-7],SHA512_W_H[kt-16]);SHA512_W_H[kt]=bt|0,SHA512_W_L[kt]=yt|0}let{Ah:j,Al:et,Bh:tt,Bl:rt,Ch:nt,Cl:it,Dh:at,Dl:st,Eh:ot,El:ut,Fh:dt,Fl:mt,Gh:xt,Gl:Ct,Hh:Pt,Hl:Tt}=this;for(let kt=0;kt<80;kt++){const Lt=_u64_js_1.default.rotrSH(ot,ut,14)^_u64_js_1.default.rotrSH(ot,ut,18)^_u64_js_1.default.rotrBH(ot,ut,41),Nt=_u64_js_1.default.rotrSL(ot,ut,14)^_u64_js_1.default.rotrSL(ot,ut,18)^_u64_js_1.default.rotrBL(ot,ut,41),zt=ot&dt^~ot&xt,jt=ut&mt^~ut&Ct,Mt=_u64_js_1.default.add5L(Tt,Nt,jt,SHA512_Kl[kt],SHA512_W_L[kt]),Dt=_u64_js_1.default.add5H(Mt,Pt,Lt,zt,SHA512_Kh[kt],SHA512_W_H[kt]),Ft=Mt|0,Bt=_u64_js_1.default.rotrSH(j,et,28)^_u64_js_1.default.rotrBH(j,et,34)^_u64_js_1.default.rotrBH(j,et,39),yt=_u64_js_1.default.rotrSL(j,et,28)^_u64_js_1.default.rotrBL(j,et,34)^_u64_js_1.default.rotrBL(j,et,39),bt=j&tt^j&nt^tt&nt,ct=et&rt^et&it^rt⁢Pt=xt|0,Tt=Ct|0,xt=dt|0,Ct=mt|0,dt=ot|0,mt=ut|0,{h:ot,l:ut}=_u64_js_1.default.add(at|0,st|0,Dt|0,Ft|0),at=nt|0,st=it|0,nt=tt|0,it=rt|0,tt=j|0,rt=et|0;const ht=_u64_js_1.default.add3L(Ft,yt,ct);j=_u64_js_1.default.add3H(ht,Dt,Bt,bt),et=ht|0}({h:j,l:et}=_u64_js_1.default.add(this.Ah|0,this.Al|0,j|0,et|0)),{h:tt,l:rt}=_u64_js_1.default.add(this.Bh|0,this.Bl|0,tt|0,rt|0),{h:nt,l:it}=_u64_js_1.default.add(this.Ch|0,this.Cl|0,nt|0,it|0),{h:at,l:st}=_u64_js_1.default.add(this.Dh|0,this.Dl|0,at|0,st|0),{h:ot,l:ut}=_u64_js_1.default.add(this.Eh|0,this.El|0,ot|0,ut|0),{h:dt,l:mt}=_u64_js_1.default.add(this.Fh|0,this.Fl|0,dt|0,mt|0),{h:xt,l:Ct}=_u64_js_1.default.add(this.Gh|0,this.Gl|0,xt|0,Ct|0),{h:Pt,l:Tt}=_u64_js_1.default.add(this.Hh|0,this.Hl|0,Pt|0,Tt|0),this.set(j,et,tt,rt,nt,it,at,st,ot,ut,dt,mt,xt,Ct,Pt,Tt)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}sha512$1.SHA512=SHA512;class SHA512_224 extends SHA512{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class SHA512_256 extends SHA512{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class SHA384 extends SHA512{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}sha512$1.sha512=(0,utils_js_1$1.wrapConstructor)(()=>new SHA512);sha512$1.sha512_224=(0,utils_js_1$1.wrapConstructor)(()=>new SHA512_224);sha512$1.sha512_256=(0,utils_js_1$1.wrapConstructor)(()=>new SHA512_256);sha512$1.sha384=(0,utils_js_1$1.wrapConstructor)(()=>new SHA384);var pbkdf2$1={},hmac$2={};(function(_){Object.defineProperty(_,"__esModule",{value:!0}),_.hmac=void 0;const a=_assert,$=utils$o;class j extends $.Hash{constructor(rt,nt){super(),this.finished=!1,this.destroyed=!1,a.default.hash(rt);const it=(0,$.toBytes)(nt);if(this.iHash=rt.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const at=this.blockLen,st=new Uint8Array(at);st.set(it.length>at?rt.create().update(it).digest():it);for(let ot=0;otnew j(tt,rt).update(nt).digest();_.hmac=et,_.hmac.create=(tt,rt)=>new j(tt,rt)})(hmac$2);Object.defineProperty(pbkdf2$1,"__esModule",{value:!0});pbkdf2$1.pbkdf2Async=pbkdf2$1.pbkdf2=void 0;const _assert_js_1=_assert,hmac_js_1=hmac$2,utils_js_1=utils$o;function pbkdf2Init(_,a,$,j){_assert_js_1.default.hash(_);const et=(0,utils_js_1.checkOpts)({dkLen:32,asyncTick:10},j),{c:tt,dkLen:rt,asyncTick:nt}=et;if(_assert_js_1.default.number(tt),_assert_js_1.default.number(rt),_assert_js_1.default.number(nt),tt<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const it=(0,utils_js_1.toBytes)(a),at=(0,utils_js_1.toBytes)($),st=new Uint8Array(rt),ot=hmac_js_1.hmac.create(_,it),ut=ot._cloneInto().update(at);return{c:tt,dkLen:rt,asyncTick:nt,DK:st,PRF:ot,PRFSalt:ut}}function pbkdf2Output(_,a,$,j,et){return _.destroy(),a.destroy(),j&&j.destroy(),et.fill(0),$}function pbkdf2(_,a,$,j){const{c:et,dkLen:tt,DK:rt,PRF:nt,PRFSalt:it}=pbkdf2Init(_,a,$,j);let at;const st=new Uint8Array(4),ot=(0,utils_js_1.createView)(st),ut=new Uint8Array(nt.outputLen);for(let dt=1,mt=0;mt{it._cloneInto(st).update(dt).digestInto(dt);for(let Tt=0;Ttlpad(a.toString(2),"0",8)).join("")}function deriveChecksumBits(_){const $=_.length*8/32,j=sha256_1.sha256(Uint8Array.from(_));return bytesToBinary(Array.from(j)).slice(0,$)}function salt(_){return"mnemonic"+(_||"")}function mnemonicToSeedSync(_,a){const $=Uint8Array.from(Buffer$g.from(normalize(_),"utf8")),j=Uint8Array.from(Buffer$g.from(salt(normalize(a)),"utf8")),et=pbkdf2_1.pbkdf2(sha512_1.sha512,$,j,{c:2048,dkLen:64});return Buffer$g.from(et)}var mnemonicToSeedSync_1=src.mnemonicToSeedSync=mnemonicToSeedSync;function mnemonicToSeed(_,a){const $=Uint8Array.from(Buffer$g.from(normalize(_),"utf8")),j=Uint8Array.from(Buffer$g.from(salt(normalize(a)),"utf8"));return pbkdf2_1.pbkdf2Async(sha512_1.sha512,$,j,{c:2048,dkLen:64}).then(et=>Buffer$g.from(et))}src.mnemonicToSeed=mnemonicToSeed;function mnemonicToEntropy(_,a){if(a=a||DEFAULT_WORDLIST,!a)throw new Error(WORDLIST_REQUIRED);const $=normalize(_).split(" ");if($.length%3!==0)throw new Error(INVALID_MNEMONIC);const j=$.map(st=>{const ot=a.indexOf(st);if(ot===-1)throw new Error(INVALID_MNEMONIC);return lpad(ot.toString(2),"0",11)}).join(""),et=Math.floor(j.length/33)*32,tt=j.slice(0,et),rt=j.slice(et),nt=tt.match(/(.{1,8})/g).map(binaryToByte);if(nt.length<16)throw new Error(INVALID_ENTROPY);if(nt.length>32)throw new Error(INVALID_ENTROPY);if(nt.length%4!==0)throw new Error(INVALID_ENTROPY);const it=Buffer$g.from(nt);if(deriveChecksumBits(it)!==rt)throw new Error(INVALID_CHECKSUM);return it.toString("hex")}src.mnemonicToEntropy=mnemonicToEntropy;function entropyToMnemonic(_,a){if(Buffer$g.isBuffer(_)||(_=Buffer$g.from(_,"hex")),a=a||DEFAULT_WORDLIST,!a)throw new Error(WORDLIST_REQUIRED);if(_.length<16)throw new TypeError(INVALID_ENTROPY);if(_.length>32)throw new TypeError(INVALID_ENTROPY);if(_.length%4!==0)throw new TypeError(INVALID_ENTROPY);const $=bytesToBinary(Array.from(_)),j=deriveChecksumBits(_),rt=($+j).match(/(.{1,11})/g).map(nt=>{const it=binaryToByte(nt);return a[it]});return a[0]==="あいこくしん"?rt.join(" "):rt.join(" ")}src.entropyToMnemonic=entropyToMnemonic;function generateMnemonic(_,a,$){if(_=_||128,_%32!==0)throw new TypeError(INVALID_ENTROPY);return a=a||(j=>Buffer$g.from(utils_1.randomBytes(j))),entropyToMnemonic(a(_/8),$)}var generateMnemonic_1=src.generateMnemonic=generateMnemonic;function validateMnemonic(_,a){try{mnemonicToEntropy(_,a)}catch{return!1}return!0}var validateMnemonic_1=src.validateMnemonic=validateMnemonic;function setDefaultWordlist(_){const a=_wordlists_1.wordlists[_];if(a)DEFAULT_WORDLIST=a;else throw new Error('Could not find wordlist for language "'+_+'"')}src.setDefaultWordlist=setDefaultWordlist;function getDefaultWordlist(){if(!DEFAULT_WORDLIST)throw new Error("No Default Wordlist set");return Object.keys(_wordlists_1.wordlists).filter(_=>_==="JA"||_==="EN"?!1:_wordlists_1.wordlists[_].every((a,$)=>a===DEFAULT_WORDLIST[$]))[0]}src.getDefaultWordlist=getDefaultWordlist;var _wordlists_2=_wordlists,wordlists=src.wordlists=_wordlists_2.wordlists,hmac$1={},hash$3={};Object.defineProperty(hash$3,"__esModule",{value:!0});function isSerializableHash(_){return typeof _.saveState<"u"&&typeof _.restoreState<"u"&&typeof _.cleanSavedState<"u"}hash$3.isSerializableHash=isSerializableHash;Object.defineProperty(hmac$1,"__esModule",{value:!0});var hash_1=hash$3,constant_time_1=constantTime,wipe_1=wipe$1,HMAC=function(){function _(a,$){this._finished=!1,this._inner=new a,this._outer=new a,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var j=new Uint8Array(this.blockSize);$.length>this.blockSize?this._inner.update($).finish(j).clean():j.set($);for(var et=0;etmaxSeedSize$1)throw new InvalidSeedLengthError(tt.length);if(!Object.prototype.hasOwnProperty.call(seedKey,$))throw new InvalidCurveError(`Unsupported curve "${$}" expecting either "p256" or "secp256k1"`);const rt=new elliptic$3.ec($);if(((j=rt.n)===null||j===void 0?void 0:j.bitLength())!==256)throw new InvalidBitSize(`Invalid curve "${$}" with bit size "${(et=rt.n)===null||et===void 0?void 0:et.bitLength()}" expecting bit size "256"`);const nt=new TextEncoder().encode(seedKey[$]);let it=null,at=new Uint8Array,st=0;for(;st===0;){const ut=new HMAC_1(sha512$2.SHA512,nt).update(tt).digest();it=new BN$p(ut.subarray(0,32)),at=ut.subarray(32),it.isZero()||it.cmp(rt.n)>=0?tt=ut:st++}const ot=rt.keyPair({});return ot.priv=it,new lm(ot,at)}derive(a){const $=new Uint8Array(37);a&Hard?$.set(this.keyPair.getPrivate().toArray(),1):$.set(this.keyPair.getPublic().encodeCompressed(),0),new DataView($.buffer).setUint32(33,a);let j=new BN$p(0),et=new Uint8Array,tt=0;for(;tt===0;){const nt=new HMAC_1(sha512$2.SHA512,this.chainCode).update($).digest();j=new BN$p(nt.subarray(0,32)),et=nt.subarray(32),this.keyPair.ec.n&&j.cmp(this.keyPair.ec.n)<0&&(j=j.add(this.keyPair.getPrivate()).mod(this.keyPair.ec.n),j.isZero()||tt++),$.set(et,1),$[0]=1}const rt=this.keyPair.ec.keyPair({});return rt.priv=j,new lm(rt,et)}derivePath(a){let $=this;for(const j of a)$=$.derive(j);return $}bytes(){if(!this.keyPair.priv)throw new InvalidKeyError("missing private key");const a=this.keyPair.priv.toArray(),$=new Uint8Array(32);return $.set(a,$.length-a.length),$}};const Hard=2147483648;class Path extends Array{static from(a){return super.from(a).map($=>$>>>0)}static fromString(a){if(a.length===0)return new Path;let $=a.split("/");const j=[];$[0]==="m"&&($=$.slice(1));for(let et of $){if(et.length===0)throw new InvalidDerivationPathError(a,": Invalid BIP32 path");let tt=0;const rt=et[et.length-1];(rt==="'"||rt==="h"||rt==="H")&&(tt=Hard,et=et.slice(0,et.length-1));const nt=(parseInt(et,10)|tt)>>>0;j.push(nt)}return Path.from(j)}}const minSeedSize=16,maxSeedSize=64,ed25519Key="ed25519 seed";class PrivateKey{constructor(a,$){this.priv=a,this.chainCode=$}static fromSeed(a){const $=typeof a=="string"?parseHex(a):a;if($.lengthmaxSeedSize)throw new InvalidSeedLengthError($.length);const j=new TextEncoder().encode(ed25519Key),et=new HMAC_1(sha512$2.SHA512,j).update($).digest();return new PrivateKey(ed25519.generateKeyPairFromSeed(et.subarray(0,32)).secretKey,et.subarray(32))}seed(){return this.priv.subarray(0,32)}derive(a){if(!(a&Hard))throw new InvalidDerivationPathError(a.toString(),": Non-hardened derivation path.");const $=new Uint8Array(37);$.set(this.seed(),1),new DataView($.buffer).setUint32(33,a);const j=new HMAC_1(sha512$2.SHA512,this.chainCode).update($).digest();return new PrivateKey(ed25519.generateKeyPairFromSeed(j.subarray(0,32)).secretKey,j.subarray(32))}derivePath(a){let $=this;for(const j of a)$=$.derive(j);return $}}const generateSecretKey=(_,a,$)=>{const j=Path.fromString(a);let et;switch($){case"ed25519":return et=PrivateKey.fromSeed(_).derivePath(j),b58cencode(et.seed().slice(0,32),prefix.edsk2);case"secp256k1":case"p256":{const tt=$==="secp256k1"?prefix.spsk:prefix.p2sk;let rt=PrivateKey$1.fromSeed(_,$);rt=rt.derivePath(j);const nt=new Uint8Array(rt.keyPair.getPrivate().toArray());return b58cencode(nt,tt)}case"bip25519":throw new ToBeImplemented;default:throw new InvalidCurveError(`Unsupported curve "${$}" expecting one of the following "ed25519", "secp256k1", "p256"`)}};class InMemorySigner{static fromFundraiser(a,$,j){if(!validateMnemonic_1(j))throw new InvalidMnemonicError(j);const et=mnemonicToSeedSync_1(j,`${a}${$}`),tt=b58cencode(et.slice(0,32),prefix.edsk2);return new InMemorySigner(tt)}static fromSecretKey(a,$){return __awaiter$1(this,void 0,void 0,function*(){return new InMemorySigner(a,$)})}static fromMnemonic({mnemonic:a,password:$="",derivationPath:j="44'/1729'/0'/0'",curve:et="ed25519"}){if(!validateMnemonic_1(a))throw new InvalidMnemonicError(a);const tt=mnemonicToSeedSync_1(a,$),rt=generateSecretKey(tt,j,et);return new InMemorySigner(rt)}constructor(a,$){const j=a.substring(2,3)==="e";let et=tt=>tt;if(j){if(!$)throw new InvalidPassphraseError("No passphrase provided to decrypt encrypted key");et=tt=>{const rt=toBuffer$1(tt.slice(0,8)),nt=tt.slice(8),it=browser$7.pbkdf2Sync($,rt,32768,32,"sha512");return nacl.openSecretBox(new Uint8Array(it),new Uint8Array(24),new Uint8Array(nt))}}switch(a.substring(0,4)){case"edes":case"edsk":this._key=new Tz1(a,j,et);break;case"spsk":case"spes":this._key=new Tz2(a,j,et);break;case"p2sk":case"p2es":this._key=new Tz3(a,j,et);break;default:throw new InvalidKeyError(`${invalidDetail(ValidationResult.NO_PREFIX_MATCHED)} expecting one of the following '${Prefix.EDESK}', '${Prefix.EDSK}', '${Prefix.SPSK}', '${Prefix.SPESK}', '${Prefix.P2SK}' or '${Prefix.P2ESK}'.`)}}sign(a,$){return __awaiter$1(this,void 0,void 0,function*(){let j=hex2buf(a);typeof $<"u"&&(j=mergebuf($,j));const et=blake2b$1.hash(j,32);return this._key.sign(a,et)})}publicKey(){return __awaiter$1(this,void 0,void 0,function*(){return this._key.publicKey()})}publicKeyHash(){return __awaiter$1(this,void 0,void 0,function*(){return this._key.publicKeyHash()})}secretKey(){return __awaiter$1(this,void 0,void 0,function*(){return this._key.secretKey()})}}function isFunction$1(_){return typeof _=="function"}function createErrorClass(_){var a=function(j){Error.call(j),j.stack=new Error().stack},$=_(a);return $.prototype=Object.create(Error.prototype),$.prototype.constructor=$,$}var UnsubscriptionError=createErrorClass(function(_){return function($){_(this),this.message=$?$.length+` errors occurred during unsubscription: `+$.map(function(j,et){return et+1+") "+j.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=$}});function arrRemove(_,a){if(_){var $=_.indexOf(a);0<=$&&_.splice($,1)}}var Subscription=function(){function _(a){this.initialTeardown=a,this.closed=!1,this._parentage=null,this._finalizers=null}return _.prototype.unsubscribe=function(){var a,$,j,et,tt;if(!this.closed){this.closed=!0;var rt=this._parentage;if(rt)if(this._parentage=null,Array.isArray(rt))try{for(var nt=__values(rt),it=nt.next();!it.done;it=nt.next()){var ot=it.value;ot.remove(this)}}catch(Et){a={error:Et}}finally{try{it&&!it.done&&($=nt.return)&&$.call(nt)}finally{if(a)throw a.error}}else rt.remove(this);var st=this.initialTeardown;if(isFunction$1(st))try{st()}catch(Et){tt=Et instanceof UnsubscriptionError?Et.errors:[Et]}var at=this._finalizers;if(at){this._finalizers=null;try{for(var ut=__values(at),ht=ut.next();!ht.done;ht=ut.next()){var bt=ht.value;try{execFinalizer(bt)}catch(Et){tt=tt??[],Et instanceof UnsubscriptionError?tt=__spreadArray(__spreadArray([],__read(tt)),__read(Et.errors)):tt.push(Et)}}}catch(Et){j={error:Et}}finally{try{ht&&!ht.done&&(et=ut.return)&&et.call(ut)}finally{if(j)throw j.error}}}if(tt)throw new UnsubscriptionError(tt)}},_.prototype.add=function(a){var $;if(a&&a!==this)if(this.closed)execFinalizer(a);else{if(a instanceof _){if(a.closed||a._hasParent(this))return;a._addParent(this)}(this._finalizers=($=this._finalizers)!==null&&$!==void 0?$:[]).push(a)}},_.prototype._hasParent=function(a){var $=this._parentage;return $===a||Array.isArray($)&&$.includes(a)},_.prototype._addParent=function(a){var $=this._parentage;this._parentage=Array.isArray($)?($.push(a),$):$?[$,a]:a},_.prototype._removeParent=function(a){var $=this._parentage;$===a?this._parentage=null:Array.isArray($)&&arrRemove($,a)},_.prototype.remove=function(a){var $=this._finalizers;$&&arrRemove($,a),a instanceof _&&a._removeParent(this)},_.EMPTY=function(){var a=new _;return a.closed=!0,a}(),_}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(_){return _ instanceof Subscription||_&&"closed"in _&&isFunction$1(_.remove)&&isFunction$1(_.add)&&isFunction$1(_.unsubscribe)}function execFinalizer(_){isFunction$1(_)?_():_.unsubscribe()}var config$2={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(_,a){for(var $=[],j=2;j0},enumerable:!1,configurable:!0}),a.prototype._trySubscribe=function($){return this._throwIfClosed(),_.prototype._trySubscribe.call(this,$)},a.prototype._subscribe=function($){return this._throwIfClosed(),this._checkFinalizedStatuses($),this._innerSubscribe($)},a.prototype._innerSubscribe=function($){var j=this,et=this,tt=et.hasError,rt=et.isStopped,nt=et.observers;return tt||rt?EMPTY_SUBSCRIPTION:(this.currentObservers=null,nt.push($),new Subscription(function(){j.currentObservers=null,arrRemove(nt,$)}))},a.prototype._checkFinalizedStatuses=function($){var j=this,et=j.hasError,tt=j.thrownError,rt=j.isStopped;et?$.error(tt):rt&&$.complete()},a.prototype.asObservable=function(){var $=new Observable;return $.source=this,$},a.create=function($,j){return new AnonymousSubject($,j)},a}(Observable),AnonymousSubject=function(_){__extends$1(a,_);function a($,j){var et=_.call(this)||this;return et.destination=$,et.source=j,et}return a.prototype.next=function($){var j,et;(et=(j=this.destination)===null||j===void 0?void 0:j.next)===null||et===void 0||et.call(j,$)},a.prototype.error=function($){var j,et;(et=(j=this.destination)===null||j===void 0?void 0:j.error)===null||et===void 0||et.call(j,$)},a.prototype.complete=function(){var $,j;(j=($=this.destination)===null||$===void 0?void 0:$.complete)===null||j===void 0||j.call($)},a.prototype._subscribe=function($){var j,et;return(et=(j=this.source)===null||j===void 0?void 0:j.subscribe($))!==null&&et!==void 0?et:EMPTY_SUBSCRIPTION},a}(Subject),BehaviorSubject=function(_){__extends$1(a,_);function a($){var j=_.call(this)||this;return j._value=$,j}return Object.defineProperty(a.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),a.prototype._subscribe=function($){var j=_.prototype._subscribe.call(this,$);return!j.closed&&$.next(this._value),j},a.prototype.getValue=function(){var $=this,j=$.hasError,et=$.thrownError,tt=$._value;if(j)throw et;return this._throwIfClosed(),tt},a.prototype.next=function($){_.prototype.next.call(this,this._value=$)},a}(Subject),dateTimestampProvider={now:function(){return(dateTimestampProvider.delegate||Date).now()},delegate:void 0},ReplaySubject=function(_){__extends$1(a,_);function a($,j,et){$===void 0&&($=1/0),j===void 0&&(j=1/0),et===void 0&&(et=dateTimestampProvider);var tt=_.call(this)||this;return tt._bufferSize=$,tt._windowTime=j,tt._timestampProvider=et,tt._buffer=[],tt._infiniteTimeWindow=!0,tt._infiniteTimeWindow=j===1/0,tt._bufferSize=Math.max(1,$),tt._windowTime=Math.max(1,j),tt}return a.prototype.next=function($){var j=this,et=j.isStopped,tt=j._buffer,rt=j._infiniteTimeWindow,nt=j._timestampProvider,it=j._windowTime;et||(tt.push($),!rt&&tt.push(nt.now()+it)),this._trimBuffer(),_.prototype.next.call(this,$)},a.prototype._subscribe=function($){this._throwIfClosed(),this._trimBuffer();for(var j=this._innerSubscribe($),et=this,tt=et._infiniteTimeWindow,rt=et._buffer,nt=rt.slice(),it=0;it0&&Pt(et)},void 0,void 0,function(){bt!=null&&bt.closed||bt==null||bt.unsubscribe(),Et=null})),!Ct&&Pt(j!=null?typeof j=="number"?j:+j-it.now():et)})}function timeoutErrorFactory(_){throw new TimeoutError(_)}function map$1(_,a){return operate(function($,j){var et=0;$.subscribe(createOperatorSubscriber(j,function(tt){j.next(_.call(a,tt,et++))}))})}var isArray$2=Array.isArray;function callOrApply(_,a){return isArray$2(a)?_.apply(void 0,__spreadArray([],__read(a))):_(a)}function mapOneOrManyArgs(_){return map$1(function(a){return callOrApply(_,a)})}var isArray$1=Array.isArray,getPrototypeOf=Object.getPrototypeOf,objectProto=Object.prototype,getKeys$1=Object.keys;function argsArgArrayOrObject(_){if(_.length===1){var a=_[0];if(isArray$1(a))return{args:a,keys:null};if(isPOJO(a)){var $=getKeys$1(a);return{args:$.map(function(j){return a[j]}),keys:$}}}return{args:_,keys:null}}function isPOJO(_){return _&&typeof _=="object"&&getPrototypeOf(_)===objectProto}function createObject(_,a){return _.reduce(function($,j,et){return $[j]=a[et],$},{})}function combineLatest(){for(var _=[],a=0;a=2;return function(j){return j.pipe(identity,take(1),$?defaultIfEmpty(a):throwIfEmpty(function(){return new EmptyError}))}}function multicast(_,a){var $=isFunction$1(_)?_:function(){return _};return isFunction$1(a)?connect(a,{connector:$}):function(j){return new ConnectableObservable(j,$)}}function pluck(){for(var _=[],a=0;a0&&(st=new SafeSubscriber({next:function(Ut){return Nt.next(Ut)},error:function(Ut){Et=!0,Ct(),at=handleReset(Pt,et,Ut),Nt.error(Ut)},complete:function(){bt=!0,Ct(),at=handleReset(Pt,rt),Nt.complete()}}),innerFrom(It).subscribe(st))})(ot)}}function handleReset(_,a){for(var $=[],j=2;j{j.set(et,a[et])}),j}typecheckKey(a){this.keySchema&&this.keySchema.Typecheck(a)}typecheckValue(a){this.valueSchema&&this.valueSchema.Typecheck(a)}assertTypecheckValue(a){try{this.typecheckValue(a)}catch($){throw new MapTypecheckError(a,this.valueSchema,"value",$)}}assertTypecheckKey(a){try{this.typecheckKey(a)}catch($){throw new MapTypecheckError(a,this.keySchema,"key",$)}}serializeDeterministically(a){return stringify$2(a)}*keys(){for(const[a]of this.entries())yield a}*values(){for(const[,a]of this.entries())yield a}*entries(){for(const a of this.valueMap.keys())yield[this.keyMap.get(a),this.valueMap.get(a)]}get(a){this.assertTypecheckKey(a);const $=this.serializeDeterministically(a);return this.valueMap.get($)}set(a,$){this.assertTypecheckKey(a),this.assertTypecheckValue($);const j=this.serializeDeterministically(a);this.keyMap.set(j,a),this.valueMap.set(j,$)}delete(a){this.assertTypecheckKey(a),this.keyMap.delete(this.serializeDeterministically(a)),this.valueMap.delete(this.serializeDeterministically(a))}has(a){this.assertTypecheckKey(a);const $=this.serializeDeterministically(a);return this.keyMap.has($)&&this.valueMap.has($)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(a){for(const[$,j]of this.entries())a(j,$,this)}}_a$1=michelsonMapTypeSymbol;class TokenValidationError extends TaquitoError{constructor(a,$,j){super(),this.value=a,this.token=$,this.name="TokenValidationError";const et=this.token.annot(),tt=et?`[${et}] `:"";this.message=`${tt}${j}`}}class Token{constructor(a,$,j){this.val=a,this.idx=$,this.fac=j,this.createToken=this.fac}typeWithoutAnnotations(){const a=j=>{if(typeof j=="object"){if(Array.isArray(j))return j.map(rt=>a(rt));const et=j;return et.args?{prim:et.prim,args:et.args.map(tt=>a(tt))}:{prim:et.prim}}return j};return(j=>j.args?{prim:j.prim,args:j.args.map(et=>a(et))}:{prim:j.prim})(this.val)}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.ExtractSchema()]]}}class ComparableToken extends Token{compare(a,$){return a===$?0:a<$?-1:1}}class BigMapValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="BigMapValidationError"}}class BigMapToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}ExtractSchema(){return{big_map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:BigMapToken.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}validate(a){if(!MichelsonMap.isMichelsonMap(a))throw new BigMapValidationError(a,this,`Value ${JSON.stringify(a)} is not a MichelsonMap`)}objLitToMichelsonMap(a){return a instanceof MichelsonMap?a:typeof a=="object"?Object.keys(a).length===0?new MichelsonMap:MichelsonMap.fromLiteral(a):a}Encode(a){const $=this.objLitToMichelsonMap(a.pop());return this.validate($),Array.from($.keys()).sort((j,et)=>this.KeySchema.compare(j,et)).map(j=>({prim:"Elt",args:[this.KeySchema.EncodeObject(j),this.ValueSchema.EncodeObject($.get(j))]}))}EncodeObject(a,$){const j=this.objLitToMichelsonMap(a);return this.validate(j),$&&$[BigMapToken.prim]?$[BigMapToken.prim](j,this.val):Array.from(j.keys()).sort((et,tt)=>this.KeySchema.compare(et,tt)).map(et=>({prim:"Elt",args:[this.KeySchema.EncodeObject(et),this.ValueSchema.EncodeObject(j.get(et))]}))}Execute(a,$){if($&&$[BigMapToken.prim])return $[BigMapToken.prim](a,this.val);if(Array.isArray(a)){const j=new MichelsonMap(this.val);return a.forEach(et=>{j.set(this.KeySchema.ToKey(et.args[0]),this.ValueSchema.Execute(et.args[1]))}),j}else{if("int"in a)return a.int;throw new BigMapValidationError(a,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(a)}`)}}findAndReturnTokens(a,$){return BigMapToken.prim===a&&$.push(this),this.KeySchema.findAndReturnTokens(a,$),this.ValueSchema.findAndReturnTokens(a,$),$}}BigMapToken.prim="big_map";class OrValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="OrValidationError"}}class OrToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Encode(a){const $=a[a.length-1],j=this.createToken(this.val.args[0],this.idx);let et=1;j instanceof OrToken&&(et=Object.keys(j.ExtractSchema()).length);const tt=this.createToken(this.val.args[1],this.idx+et);if(String(j.annot())===String($)&&!(j instanceof OrToken))return a.pop(),{prim:"Left",args:[j.Encode(a)]};if(String(tt.annot())===String($)&&!(tt instanceof OrToken))return a.pop(),{prim:"Right",args:[tt.Encode(a)]};if(j instanceof OrToken){const rt=j.Encode(a);if(rt)return{prim:"Left",args:[rt]}}if(tt instanceof OrToken){const rt=tt.Encode(a);if(rt)return{prim:"Right",args:[rt]}}return null}ExtractSignature(){const a=this.createToken(this.val.args[0],this.idx);let $=1;a instanceof OrToken&&($=Object.keys(a.ExtractSchema()).length);const j=this.createToken(this.val.args[1],this.idx+$),et=[];if(a instanceof OrToken)et.push(...a.ExtractSignature());else for(const tt of a.ExtractSignature())et.push([a.annot(),...tt]);if(j instanceof OrToken)et.push(...j.ExtractSignature());else for(const tt of j.ExtractSignature())et.push([j.annot(),...tt]);return et}EncodeObject(a,$){this.validateJavascriptObject(a);const j=Object.keys(a)[0],et=this.createToken(this.val.args[0],this.idx);let tt=1;et instanceof OrToken&&(tt=Object.keys(et.ExtractSchema()).length);const rt=this.createToken(this.val.args[1],this.idx+tt);if(String(et.annot())===String(j)&&!(et instanceof OrToken))return{prim:"Left",args:[et.EncodeObject(a[j],$)]};if(String(rt.annot())===String(j)&&!(rt instanceof OrToken))return{prim:"Right",args:[rt.EncodeObject(a[j],$)]};if(et instanceof OrToken){const nt=et.EncodeObject(a,$);if(nt)return{prim:"Left",args:[nt]}}if(rt instanceof OrToken){const nt=rt.EncodeObject(a,$);if(nt)return{prim:"Right",args:[nt]}}return null}validateJavascriptObject(a){if(typeof a!="object"||Array.isArray(a)||a===null||Object.keys(a).length!==1)throw new OrValidationError(a,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(a)}`)}Execute(a,$){const j=this.createToken(this.val.args[0],this.idx);let et=1;j instanceof OrToken&&(et=Object.keys(j.ExtractSchema()).length);const tt=this.createToken(this.val.args[1],this.idx+et);if(a.prim==="Right")return tt instanceof OrToken?tt.Execute(a.args[0],$):{[tt.annot()]:tt.Execute(a.args[0],$)};if(a.prim==="Left")return j instanceof OrToken?j.Execute(a.args[0],$):{[j.annot()]:j.Execute(a.args[0],$)};throw new OrValidationError(a,this,`Was expecting Left or Right prim but got: ${JSON.stringify(a.prim)}`)}traversal(a,$,j){const et=this.createToken(this.val.args[0],this.idx);let tt=1,rt;et instanceof OrToken?(rt=a(et),tt=Object.keys(et.ExtractSchema()).length):rt={[et.annot()]:a(et)};const nt=this.createToken(this.val.args[1],this.idx+tt);let it;return nt instanceof OrToken?it=$(nt):it={[nt.annot()]:$(nt)},j(rt,it)}ExtractSchema(){return this.traversal(a=>a.ExtractSchema(),a=>a.ExtractSchema(),(a,$)=>Object.assign(Object.assign({},a),$))}generateSchema(){return{__michelsonType:OrToken.prim,schema:this.traversal(a=>a instanceof OrToken?a.generateSchema().schema:a.generateSchema(),a=>a instanceof OrToken?a.generateSchema().schema:a.generateSchema(),(a,$)=>Object.assign(Object.assign({},a),$))}}findToken(a){const $=this.createToken(this.val.args[0],this.idx);let j=1;$ instanceof OrToken&&(j=Object.keys($.ExtractSchema()).length);const et=this.createToken(this.val.args[1],this.idx+j);if(String($.annot())===String(a)&&!($ instanceof OrToken)&&$ instanceof ComparableToken)return $;if(String(et.annot())===String(a)&&!(et instanceof OrToken)&&et instanceof ComparableToken)return et;if($ instanceof OrToken){const tt=$.findToken(a);if(tt)return tt}if(et instanceof OrToken){const tt=et.findToken(a);if(tt)return tt}return null}compare(a,$){const j=Object.keys(a)[0],et=Object.keys($)[0];if(j===et){const tt=this.findToken(j);if(tt instanceof ComparableToken)return tt.compare(a[j],$[j])}else{const tt=JSON.stringify(this.EncodeObject(a)),rt=JSON.stringify(this.EncodeObject($));return ttj.findAndReturnTokens(a,$),j=>j.findAndReturnTokens(a,$),(j,et)=>Object.assign(Object.assign({},j),et)),$}}OrToken.prim="or";class TokenArgumentValidationError extends TaquitoError{constructor(a){super(a),this.message=a,this.name="TokenArgumentValidationError"}}class TokenComparisonError extends TaquitoError{constructor(a,$){super(),this.val1=a,this.val2=$,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(a)} and ${JSON.stringify($)} are not comparable`}}function collapse$1(_,a=PairToken.prim){if(Array.isArray(_))return collapse$1({prim:a,args:_},a);if(_.args===void 0)throw new TokenArgumentValidationError(`The value ${JSON.stringify(_)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return _.args.length>2?[_.args[0],{prim:a,args:_.args.slice(1)}]:[_.args[0],_.args[1]]}class PairToken extends ComparableToken{constructor(a,$,j){super(Array.isArray(a)?{prim:PairToken.prim,args:a}:a.prim?a:{prim:PairToken.prim,args:a},$,j)}args(){return collapse$1(this.val)}tokens(){let a=0;return this.args().map($=>{const j=this.createToken($,this.idx+a);return j instanceof PairToken?a+=Object.keys(j.ExtractSchema()).length:a++,j})}Encode(a){return{prim:"Pair",args:this.tokens().map($=>$.Encode(a))}}ExtractSignature(){const a=this.args(),$=this.createToken(a[0],this.idx);let j=1;$ instanceof OrToken&&(j=Object.keys($.ExtractSchema()).length);const et=this.createToken(a[1],this.idx+j),tt=[];for(const rt of $.ExtractSignature())for(const nt of et.ExtractSignature())tt.push([...rt,...nt]);return tt}ToBigMapKey(a){return{key:this.EncodeObject(a),type:this.typeWithoutAnnotations()}}ToKey(a){return this.Execute(a)}EncodeObject(a,$){const[j,et]=this.tokens();let tt;j instanceof PairToken&&!j.hasAnnotations()?tt=a:tt=a[j.annot()];let rt;return et instanceof PairToken&&!et.hasAnnotations()?rt=a:rt=a[et.annot()],{prim:"Pair",args:[j.EncodeObject(tt,$),et.EncodeObject(rt,$)]}}traversal(a,$){const j=this.args(),et=this.createToken(j[0],this.idx);let tt=1,rt;et instanceof PairToken&&!et.hasAnnotations()?(rt=a(et),et instanceof PairToken&&(tt=Object.keys(et.ExtractSchema()).length)):rt={[et.annot()]:a(et)};const nt=this.createToken(j[1],this.idx+tt);let it;return nt instanceof PairToken&&!nt.hasAnnotations()?it=$(nt):it={[nt.annot()]:$(nt)},Object.assign(Object.assign({},rt),it)}Execute(a,$){const j=collapse$1(a,"Pair");return this.traversal(et=>et.Execute(j[0],$),et=>et.Execute(j[1],$))}ExtractSchema(){return this.traversal(a=>a.ExtractSchema(),a=>a.ExtractSchema())}generateSchema(){return{__michelsonType:PairToken.prim,schema:this.traversal(a=>a instanceof PairToken&&!a.hasAnnotations()?a.generateSchema().schema:a.generateSchema(),a=>a instanceof PairToken&&!a.hasAnnotations()?a.generateSchema().schema:a.generateSchema())}}compare(a,$){const[j,et]=this.tokens(),tt=(rt,nt)=>rt instanceof PairToken&&!rt.hasAnnotations()?nt:nt[rt.annot()];if(j instanceof ComparableToken&&et instanceof ComparableToken){const rt=j.compare(tt(j,a),tt(j,$));return rt===0?et.compare(tt(et,a),tt(et,$)):rt}throw new TokenComparisonError(a,$)}findAndReturnTokens(a,$){return PairToken.prim===a&&$.push(this),this.tokens().map(j=>j.findAndReturnTokens(a,$)),$}}PairToken.prim="pair";class NatValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="NatValidationError"}}class NatToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){return new BigNumber(a[Object.keys(a)[0]])}Encode(a){const $=a.pop();return this.validate($),{int:new BigNumber($).toFixed()}}validate(a){const $=new BigNumber(a);if($.isNaN())throw new NatValidationError(a,this,`Value is not a number: ${JSON.stringify(a)}`);if($.isNegative())throw new NatValidationError(a,this,`Value cannot be negative: ${JSON.stringify(a)}`)}EncodeObject(a,$){return this.validate(a),$&&$[NatToken.prim]?$[NatToken.prim](a):{int:new BigNumber(a).toFixed()}}ExtractSchema(){return NatToken.prim}generateSchema(){return{__michelsonType:NatToken.prim,schema:NatToken.prim}}ToBigMapKey(a){return{key:{int:String(a)},type:{prim:NatToken.prim}}}ToKey({int:a}){return new BigNumber(a)}compare(a,$){const j=Number(a),et=Number($);return j===et?0:jrt.startsWith("tz"),et=j(a),tt=j($);return et&&!tt?-1:tt&&!et?1:super.compare(a,$)}findAndReturnTokens(a,$){return AddressToken.prim===a&&$.push(this),$}}AddressToken.prim="address";class MapValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="MapValidationError"}}class MapToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(a){if(!MichelsonMap.isMichelsonMap(a))throw new MapValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid MichelsonMap`)}Execute(a,$){const j=new MichelsonMap(this.val);return a.forEach(et=>{j.set(this.KeySchema.ToKey(et.args[0]),this.ValueSchema.Execute(et.args[1],$))}),j}objLitToMichelsonMap(a){return a instanceof MichelsonMap?a:typeof a=="object"?Object.keys(a).length===0?new MichelsonMap:MichelsonMap.fromLiteral(a):a}Encode(a){const $=this.objLitToMichelsonMap(a.pop());return this.validate($),Array.from($.keys()).sort((j,et)=>this.KeySchema.compare(j,et)).map(j=>({prim:"Elt",args:[this.KeySchema.EncodeObject(j),this.ValueSchema.EncodeObject($.get(j))]}))}EncodeObject(a,$){const j=this.objLitToMichelsonMap(a);return this.validate(j),$&&$[MapToken.prim]?$[MapToken.prim](j):Array.from(j.keys()).sort((et,tt)=>this.KeySchema.compare(et,tt)).map(et=>({prim:"Elt",args:[this.KeySchema.EncodeObject(et),this.ValueSchema.EncodeObject(j.get(et))]}))}ExtractSchema(){return{map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:MapToken.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(a,$){return MapToken.prim===a&&$.push(this),this.KeySchema.findAndReturnTokens(a,$),this.ValueSchema.findAndReturnTokens(a,$),$}}MapToken.prim="map";class BoolToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){return String(a.prim).toLowerCase()==="true"}Encode(a){return{prim:a.pop()?"True":"False"}}EncodeObject(a,$){return $&&$[BoolToken.prim]?$[BoolToken.prim](a):{prim:a?"True":"False"}}ExtractSchema(){return BoolToken.prim}generateSchema(){return{__michelsonType:BoolToken.prim,schema:BoolToken.prim}}ToBigMapKey(a){return{key:this.EncodeObject(a),type:{prim:BoolToken.prim}}}ToKey(a){return this.EncodeObject(a)}compare(a,$){return a&&$||!a&&!$?0:a?1:-1}findAndReturnTokens(a,$){return BoolToken.prim===a&&$.push(this),$}}BoolToken.prim="bool";class ContractValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ContractValidationError"}}class ContractToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(validateAddress(a)!==ValidationResult.VALID)throw new ContractValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid contract address.`);return null}Execute(a){if(a.string)return a.string;if(!a.bytes)throw new ContractValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid contract address. must contain bytes or string.`);return encodeAddress(a.bytes)}Encode(a){const $=a.pop();return this.validate($),{string:$}}EncodeObject(a,$){return this.validate(a),$&&$[ContractToken.prim]?$[ContractToken.prim](a):{string:a}}ExtractSchema(){return ContractToken.prim}generateSchema(){const a=this.createToken(this.val.args[0],0);return{__michelsonType:ContractToken.prim,schema:{parameter:this.val.args[0]?a.generateSchema():{}}}}findAndReturnTokens(a,$){return ContractToken.prim===a&&$.push(this),$}}ContractToken.prim="contract";class ListValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ListValidationError"}}class ListToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(a){if(!Array.isArray(a))throw new ListValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid array`)}Encode(a){const $=a.pop();this.validate($);const j=this.createToken(this.val.args[0],0);return $.reduce((et,tt)=>[...et,j.EncodeObject(tt)],[])}Execute(a,$){const j=this.createToken(this.val.args[0],0);return this.validate(a),a.reduce((et,tt)=>[...et,j.Execute(tt,$)],[])}EncodeObject(a,$){const j=this.createToken(this.val.args[0],0);return this.validate(a),$&&$[ListToken.prim]?$[ListToken.prim](a):a.reduce((et,tt)=>[...et,j.EncodeObject(tt)],[])}ExtractSchema(){return{[ListToken.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:ListToken.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(a,$){return ListToken.prim===a&&$.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(a,$),$}}ListToken.prim="list";class MutezValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="MutezValidationError"}}class MutezToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){return new BigNumber(a[Object.keys(a)[0]])}ExtractSchema(){return MutezToken.prim}generateSchema(){return{__michelsonType:MutezToken.prim,schema:MutezToken.prim}}validate(a){if(new BigNumber(a).isNaN())throw new MutezValidationError(a,this,`Value is not a number: ${a}`)}Encode(a){const $=a.pop();return this.validate($),{int:String($).toString()}}EncodeObject(a,$){return this.validate(a),$&&$[MutezToken.prim]?$[MutezToken.prim](a):{int:String(a).toString()}}ToBigMapKey(a){return{key:{int:String(a)},type:{prim:MutezToken.prim}}}ToKey({int:a}){return a}compare(a,$){const j=Number(a),et=Number($);return j===et?0:jthis.KeySchema.compare(j,et)).reduce((j,et)=>[...j,this.KeySchema.EncodeObject(et)],[])}Execute(a,$){return a.reduce((j,et)=>[...j,this.KeySchema.Execute(et,$)],[])}EncodeObject(a,$){return this.validate(a),$&&$[SetToken.prim]?$[SetToken.prim](a):a.sort((j,et)=>this.KeySchema.compare(j,et)).reduce((j,et)=>[...j,this.KeySchema.EncodeObject(et)],[])}ExtractSchema(){return SetToken.prim}generateSchema(){return{__michelsonType:SetToken.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(a,$){return SetToken.prim===a&&$.push(this),this.KeySchema.findAndReturnTokens(a,$),$}}SetToken.prim="set";class ChainIDValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ChainIDValidationError"}}class ChainIDToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(validateChain(a)!==ValidationResult.VALID)throw new ChainIDValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid ChainID`)}Execute(a){return a[Object.keys(a)[0]]}ExtractSchema(){return ChainIDToken.prim}generateSchema(){return{__michelsonType:ChainIDToken.prim,schema:ChainIDToken.prim}}Encode(a){const $=a.pop();return this.validate($),{string:$}}EncodeObject(a,$){return this.validate(a),$&&$[ChainIDToken.prim]?$[ChainIDToken.prim](a):{string:a}}ToKey({string:a}){return a}ToBigMapKey(a){return{key:{string:a},type:{prim:ChainIDToken.prim}}}findAndReturnTokens(a,$){return ChainIDToken.prim===a&&$.push(this),$}}ChainIDToken.prim="chain_id";class EncodeTicketError extends TaquitoError{constructor(){super(),this.name="TicketEncodeError",this.message="Tickets cannot be sent to the blockchain; they are created on-chain"}}const ticketerType$1={prim:"contract"},amountType$1={prim:"int"};class TicketToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(a){throw new EncodeTicketError}EncodeObject(a,$){if($&&$[TicketToken.prim])return $[TicketToken.prim](a,this.val);throw new EncodeTicketError}Execute(a,$){if($&&$[TicketToken.prim])return $[TicketToken.prim](a,this.val);const j=this.createToken(ticketerType$1,this.idx),et=this.valueToken,tt=this.createToken(amountType$1,this.idx);return a.args[2]===void 0&&a.args[1].args!==void 0?{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1].args[0],$),amount:tt.Execute(a.args[1].args[1],$)}:{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1],$),amount:tt.Execute(a.args[2],$)}}ExtractSchema(){return{ticketer:ContractToken.prim,value:this.valueToken.ExtractSchema(),amount:IntToken.prim}}generateSchema(){return{__michelsonType:TicketToken.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:ContractToken.prim,schema:ContractToken.prim},amount:{__michelsonType:IntToken.prim,schema:IntToken.prim}}}}findAndReturnTokens(a,$){return TicketToken.prim===a&&$.push(this),this.valueToken.findAndReturnTokens(a,$),$}}TicketToken.prim="ticket";class EncodeTicketDeprecatedError extends TaquitoError{constructor(){super(),this.name="TicketDeprecatedEncodeError",this.message="Ticket_deprecated cannot be sent to the blockchain; they are created on-chain"}}const ticketerType={prim:"contract"},amountType={prim:"int"};class TicketDeprecatedToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(a){throw new EncodeTicketDeprecatedError}EncodeObject(a,$){if($&&$[TicketDeprecatedToken.prim])return $[TicketDeprecatedToken.prim](a,this.val);throw new EncodeTicketDeprecatedError}Execute(a,$){if($&&$[TicketDeprecatedToken.prim])return $[TicketDeprecatedToken.prim](a,this.val);const j=this.createToken(ticketerType,this.idx),et=this.valueToken,tt=this.createToken(amountType,this.idx);return a.args[2]===void 0&&a.args[1].args!==void 0?{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1].args[0],$),amount:tt.Execute(a.args[1].args[1],$)}:{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1],$),amount:tt.Execute(a.args[2],$)}}ExtractSchema(){return{ticketer:ContractToken.prim,value:this.valueToken.ExtractSchema(),amount:IntToken.prim}}generateSchema(){return{__michelsonType:TicketDeprecatedToken.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:ContractToken.prim,schema:ContractToken.prim},amount:{__michelsonType:IntToken.prim,schema:IntToken.prim}}}}findAndReturnTokens(a,$){return TicketDeprecatedToken.prim===a&&$.push(this),this.valueToken.findAndReturnTokens(a,$),$}}TicketDeprecatedToken.prim="ticket_deprecated";class NeverTokenError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="NeverTokenError"}}class NeverToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Encode(a){const $=a.pop();throw new NeverTokenError($,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify($)}.`)}EncodeObject(a,$){if($&&$[NeverToken.prim])return $[NeverToken.prim](a);throw new NeverTokenError(a,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(a)}.`)}Execute(a){throw new NeverTokenError(a,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(a)}.`)}ExtractSchema(){return NeverToken.prim}generateSchema(){return{__michelsonType:NeverToken.prim,schema:NeverToken.prim}}findAndReturnTokens(a,$){return NeverToken.prim===a&&$.push(this),$}}NeverToken.prim="never";class SaplingStateValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="SaplingStateValidationError"}}class SaplingStateToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}isValid(a){return typeof a=="object"&&Object.keys(a).length===0}Execute(a,$){if($&&$[SaplingStateToken.prim])return $[SaplingStateToken.prim](a,this.val);if("int"in a)return a.int;throw new SaplingStateValidationError(a,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(a)}`)}Encode(a){const $=a.pop();if(this.isValid($))return[];throw new SaplingStateValidationError($,this,`Invalid sapling_state. Received: ${JSON.stringify($)} while expecting: {}`)}EncodeObject(a,$){if($&&$[SaplingStateToken.prim])return $[SaplingStateToken.prim](a);if(this.isValid(a))return[];throw new SaplingStateValidationError(a,this,`Invalid sapling_state. Received: ${JSON.stringify(a)} while expecting: {}`)}ExtractSchema(){return{[SaplingStateToken.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:SaplingStateToken.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(a,$){return SaplingStateToken.prim===a&&$.push(this),$}}SaplingStateToken.prim="sapling_state";class SaplingTransactionValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="SaplingTransactionValidationError"}}class SaplingTransactionToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){throw new SaplingTransactionValidationError(a,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(a)}.`)}validateBytes(a){const $=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(a);if($&&$[2].length%2===0)return $[2];throw new SaplingTransactionValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.validateBytes(this.convertUint8ArrayToHexString($)),{bytes:String($).toString()}}EncodeObject(a,$){return a=this.validateBytes(this.convertUint8ArrayToHexString(a)),$&&$[SaplingTransactionToken.prim]?$[SaplingTransactionToken.prim](a):{bytes:String(a).toString()}}ExtractSchema(){return{[SaplingTransactionToken.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:SaplingTransactionToken.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(a,$){return SaplingTransactionToken.prim===a&&$.push(this),$}}SaplingTransactionToken.prim="sapling_transaction";class SaplingTransactionDeprecatedValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="SaplingTransactionDeprecatedValidationError"}}class SaplingTransactionDeprecatedToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){throw new SaplingTransactionDeprecatedValidationError(a,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(a)}.`)}validateBytes(a){const $=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(a);if($&&$[2].length%2===0)return $[2];throw new SaplingTransactionDeprecatedValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.validateBytes(this.convertUint8ArrayToHexString($)),{bytes:String($).toString()}}EncodeObject(a,$){return a=this.validateBytes(this.convertUint8ArrayToHexString(a)),$&&$[SaplingTransactionDeprecatedToken.prim]?$[SaplingTransactionDeprecatedToken.prim](a):{bytes:String(a).toString()}}ExtractSchema(){return{[SaplingTransactionDeprecatedToken.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:SaplingTransactionDeprecatedToken.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(a,$){return SaplingTransactionDeprecatedToken.prim===a&&$.push(this),$}}SaplingTransactionDeprecatedToken.prim="sapling_transaction_deprecated";class Bls12381frValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="Bls12381frValidationError"}}class Bls12381frToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new Bls12381frValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return typeof $=="number"?{int:$.toString()}:($=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$})}EncodeObject(a,$){return $&&$[Bls12381frToken.prim]?$[Bls12381frToken.prim](a):typeof a=="number"?{int:a.toString()}:(a=this.convertUint8ArrayToHexString(a),this.validate(a),{bytes:a})}Execute(a){return a.bytes}ExtractSchema(){return Bls12381frToken.prim}generateSchema(){return{__michelsonType:Bls12381frToken.prim,schema:Bls12381frToken.prim}}findAndReturnTokens(a,$){return Bls12381frToken.prim===a&&$.push(this),$}}Bls12381frToken.prim="bls12_381_fr";class Bls12381g1ValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="Bls12381g1ValidationError"}}class Bls12381g1Token extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new Bls12381g1ValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[Bls12381g1Token.prim]?$[Bls12381g1Token.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return Bls12381g1Token.prim}generateSchema(){return{__michelsonType:Bls12381g1Token.prim,schema:Bls12381g1Token.prim}}findAndReturnTokens(a,$){return Bls12381g1Token.prim===a&&$.push(this),$}}Bls12381g1Token.prim="bls12_381_g1";class Bls12381g2ValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="Bls12381g2ValidationError"}}class Bls12381g2Token extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new Bls12381g2ValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[Bls12381g2Token.prim]?$[Bls12381g2Token.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return Bls12381g2Token.prim}generateSchema(){return{__michelsonType:Bls12381g2Token.prim,schema:Bls12381g2Token.prim}}findAndReturnTokens(a,$){return Bls12381g2Token.prim===a&&$.push(this),$}}Bls12381g2Token.prim="bls12_381_g2";class ChestValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ChestValidationError"}}class ChestToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2==0))throw new ChestValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[ChestToken.prim]?$[ChestToken.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return ChestToken.prim}generateSchema(){return{__michelsonType:ChestToken.prim,schema:ChestToken.prim}}findAndReturnTokens(a,$){return ChestToken.prim===a&&$.push(this),$}}ChestToken.prim="chest";class ChestKeyValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ChestKeyValidationError"}}class ChestKeyToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new ChestKeyValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[ChestKeyToken.prim]?$[ChestKeyToken.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return ChestKeyToken.prim}generateSchema(){return{__michelsonType:ChestKeyToken.prim,schema:ChestKeyToken.prim}}findAndReturnTokens(a,$){return ChestKeyToken.prim===a&&$.push(this),$}}ChestKeyToken.prim="chest_key";class GlobalConstantEncodingError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="GlobalConstantEncodingError"}}class GlobalConstantDecodingError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="GlobalConstantDecodingError"}}class GlobalConstantToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a,$){if($&&$[GlobalConstantToken.prim])return $[GlobalConstantToken.prim](a,this.val);throw new GlobalConstantDecodingError(a,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(a){throw new GlobalConstantEncodingError(a,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(a,$){if($&&$[GlobalConstantToken.prim])return $[GlobalConstantToken.prim](a);throw new GlobalConstantEncodingError(a,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}ExtractSchema(){return GlobalConstantToken.prim}generateSchema(){return{__michelsonType:GlobalConstantToken.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(a,$){return GlobalConstantToken.prim===a&&$.push(this),$}}GlobalConstantToken.prim="constant";const tokens=[PairToken,NatToken,StringToken,BigMapToken,AddressToken,MapToken,BoolToken,OrToken,ContractToken,ListToken,MutezToken,BytesToken,OptionToken,TimestampToken,IntToken,UnitToken,KeyToken,KeyHashToken,SignatureToken,LambdaToken,OperationToken,SetToken,ChainIDToken,TicketToken,TicketDeprecatedToken,NeverToken,SaplingStateToken,SaplingTransactionToken,SaplingTransactionDeprecatedToken,Bls12381frToken,Bls12381g1Token,Bls12381g2Token,ChestToken,ChestKeyToken,GlobalConstantToken];class InvalidTokenError extends TaquitoError{constructor(a,$){super(a),this.message=a,this.data=$,this.name="Invalid token error"}}function createToken(_,a){if(Array.isArray(_))return new PairToken(_,a,createToken);const $=tokens.find(j=>j.prim===_.prim);if(!$)throw new InvalidTokenError(`Malformed data: ${JSON.stringify(_)}. Expected a value with a valid prim property`,_);return new $(_,a,createToken)}class ParameterEncodingError extends InvalidViewParameterError{constructor(a,$,j,et){super(a,$,j,et),this.viewName=a,this.sigs=$,this.args=j,this.cause=et,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(j)} received for name "${a}" expecting one of the following signatures ${JSON.stringify($)}`}}class InvalidScriptError extends TaquitoError{constructor(a,$){super(),this.script=a,this.reason=$,this.name="InvalidScriptError";let j="Invalid on-chain view found in the following script.";$&&(j+=` Reason: ${$}.`),j+=`Script: ${JSON.stringify(a)}`,this.message=j}}class InvalidRpcResponseError extends TaquitoError{constructor(a,$){super(),this.script=a,this.reason=$,this.name="InvalidRpcResponseError";let j="Invalid RPC response passed as argument(s).";$&&(j+=` Reason: ${$}.`),j+=` Received: ${JSON.stringify(a)}`,this.message=j}}class InvalidBigMapSchemaError extends TaquitoError{constructor(a){super(a),this.message=a,this.name="InvalidBigMapSchemaError"}}class InvalidBigMapDiffError extends TaquitoError{constructor(a,$){super(a),this.message=a,this.value=$,this.name="InvalidBigMapDiffError"}}class BigMapEncodingError extends TaquitoError{constructor(a,$,j,et){super(),this.details=$,this.schema=j,this.value=et,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${a}. Schema is: ${JSON.stringify(j)}. The ${a} is: ${JSON.stringify(et)}. Error details: ${$}`}}class StorageEncodingError extends TaquitoError{constructor(a,$,j,et,tt){super(),this.details=$,this.schema=j,this.value=et,this.semantics=tt,this.name="StorageEncodingError",this.message=`Unable to encode ${a}. The schema is: ${JSON.stringify(j)}, the value is: ${JSON.stringify(et)}.${tt?`And the semantic is: ${JSON.stringify(tt)}`:""}. Error details: ${$}`}}class MissingArgumentError extends TaquitoError{constructor(a){super(a),this.message=a,this.name="MissingArgumentError"}}var _a;const schemaTypeSymbol=Symbol.for("taquito-schema-type-symbol");function collapse(_,a=PairToken.prim){var $,j;if(Array.isArray(_))return collapse({prim:a,args:_},a);const et=_;return et.prim===a&&et.args&&et.args.length>2?Object.assign(Object.assign({},et),{args:[($=et.args)===null||$===void 0?void 0:$[0],{prim:a,args:(j=et.args)===null||j===void 0?void 0:j.slice(1)}]}):et}function deepEqual(_,a){if(_===void 0||a===void 0)return _===a;const $=collapse(_),j=collapse(a);return $.prim===j.prim&&($.args===void 0&&j.args===void 0||$.args!==void 0&&j.args!==void 0&&$.args.length===j.args.length&&$.args.every((et,tt)=>{var rt,nt;return deepEqual(et,(nt=(rt=j.args)===null||rt===void 0?void 0:rt[tt])!==null&&nt!==void 0?nt:{})}))&&($.annots===void 0&&j.annots===void 0||$.annots!==void 0&&j.annots!==void 0&&$.annots.length===j.annots.length&&$.annots.every((et,tt)=>{var rt;return et===((rt=j.annots)===null||rt===void 0?void 0:rt[tt])}))}class Schema{static isSchema(a){return a&&a[schemaTypeSymbol]===!0}static fromRPCResponse(a){if(!a)throw new InvalidRpcResponseError(a,"the RPC response is empty");if(!a.script)throw new InvalidRpcResponseError(a,"the RPC response has no script");if(!Array.isArray(a.script.code))throw new InvalidRpcResponseError(a,"The response.script.code should be an array");let $=a.script.code;for(;$.length===1&&Array.isArray($[0]);)$=$[0];const j=$.find(et=>"prim"in et&&et.prim==="storage");if(!j||!Array.isArray(j.args))throw new InvalidRpcResponseError(a,'The response.script.code has an element of type {prim: "storage"}, but its args is not an array');return new Schema(j.args[0])}isExpressionExtended(a){return"prim"in a&&Array.isArray(a.args)}constructor(a){if(this.val=a,this[_a]=!0,this.root=createToken(a,0),this.root instanceof BigMapToken)this.bigMap=this.root;else if(this.isExpressionExtended(a)&&a.prim==="pair"){const $=a.args[0];this.isExpressionExtended($)&&$.prim==="big_map"&&(this.bigMap=new BigMapToken($,0,createToken))}}removeTopLevelAnnotation(a){return(this.root instanceof PairToken||this.root instanceof OrToken)&&this.root.hasAnnotations()&&typeof a=="object"&&Object.keys(a).length===1?a[Object.keys(a)[0]]:a}Execute(a,$){const j=this.root.Execute(a,$);return this.removeTopLevelAnnotation(j)}Typecheck(a){this.root instanceof BigMapToken&&Number.isInteger(Number(a))||this.root instanceof TicketToken&&a.ticketer&&a.value&&a.amount||this.root instanceof TicketDeprecatedToken&&a.ticketer&&a.value&&a.amount||this.root instanceof MapToken&&this.root.ValueSchema instanceof BigMapToken||this.root.EncodeObject(a)}ExecuteOnBigMapDiff(a,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");if(!Array.isArray(a))throw new InvalidBigMapDiffError(`Big map diff must be an array, got: ${JSON.stringify(a)}`,a);const j=a.map(({key:et,value:tt})=>({args:[et,tt]}));return this.bigMap.Execute(j,$)}ExecuteOnBigMapValue(a,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");return this.bigMap.ValueSchema.Execute(a,$)}EncodeBigMapKey(a){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(a)}catch($){throw new BigMapEncodingError("key",$,this.bigMap.KeySchema,a)}}Encode(a,$){try{return this.root.EncodeObject(a,$)}catch(j){throw j instanceof TokenValidationError?j:new StorageEncodingError("storage object",j,this.root,a,$)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(a,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");const j=a.reduce((et,tt)=>Object.assign(Object.assign({},et),this.ExecuteOnBigMapDiff(tt.contents[0].metadata.operation_result.big_map_diff)),{});return Object.assign(Object.assign({},this.Execute($)),{[this.bigMap.annot()]:j})}FindFirstInTopLevelPair(a,$){return this.findValue(this.root.val,a,$)}findValue(a,$,j){if(deepEqual(j,a))return $;if(Array.isArray(a)||a.prim==="pair"){const et=collapse(a),tt=collapse($,"Pair");if(et.args===void 0||tt.args===void 0)throw new MissingArgumentError("Tokens have no arguments");if(et.args[0])return this.findValue(et.args[0],tt.args[0],j)||this.findValue(et.args[1],tt.args[1],j)}}findToken(a){const $=[];return this.root.findAndReturnTokens(a,$)}}_a=schemaTypeSymbol;class ParameterSchema{static fromRPCResponse(a){if(!a)throw new InvalidRpcResponseError(a,"the RPC response is empty");if(!a.script)throw new InvalidRpcResponseError(a,"the RPC response has no script");if(!Array.isArray(a.script.code))throw new InvalidRpcResponseError(a,"The response.script.code should be an array");const $=a.script.code.find(j=>"prim"in j&&j.prim==="parameter");if(!$)throw new InvalidRpcResponseError(a,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray($.args))throw new InvalidRpcResponseError(a,'The response.script.code has an element of type {prim: "parameter"}, but its args is not an array');return new ParameterSchema($.args[0])}get isMultipleEntryPoint(){return this.root instanceof OrToken||this.root instanceof OptionToken&&this.root.subToken()instanceof OrToken}get hasAnnotation(){return this.isMultipleEntryPoint?Object.keys(this.ExtractSchema())[0]!=="0":!0}constructor(a){this.root=createToken(a,0)}Execute(a,$){return this.root.Execute(a,$)}Encode(...a){try{return this.root.Encode(a.reverse())}catch($){throw $ instanceof TokenValidationError?$:new ParameterEncodingError("Unable to encode parameter",this.root,a,$)}}EncodeObject(a,$){try{return this.root.EncodeObject(a,$)}catch(j){throw j instanceof TokenValidationError?j:new ParameterEncodingError("Unable to encode parameter object",this.root,a,j)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class ViewSchema{static fromRPCResponse(a){const $=[],j=a&&a.script&&Array.isArray(a.script.code)&&a.script.code.filter(et=>et.prim==="view");return j&&j.forEach(et=>{$.push(new ViewSchema(et.args))}),$}constructor(a){if(!a)throw new InvalidScriptError(a,"the args are not defined");if(a.length!==4)throw new InvalidScriptError(a,"there should be exactly 4 arguments");if(!("string"in a[0])||!a[0].string)throw new InvalidScriptError(a,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=a[0].string,this.viewArgsType=a[1],this.viewReturnType=a[2],this.instructions=a[3],this.rootArgsType=createToken(this.viewArgsType,0),this.rootReturnType=createToken(this.viewReturnType,0)}encodeViewArgs(a){try{return this.rootArgsType.EncodeObject(a)}catch($){throw new ParameterEncodingError(this.viewName,void 0,a,$)}}decodeViewResult(a,$){return this.rootReturnType.Execute(a,$)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}class EventSchema{constructor(a,$){this.tag=a,this.type=$}static fromMichelineValue(a){var $,j;return new EventSchema(($=a.annots)===null||$===void 0?void 0:$[0],(j=a.args)===null||j===void 0?void 0:j[0])}static fromRPCResponse(a){const $=[];return a.script.code.forEach(j=>{!("prim"in j)||j.prim!=="code"||!("args"in j)||!j.args||$.push(...EventSchema.extractEventsRecursively(j.args))}),EventSchema.removeDuplicates($)}static removeDuplicates(a){const $=[];return a.forEach(j=>{$.findIndex(tt=>tt.tag===j.tag&&deepEqual(tt.type,j.type))===-1&&$.push(j)}),$}static extractEventsRecursively(a){return Array.isArray(a)?a.flatMap($=>EventSchema.extractEventsRecursively($)):"prim"in a?a.prim==="EMIT"?[EventSchema.fromMichelineValue(a)]:!("args"in a)||!a.args?[]:a.args.flatMap($=>EventSchema.extractEventsRecursively($)):[]}}const UnitValue=Symbol(),sourceReference=Symbol("source_reference");class ScanError extends TaquitoError{constructor(a,$,j){super(),this.src=a,this.idx=$,this.message=j,this.name="ScanError"}}var Literal;(function(_){_[_.Comment=0]="Comment",_[_.Number=1]="Number",_[_.String=2]="String",_[_.Bytes=3]="Bytes",_[_.Ident=4]="Ident"})(Literal||(Literal={}));const isSpace=new RegExp("\\s"),isIdentStart=new RegExp("[:@%_A-Za-z]"),isIdent=new RegExp("[@%_\\.A-Za-z0-9]"),isDigit=new RegExp("[0-9]"),isHex=new RegExp("[0-9a-fA-F]");function*scan(_,a=!1){let $=0;for(;$<_.length;){for(;$<_.length&&isSpace.test(_[$]);)$++;if($===_.length)return;const j=_[$],et=$;if(isIdentStart.test(j)){for($++;$<_.length&&isIdent.test(_[$]);)$++;yield{t:Literal.Ident,v:_.slice(et,$),first:et,last:$}}else if(_.length-$>1&&_.substring($,$+2)==="0x"){for($+=2;$<_.length&&isHex.test(_[$]);)$++;if($-et&1)throw new ScanError(_,$,"Bytes literal length is expected to be power of two");yield{t:Literal.Bytes,v:_.slice(et,$),first:et,last:$}}else if(isDigit.test(j)||j==="-"){j==="-"&&$++;const tt=$;for(;$<_.length&&isDigit.test(_[$]);)$++;if(tt===$)throw new ScanError(_,$,"Number literal is too short");yield{t:Literal.Number,v:_.slice(et,$),first:et,last:$}}else if(j==='"'){$++;let tt=!1;for(;$<_.length&&(tt||_[$]!=='"');$++)!tt&&_[$]==="\\"?tt=!0:tt=!1;if($===_.length)throw new ScanError(_,$,"Unterminated string literal");$++,yield{t:Literal.String,v:_.slice(et,$),first:et,last:$}}else if(j==="#"){for($++;$<_.length&&_[$]!==` -`;)$++;a&&(yield{t:Literal.Comment,v:_.slice(et,$),first:et,last:$})}else if(_.length-$>1&&_.substring($,$+2)==="/*"){for($+=2;$<_.length&&!(_.length-$>1&&_.substring($,$+2)==="*/");)$++;if($===_.length)throw new ScanError(_,$,"Unterminated C style comment");$+=2,a&&(yield{t:Literal.Comment,v:_.slice(et,$),first:et,last:$})}else if(j==="("||j===")"||j==="{"||j==="}"||j===";")$++,yield{t:j,v:j,first:et,last:$};else throw new ScanError(_,$,`Invalid character at offset ${$}: \`${j}'`)}}const refContract=Symbol("ref_contract");var Protocol;(function(_){_.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",_.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",_.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",_.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",_.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",_.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",_.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",_.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",_.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",_.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",_.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",_.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",_.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",_.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",_.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",_.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",_.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",_.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",_.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",_.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",_.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",_.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",_.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",_.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",_.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",_.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(Protocol||(Protocol={}));const DefaultProtocol=Protocol.Psithaca2,protoLevel={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:12,PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw:13,PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY:13,PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg:14,PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW:15,PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc:16,PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1:16,PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf:17,ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH:19,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:20};function ProtoInferiorTo(_,a){return protoLevel[_][ht+1,bt]),et+=at,tt+=ut;break}case"I":tt!==$.length&&(rt[1]=$[tt++]);break;default:throw new MacroError(_,`${_.prim}: unexpected character: ${it}`)}return{r:j(nt,ot,[0,rt]),n:et,an:tt}}function parseSetMapCadr(_,a,$,j){const et=a[0];switch(et){case"A":return a.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},parseSetMapCadr(_,a.slice(1),[],j)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...$]}]:j.a;case"D":return a.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},parseSetMapCadr(_,a.slice(1),[],j)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...$]}]:j.d;default:throw new MacroError(_,`${_.prim}: unexpected character: ${et}`)}}function trimLast(_,a){let $=_.length;for(;$>0&&_[$-1]===a;)$--;return _.slice(0,$)}function filterAnnotations(_){const a=[],$=[];if(_!==void 0)for(const j of _)(j.length!==0&&j[0]==="%"?a:$).push(j);return{fields:a,rest:$}}function mkPrim({prim:_,annots:a,args:$}){return Object.assign(Object.assign({prim:_},a&&{annots:a}),$&&{args:$})}const pairRe=/^P[PAI]{3,}R$/,unpairRe=/^UNP[PAI]{2,}R$/,cadrRe=/^C[AD]{2,}R$/,setCadrRe=/^SET_C[AD]+R$/,mapCadrRe=/^MAP_C[AD]+R$/,diipRe=/^DI{2,}P$/,duupRe=/^DU+P$/;function expandMacros(_,a){const $=(a==null?void 0:a.protocol)||DefaultProtocol;function j(et){return et!==void 0?[{prim:"RENAME",annots:et}]:[]}switch(_.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(assertArgs$1(_,0))return[{prim:"COMPARE"},mkPrim({prim:_.prim.slice(3),annots:_.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(assertArgs$1(_,2))return[{prim:_.prim.slice(2)},mkPrim({prim:"IF",annots:_.annots,args:_.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(assertArgs$1(_,2))return[{prim:"COMPARE"},{prim:_.prim.slice(5)},mkPrim({prim:"IF",annots:_.annots,args:_.args})];break;case"FAIL":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:_.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[[{prim:"COMPARE"},{prim:_.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(assertArgs$1(_,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],j(_.annots)]}];break;case"ASSERT_LEFT":if(assertArgs$1(_,0))return[{prim:"IF_LEFT",args:[j(_.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(assertArgs$1(_,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],j(_.annots)]}];break;case"IF_SOME":if(assertArgs$1(_,2))return[mkPrim({prim:"IF_NONE",annots:_.annots,args:[_.args[1],_.args[0]]})];break;case"IF_RIGHT":if(assertArgs$1(_,2))return[mkPrim({prim:"IF_LEFT",annots:_.annots,args:[_.args[1],_.args[0]]})];break;case"CAR":case"CDR":if(_.args!==void 0){if(assertArgs$1(_,1)&&assertIntArg(_,_.args[0])){const et=parseInt(_.args[0].int,10);return mkPrim({prim:"GET",args:[{int:_.prim==="CAR"?String(et*2+1):String(et*2)}],annots:_.annots})}}else return _}if(pairRe.test(_.prim)&&assertArgs$1(_,0)){const{fields:et,rest:tt}=filterAnnotations(_.annots),{r:rt}=parsePairUnpairExpr(_,_.prim.slice(1),et,(nt,it,ot)=>[...nt||[],...it||[],ot]);return rt.map(([nt,it],ot)=>{const st=[...trimLast(it,null).map(ut=>ut===null?"%":ut),...nt===0&&ot===rt.length-1?tt:[]],at=mkPrim({prim:"PAIR",annots:st.length!==0?st:void 0});return nt===0?at:{prim:"DIP",args:nt===1?[[at]]:[{int:String(nt)},[at]]}})}if(unpairRe.test(_.prim))if(ProtoInferiorTo($,Protocol.PtEdo2Zk)&&assertArgs$1(_,0)){const{r:et}=parsePairUnpairExpr(_,_.prim.slice(3),_.annots||[],(tt,rt,nt)=>[nt,...rt||[],...tt||[]]);return et.map(([tt,rt])=>{const nt=[{prim:"DUP"},mkPrim({prim:"CAR",annots:rt[0]!==null?[rt[0]]:void 0}),{prim:"DIP",args:[[mkPrim({prim:"CDR",annots:rt[1]!==null?[rt[1]]:void 0})]]}];return tt===0?nt:{prim:"DIP",args:tt===1?[[nt]]:[{int:String(tt)},[nt]]}})}else{if(_.prim==="UNPAIR")return _;if(assertArgs$1(_,0)){const{r:et}=parsePairUnpairExpr(_,_.prim.slice(3),[],(tt,rt,nt)=>[nt,...rt||[],...tt||[]]);return et.map(([tt])=>{const rt=mkPrim({prim:"UNPAIR"});return tt===0?rt:{prim:"DIP",args:tt===1?[[rt]]:[{int:String(tt)},[rt]]}})}}if(cadrRe.test(_.prim)&&assertArgs$1(_,0)){const et=[..._.prim.slice(1,_.prim.length-1)];return et.map((tt,rt)=>{const nt=rt===et.length-1?_.annots:void 0;switch(tt){case"A":return mkPrim({prim:"CAR",annots:nt});case"D":return mkPrim({prim:"CDR",annots:nt});default:throw new MacroError(_,`unexpected character: ${tt}`)}})}if(setCadrRe.test(_.prim)&&assertArgs$1(_,0)){const{fields:et,rest:tt}=filterAnnotations(_.annots);if(et.length>1)throw new MacroError(_,`unexpected annotation on macro ${_.prim}: ${et}`);const rt=et.length!==0?{a:[{prim:"DUP"},{prim:"CAR",annots:et},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[et[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:et},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",et[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return parseSetMapCadr(_,_.prim.slice(5,_.prim.length-1),tt,rt)}if(mapCadrRe.test(_.prim)&&assertArgs$1(_,1)){const{fields:et}=filterAnnotations(_.annots);if(et.length>1)throw new MacroError(_,`unexpected annotation on macro ${_.prim}: ${et}`);const tt={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[mkPrim({prim:"CAR",annots:et.length!==0?["@"+et[0].slice(1)]:void 0}),_.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[et.length!==0?et[0]:"%","%@"]}],d:[{prim:"DUP"},mkPrim({prim:"CDR",annots:et.length!==0?["@"+et[0].slice(1)]:void 0}),_.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",et.length!==0?et[0]:"%"]}]};return parseSetMapCadr(_,_.prim.slice(5,_.prim.length-1),[],tt)}if(diipRe.test(_.prim)&&assertArgs$1(_,1)){let et=0;for(;_.prim[1+et]==="I";)et++;return mkPrim({prim:"DIP",args:[{int:String(et)},_.args[0]]})}if(duupRe.test(_.prim)){let et=0;for(;_.prim[1+et]==="U";)et++;if(ProtoInferiorTo($,Protocol.PtEdo2Zk)){if(et===1){if(_.args===void 0)return _;assertArgs$1(_,1)&&assertIntArg(_,_.args[0])&&(et=parseInt(_.args[0].int,10))}else assertArgs$1(_,0);return et===1?[mkPrim({prim:"DUP",annots:_.annots})]:et===2?[{prim:"DIP",args:[[mkPrim({prim:"DUP",annots:_.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(et-1)},[mkPrim({prim:"DUP",annots:_.annots})]]},{prim:"DIG",args:[{int:String(et)}]}]}else{if(et===1)return _;if(assertArgs$1(_,0))return mkPrim({prim:"DUP",args:[{int:String(et)}],annots:_.annots})}}return _}function expandGlobalConstants(_,a){return _.args!==void 0&&_.args.length===1&&"string"in _.args[0]&&_.args[0].string in a?a[_.args[0].string]:_}class MichelineParseError extends TaquitoError{constructor(a,$){super(),this.token=a,this.message=$,this.name="MichelineParseError"}}class JSONParseError extends TaquitoError{constructor(a,$){super(),this.node=a,this.message=$,this.name="JSONParseError"}}const errEOF=new MichelineParseError(null,"Unexpected EOF");function isAnnotation(_){return _.t===Literal.Ident&&(_.v[0]==="@"||_.v[0]==="%"||_.v[0]===":")}const intRe=new RegExp("^-?[0-9]+$"),bytesRe=new RegExp("^([0-9a-fA-F]{2})*$");let Parser$1=class{constructor(a){this.opt=a}expand(a){var $,j,et;if((($=this.opt)===null||$===void 0?void 0:$.expandGlobalConstant)!==void 0&&a.prim==="constant"){const tt=expandGlobalConstants(a,this.opt.expandGlobalConstant);return tt!==a&&(tt[sourceReference]=Object.assign(Object.assign({},a[sourceReference]||{first:0,last:0}),{globalConstant:a})),tt}if(((j=this.opt)===null||j===void 0?void 0:j.expandMacros)===void 0||!((et=this.opt)===null||et===void 0)&&et.expandMacros){const tt=expandMacros(a,this.opt);return tt!==a&&(tt[sourceReference]=Object.assign(Object.assign({},a[sourceReference]||{first:0,last:0}),{macro:a})),tt}else return a}parseListExpr(a,$){var j;const et={first:$.first,last:$.last},tt=$.t==="(";let rt;if(tt){if(rt=a.next(),rt.done)throw errEOF;et.last=rt.value.last}else rt={value:$};if(rt.value.t!==Literal.Ident)throw new MichelineParseError(rt.value,`not an identifier: ${rt.value.v}`);const nt={prim:rt.value.v,[sourceReference]:et};for(;;){const it=a.next();if(it.done){if(tt)throw errEOF;break}else if(it.value.t===")"){if(!tt)throw new MichelineParseError(it.value,"unexpected closing bracket");et.last=it.value.last;break}else if(isAnnotation(it.value))nt.annots=nt.annots||[],nt.annots.push(it.value.v),et.last=it.value.last;else{nt.args=nt.args||[];const ot=this.parseExpr(a,it.value);et.last=((j=ot[sourceReference])===null||j===void 0?void 0:j.last)||et.last,nt.args.push(ot)}}return this.expand(nt)}parseArgs(a,$){var j;const et={first:$.first,last:$.last},tt={prim:$.v,[sourceReference]:et};for(;;){const rt=a.next();if(rt.done||rt.value.t==="}"||rt.value.t===";")return[tt,rt];if(isAnnotation(rt.value))et.last=rt.value.last,tt.annots=tt.annots||[],tt.annots.push(rt.value.v);else{const nt=this.parseExpr(a,rt.value);et.last=((j=nt[sourceReference])===null||j===void 0?void 0:j.last)||et.last,tt.args=tt.args||[],tt.args.push(nt)}}}parseSequenceExpr(a,$){var j,et;const tt={first:$.first,last:$.last},rt=[];rt[sourceReference]=tt;const nt=$.t==="{";let it=$.t==="{"?null:{value:$};for(;;){if(it===null&&(it=a.next(),it.done||(tt.last=it.value.last)),it.done){if(nt)throw errEOF;return rt}if(it.value.t==="}"){if(nt)return rt;throw new MichelineParseError(it.value,"unexpected closing bracket")}else if(it.value.t===Literal.Ident){const[ot,st]=this.parseArgs(a,it.value);tt.last=((j=ot[sourceReference])===null||j===void 0?void 0:j.last)||tt.last,rt.push(this.expand(ot)),it=st}else{const ot=this.parseExpr(a,it.value);tt.last=((et=ot[sourceReference])===null||et===void 0?void 0:et.last)||tt.last,rt.push(ot),it=null}it===null&&(it=a.next(),it.done||(tt.last=it.value.last)),!it.done&&it.value.t===";"&&(it=null)}}parseExpr(a,$){switch($.t){case Literal.Ident:return this.expand({prim:$.v,[sourceReference]:{first:$.first,last:$.last}});case Literal.Number:return{int:$.v,[sourceReference]:{first:$.first,last:$.last}};case Literal.String:return{string:JSON.parse($.v),[sourceReference]:{first:$.first,last:$.last}};case Literal.Bytes:return{bytes:$.v.slice(2),[sourceReference]:{first:$.first,last:$.last}};case"{":return this.parseSequenceExpr(a,$);default:return this.parseListExpr(a,$)}}parseSequence(a){if(typeof a!="string")throw new TypeError(`string type was expected, got ${typeof a} instead`);const $=scan(a),j=$.next();return j.done?null:this.parseSequenceExpr($,j.value)}parseList(a){if(typeof a!="string")throw new TypeError(`string type was expected, got ${typeof a} instead`);const $=scan(a),j=$.next();return j.done?null:this.parseListExpr($,j.value)}parseMichelineExpression(a){if(typeof a!="string")throw new TypeError(`string type was expected, got ${typeof a} instead`);const $=scan(a),j=$.next();return j.done?null:this.parseExpr($,j.value)}parseScript(a){return this.parseSequence(a)}parseData(a){return this.parseList(a)}parseJSON(a){if(typeof a!="object")throw new TypeError(`object type was expected, got ${typeof a} instead`);if(Array.isArray(a)){const $=[];for(const j of a){if(j===null||typeof j!="object")throw new JSONParseError(j,`unexpected sequence element: ${j}`);$.push(this.parseJSON(j))}return $}else if("prim"in a){const $=a;if(typeof $.prim=="string"&&($.annots===void 0||Array.isArray($.annots))&&($.args===void 0||Array.isArray($.args))){const j={prim:$.prim};if($.annots!==void 0){for(const et of $.annots)if(typeof et!="string")throw new JSONParseError(et,`string expected: ${et}`);j.annots=$.annots}if($.args!==void 0){j.args=[];for(const et of $.args){if(et===null||typeof et!="object")throw new JSONParseError(et,`unexpected argument: ${et}`);j.args.push(this.parseJSON(et))}}return this.expand(j)}throw new JSONParseError(a,`malformed prim expression: ${a}`)}else if("string"in a){if(typeof a.string=="string")return{string:a.string};throw new JSONParseError(a,`malformed string literal: ${a}`)}else if("int"in a){if(typeof a.int=="string"&&intRe.test(a.int))return{int:a.int};throw new JSONParseError(a,`malformed int literal: ${a}`)}else if("bytes"in a){if(typeof a.bytes=="string"&&bytesRe.test(a.bytes))return{bytes:a.bytes};throw new JSONParseError(a,`malformed bytes literal: ${a}`)}else throw new JSONParseError(a,`unexpected object: ${a}`)}};const H=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],K=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class Base58DecodingError extends TaquitoError{constructor(a){super(),this.message=a,this.name="Base58DecodingError"}}function sha256(_){const a=(_.length+9)%64,$=a===0?0:64-a;if(_.length>268435455)throw new InvalidMessageError("",`: Invalid length ${_.length} is too big -- SHA-256.`);const j=_.length<<3,et=[..._,128,...new Array($).fill(0),0,0,0,0,j>>24&255,j>>16&255,j>>8&255,j&255];function tt(st,at){return st>>>at|st<<32-at}const rt=[...H],nt=new Array(64),it=new Array(8);for(let st=0;st>>3,bt=tt(nt[ut-2],17)^tt(nt[ut-2],19)^nt[ut-2]>>>10;nt[ut]=(bt|0)+nt[ut-7]+ht+nt[ut-16]|0,ut++}for(let ht=0;ht<8;ht++)it[ht]=rt[ht];for(let ht=0;ht<64;ht++){const bt=tt(it[0],2)^tt(it[0],13)^tt(it[0],22),Et=tt(it[4],6)^tt(it[4],11)^tt(it[4],25),Ct=it[7]+Et+(it[4]&it[5]^~it[4]&it[6])+K[ht]+nt[ht]|0,Pt=bt+(it[0]&it[1]^it[0]&it[2]^it[1]&it[2])|0;it[7]=it[6],it[6]=it[5],it[5]=it[4],it[4]=it[3]+Ct|0,it[3]=it[2],it[2]=it[1],it[1]=it[0],it[0]=Ct+Pt|0}for(let ht=0;ht<8;ht++)rt[ht]=rt[ht]+it[ht]|0}const ot=[];for(const st of rt)ot.push(st>>24&255),ot.push(st>>16&255),ot.push(st>>8&255),ot.push(st&255);return ot}const base58alphabetFwd=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57];function byteAt(_,a){const $=_.charCodeAt(a)-49;if($>=base58alphabetFwd.length||base58alphabetFwd[$]===-1)throw new Base58DecodingError(`Unexpected character at position ${a}: ${_[a]}`);return base58alphabetFwd[$]}function decodeBase58(_){const a=[];let $=0;for(;$<_.length&&byteAt(_,$)===0;)$++;let j=$;for(;$<_.length;){let et=byteAt(_,$++),tt=0;for(;et!==0||tt0;)a.push(0);return a.reverse()}function decodeBase58Check(_){const a=decodeBase58(_);if(a.length<4)throw new Base58DecodingError(`Data is too short ${a.length}`);const $=a.slice(0,a.length-4),j=a.slice(a.length-4),et=sha256(sha256($));if(j[0]!==et[0]||j[1]!==et[1]||j[2]!==et[2]||j[3]!==et[3])throw new Base58DecodingError("Invalid checksum");return $}class InvalidMichelsonError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidMichelsonError"}}class InvalidTypeExpressionError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidTypeExpressionError"}}class InvalidDataExpressionError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidDataExpressionError"}}class InvalidEntrypointError extends ParameterValidationError{constructor(a){super(),this.entrypoint=a,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${a}"`}}class LongIntegerError extends TaquitoError{constructor(a){super(),this.message=a,this.name="LongIntegerError"}}class MichelsonError extends TaquitoError{constructor(a,$){super(),this.val=a,this.message=$,this.name="MichelsonError"}}class MichelsonTypeError extends MichelsonError{constructor(a,$,j){super(a,$),this.val=a,this.message=$,this.name="MichelsonTypeError",j!==void 0&&(this.data=j)}}class LongInteger{append(a){let $=0;for(;a!==0||$57)throw new LongIntegerError(`unexpected character in integer constant "${a[$]}"`);this.append(j-48)}}else a<0?(this.neg=!0,this.append(-a)):this.append(a)}cmp(a){if(this.neg!==a.neg)return(a.neg?1:0)-(this.neg?1:0);{let $=0;if(this.buf.length!==a.buf.length)$=this.buf.length=0&&this.buf[j]===a.buf[j];)j--;$=j<0?0:this.buf[j]=0}catch{return!1}}const annRe=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function unpackAnnotations(_,a){if(Array.isArray(_))return{};let $,j,et;if(_.annots!==void 0){for(const tt of _.annots)if(tt.length!==0){if(!annRe.test(tt)||!(a!=null&&a.specialVar)&&(tt==="@%"||tt==="@%%")||!(a!=null&&a.specialFields)&&tt==="%@")throw new MichelsonError(_,`${_.prim}: unexpected annotation: ${tt}`);switch(tt[0]){case"%":(a!=null&&a.emptyFields||tt.length>1)&&($=$||[],$.push(tt));break;case":":tt.length>1&&(j=j||[],j.push(tt));break;case"@":(a!=null&&a.emptyVar||tt.length>1)&&(et=et||[],et.push(tt));break}}}return{f:$,t:j,v:et}}const tezosPrefix={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]],RollupAddress:[20,[1,128,120,31]]};function checkDecodeTezosID(_,...a){const $=decodeBase58Check(_);for(const j of a){const[et,tt]=tezosPrefix[j];if($.length===et+tt.length){let rt=0;for(;rt0?assertArgs(_,1):assertArgs(_,0);break;default:throw new MichelsonValidationError(_,"instruction expected")}}return!0}function assertMichelsonComparableType(_){if(assertPrimOrSeq(_)){if(Array.isArray(_)||_.prim==="pair"||_.prim==="or"||_.prim==="option")traverseType(_,a=>assertMichelsonComparableType(a));else if(!Object.prototype.hasOwnProperty.call(simpleComparableTypeIDs,_.prim))throw new MichelsonValidationError(_,`${_.prim}: type is not comparable`)}return!0}function assertMichelsonPackableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="big_map"||_.prim==="operation"||_.prim==="sapling_state"||_.prim==="ticket")throw new MichelsonValidationError(_,`${_.prim}: type can't be used inside PACK/UNPACK instructions`);traverseType(_,a=>assertMichelsonPackableType(a))}return!0}function assertMichelsonPushableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="big_map"||_.prim==="operation"||_.prim==="sapling_state"||_.prim==="ticket"||_.prim==="contract")throw new MichelsonValidationError(_,`${_.prim}: type can't be pushed`);traverseType(_,a=>assertMichelsonPushableType(a))}return!0}function assertMichelsonStorableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="operation"||_.prim==="contract")throw new MichelsonValidationError(_,`${_.prim}: type can't be used as part of a storage`);traverseType(_,a=>assertMichelsonStorableType(a))}return!0}function assertMichelsonPassableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="operation")throw new MichelsonValidationError(_,`${_.prim}: type can't be used as part of a parameter`);traverseType(_,a=>assertMichelsonPassableType(a))}return!0}function assertMichelsonBigMapStorableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="big_map"||_.prim==="operation"||_.prim==="sapling_state")throw new MichelsonValidationError(_,`${_.prim}: type can't be used inside a big_map`);traverseType(_,a=>assertMichelsonBigMapStorableType(a))}return!0}const viewRe=new RegExp("^[a-zA-Z0-9_.%@]*$");function assertViewNameValid(_){if(_.string.length>maxViewNameLength)throw new MichelsonValidationError(_,`view name too long: ${_.string}`);if(!viewRe.test(_.string))throw new MichelsonValidationError(_,`invalid character(s) in view name: ${_.string}`)}function assertMichelsonType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim))throw new MichelsonValidationError(_,"type expected");traverseType(_,a=>assertMichelsonType(a))}return!0}function traverseType(_,a){if(Array.isArray(_)||_.prim==="pair"){const $=Array.isArray(_)?_:_.args;if($===void 0||$.length<2)throw new MichelsonValidationError(_,"at least 2 arguments expected");return $.forEach(j=>{assertPrimOrSeq(j)&&a(j)}),!0}switch(_.prim){case"option":case"list":assertArgs(_,1)&&assertPrimOrSeq(_.args[0])&&a(_.args[0]);break;case"contract":assertArgs(_,1)&&assertMichelsonPassableType(_.args[0]);break;case"or":assertArgs(_,2)&&assertPrimOrSeq(_.args[0])&&assertPrimOrSeq(_.args[1])&&(a(_.args[0]),a(_.args[1]));break;case"lambda":assertArgs(_,2)&&(assertMichelsonType(_.args[0]),assertMichelsonType(_.args[1]));break;case"set":assertArgs(_,1)&&assertMichelsonComparableType(_.args[0]);break;case"map":assertArgs(_,2)&&assertPrimOrSeq(_.args[0])&&assertPrimOrSeq(_.args[1])&&(assertMichelsonComparableType(_.args[0]),a(_.args[1]));break;case"big_map":assertArgs(_,2)&&assertPrimOrSeq(_.args[0])&&assertPrimOrSeq(_.args[1])&&(assertMichelsonComparableType(_.args[0]),assertMichelsonBigMapStorableType(_.args[1]),a(_.args[1]));break;case"ticket":assertArgs(_,1)&&assertPrimOrSeq(_.args[0])&&assertMichelsonComparableType(_.args[0]);break;case"sapling_state":case"sapling_transaction":assertArgs(_,1)&&assertIntLiteral(_.args[0]);break;default:assertArgs(_,0)}return!0}function assertMichelsonData(_){if("int"in _||"string"in _||"bytes"in _)return!0;if(Array.isArray(_)){let a=0;for(const $ of _)isPrim$1($)&&$.prim==="Elt"?(assertArgs($,2)&&(assertMichelsonData($.args[0]),assertMichelsonData($.args[1])),a++):assertMichelsonData($);if(a!==0&&a!==_.length)throw new MichelsonValidationError(_,"data entries and map elements can't be intermixed");return!0}if(isPrim$1(_))switch(_.prim){case"Unit":case"True":case"False":case"None":assertArgs(_,0);break;case"Pair":if(_.args===void 0||_.args.length<2)throw new MichelsonValidationError(_,"at least 2 arguments expected");for(const a of _.args)assertMichelsonData(a);break;case"Left":case"Right":case"Some":assertArgs(_,1)&&assertMichelsonData(_.args[0]);break;case"Lambda_rec":_.args&&assertMichelsonInstruction(_.args);break;default:if(Object.prototype.hasOwnProperty.call(instructionIDs,_.prim))assertMichelsonInstruction(_);else throw new MichelsonValidationError(_,"data entry or instruction expected")}else throw new MichelsonValidationError(_,"data entry expected");return!0}function assertMichelsonContract(_){if(assertSeq(_)){const a={},$={};for(const j of _)if(assertPrim(j)){if(j.prim!=="view"){if(j.prim in a)throw new MichelsonValidationError(_,`duplicate contract section: ${j.prim}`);a[j.prim]=!0}switch(j.prim){case"code":assertArgs(j,1)&&assertSeq(j.args[0])&&assertMichelsonInstruction(j.args[0]);break;case"parameter":if(assertArgs(j,1)&&assertMichelsonPassableType(j.args[0]),j.annots)throw new MichelsonValidationError(j,"Annotation must be part of the parameter type");break;case"storage":assertArgs(j,1)&&assertMichelsonStorableType(j.args[0]);break;case"view":if(assertArgs(j,4)){if(assertStringLiteral(j.args[0])){const et=j.args[0];if(et.string in $)throw new MichelsonValidationError(_,`duplicate view name: ${et.string}`);$[et.string]=!0,assertViewNameValid(et)}assertMichelsonPushableType(j.args[1]),assertMichelsonPushableType(j.args[2]),assertSeq(j.args[3])&&assertMichelsonInstruction(j.args[3])}break;default:throw new MichelsonValidationError(_,`unexpected contract section: ${j.prim}`)}}}return!0}function isInstruction(_){return Object.prototype.hasOwnProperty.call(instructionIDs,_.prim)}function assertDataListIfAny(_){if(!Array.isArray(_))return!1;for(const a of _)if("prim"in a){if(isInstruction(a))throw new MichelsonError(_,`Instruction outside of a lambda: ${JSON.stringify(_)}`);if(a.prim==="Elt")throw new MichelsonError(_,`Elt item outside of a map literal: ${JSON.stringify(_)}`)}return!0}function __rest$1(_,a){var $={};for(var j in _)Object.prototype.hasOwnProperty.call(_,j)&&a.indexOf(j)<0&&($[j]=_[j]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(_);et({[_]:a})));var Tag;(function(_){_[_.Int=0]="Int",_[_.String=1]="String",_[_.Sequence=2]="Sequence",_[_.Prim0=3]="Prim0",_[_.Prim0Annot=4]="Prim0Annot",_[_.Prim1=5]="Prim1",_[_.Prim1Annot=6]="Prim1Annot",_[_.Prim2=7]="Prim2",_[_.Prim2Annot=8]="Prim2Annot",_[_.Prim=9]="Prim",_[_.Bytes=10]="Bytes"})(Tag||(Tag={}));const boundsErr=new Error("bounds out of range");class Reader{constructor(a,$=0,j=a.length){this.buffer=a,this.idx=$,this.cap=j}get length(){return this.cap-this.idx}readBytes(a){if(this.cap-this.idx>>0}readUint16(){if(this.cap-this.idx<2)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++];return(a<<8|$)>>>0}readUint32(){if(this.cap-this.idx<4)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++],j=this.buffer[this.idx++],et=this.buffer[this.idx++];return(a<<24|$<<16|j<<8|et)>>>0}readInt8(){if(this.cap-this.idx<1)throw boundsErr;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++];return(a<<8|$)<<16>>16}readInt32(){if(this.cap-this.idx<4)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++],j=this.buffer[this.idx++],et=this.buffer[this.idx++];return a<<24|$<<16|j<<8|et}}var ContractID;(function(_){_[_.Implicit=0]="Implicit",_[_.Originated=1]="Originated"})(ContractID||(ContractID={}));var PublicKeyHashID;(function(_){_[_.ED25519=0]="ED25519",_[_.SECP256K1=1]="SECP256K1",_[_.P256=2]="P256"})(PublicKeyHashID||(PublicKeyHashID={}));function readPublicKeyHash(_){let a;const $=_.readUint8();switch($){case PublicKeyHashID.ED25519:a="ED25519PublicKeyHash";break;case PublicKeyHashID.SECP256K1:a="SECP256K1PublicKeyHash";break;case PublicKeyHashID.P256:a="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${$}`)}return{type:a,hash:_.readBytes(20)}}function readAddress(_){let a;const $=_.readUint8();switch($){case ContractID.Implicit:a=readPublicKeyHash(_);break;case ContractID.Originated:a={type:"ContractHash",hash:_.readBytes(20)},_.readBytes(1);break;default:throw new Error(`unknown address tag: ${$}`)}if(_.length!==0){const j=new TextDecoder;a.entryPoint=j.decode(new Uint8Array(_.readBytes(_.length)))}return a}var PublicKeyID;(function(_){_[_.ED25519=0]="ED25519",_[_.SECP256K1=1]="SECP256K1",_[_.P256=2]="P256"})(PublicKeyID||(PublicKeyID={}));function readPublicKey(_){let a,$;const j=_.readUint8();switch(j){case PublicKeyID.ED25519:$="ED25519PublicKey",a=32;break;case PublicKeyID.SECP256K1:$="SECP256K1PublicKey",a=33;break;case PublicKeyID.P256:$="P256PublicKey",a=33;break;default:throw new Error(`unknown public key tag: ${j}`)}return{type:$,publicKey:_.readBytes(a)}}function decodeAddressBytes(_){const a=parseBytes$3(_.bytes);if(a===null)throw new Error(`can't parse bytes: "${_.bytes}"`);const $=new Reader(new Uint8Array(a));return readAddress($)}function decodePublicKeyHashBytes(_){const a=parseBytes$3(_.bytes);if(a===null)throw new Error(`can't parse bytes: "${_.bytes}"`);const $=new Reader(new Uint8Array(a));return readPublicKeyHash($)}function decodePublicKeyBytes(_){const a=parseBytes$3(_.bytes);if(a===null)throw new Error(`can't parse bytes: "${_.bytes}"`);const $=new Reader(new Uint8Array(a));return readPublicKey($)}class MichelsonInstructionError extends MichelsonError{constructor(a,$,j){super(a,j),this.val=a,this.stackState=$,this.message=j,this.name="MichelsonInstructionError"}}function typeID(_){return Array.isArray(_)?"pair":_.prim}function typeArgs(_){return"prim"in _?_.args:_}function assertScalarTypesEqual(_,a,$=!1){if(typeID(_)!==typeID(a))throw new MichelsonTypeError(_,`types mismatch: ${typeID(_)} != ${typeID(a)}`,void 0);const j=[unpackAnnotations(_),unpackAnnotations(a)];if(j[0].t&&j[1].t&&j[0].t[0]!==j[1].t[0])throw new MichelsonTypeError(_,`${typeID(_)}: type names mismatch: ${j[0].t[0]} != ${j[1].t[0]}`,void 0);if($&&j[0].f&&j[1].f&&j[0].f[0]!==j[1].f[0])throw new MichelsonTypeError(_,`${typeID(_)}: field names mismatch: ${j[0].f[0]} != ${j[1].f}`,void 0);if(isPairType(_)){const et=unpackComb("pair",_),tt=unpackComb("pair",a);assertScalarTypesEqual(et.args[0],tt.args[0],!0),assertScalarTypesEqual(et.args[1],tt.args[1],!0);return}switch(_.prim){case"option":case"list":case"contract":case"set":case"ticket":assertScalarTypesEqual(_.args[0],a.args[0]);break;case"or":assertScalarTypesEqual(_.args[0],a.args[0],!0),assertScalarTypesEqual(_.args[1],a.args[1],!0);break;case"lambda":case"map":case"big_map":assertScalarTypesEqual(_.args[0],a.args[0]),assertScalarTypesEqual(_.args[1],a.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(_.args[0].int,10)!==parseInt(a.args[0].int,10))throw new MichelsonTypeError(_,`${typeID(_)}: type argument mismatch: ${_.args[0].int} != ${a.args[0].int}`,void 0)}}function assertStacksEqual(_,a){if(_.length!==a.length)throw new MichelsonTypeError(_,`stack length mismatch: ${_.length} != ${a.length}`,void 0);for(let $=0;$<_.length;$++)assertScalarTypesEqual(_[$],a[$])}function assertTypeAnnotationsValid(_,a=!1){var $,j,et;if(!Array.isArray(_)){const tt=unpackAnnotations(_);if(((($=tt.t)===null||$===void 0?void 0:$.length)||0)>1)throw new MichelsonTypeError(_,`${_.prim}: at most one type annotation allowed: ${_.annots}`,void 0);if(a){if((((j=tt.f)===null||j===void 0?void 0:j.length)||0)>1)throw new MichelsonTypeError(_,`${_.prim}: at most one field annotation allowed: ${_.annots}`,void 0)}else if((((et=tt.f)===null||et===void 0?void 0:et.length)||0)>0)throw new MichelsonTypeError(_,`${_.prim}: field annotations aren't allowed: ${_.annots}`,void 0)}if(isPairType(_)){const tt=typeArgs(_);for(const rt of tt)assertTypeAnnotationsValid(rt,!0);return}switch(_.prim){case"option":case"list":case"contract":case"set":assertTypeAnnotationsValid(_.args[0]);break;case"or":for(const tt of _.args)assertTypeAnnotationsValid(tt,!0);break;case"lambda":case"map":case"big_map":assertTypeAnnotationsValid(_.args[0]),assertTypeAnnotationsValid(_.args[1])}}function isFunction(_){if(!Array.isArray(_))return!1;for(const a of _)if(!(Array.isArray(a)&&isFunction(a)||"prim"in a&&isInstruction(a)))return!1;return!0}function assertDataValidInternal(_,a,$){if(isPairType(a)){if(isPairData(_)){assertDataListIfAny(_);const j=unpackComb("Pair",_),et=unpackComb("pair",a);assertDataValidInternal(j.args[0],et.args[0],$),assertDataValidInternal(j.args[1],et.args[1],$);return}throw new MichelsonTypeError(a,`pair expected: ${JSON.stringify(_)}`,_)}switch(a.prim){case"int":if("int"in _&&isDecimal(_.int))return;throw new MichelsonTypeError(a,`integer value expected: ${JSON.stringify(_)}`,_);case"nat":case"mutez":if("int"in _&&isNatural(_.int))return;throw new MichelsonTypeError(a,`natural value expected: ${JSON.stringify(_)}`,_);case"string":if("string"in _)return;throw new MichelsonTypeError(a,`string value expected: ${JSON.stringify(_)}`,_);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in _&&parseBytes$3(_.bytes)!==null)return;throw new MichelsonTypeError(a,`bytes value expected: ${JSON.stringify(_)}`,_);case"bool":if("prim"in _&&(_.prim==="True"||_.prim==="False"))return;throw new MichelsonTypeError(a,`boolean value expected: ${JSON.stringify(_)}`,_);case"key_hash":if("string"in _&&checkDecodeTezosID(_.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash")!==null)return;if("bytes"in _)try{decodePublicKeyHashBytes(_);return}catch{}throw new MichelsonTypeError(a,`key hash expected: ${JSON.stringify(_)}`,_);case"timestamp":if(("string"in _||"int"in _)&&parseDate(_)!==null)return;throw new MichelsonTypeError(a,`timestamp expected: ${JSON.stringify(_)}`,_);case"address":if("string"in _){let j=_.string;const et=_.string.indexOf("%");if(et>=0&&(j=_.string.slice(0,et)),checkDecodeTezosID(j,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress")!==null)return}else if("bytes"in _)try{decodeAddressBytes(_);return}catch{}throw new MichelsonTypeError(a,`address expected: ${JSON.stringify(_)}`,_);case"key":if("string"in _&&checkDecodeTezosID(_.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey")!==null)return;if("bytes"in _)try{decodePublicKeyBytes(_);return}catch{}throw new MichelsonTypeError(a,`public key expected: ${JSON.stringify(_)}`,_);case"unit":if("prim"in _&&_.prim==="Unit")return;throw new MichelsonTypeError(a,`unit value expected: ${JSON.stringify(_)}`,_);case"signature":if("bytes"in _||"string"in _&&checkDecodeTezosID(_.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature")!==null)return;throw new MichelsonTypeError(a,`signature expected: ${JSON.stringify(_)}`,_);case"chain_id":if(("bytes"in _||"string"in _)&&("string"in _?decodeBase58Check(_.string):parseBytes$3(_.bytes))!==null)return;throw new MichelsonTypeError(a,`chain id expected: ${JSON.stringify(_)}`,_);case"option":if("prim"in _){if(_.prim==="None")return;if(_.prim==="Some"){assertDataValidInternal(_.args[0],a.args[0],$);return}}throw new MichelsonTypeError(a,`option expected: ${JSON.stringify(_)}`,_);case"list":case"set":if(assertDataListIfAny(_)){for(const j of _)assertDataValidInternal(j,a.args[0],$);return}throw new MichelsonTypeError(a,`${a.prim} expected: ${JSON.stringify(_)}`,_);case"or":if("prim"in _){if(_.prim==="Left"){assertDataValidInternal(_.args[0],a.args[0],$);return}else if(_.prim==="Right"){assertDataValidInternal(_.args[0],a.args[1],$);return}}throw new MichelsonTypeError(a,`union (or) expected: ${JSON.stringify(_)}`,_);case"lambda":if(isFunction(_)){const j=functionTypeInternal(_,[a.args[0]],$);if("failed"in j)throw new MichelsonTypeError(a,`function is failed with error type: ${j.failed}`,_);if(j.length!==1)throw new MichelsonTypeError(a,"function must return a value",_);assertScalarTypesEqual(a.args[1],j[0]);return}throw new MichelsonTypeError(a,`function expected: ${JSON.stringify(_)}`,_);case"map":case"big_map":if(Array.isArray(_)){for(const j of _){if(!("prim"in j)||j.prim!=="Elt")throw new MichelsonTypeError(a,`map elements expected: ${JSON.stringify(_)}`,_);assertDataValidInternal(j.args[0],a.args[0],$),assertDataValidInternal(j.args[1],a.args[1],$)}return}throw new MichelsonTypeError(a,`${a.prim} expected: ${JSON.stringify(_)}`,_);case"bls12_381_fr":if("int"in _&&isDecimal(_.int)||"bytes"in _&&parseBytes$3(_.bytes)!==null)return;throw new MichelsonTypeError(a,`BLS12-381 element expected: ${JSON.stringify(_)}`,_);case"sapling_state":if(Array.isArray(_))return;throw new MichelsonTypeError(a,`sapling state expected: ${JSON.stringify(_)}`,_);case"ticket":assertDataValidInternal(_,{prim:"pair",args:[{prim:"address"},a.args[0],{prim:"nat"}]},$);return;default:throw new MichelsonTypeError(a,`type ${typeID(a)} don't have Michelson literal representation`,_)}}function instructionListType(_,a,$){let j=a,et=a,tt=0;for(const rt of _){const nt=functionTypeInternal(rt,et,$);if(j=nt,"failed"in nt)break;et=nt,tt++}if("failed"in j&&j.level==0&&(!("prim"in j.failed)||j.failed.prim!=="never")&&tt!==_.length-1)throw new MichelsonInstructionError(_,j,"FAIL must appear in a tail position");if(($==null?void 0:$.traceCallback)!==void 0){const rt={op:_,in:a,out:j};$.traceCallback(rt)}return"failed"in j?{failed:j.failed,level:j.level+1}:j}function functionTypeInternal(_,a,$){const j=($==null?void 0:$.protocol)||DefaultProtocol;if(Array.isArray(_))return instructionListType(_,a,$);const et=_;function tt(Ft,...Bt){if(a.length{try{return Ft(...Bt)}catch(yt){throw yt instanceof MichelsonError?new MichelsonInstructionError(et,a,yt.message):yt}}}function nt(Ft){return Bt=>{try{return Ft(Bt)}catch(yt){throw yt instanceof MichelsonError?new MichelsonInstructionError(et,a,yt.message):yt}}}const it=rt(unpackAnnotations),ot=rt(assertStacksEqual),st=rt(assertScalarTypesEqual),at=nt(assertMichelsonComparableType),ut=nt(assertMichelsonPackableType),ht=nt(assertMichelsonStorableType),bt=nt(assertMichelsonPushableType),Et=nt(assertMichelsonBigMapStorableType);function Ct(Ft,Bt){const yt=it(et,Object.assign(Object.assign({},Bt),{emptyFields:Ft.f!==void 0&&Ft.f>1,emptyVar:Ft.v!==void 0&&Ft.v>1})),mt=(ct,dt,vt)=>{if(ct&&ct.length>(dt||0))throw new MichelsonInstructionError(et,a,`${et.prim}: at most ${dt||0} ${vt} annotations allowed`)};return mt(yt.f,Ft.f,"field"),mt(yt.t,Ft.t,"type"),mt(yt.v,Ft.v,"variable"),yt}function Pt(Ft,Bt){const yt=Ft,mt=Array.isArray(yt)?{prim:"pair",args:yt}:yt,ct=it(mt),dt=Bt.v!==void 0||Bt.t!==void 0||Bt.f!==void 0?[...(Bt.v===null?ct.v:Bt.v)||[],...(Bt.t===null?ct.t:Bt.t)||[],...(Bt.f===null?ct.f:Bt.f)||[]]:void 0,vt=__rest$1(mt,["annots"]);return Object.assign(Object.assign({},vt),dt&&dt.length!==0&&{annots:dt})}function Tt(Ft,Bt){const yt=Ct({v:1});return Pt(Ft,{v:yt.v!==void 0?yt.v:Bt!==void 0?[Bt]:null,t:null})}function It(Ft,Bt,yt,mt,ct){var dt,vt,St,Rt;const $t=(dt=it(Bt).f)===null||dt===void 0?void 0:dt[0],xt=(vt=yt.f)===null||vt===void 0?void 0:vt[mt];if(xt!==void 0&&xt!=="%"&&$t!==void 0&&xt!==$t)throw new MichelsonInstructionError(et,a,`${et.prim}: field names doesn't match: ${xt} !== ${$t}`);const At=(St=yt.v)===null||St===void 0?void 0:St[mt],wt=(Rt=it(Ft).v)===null||Rt===void 0?void 0:Rt[0];return Pt(Bt,{t:null,v:At?At==="@%"?$t?["@"+$t.slice(1)]:void 0:At==="@%%"?wt?["@"+wt.slice(1)+"."+($t?$t.slice(1):ct)]:$t?["@"+$t.slice(1)]:void 0:[At]:null})}function Lt(Ft,Bt,yt=Bt){const mt=unpackComb("pair",Ft);if(yt===1)return[mt.args[0]];if(yt===2)return mt.args;const ct=mt.args[1];if(isPairType(ct))return[mt.args[0],...Lt(ct,Bt,yt-1)];throw new MichelsonInstructionError(et,a,`${et.prim}: at least ${Bt} fields are expected`)}function Nt(Ft,Bt,yt=Bt){if(yt===0)return Ft;const mt=unpackComb("pair",Ft);if(yt===1)return mt.args[0];const ct=mt.args[1];if(isPairType(ct))return Nt(ct,Bt,yt-2);if(yt===2)return ct;throw new MichelsonInstructionError(et,a,`${et.prim}: at least ${Bt+1} fields are expected`)}function Ut(Ft,Bt,yt,mt=yt){if(mt===0)return Bt;const ct=unpackComb("pair",Ft);if(mt===1)return Object.assign(Object.assign({},ct),{args:[Bt,ct.args[1]]});const dt=ct.args[1];if(isPairType(dt))return Object.assign(Object.assign({},ct),{args:[ct.args[0],Ut(dt,Bt,yt,mt-2)]});if(mt===2)return Object.assign(Object.assign({},ct),{args:[ct.args[0],Bt]});throw new MichelsonInstructionError(et,a,`${et.prim}: at least ${yt+1} fields are expected`)}const jt=(Ft,Bt)=>["@"+(Ft.v?Ft.v[0].slice(1)+".":"")+Bt];function Mt(Ft,Bt){return"failed"in Ft||"failed"in Bt?"failed"in Ft?Bt:Ft:(ot(Ft,Bt),Ft)}const Dt=(Ft=>{var Bt,yt,mt,ct,dt;switch(Ft.prim){case"DUP":{const vt=Ft.args?parseInt(Ft.args[0].int,10):1;if(vt===0)throw new MichelsonInstructionError(Ft,a,"DUP 0 is forbidden");const St=tt(vt-1,null)[0];if(typeID(St)==="ticket")throw new MichelsonInstructionError(Ft,a,"ticket can't be DUPed");return[St,...a]}case"SWAP":{const vt=tt(0,null,null);return Ct({}),[vt[1],vt[0],...a.slice(2)]}case"SOME":return[Pt({prim:"option",args:[tt(0,null)[0]]},Ct({t:1,v:1})),...a.slice(1)];case"UNIT":return[Pt({prim:"unit"},Ct({v:1,t:1})),...a];case"PAIR":{const vt=Ft.args?parseInt(Ft.args[0].int,10):2;if(vt<2)throw new MichelsonInstructionError(Ft,a,`PAIR ${vt} is forbidden`);const St=tt(0,...new Array(vt).fill(null)),Rt=Ct({f:vt,t:1,v:1},{specialFields:!0}),$t=At=>{const wt=At.lastIndexOf(".");return At.slice(wt>0?wt+1:1)},xt=St.map((At,wt)=>{var Ot;const tr=it(At),nr=Rt.f&&Rt.f.length>wt&&Rt.f[wt]!=="%"?Rt.f[wt]==="%@"?tr.v?["%"+$t(((Ot=tr.v)===null||Ot===void 0?void 0:Ot[0])||"")]:void 0:[Rt.f[wt]]:void 0;return Pt(At,{v:null,t:null,f:nr})});return[Pt({prim:"pair",args:xt},{t:Rt.t,v:Rt.v}),...a.slice(vt)]}case"UNPAIR":{const vt=Ft.args?parseInt(Ft.args[0].int,10):2;if(vt<2)throw new MichelsonInstructionError(Ft,a,`UNPAIR ${vt} is forbidden`);const St=tt(0,["pair"])[0],Rt=Ct({f:2,v:2},{specialVar:!0});return[...Lt(St,vt).map((xt,At)=>It(St,xt,Rt,At,At===0?"car":"cdr")),...a.slice(1)]}case"CAR":case"CDR":{const vt=unpackComb("pair",tt(0,["pair"])[0]),St=vt.args[Ft.prim==="CAR"?0:1],Rt=Ct({f:1,v:1},{specialVar:!0});return[It(vt,St,Rt,0,Ft.prim.toLocaleLowerCase()),...a.slice(1)]}case"CONS":{const vt=tt(0,null,["list"]);return st(vt[0],vt[1].args[0]),[Tt({prim:"list",args:[vt[1].args[0]]}),...a.slice(2)]}case"SIZE":return tt(0,["string","list","set","map","bytes"]),[Tt({prim:"nat"}),...a.slice(1)];case"MEM":{const vt=tt(0,null,["set","map","big_map"]);return at(vt[0]),st(vt[0],vt[1].args[0]),[Tt({prim:"bool"}),...a.slice(2)]}case"GET":if(Ft.args){const vt=parseInt(Ft.args[0].int,10),St=tt(0,["pair"])[0];return[Tt(Nt(St,vt)),...a.slice(1)]}else{const vt=tt(0,null,["map","big_map"]);return at(vt[0]),st(vt[0],vt[1].args[0]),[Tt({prim:"option",args:[vt[1].args[1]]}),...a.slice(2)]}case"UPDATE":if(Ft.args){const vt=parseInt(Ft.args[0].int,10),St=tt(0,null,["pair"]);return[Tt(Ut(St[1],St[0],vt)),...a.slice(2)]}else{const vt=tt(0,null,["bool","option"]);if(at(vt[0]),vt[1].prim==="bool"){const Rt=tt(2,["set"]);return st(vt[0],Rt[0].args[0]),[Tt({prim:"set",args:[Pt(vt[0],{t:null})]}),...a.slice(3)]}const St=tt(2,["map","big_map"]);return st(vt[0],St[0].args[0]),St[0].prim==="map"?[Tt({prim:"map",args:[Pt(vt[0],{t:null}),Pt(vt[1].args[0],{t:null})]}),...a.slice(3)]:(Et(vt[1].args[0]),[Tt({prim:"big_map",args:[Pt(vt[0],{t:null}),Pt(vt[1].args[0],{t:null})]}),...a.slice(3)])}case"GET_AND_UPDATE":{const vt=Ct({v:2}),St=tt(0,null,["option"],["map","big_map"]);at(St[0]),st(St[0],St[2].args[0]),st(St[1].args[0],St[2].args[1]);const Rt=(Bt=vt.v)===null||Bt===void 0?void 0:Bt.map($t=>$t!=="@"?[$t]:void 0);return St[2].prim==="map"?[Pt({prim:"option",args:[St[2].args[1]]},{v:Rt==null?void 0:Rt[0]}),Pt({prim:"map",args:[Pt(St[0],{t:null}),Pt(St[1].args[0],{t:null})]},{v:Rt==null?void 0:Rt[1]}),...a.slice(3)]:(Et(St[1].args[0]),[Pt({prim:"option",args:[St[2].args[1]]},{v:Rt==null?void 0:Rt[0]}),Pt({prim:"big_map",args:[Pt(St[0],{t:null}),Pt(St[1].args[0],{t:null})]},{v:Rt==null?void 0:Rt[1]}),...a.slice(3)])}case"EXEC":{const vt=tt(0,null,["lambda"]);return st(vt[0],vt[1].args[0]),[Tt(vt[1].args[1]),...a.slice(2)]}case"APPLY":{const vt=tt(0,null,["lambda"]);if(ht(vt[0]),bt(vt[0]),!isPairType(vt[1].args[0]))throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: function's argument must be a pair: ${typeID(vt[1].args[0])}`);const St=vt[1].args[0];return st(vt[0],typeArgs(St)[0]),[Tt({prim:"lambda",args:[typeArgs(St)[1],vt[1].args[1]]}),...a.slice(2)]}case"FAILWITH":{const vt=tt(0,null)[0];return ProtoInferiorTo(j,Protocol.PtEdo2Zk)||ut(vt),{failed:vt,level:0}}case"NEVER":return tt(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[Tt(tt(0,null)[0]),...a.slice(1)];case"CONCAT":{const vt=tt(0,["string","list","bytes"]);if(vt[0].prim==="list"){if(typeID(vt[0].args[0])!=="string"&&typeID(vt[0].args[0])!=="bytes")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't concatenate list of ${typeID(vt[0].args[0])}'s`);return[Tt(vt[0].args[0]),...a.slice(1)]}const St=tt(1,["string","bytes"]);if(vt[0].prim!==St[0].prim)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't concatenate ${vt[0].prim} with ${St[0].prim}`);return[Tt(St[0]),...a.slice(2)]}case"SLICE":return[Tt({prim:"option",args:[tt(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...a.slice(3)];case"PACK":{const vt=tt(0,null)[0];return ut(vt),[Tt({prim:"bytes"},"@packed"),...a.slice(1)]}case"ADD":{const vt=tt(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if(vt[0].prim==="nat"&&vt[1].prim==="int"||vt[0].prim==="int"&&vt[1].prim==="nat")return[Tt({prim:"int"}),...a.slice(2)];if(vt[0].prim==="int"&&vt[1].prim==="timestamp"||vt[0].prim==="timestamp"&&vt[1].prim==="int")return[Tt({prim:"timestamp"}),...a.slice(2)];if((vt[0].prim==="int"||vt[0].prim==="nat"||vt[0].prim==="mutez"||vt[0].prim==="bls12_381_g1"||vt[0].prim==="bls12_381_g2"||vt[0].prim==="bls12_381_fr")&&vt[0].prim===vt[1].prim)return[Tt(vt[0]),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't add ${vt[0].prim} to ${vt[1].prim}`)}case"SUB":{const vt=ProtoInferiorTo(j,Protocol.PsiThaCa)?tt(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):tt(0,["nat","int","timestamp"],["nat","int","timestamp"]);if((vt[0].prim==="nat"||vt[0].prim==="int")&&(vt[1].prim==="nat"||vt[1].prim==="int")||vt[0].prim==="timestamp"&&vt[1].prim==="timestamp")return[Tt({prim:"int"}),...a.slice(2)];if(vt[0].prim==="timestamp"&&vt[1].prim==="int")return[Tt({prim:"timestamp"}),...a.slice(2)];if(vt[0].prim==="mutez"&&vt[1].prim==="mutez")return[Tt({prim:"mutez"}),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't subtract ${vt[0].prim} from ${vt[1].prim}`)}case"SUB_MUTEZ":return tt(0,["mutez"],["mutez"]),[Tt({prim:"option",args:[{prim:"mutez"}]}),...a.slice(2)];case"MUL":{const vt=tt(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if(vt[0].prim==="nat"&&vt[1].prim==="int"||vt[0].prim==="int"&&vt[1].prim==="nat")return[Tt({prim:"int"}),...a.slice(2)];if(vt[0].prim==="nat"&&vt[1].prim==="mutez"||vt[0].prim==="mutez"&&vt[1].prim==="nat")return[Tt({prim:"mutez"}),...a.slice(2)];if((vt[0].prim==="bls12_381_g1"||vt[0].prim==="bls12_381_g2"||vt[0].prim==="bls12_381_fr")&&vt[1].prim==="bls12_381_fr"||(vt[0].prim==="nat"||vt[0].prim==="int")&&vt[0].prim===vt[1].prim)return[Tt(vt[0]),...a.slice(2)];if((vt[0].prim==="nat"||vt[0].prim==="int")&&vt[1].prim==="bls12_381_fr"||(vt[1].prim==="nat"||vt[1].prim==="int")&&vt[0].prim==="bls12_381_fr")return[Tt({prim:"bls12_381_fr"}),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't multiply ${vt[0].prim} by ${vt[1].prim}`)}case"EDIV":{const vt=(Rt,$t)=>({prim:"option",args:[{prim:"pair",args:[{prim:Rt},{prim:$t}]}]}),St=tt(0,["nat","int","mutez"],["nat","int","mutez"]);if(St[0].prim==="nat"&&St[1].prim==="nat")return[Tt(vt("nat","nat")),...a.slice(2)];if((St[0].prim==="nat"||St[0].prim==="int")&&(St[1].prim==="nat"||St[1].prim==="int"))return[Tt(vt("int","nat")),...a.slice(2)];if(St[0].prim==="mutez"&&St[1].prim==="nat")return[Tt(vt("mutez","mutez")),...a.slice(2)];if(St[0].prim==="mutez"&&St[1].prim==="mutez")return[Tt(vt("nat","mutez")),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't euclideally divide ${St[0].prim} by ${St[1].prim}`)}case"ABS":return tt(0,["int"]),[Tt({prim:"nat"}),...a.slice(1)];case"ISNAT":return tt(0,["int"]),[Tt({prim:"option",args:[{prim:"nat"}]}),...a.slice(1)];case"INT":return tt(0,["nat","bls12_381_fr","bytes"]),[Tt({prim:"int"}),...a.slice(1)];case"BYTES":return tt(0,["nat","int"]),[Tt({prim:"bytes"}),...a.slice(1)];case"NAT":return tt(0,["bytes"]),[Tt({prim:"nat"}),...a.slice(1)];case"NEG":{const vt=tt(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return vt.prim==="nat"||vt.prim==="int"?[Tt({prim:"int"}),...a.slice(1)]:[Tt(vt),...a.slice(1)]}case"LSL":case"LSR":return tt(0,["nat","bytes"],["nat","bytes"]),[Tt({prim:"nat"}),...a.slice(2)];case"OR":case"XOR":{const vt=tt(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(vt[0].prim!==vt[1].prim)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: both arguments must be of the same type: ${vt[0].prim}, ${vt[1].prim}`);return[Tt(vt[1]),...a.slice(2)]}case"AND":{const vt=tt(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if((vt[0].prim!=="int"||vt[1].prim!=="nat")&&vt[0].prim!==vt[1].prim)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: both arguments must be of the same type: ${vt[0].prim}, ${vt[1].prim}`);return[Tt(vt[1]),...a.slice(2)]}case"NOT":return tt(0,["nat","bytes","bool","int"])[0].prim==="bool"?[Tt({prim:"bool"}),...a.slice(1)]:[Tt({prim:"int"}),...a.slice(1)];case"COMPARE":{const vt=tt(0,null,null);return at(vt[0]),at(vt[1]),[Tt({prim:"int"}),...a.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return tt(0,["int"]),[Tt({prim:"bool"}),...a.slice(1)];case"SELF":{if(($==null?void 0:$.contract)===void 0)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: contract required`);const vt=Ct({f:1,v:1}),St=contractEntryPoint($.contract,(yt=vt.f)===null||yt===void 0?void 0:yt[0]);if(St===null)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: contract has no entrypoint ${St}`);return[Pt({prim:"contract",args:[St]},{v:vt.v?vt.v:["@self"]}),...a]}case"TRANSFER_TOKENS":{const vt=tt(0,null,["mutez"],["contract"]);return st(vt[0],vt[2].args[0]),[Tt({prim:"operation"}),...a.slice(3)]}case"SET_DELEGATE":{const vt=tt(0,["option"])[0];if(typeID(vt.args[0])!=="key_hash")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: key hash expected: ${typeID(vt.args[0])}`);return[Tt({prim:"operation"}),...a.slice(1)]}case"IMPLICIT_ACCOUNT":return tt(0,["key_hash"]),[Tt({prim:"contract",args:[{prim:"unit"}]}),...a.slice(1)];case"NOW":return[Tt({prim:"timestamp"},"@now"),...a];case"AMOUNT":return[Tt({prim:"mutez"},"@amount"),...a];case"BALANCE":return[Tt({prim:"mutez"},"@balance"),...a];case"CHECK_SIGNATURE":return tt(0,["key"],["signature"],["bytes"]),[Tt({prim:"bool"}),...a.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return tt(0,["bytes"]),[Tt({prim:"bytes"}),...a.slice(1)];case"HASH_KEY":return tt(0,["key"]),[Tt({prim:"key_hash"}),...a.slice(1)];case"SOURCE":return[Tt({prim:"address"},"@source"),...a];case"SENDER":return[Tt({prim:"address"},"@sender"),...a];case"ADDRESS":{const vt=tt(0,["contract"])[0],St=Ct({v:1});return[Pt({prim:"address",[refContract]:vt},{v:St.v?St.v:jt(it(vt),"address")}),...a.slice(1)]}case"SELF_ADDRESS":{const vt={prim:"address"};return($==null?void 0:$.contract)!==void 0&&(vt[refContract]={prim:"contract",args:[contractSection($.contract,"parameter").args[0]]}),[Tt(vt,"@address"),...a]}case"CHAIN_ID":return[Tt({prim:"chain_id"}),...a];case"DROP":{Ct({});const vt=Ft.args!==void 0?parseInt(Ft.args[0].int,10):1;return tt(vt-1,null),a.slice(vt)}case"DIG":{Ct({});const vt=parseInt(Ft.args[0].int,10);return[tt(vt,null)[0],...a.slice(0,vt),...a.slice(vt+1)]}case"DUG":{Ct({});const vt=parseInt(Ft.args[0].int,10);return[...a.slice(1,vt+1),tt(0,null)[0],...a.slice(vt+1)]}case"NONE":return assertTypeAnnotationsValid(Ft.args[0]),[Pt({prim:"option",args:[Ft.args[0]]},Ct({t:1,v:1})),...a];case"LEFT":case"RIGHT":{const vt=tt(0,null)[0],St=Ct({f:2,t:1,v:1},{specialFields:!0}),Rt=it(vt),$t=[Pt(vt,{t:null,v:null,f:St.f&&St.f.length>0&&St.f[0]!=="%"?St.f[0]==="%@"?Rt.v?["%"+Rt.v[0].slice(1)]:void 0:St.f:void 0}),Pt(Ft.args[0],{t:null,f:St.f&&St.f.length>1&&St.f[1]!=="%"?St.f:void 0})];return[Pt({prim:"or",args:Ft.prim==="LEFT"?$t:[$t[1],$t[0]]},{t:St.t,v:St.v}),...a.slice(1)]}case"NIL":return assertTypeAnnotationsValid(Ft.args[0]),[Pt({prim:"list",args:[Ft.args[0]]},Ct({t:1,v:1})),...a];case"UNPACK":return tt(0,["bytes"]),assertTypeAnnotationsValid(Ft.args[0]),[Tt({prim:"option",args:[Ft.args[0]]},"@unpacked"),...a.slice(1)];case"CONTRACT":{const vt=tt(0,["address"])[0];assertTypeAnnotationsValid(Ft.args[0]);const St=Ct({v:1,f:1}),Rt=vt[refContract];if(Rt!==void 0){const $t=contractEntryPoint(Rt,(mt=St.f)===null||mt===void 0?void 0:mt[0]);if($t===null)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: contract has no entrypoint ${$t}`);st($t,Ft.args[0])}return[Pt({prim:"option",args:[{prim:"contract",args:[Ft.args[0]]}]},{v:St.v?St.v:jt(it(vt),"contract")}),...a.slice(1)]}case"CAST":{Ct({});const vt=tt(0,null)[0];return assertTypeAnnotationsValid(Ft.args[0]),st(Ft.args[0],vt),[Ft.args[0],...a.slice(1)]}case"IF_NONE":{Ct({});const vt=tt(0,["option"])[0],St=a.slice(1),Rt=functionTypeInternal(Ft.args[0],St,$),$t=functionTypeInternal(Ft.args[1],[Pt(vt.args[0],{t:null,v:jt(it(vt),"some")}),...St],$);return Mt(Rt,$t)}case"IF_LEFT":{Ct({});const vt=tt(0,["or"])[0],St=it(vt),Rt=it(vt.args[0]),$t=it(vt.args[1]),xt=a.slice(1),At=functionTypeInternal(Ft.args[0],[Pt(vt.args[0],{t:null,v:jt(St,Rt.f?Rt.f[0].slice(1):"left")}),...xt],$),wt=functionTypeInternal(Ft.args[1],[Pt(vt.args[1],{t:null,v:jt(St,$t.f?$t.f[0].slice(1):"right")}),...xt],$);return Mt(At,wt)}case"IF_CONS":{Ct({});const vt=tt(0,["list"])[0],St=it(vt),Rt=a.slice(1),$t=functionTypeInternal(Ft.args[0],[Pt(vt.args[0],{t:null,v:jt(St,"hd")}),Pt(vt,{t:null,v:jt(St,"tl")}),...Rt],$),xt=functionTypeInternal(Ft.args[1],Rt,$);return Mt($t,xt)}case"IF":{Ct({}),tt(0,["bool"]);const vt=a.slice(1),St=functionTypeInternal(Ft.args[0],vt,$),Rt=functionTypeInternal(Ft.args[1],vt,$);return Mt(St,Rt)}case"MAP":{const vt=tt(0,["list","map","option"])[0],St=a.slice(1),Rt=vt.prim==="map"?{prim:"pair",args:vt.args}:vt.args[0],$t=functionTypeInternal(Ft.args[0],[Pt(Rt,{t:null,v:jt(it(vt),"elt")}),...St],$);if("failed"in $t){if(!("prim"in $t.failed)||$t.failed.prim!=="never")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: FAIL is not allowed in MAP`);return{failed:$t.failed,level:$t.level+1}}if($t.length<1)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: function must return a value`);return ot($t.slice(1),St),vt.prim==="list"?[Tt({prim:"list",args:[$t[0]]}),...St]:vt.prim==="map"?[Tt({prim:"map",args:[vt.args[0],$t[0]]}),...St]:[Tt({prim:"option",args:[$t[0]]}),...St]}case"ITER":{Ct({});const vt=tt(0,["set","list","map"])[0],St=a.slice(1),Rt=vt.prim==="map"?{prim:"pair",args:vt.args}:vt.args[0],$t=functionTypeInternal(Ft.args[0],[Pt(Rt,{t:null,v:jt(it(vt),"elt")}),...St],$);return"failed"in $t?{failed:$t.failed,level:$t.level+1}:(ot($t,St),St)}case"LOOP":{Ct({}),tt(0,["bool"]);const vt=a.slice(1),St=functionTypeInternal(Ft.args[0],vt,$);return"failed"in St?{failed:St.failed,level:St.level+1}:(ot(St,[{prim:"bool"},...vt]),vt)}case"LOOP_LEFT":{Ct({});const vt=tt(0,["or"])[0],St=a.slice(1),Rt=functionTypeInternal(Ft.args[0],[Pt(vt.args[0],{t:null,v:jt(it(vt),"left")}),...St],$);return"failed"in Rt?{failed:Rt.failed,level:Rt.level+1}:(ot(Rt,[vt,...St]),[Pt(vt.args[1],{t:null,v:Ct({v:1}).v}),...St])}case"DIP":{Ct({});const vt=Ft.args.length===2?parseInt(Ft.args[0].int,10):1;tt(vt-1,null);const St=a.slice(0,vt),Rt=a.slice(vt),$t=Ft.args.length===2?functionTypeInternal(Ft.args[1],Rt,$):functionTypeInternal(Ft.args[0],Rt,$);return"failed"in $t?{failed:$t.failed,level:$t.level+1}:[...St,...$t]}case"CREATE_CONTRACT":{const vt=Ct({v:2}),St=tt(0,["option"],["mutez"],null);if(typeID(St[0].args[0])!=="key_hash")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: key hash expected: ${typeID(St[0].args[0])}`);ht(St[2])&&(assertContractValid(Ft.args[0]),assertScalarTypesEqual(contractSection(Ft.args[0],"storage").args[0],St[2]));const Rt=(ct=vt.v)===null||ct===void 0?void 0:ct.map($t=>$t!=="@"?[$t]:void 0);return[Pt({prim:"operation"},{v:Rt==null?void 0:Rt[0]}),Pt({prim:"address",[refContract]:{prim:"contract",args:[contractSection(Ft.args[0],"parameter").args[0]]}},{v:Rt==null?void 0:Rt[1]}),...a.slice(3)]}case"PUSH":return assertTypeAnnotationsValid(Ft.args[0]),assertDataValidInternal(Ft.args[1],Ft.args[0],Object.assign(Object.assign({},$),{contract:void 0})),[Tt(Ft.args[0]),...a];case"EMPTY_SET":return assertTypeAnnotationsValid(Ft.args[0]),at(Ft.args[0]),[Pt({prim:"set",args:Ft.args},Ct({t:1,v:1})),...a];case"EMPTY_MAP":return assertTypeAnnotationsValid(Ft.args[0]),at(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]),[Pt({prim:"map",args:Ft.args},Ct({t:1,v:1})),...a];case"EMPTY_BIG_MAP":return assertTypeAnnotationsValid(Ft.args[0]),at(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]),Et(Ft.args[0]),[Pt({prim:"big_map",args:Ft.args},Ct({t:1,v:1})),...a];case"LAMBDA_REC":case"LAMBDA":{assertTypeAnnotationsValid(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]);const vt=[Ft.args[0]];Ft.prim==="LAMBDA_REC"&&vt.push({prim:"lambda",args:[Ft.args[0],Ft.args[1]]});const St=functionTypeInternal(Ft.args[2],vt,Object.assign(Object.assign({},$),{contract:void 0}));if("failed"in St)return{failed:St.failed,level:St.level+1};if(St.length!==1)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: function must return a value`);return st(Ft.args[1],St[0]),[Tt({prim:"lambda",args:[Ft.args[0],Ft.args[1]]}),...a]}case"LEVEL":return[Tt({prim:"nat"},"@level"),...a];case"TOTAL_VOTING_POWER":return[Tt({prim:"nat"}),...a];case"VOTING_POWER":return tt(0,["key_hash"]),[Tt({prim:"nat"}),...a.slice(1)];case"TICKET":{const vt=tt(0,null,["nat"])[0];return at(vt),ProtoInferiorTo(j,Protocol.PtLimaPtL)?[Pt({prim:"ticket",args:[vt]},Ct({t:1,v:1})),...a.slice(2)]:[Tt({prim:"option",args:[Pt({prim:"ticket",args:[vt]},Ct({t:1,v:1}))]}),...a.slice(2)]}case"JOIN_TICKETS":{const vt=unpackComb("pair",tt(0,["pair"])[0]);if(typeID(vt.args[0])!=="ticket")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: ticket expected: ${typeID(vt.args[0])}`);return st(vt.args[0],vt.args[1]),[Tt({prim:"option",args:[Pt(vt.args[0],{t:null})]}),...a.slice(1)]}case"SPLIT_TICKET":{const vt=tt(0,["ticket"],["pair"]),St=unpackComb("pair",vt[1]);if(typeID(St.args[0])!=="nat")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: nat expected: ${typeID(St.args[0])}`);return st(St.args[0],St.args[1]),[Tt({prim:"option",args:[{prim:"pair",args:[Pt(vt[0],{t:null}),Pt(vt[0],{t:null})]}]}),...a.slice(2)]}case"READ_TICKET":{const vt=Ct({v:2}),St=tt(0,["ticket"])[0],Rt=(dt=vt.v)===null||dt===void 0?void 0:dt.map($t=>$t!=="@"?[$t]:void 0);return[Pt({prim:"pair",args:[{prim:"address"},Pt(St.args[0],{t:null}),{prim:"nat"}]},{v:Rt==null?void 0:Rt[0]}),Pt(St,{v:Rt==null?void 0:Rt[1],t:null}),...a.slice(1)]}case"PAIRING_CHECK":{const vt=tt(0,["list"])[0].args[0];if(!isPairType(vt))throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: pair expected: ${typeID(vt)}`);const St=unpackComb("pair",vt);if(typeID(St.args[0])!=="bls12_381_g1")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: bls12_381_g1 expected: ${typeID(St.args[0])}`);if(typeID(St.args[1])!=="bls12_381_g2")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: bls12_381_g2 expected: ${typeID(St.args[1])}`);return[Tt({prim:"bool"}),...a.slice(1)]}case"SAPLING_EMPTY_STATE":return[Pt({prim:"sapling_state",args:[Ft.args[0]]},Ct({v:1,t:1})),...a];case"SAPLING_VERIFY_UPDATE":{const vt=tt(0,["sapling_transaction"],["sapling_state"]);if(parseInt(vt[0].args[0].int,10)!==parseInt(vt[1].args[0].int,10))throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: sapling memo size mismatch: ${vt[0].args[0].int} != ${vt[1].args[0].int}`);return ProtoInferiorTo(j,Protocol.PtJakarta)?[Tt({prim:"option",args:[{prim:"pair",args:[{prim:"int"},Pt(vt[1],{t:null})]}]}),...a.slice(2)]:[Tt({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},Pt(vt[1],{t:null})]}]}]}),...a.slice(2)]}case"OPEN_CHEST":return tt(0,["chest_key"],["chest"],["nat"]),[Tt({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...a.slice(3)];case"VIEW":{const vt=tt(0,null,["address"]);return bt(vt[0]),[Tt({prim:"option",args:[Ft.args[1]]}),...a.slice(2)]}case"MIN_BLOCK_TIME":return[Tt({prim:"nat"}),...a];case"EMIT":{const vt=Ct({f:1,t:1});if(Ft.args){const St=tt(0,null);return st(St[0],Ft.args[0]),[Pt({prim:"operation"},vt),...a.slice(1)]}return[Pt({prim:"operation"},vt),...a.slice(1)]}default:throw new MichelsonError(Ft,`unexpected instruction: ${Ft.prim}`)}})(et);if(($==null?void 0:$.traceCallback)!==void 0){const Ft={op:et,in:a,out:Dt};$.traceCallback(Ft)}return Dt}function contractSection(_,a){for(const $ of _)if($.prim===a)return $;throw new MichelsonError(_,`missing contract section: ${a}`)}function contractViews(_){const a={};for(const $ of _)$.prim==="view"&&(a[$.args[0].string]=$);return a}function isContract(_){if(Array.isArray(_)){for(const a of _)if("prim"in a&&(a.prim==="parameter"||a.prim==="storage"||a.prim==="code"))return!0}return!1}function contractEntryPoint(_,a){a=a||"%default";const $=contractEntryPoints(_).find(j=>j[0]===a);return $!==void 0?$[1]:a==="%default"?isContract(_)?contractSection(_,"parameter").args[0]:_:null}function isOrType(_){return Array.isArray(_)||_.prim==="or"}function contractEntryPoints(_){if(isContract(_)){const a=contractSection(_,"parameter"),$=contractEntryPoints(a.args[0]),j=unpackAnnotations(a);return j.f?[[j.f[0],a.args[0]],...$]:$}if(isOrType(_)){const a=typeArgs(_),$=j=>{const et=unpackAnnotations(a[j]);if(typeID(a[j])==="or"){const tt=contractEntryPoints(a[j]);return et.f?[[et.f[0],a[j]],...tt]:tt}return et.f?[[et.f[0],a[j]]]:[]};return[...$(0),...$(1)]}return[]}function assertContractValid(_,a){const $=(it,ot,st,at)=>{assertTypeAnnotationsValid(it,!0),assertTypeAnnotationsValid(ot);const ut={prim:"pair",args:[Object.assign(Object.assign({},it),{annots:["@parameter"]}),Object.assign(Object.assign({},ot),{annots:["@storage"]})]},ht=functionTypeInternal(at,[ut],Object.assign(Object.assign({},a),{contract:_}));if("failed"in ht)return ht;try{assertStacksEqual(ht,[st])}catch(bt){throw bt instanceof MichelsonError?new MichelsonInstructionError(at,ht,bt.message):bt}return ht},j=contractSection(_,"parameter").args[0],et=contractSection(_,"storage").args[0],tt=contractSection(_,"code").args[0],nt=$(j,et,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},et]},tt);for(const it of Object.values(contractViews(_)))$(it.args[1],et,it.args[2],it.args[3]);return nt}function assertDataValid(_,a,$){assertTypeAnnotationsValid(a),assertDataValidInternal(_,a,$||null)}function functionType(_,a,$){for(const j of a)assertTypeAnnotationsValid(j);if(($==null?void 0:$.contract)!==void 0)for(const j of["parameter","storage"]){const et=contractSection($.contract,j).args[0];assertTypeAnnotationsValid(et)}return functionTypeInternal(_,a,$||null)}function isDataValid(_,a,$){try{return assertDataValid(_,a,$),!0}catch{return!1}}class Contract{constructor(a,$){this.contract=a,this.ctx=Object.assign({contract:a},$),this.output=assertContractValid(a,this.ctx)}static parse(a,$){const j=new Parser$1($),et=typeof a=="string"?j.parseScript(a):j.parseJSON(a);if(et===null)throw new InvalidMichelsonError("empty Michelson");if(assertMichelsonContract(et))return new Contract(et,$)}static parseTypeExpression(a,$){const j=new Parser$1($),et=typeof a=="string"?j.parseScript(a):j.parseJSON(a);if(et===null)throw new InvalidTypeExpressionError("empty type expression");if(assertMichelsonType(et))return assertTypeAnnotationsValid(et),et}static parseDataExpression(a,$){const j=new Parser$1($),et=typeof a=="string"?j.parseScript(a):j.parseJSON(a);if(et===null)throw new InvalidDataExpressionError("empty data expression");if(assertMichelsonData(et))return et;throw void 0}section(a){return contractSection(this.contract,a)}entryPoints(){return contractEntryPoints(this.contract)}entryPoint(a){return contractEntryPoint(this.contract,a)}assertDataValid(a,$){assertDataValid(a,$,this.ctx)}isDataValid(a,$){return isDataValid(a,$,this.ctx)}assertParameterValid(a,$){const j=this.entryPoint(a||void 0);if(j===null)throw new InvalidEntrypointError(a==null?void 0:a.toString());this.assertDataValid($,j)}isParameterValid(a,$){try{return this.assertParameterValid(a,$),!0}catch{return!1}}functionType(a,$){return functionType(a,$,this.ctx)}}new Contract([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);const toHexString=_=>_.reduce((a,$)=>a+$.toString(16).padStart(2,"0"),""),pad=(_,a=8)=>_.toString(16).padStart(a,"0"),ENTRYPOINT_MAX_LENGTH=31;var CODEC;(function(_){_.SECRET="secret",_.RAW="raw",_.TZ1="tz1",_.BRANCH="branch",_.ZARITH="zarith",_.PUBLIC_KEY="public_key",_.PKH="pkh",_.PKH_ARR="pkhArr",_.DELEGATE="delegate",_.SCRIPT="script",_.BALLOT_STATEMENT="ballotStmt",_.PROPOSAL="proposal",_.PROPOSAL_ARR="proposalArr",_.INT32="int32",_.INT16="int16",_.PARAMETERS="parameters",_.ADDRESS="address",_.SMART_CONTRACT_ADDRESS="smart_contract_address",_.SMART_ROLLUP_ADDRESS="smart_rollup_address",_.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",_.VALUE="value",_.PADDED_BYTES="padded_bytes",_.SMART_ROLLUP_MESSAGE="smart_rollup_message",_.MANAGER="manager",_.BLOCK_PAYLOAD_HASH="blockPayloadHash",_.ENTRYPOINT="entrypoint",_.OPERATION="operation",_.OP_ACTIVATE_ACCOUNT="activate_account",_.OP_DELEGATION="delegation",_.OP_TRANSACTION="transaction",_.OP_ORIGINATION="origination",_.OP_BALLOT="ballot",_.OP_FAILING_NOOP="failing_noop",_.OP_ATTESTATION="attestation",_.OP_ENDORSEMENT="endorsement",_.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",_.OP_REVEAL="reveal",_.OP_PROPOSALS="proposals",_.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",_.OP_TRANSFER_TICKET="transfer_ticket",_.BURN_LIMIT="burn_limit",_.OP_INCREASE_PAID_STORAGE="increase_paid_storage",_.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",_.OP_DRAIN_DELEGATE="drain_delegate",_.DEPOSITS_LIMIT="deposits_limit",_.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",_.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",_.PVM_KIND="pvm_kind",_.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",_.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message"})(CODEC||(CODEC={}));const opMapping={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction_deprecated",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET_DEPRECATED",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ",94:"tx_rollup_l2_address",95:"MIN_BLOCK_TIME",96:"sapling_transaction",97:"EMIT",98:"Lambda_rec",99:"LAMBDA_REC","9a":"TICKET","9b":"BYTES","9c":"NAT"},opMappingReverse=(()=>{const _={};return Object.keys(opMapping).forEach(a=>{_[opMapping[a]]=a}),_})(),kindMapping={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",21:"attestation",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant",158:"transfer_ticket",112:"set_deposits_limit",113:"increase_paid_storage",114:"update_consensus_key",9:"drain_delegate",200:"smart_rollup_originate",201:"smart_rollup_add_messages",206:"smart_rollup_execute_outbox_message",17:"failing_noop"},kindMappingReverse=(()=>{const _={};return Object.keys(kindMapping).forEach(a=>{const $=typeof a=="string"?parseInt(a,10):a;_[kindMapping[$]]=pad($,2)}),_})(),entrypointMapping={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate","05":"deposit","06":"stake","07":"unstake","08":"finalize_unstake","09":"set_delegate_parameters"},entrypointMappingReverse=(()=>{const _={};return Object.keys(entrypointMapping).forEach(a=>{_[entrypointMapping[a]]=a}),_})();class InvalidOperationSchemaError extends ParameterValidationError{constructor(a,$){super(),this.operation=a,this.errorDetail=$,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",$&&(this.message+=` ${$}.`)}}class OversizedEntryPointError extends ParameterValidationError{constructor(a){super(),this.entrypoint=a,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${a.length}", maximum length is "${ENTRYPOINT_MAX_LENGTH}".`}}class InvalidBallotValueError extends ParameterValidationError{constructor(a){super(),this.ballotValue=a,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${a}" expecting one of the following: "yay", "nay", "pass".`}}class DecodeBallotValueError extends ParameterValidationError{constructor(a){super(),this.ballotValue=a,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${a}", cannot be decoded.`}}class UnexpectedMichelsonValueError extends ParameterValidationError{constructor(a){super(),this.value=a,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${a}", unalbe to encode.`}}class OperationDecodingError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="OperationDecodingError"}}class OperationEncodingError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="OperationEncodingError"}}class UnsupportedOperationError extends ParameterValidationError{constructor(a){super(),this.op=a,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${a}", can submit an issue on our github for feature request.`}}class UnsupportedPvmKindError extends ParameterValidationError{constructor(a){super(),this.pvm=a,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${a}" expecting either "arith" or "wasm_2_0_0".`}}class DecodePvmKindError extends ParameterValidationError{constructor(a){super(),this.pvm=a,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${a}", cannot be decoded.`}}class InvalidSmartRollupAddressError extends ParameterValidationError{constructor(a,$){super(),this.address=a,this.errorDetail=$,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${a}"`,$&&(this.message+=` ${$}.`)}}class InvalidSmartRollupCommitmentHashError extends ParameterValidationError{constructor(a,$){super(),this.hash=a,this.errorDetail=$,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${a}"`,$&&(this.message+=` ${$}.`)}}class Uint8ArrayConsumer{static fromHexString(a){const $=a.toLowerCase();if(/^(([a-f]|\d){2})*$/.test($)){const j=new Uint8Array(($.match(/([a-z]|\d){2}/g)||[]).map(et=>parseInt(et,16)));return new Uint8ArrayConsumer(j)}else throw new InvalidHexStringError($)}constructor(a,$=0){this.arr=a,this.offset=$}consume(a){const $=this.arr.subarray(this.offset,this.offset+a);return this.offset+=a,$}get(a){return this.arr[this.offset+a]}length(){return this.arr.length-this.offset}slice(a,$){return new Uint8ArrayConsumer(this.arr.slice(a,$))}}const isPrim=_=>"prim"in _,isBytes$2=_=>"bytes"in _&&typeof _.bytes=="string",isString=_=>"string"in _&&typeof _.string=="string",isInt=_=>"int"in _&&typeof _.int=="string",scriptEncoder=_=>{const a=valueEncoder(_.code),$=valueEncoder(_.storage);return`${pad(a.length/2,8)}${a}${pad($.length/2,8)}${$}`},scriptDecoder=_=>{const a=extractRequiredLen(_),$=extractRequiredLen(_);return{code:valueDecoder(new Uint8ArrayConsumer(a)),storage:valueDecoder(new Uint8ArrayConsumer($))}},valueEncoder=_=>{if(Array.isArray(_)){const a=_.map(j=>valueEncoder(j)).join(""),$=a.length/2;return`02${pad($)}${a}`}else{if(isPrim(_))return primEncoder(_);if(isBytes$2(_))return bytesEncoder(_);if(isString(_))return stringEncoder(_);if(isInt(_))return intEncoder(_)}throw new UnexpectedMichelsonValueError(JSON.stringify(_))},valueDecoder=_=>{const a=_.consume(1);switch(a[0]){case 10:return bytesDecoder(_);case 1:return stringDecoder(_);case 0:return intDecoder(_);case 2:{const $=new Uint8ArrayConsumer(extractRequiredLen(_)),j=[];for(;$.length()>0;)j.push(valueDecoder($));return j}default:return primDecoder(_,a)}},extractRequiredLen=(_,a=4)=>{const $=_.consume(a),j=parseInt(Buffer$g.from($).toString("hex"),16);return _.consume(j)},stripLengthPrefixFromBytes=(_,a=4)=>{const $=[];let j=_;for(;j.length();){const et=j.consume(a),tt=parseInt(Buffer$g.from(et).toString("hex"),16);$.push(j.consume(tt)),j=j.slice(tt+a)}return $},bytesEncoder=_=>{if(!/^([A-Fa-f0-9]{2})*$/.test(_.bytes))throw new InvalidHexStringError(_.bytes);const a=_.bytes.length/2;return`0a${pad(a)}${_.bytes}`},bytesDecoder=_=>{const a=extractRequiredLen(_);return{bytes:Buffer$g.from(a).toString("hex")}},stringEncoder=_=>{const a=Buffer$g.from(_.string,"utf8").toString("hex"),$=a.length/2;return`01${pad($)}${a}`},stringDecoder=_=>{const a=extractRequiredLen(_);return{string:Buffer$g.from(a).toString("utf8")}},intEncoder=({int:_})=>{const a=new BigNumber(_,10),$=a.toString(2)[0]==="-"?"1":"0",j=a.toString(2).replace(/-/g,""),et=j.length<=6?6:(j.length-6)%7?j.length+7-(j.length-6)%7:j.length,rt=j.padStart(et,"0").match(/\d{6,7}/g).reverse();return rt[0]=$+rt[0],`00${rt.map((it,ot)=>parseInt((ot===rt.length-1?"0":"1")+it,2).toString(16).padStart(2,"0")).join("")}`},intDecoder=_=>{let a=_.consume(1)[0];const $=[],j=128;for(;a&j;)$.push(a),a=_.consume(1)[0];$.push(a);const et=!!(64&$[0]);$[0]=$[0]&127;const tt=$.map((nt,it)=>nt.toString(2).slice(it===0?-6:-7).padStart(it===0?6:7,"0")).reverse();let rt=new BigNumber(tt.join(""),2);return et&&(rt=rt.times(-1)),{int:rt.toFixed()}},primEncoder=_=>{const a=+Array.isArray(_.annots),$=Array.isArray(_.args)?_.args.length:0,j=pad(Math.min(2*$+a+3,9),2),et=opMappingReverse[_.prim];let tt=(_.args||[]).map(nt=>valueEncoder(nt)).join("");const rt=Array.isArray(_.annots)?encodeAnnots(_.annots):"";return(_.prim==="LAMBDA"||_.prim==="LAMBDA_REC")&&$&&(tt=pad(tt.length/2)+tt+pad(0)),(_.prim==="pair"||_.prim==="Pair")&&$>2&&(tt=rt===""?pad(tt.length/2)+tt+pad(0):pad(tt.length/2)+tt),_.prim==="view"&&_.args&&(tt=pad(tt.length/2)+tt+pad(0)),`${j}${et}${tt}${rt}`},primDecoder=(_,a)=>{const $=(a[0]-3)%2===1;let j=Math.floor((a[0]-3)/2);const et=_.consume(1)[0].toString(16).padStart(2,"0"),tt={prim:opMapping[et]};if((opMapping[et]==="LAMBDA"||opMapping[et]==="LAMBDA_REC")&&_.consume(4),opMapping[et]==="view")return j!=0?primViewDecoder(_,tt):tt;let rt,nt;(opMapping[et]==="pair"||opMapping[et]==="Pair")&&j>2&&(rt=decodeCombPair(_),j=0,nt=decodeAnnots(_));const it=new Array(j).fill(0).map(()=>valueDecoder(_));return(opMapping[et]==="LAMBDA"||opMapping[et]==="LAMBDA_REC")&&_.consume(4),rt?tt.args=rt:it.length&&(tt.args=it),nt&&nt[0]!==""?tt.annots=nt:$&&(tt.annots=decodeAnnots(_)),tt},primViewDecoder=(_,a)=>(_.consume(4),a.args=new Array(4).fill(0).map(()=>valueDecoder(_)),_.consume(4),a),decodeCombPair=_=>{const a=new Uint8ArrayConsumer(extractRequiredLen(_)),$=[];for(;a.length()>0;)$.push(valueDecoder(a));return $},encodeAnnots=_=>{const a=_.map(j=>Buffer$g.from(j,"utf8").toString("hex")).join("20"),$=a.length/2;return`${pad($)}${a}`},decodeAnnots=_=>{const a=_.consume(4),$=parseInt(Buffer$g.from(a).toString("hex"),16),j=_.consume($);return Buffer$g.from(j).toString("hex").split("20").map(tt=>Buffer$g.from(tt,"hex").toString("utf8"))},prefixEncoder=_=>a=>buf2hex(Buffer$g.from(b58cdecode(a,prefix[_]))),prefixDecoder=_=>a=>{const $=a.consume(prefixLength[_]);return b58cencode($,prefix[_])},tz1Decoder=prefixDecoder(Prefix.TZ1),branchDecoder=prefixDecoder(Prefix.B),publicKeyHashDecoder=_=>{const a=_.consume(1);if(a[0]===0)return prefixDecoder(Prefix.TZ1)(_);if(a[0]===1)return prefixDecoder(Prefix.TZ2)(_);if(a[0]===2)return prefixDecoder(Prefix.TZ3)(_)},publicKeyHashesDecoder=_=>{if(!boolDecoder(_))return;const a=[];for(_.consume(4);_.length()>0;)a.push(publicKeyHashDecoder(_));return a},branchEncoder=prefixEncoder(Prefix.B),tz1Encoder=prefixEncoder(Prefix.TZ1),boolEncoder=_=>_?"ff":"00",proposalEncoder=_=>prefixEncoder(Prefix.P)(_),proposalDecoder=_=>prefixDecoder(Prefix.P)(_),proposalsDecoder=_=>{const a=[];for(_.consume(4);_.length()>0;)a.push(proposalDecoder(_));return a},proposalsEncoder=_=>pad(32*_.length)+_.map(a=>proposalEncoder(a)).join(""),ballotEncoder=_=>{switch(_){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new InvalidBallotValueError(_)}},ballotDecoder=_=>{const a=_.consume(1);switch(a[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new DecodeBallotValueError(a[0].toString())}},pvmKindEncoder=_=>{switch(_){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new UnsupportedPvmKindError(_)}},pvmKindDecoder=_=>{const a=_.consume(1);switch(a[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new DecodePvmKindError(a[0].toString())}},delegateEncoder=_=>_?boolEncoder(!0)+publicKeyHashEncoder(_):boolEncoder(!1),int32Encoder=_=>{const a=parseInt(String(_),10),$=[];for(let j=0;j<4;j++){const et=(4-(j+1))*8;$.push((a&255<>et)}return Buffer$g.from($).toString("hex")},int32Decoder=_=>{const a=_.consume(4);let $=0;for(let j=0;j{const a=parseInt(String(_),10),$=[];for(let j=0;j<2;j++){const et=(2-(j+1))*8;$.push((a&255<>et)}return Buffer$g.from($).toString("hex")},int16Decoder=_=>{const a=_.consume(2);let $=0;for(let j=0;j_.consume(1)[0]===255,delegateDecoder=_=>{if(boolDecoder(_))return publicKeyHashDecoder(_)},publicKeyHashEncoder=_=>{switch(_.substring(0,3)){case Prefix.TZ1:return"00"+prefixEncoder(Prefix.TZ1)(_);case Prefix.TZ2:return"01"+prefixEncoder(Prefix.TZ2)(_);case Prefix.TZ3:return"02"+prefixEncoder(Prefix.TZ3)(_);case Prefix.TZ4:return"03"+prefixEncoder(Prefix.TZ4)(_);default:throw new InvalidKeyHashError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one for the following "${Prefix.TZ1}", "${Prefix.TZ2}", "${Prefix.TZ3}" or "${Prefix.TZ4}".`)}},publicKeyHashesEncoder=_=>{if(!_)return boolEncoder(!1);if(_.length===0)return boolEncoder(!0)+pad(0);const a=_.reduce(($,j)=>$+publicKeyHashEncoder(j),"");return boolEncoder(!0)+pad(a.length/2)+a},publicKeyEncoder=_=>{switch(_.substring(0,4)){case Prefix.EDPK:return"00"+prefixEncoder(Prefix.EDPK)(_);case Prefix.SPPK:return"01"+prefixEncoder(Prefix.SPPK)(_);case Prefix.P2PK:return"02"+prefixEncoder(Prefix.P2PK)(_);default:throw new InvalidPublicKeyError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following '${Prefix.EDPK}', '${Prefix.SPPK}', '${Prefix.P2PK}' or '${Prefix.BLPK}'.`)}},addressEncoder=_=>{switch(_.substring(0,3)){case Prefix.TZ1:case Prefix.TZ2:case Prefix.TZ3:case Prefix.TZ4:return"00"+publicKeyHashEncoder(_);case Prefix.KT1:return"01"+prefixEncoder(Prefix.KT1)(_)+"00";default:throw new InvalidAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following prefix '${Prefix.TZ1}', ${Prefix.TZ2}', '${Prefix.TZ3}', '${Prefix.TZ4}' or '${Prefix.KT1}'.`)}},smartRollupAddressEncoder=_=>{if(_.substring(0,3)!==Prefix.SR1)throw new InvalidSmartRollupAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SR1}'.`);return prefixEncoder(Prefix.SR1)(_)},smartContractAddressEncoder=_=>{if(_.substring(0,3)===Prefix.KT1)return"01"+prefixEncoder(Prefix.KT1)(_)+"00";throw new InvalidContractAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.KT1}'.`)},publicKeyDecoder=_=>{switch(_.consume(1)[0]){case 0:return prefixDecoder(Prefix.EDPK)(_);case 1:return prefixDecoder(Prefix.SPPK)(_);case 2:return prefixDecoder(Prefix.P2PK)(_);default:throw new InvalidPublicKeyError(_.toString(),invalidDetail(ValidationResult.NO_PREFIX_MATCHED))}},smartRollupCommitmentHashEncoder=_=>{if(_.substring(0,4)===Prefix.SRC1)return prefixEncoder(Prefix.SRC1)(_);throw new InvalidSmartRollupCommitmentHashError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SRC1}'`)},addressDecoder=_=>{switch(_.consume(1)[0]){case 0:return publicKeyHashDecoder(_);case 1:{const $=prefixDecoder(Prefix.KT1)(_);return _.consume(1),$}default:throw new InvalidAddressError(_.toString(),": Unable to decode.")}},smartRollupAddressDecoder=_=>{const a=prefixDecoder(Prefix.SR1)(_);if(a.substring(0,3)!==Prefix.SR1)throw new InvalidSmartRollupAddressError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SR1}'.`);return a},smartContractAddressDecoder=_=>{if(_.consume(1)[0]===1){const $=prefixDecoder(Prefix.KT1)(_);return _.consume(1),$}throw new InvalidContractAddressError(_.toString(),invalidDetail(ValidationResult.NO_PREFIX_MATCHED))},smartRollupCommitmentHashDecoder=_=>{const a=prefixDecoder(Prefix.SRC1)(_);if(a.substring(0,4)!==Prefix.SRC1)throw new InvalidSmartRollupCommitmentHashError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SRC1}'`);return a},zarithEncoder=_=>{const a=[];let $=new BigNumber(_,10);if($.isNaN())throw new TypeError(`Invalid zarith number ${_}`);for(;;)if($.lt(128)){$.lt(16)&&a.push("0"),a.push($.toString(16));break}else{let j=$.mod(128);$=$.minus(j),$=$.dividedBy(128),j=j.plus(128),a.push(j.toString(16))}return a.join("")},zarithDecoder=_=>{let a=0;for(;a<_.length()&&_.get(a)&128;)a+=1;let $=new BigNumber(0);for(let j=a;j>=0;j-=1){const et=_.get(j)&127;$=$.multipliedBy(128),$=$.plus(et)}return _.consume(a+1),new BigNumber($).toString()},entrypointDecoder=_=>{const a=pad(_.consume(1)[0],2);if(a in entrypointMapping)return entrypointMapping[a];{const $=extractRequiredLen(_,1),j=Buffer$g.from($).toString("utf8");if(j.length>ENTRYPOINT_MAX_LENGTH)throw new OversizedEntryPointError(j);return j}},parametersDecoder=_=>{if(_.consume(1)[0]!==0){const $=entrypointDecoder(_),j=extractRequiredLen(_),et=valueDecoder(new Uint8ArrayConsumer(j));return{entrypoint:$,value:et}}},entrypointEncoder=_=>{if(_ in entrypointMappingReverse)return`${entrypointMappingReverse[_]}`;if(_.length>ENTRYPOINT_MAX_LENGTH)throw new OversizedEntryPointError(_);return`ff${valueEncoder({string:_}).slice(8)}`},parametersEncoder=_=>{if(!_||_.entrypoint==="default"&&"prim"in _.value&&_.value.prim==="Unit")return"00";const a=entrypointEncoder(_.entrypoint),$=valueEncoder(_.value),j=($.length/2).toString(16).padStart(8,"0");return`ff${a}${j}${$}`},valueParameterEncoder=_=>{const a=valueEncoder(_);return`${pad(a.length/2)}${a}`},valueParameterDecoder=_=>{const a=extractRequiredLen(_);return valueDecoder(new Uint8ArrayConsumer(a))},blockPayloadHashEncoder=prefixEncoder(Prefix.VH),blockPayloadHashDecoder=prefixDecoder(Prefix.VH),entrypointNameEncoder=_=>`${valueEncoder({string:_}).slice(2)}`,entrypointNameDecoder=_=>{const a=extractRequiredLen(_);return Buffer$g.from(a).toString("utf8")},burnLimitEncoder=_=>_?`ff${zarithEncoder(_)}`:"00",burnLimitDecoder=_=>{const a=_.consume(1);if(Buffer$g.from(a).toString("hex")!=="00")return zarithDecoder(_)},depositsLimitEncoder=_=>_?`ff${zarithEncoder(_)}`:"00",depositsLimitDecoder=_=>{const a=_.consume(1);if(Buffer$g.from(a).toString("hex")!=="00")return zarithDecoder(_)},paddedBytesEncoder=(_,a=8)=>`${pad(_.length/2,a)}${_}`,paddedBytesDecoder=_=>{const a=extractRequiredLen(_);return Buffer$g.from(a).toString("hex")},smartRollupMessageEncoder=_=>{const a=_.reduce(($,j)=>$+`${pad(j.length/2)}${j}`,"");return`${pad(a.length/2)}${a}`},smartRollupMessageDecoder=_=>{const a=extractRequiredLen(_);return stripLengthPrefixFromBytes(new Uint8ArrayConsumer(a)).map(j=>Buffer$g.from(j).toString("hex"))},ManagerOperationSchema={branch:CODEC.BRANCH,contents:[CODEC.OPERATION]},ActivationSchema={pkh:CODEC.TZ1,secret:CODEC.SECRET},RevealSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,public_key:CODEC.PUBLIC_KEY},DelegationSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,delegate:CODEC.DELEGATE},TransactionSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,amount:CODEC.ZARITH,destination:CODEC.ADDRESS,parameters:CODEC.PARAMETERS},OriginationSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,balance:CODEC.ZARITH,delegate:CODEC.DELEGATE,script:CODEC.SCRIPT},BallotSchema={source:CODEC.PKH,period:CODEC.INT32,proposal:CODEC.PROPOSAL,ballot:CODEC.BALLOT_STATEMENT},AttestationSchema={slot:CODEC.INT16,level:CODEC.INT32,round:CODEC.INT32,block_payload_hash:CODEC.BLOCK_PAYLOAD_HASH},EndorsementSchema={slot:CODEC.INT16,level:CODEC.INT32,round:CODEC.INT32,block_payload_hash:CODEC.BLOCK_PAYLOAD_HASH},SeedNonceRevelationSchema={level:CODEC.INT32,nonce:CODEC.RAW},ProposalsSchema={source:CODEC.PKH,period:CODEC.INT32,proposals:CODEC.PROPOSAL_ARR},RegisterGlobalConstantSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,value:CODEC.VALUE},TransferTicketSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,ticket_contents:CODEC.VALUE,ticket_ty:CODEC.VALUE,ticket_ticketer:CODEC.ADDRESS,ticket_amount:CODEC.ZARITH,destination:CODEC.ADDRESS,entrypoint:CODEC.ENTRYPOINT},IncreasePaidStorageSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,amount:CODEC.ZARITH,destination:CODEC.SMART_CONTRACT_ADDRESS},UpdateConsensusKeySchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,pk:CODEC.PUBLIC_KEY},DrainDelegateSchema={consensus_key:CODEC.PKH,delegate:CODEC.PKH,destination:CODEC.PKH},SetDepositsLimitSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,limit:CODEC.DEPOSITS_LIMIT},SmartRollupOriginateSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,pvm_kind:CODEC.PVM_KIND,kernel:CODEC.PADDED_BYTES,parameters_ty:CODEC.VALUE,whitelist:CODEC.PKH_ARR},SmartRollupAddMessagesSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,message:CODEC.SMART_ROLLUP_MESSAGE},SmartRollupExecuteOutboxMessageSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,rollup:CODEC.SMART_ROLLUP_ADDRESS,cemented_commitment:CODEC.SMART_ROLLUP_COMMITMENT_HASH,output_proof:CODEC.PADDED_BYTES},FailingNoopSchema={arbitrary:CODEC.PADDED_BYTES},operationEncoder=_=>a=>{if(!(a.kind in _)||!(a.kind in kindMappingReverse))throw new InvalidOperationKindError(a.kind);return kindMappingReverse[a.kind]+_[a.kind](a)},operationDecoder=_=>a=>{const $=a.consume(1),j=kindMapping[$[0]];if(j===void 0)throw new UnsupportedOperationError($[0].toString());const et=_[j](a);if(typeof et!="object")throw new OperationDecodingError("Invalid operation, cannot be decoded.");return Object.assign({kind:j},et)},schemaEncoder=_=>a=>$=>Object.keys(a).reduce((et,tt)=>{const rt=a[tt];if($&&Array.isArray(rt)){const nt=_[rt[0]],it=$[tt];if(!Array.isArray(it))throw new OperationEncodingError(`Invalid operation value "${JSON.stringify(it)}" of key "${tt}, expected value to be Array.`);return et+it.reduce((ot,st)=>ot+nt(st),"")}else{const nt=_[rt];return et+nt($[tt])}},""),schemaDecoder=_=>a=>$=>Object.keys(a).reduce((et,tt)=>{const rt=a[tt];if(Array.isArray(rt)){const nt=_[rt[0]],it=[],ot=$.length();for(;$.length()>0;)if(it.push(nt($)),ot===$.length())throw new OperationDecodingError("Unable to decode value");return Object.assign(Object.assign({},et),{[tt]:it})}else{const nt=_[rt],it=nt($);return typeof it<"u"?Object.assign(Object.assign({},et),{[tt]:it}):Object.assign({},et)}},{}),decoders={[CODEC.SECRET]:_=>toHexString(_.consume(20)),[CODEC.RAW]:_=>toHexString(_.consume(32)),[CODEC.TZ1]:tz1Decoder,[CODEC.BRANCH]:branchDecoder,[CODEC.ZARITH]:zarithDecoder,[CODEC.PUBLIC_KEY]:publicKeyDecoder,[CODEC.PKH]:publicKeyHashDecoder,[CODEC.PKH_ARR]:publicKeyHashesDecoder,[CODEC.DELEGATE]:delegateDecoder,[CODEC.INT32]:int32Decoder,[CODEC.SCRIPT]:scriptDecoder,[CODEC.BALLOT_STATEMENT]:ballotDecoder,[CODEC.PROPOSAL]:proposalDecoder,[CODEC.PROPOSAL_ARR]:proposalsDecoder,[CODEC.PARAMETERS]:parametersDecoder,[CODEC.ADDRESS]:addressDecoder,[CODEC.SMART_ROLLUP_ADDRESS]:smartRollupAddressDecoder,[CODEC.SMART_CONTRACT_ADDRESS]:smartContractAddressDecoder,[CODEC.SMART_ROLLUP_COMMITMENT_HASH]:smartRollupCommitmentHashDecoder,[CODEC.VALUE]:valueParameterDecoder,[CODEC.INT16]:int16Decoder,[CODEC.BLOCK_PAYLOAD_HASH]:blockPayloadHashDecoder,[CODEC.ENTRYPOINT]:entrypointNameDecoder,[CODEC.BURN_LIMIT]:burnLimitDecoder,[CODEC.DEPOSITS_LIMIT]:depositsLimitDecoder,[CODEC.PVM_KIND]:pvmKindDecoder,[CODEC.PADDED_BYTES]:paddedBytesDecoder,[CODEC.SMART_ROLLUP_MESSAGE]:smartRollupMessageDecoder};decoders[CODEC.OPERATION]=operationDecoder(decoders);decoders[CODEC.OP_ACTIVATE_ACCOUNT]=_=>schemaDecoder(decoders)(ActivationSchema)(_);decoders[CODEC.OP_FAILING_NOOP]=_=>schemaDecoder(decoders)(FailingNoopSchema)(_);decoders[CODEC.OP_DELEGATION]=_=>schemaDecoder(decoders)(DelegationSchema)(_);decoders[CODEC.OP_TRANSACTION]=_=>schemaDecoder(decoders)(TransactionSchema)(_);decoders[CODEC.OP_ORIGINATION]=_=>schemaDecoder(decoders)(OriginationSchema)(_);decoders[CODEC.OP_BALLOT]=_=>schemaDecoder(decoders)(BallotSchema)(_);decoders[CODEC.OP_ATTESTATION]=_=>schemaDecoder(decoders)(AttestationSchema)(_);decoders[CODEC.OP_ENDORSEMENT]=_=>schemaDecoder(decoders)(EndorsementSchema)(_);decoders[CODEC.OP_SEED_NONCE_REVELATION]=_=>schemaDecoder(decoders)(SeedNonceRevelationSchema)(_);decoders[CODEC.OP_PROPOSALS]=_=>schemaDecoder(decoders)(ProposalsSchema)(_);decoders[CODEC.OP_REVEAL]=_=>schemaDecoder(decoders)(RevealSchema)(_);decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT]=_=>schemaDecoder(decoders)(RegisterGlobalConstantSchema)(_);decoders[CODEC.OP_TRANSFER_TICKET]=_=>schemaDecoder(decoders)(TransferTicketSchema)(_);decoders[CODEC.OP_INCREASE_PAID_STORAGE]=_=>schemaDecoder(decoders)(IncreasePaidStorageSchema)(_);decoders[CODEC.OP_UPDATE_CONSENSUS_KEY]=_=>schemaDecoder(decoders)(UpdateConsensusKeySchema)(_);decoders[CODEC.OP_DRAIN_DELEGATE]=_=>schemaDecoder(decoders)(DrainDelegateSchema)(_);decoders[CODEC.OP_SMART_ROLLUP_ORIGINATE]=_=>schemaDecoder(decoders)(SmartRollupOriginateSchema)(_);decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES]=_=>schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(_);decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=_=>schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(_);decoders[CODEC.MANAGER]=schemaDecoder(decoders)(ManagerOperationSchema);decoders[CODEC.OP_SET_DEPOSITS_LIMIT]=_=>schemaDecoder(decoders)(SetDepositsLimitSchema)(_);const encoders={[CODEC.SECRET]:_=>_,[CODEC.RAW]:_=>_,[CODEC.TZ1]:tz1Encoder,[CODEC.BRANCH]:branchEncoder,[CODEC.ZARITH]:zarithEncoder,[CODEC.PUBLIC_KEY]:publicKeyEncoder,[CODEC.PKH]:publicKeyHashEncoder,[CODEC.PKH_ARR]:publicKeyHashesEncoder,[CODEC.DELEGATE]:delegateEncoder,[CODEC.SCRIPT]:scriptEncoder,[CODEC.BALLOT_STATEMENT]:ballotEncoder,[CODEC.PROPOSAL]:proposalEncoder,[CODEC.PROPOSAL_ARR]:proposalsEncoder,[CODEC.INT32]:int32Encoder,[CODEC.PARAMETERS]:parametersEncoder,[CODEC.ADDRESS]:addressEncoder,[CODEC.SMART_ROLLUP_ADDRESS]:smartRollupAddressEncoder,[CODEC.SMART_CONTRACT_ADDRESS]:smartContractAddressEncoder,[CODEC.SMART_ROLLUP_COMMITMENT_HASH]:smartRollupCommitmentHashEncoder,[CODEC.VALUE]:valueParameterEncoder,[CODEC.INT16]:int16Encoder,[CODEC.BLOCK_PAYLOAD_HASH]:blockPayloadHashEncoder,[CODEC.ENTRYPOINT]:entrypointNameEncoder,[CODEC.BURN_LIMIT]:burnLimitEncoder,[CODEC.DEPOSITS_LIMIT]:depositsLimitEncoder,[CODEC.PVM_KIND]:pvmKindEncoder,[CODEC.PADDED_BYTES]:paddedBytesEncoder,[CODEC.SMART_ROLLUP_MESSAGE]:smartRollupMessageEncoder};encoders[CODEC.OPERATION]=operationEncoder(encoders);encoders[CODEC.OP_ACTIVATE_ACCOUNT]=_=>schemaEncoder(encoders)(ActivationSchema)(_);encoders[CODEC.OP_DELEGATION]=_=>schemaEncoder(encoders)(DelegationSchema)(_);encoders[CODEC.OP_TRANSACTION]=_=>schemaEncoder(encoders)(TransactionSchema)(_);encoders[CODEC.OP_ORIGINATION]=_=>schemaEncoder(encoders)(OriginationSchema)(_);encoders[CODEC.OP_BALLOT]=_=>schemaEncoder(encoders)(BallotSchema)(_);encoders[CODEC.OP_ATTESTATION]=_=>schemaEncoder(encoders)(AttestationSchema)(_);encoders[CODEC.OP_ENDORSEMENT]=_=>schemaEncoder(encoders)(EndorsementSchema)(_);encoders[CODEC.OP_SEED_NONCE_REVELATION]=_=>schemaEncoder(encoders)(SeedNonceRevelationSchema)(_);encoders[CODEC.OP_PROPOSALS]=_=>schemaEncoder(encoders)(ProposalsSchema)(_);encoders[CODEC.OP_REVEAL]=_=>schemaEncoder(encoders)(RevealSchema)(_);encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT]=_=>schemaEncoder(encoders)(RegisterGlobalConstantSchema)(_);encoders[CODEC.OP_TRANSFER_TICKET]=_=>schemaEncoder(encoders)(TransferTicketSchema)(_);encoders[CODEC.OP_INCREASE_PAID_STORAGE]=_=>schemaEncoder(encoders)(IncreasePaidStorageSchema)(_);encoders[CODEC.OP_UPDATE_CONSENSUS_KEY]=_=>schemaEncoder(encoders)(UpdateConsensusKeySchema)(_);encoders[CODEC.OP_DRAIN_DELEGATE]=_=>schemaEncoder(encoders)(DrainDelegateSchema)(_);encoders[CODEC.OP_SMART_ROLLUP_ORIGINATE]=_=>schemaEncoder(encoders)(SmartRollupOriginateSchema)(_);encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES]=_=>schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(_);encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=_=>schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(_);encoders[CODEC.MANAGER]=schemaEncoder(encoders)(ManagerOperationSchema);encoders[CODEC.OP_SET_DEPOSITS_LIMIT]=_=>schemaEncoder(encoders)(SetDepositsLimitSchema)(_);encoders[CODEC.OP_FAILING_NOOP]=_=>schemaEncoder(encoders)(FailingNoopSchema)(_);const OperationKindMapping={activate_account:ActivationSchema,reveal:RevealSchema,delegation:DelegationSchema,transaction:TransactionSchema,origination:OriginationSchema,ballot:BallotSchema,attestation:AttestationSchema,endorsement:EndorsementSchema,seed_nonce_revelation:SeedNonceRevelationSchema,proposals:ProposalsSchema,register_global_constant:RegisterGlobalConstantSchema,transfer_ticket:TransferTicketSchema,increase_paid_storage:IncreasePaidStorageSchema,update_consensus_key:UpdateConsensusKeySchema,drain_delegate:DrainDelegateSchema,set_deposits_limit:SetDepositsLimitSchema,smart_rollup_originate:SmartRollupOriginateSchema,smart_rollup_add_messages:SmartRollupAddMessagesSchema,smart_rollup_execute_outbox_message:SmartRollupExecuteOutboxMessageSchema,failing_noop:FailingNoopSchema},getArrayDifference=(_,a)=>a.filter($=>!_.includes($)),deleteArrayElementByValue=(_,a)=>_.filter($=>$!==a),validateOperationKind=_=>Object.keys(OperationKindMapping).includes(_),validateMissingProperty=_=>{const a=_.kind,$=Object.keys(_),j=deleteArrayElementByValue($,"kind"),et=Object.keys(OperationKindMapping[a]);return getArrayDifference(j,et)};var ProtocolsHash;(function(_){_.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",_.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",_.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",_.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",_.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",_.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",_.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",_.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",_.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",_.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",_.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",_.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",_.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",_.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",_.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",_.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",_.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",_.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(ProtocolsHash||(ProtocolsHash={}));const PROTOCOL_CURRENT=ProtocolsHash.ProxfordY;function getCodec(_,a){return{encoder:encoders[_],decoder:$=>{const j=Uint8ArrayConsumer.fromHexString($);return decoders[_](j)}}}class LocalForger{constructor(a=PROTOCOL_CURRENT){this.protocolHash=a,this.codec=getCodec(CODEC.MANAGER,this.protocolHash)}forge(a){const $=validateBlock(a.branch);if($!==ValidationResult.VALID)throw new InvalidBlockHashError(a.branch,invalidDetail($));for(const et of a.contents){if(!validateOperationKind(et.kind))throw new InvalidOperationKindError(et.kind);const tt=validateMissingProperty(et);if(tt.length===1){if(et.kind==="delegation"&&tt[0]==="delegate")continue;if(et.kind==="origination"&&tt[0]==="delegate")continue;if(et.kind==="transaction"&&tt[0]==="parameters")continue;if(et.kind==="set_deposits_limit"&&tt[0]==="limit")continue;if(et.kind==="smart_rollup_originate"&&tt[0]==="whitelist")continue;throw new InvalidOperationSchemaError(et,`missing properties "${tt.join(", ")}"`)}else if(tt.length>1)throw new InvalidOperationSchemaError(et,`missing properties "${tt.join(", ")}"`)}const j=this.codec.encoder(a).toLowerCase();return Promise.resolve(j)}parse(a){return Promise.resolve(this.codec.decoder(a))}}new LocalForger;function __rest(_,a){var $={};for(var j in _)Object.prototype.hasOwnProperty.call(_,j)&&a.indexOf(j)<0&&($[j]=_[j]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(_);et(_.on("data",$=>{a.next($)}),_.on("error",$=>{a.error($)}),_.on("close",()=>{a.complete()}),()=>{_.close()}))}const REVEAL_GAS_LIMIT={TZ1:169,TZ2:155,TZ3:445,TZ4:1674},REVEAL_FEE={TZ1:276,TZ2:276,TZ3:305,TZ4:477},REVEAL_STORAGE_LIMIT=0,COST_PER_BYTE=250;var Protocols;(function(_){_.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",_.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",_.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",_.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",_.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",_.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",_.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",_.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",_.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",_.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",_.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",_.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",_.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",_.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",_.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",_.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",_.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",_.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",_.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(Protocols||(Protocols={}));Protocols.Pt24m4xi,Protocols.PsBABY5H,Protocols.PsBabyM1,Protocols.PsCARTHA,Protocols.PsDELPH1,Protocols.PtEdo2Zk,Protocols.PsFLorena,Protocols.PtGRANADs,Protocols.PtHangz2,Protocols.PsiThaCa,Protocols.Psithaca2,Protocols.PtJakart2,Protocols.PtKathman,Protocols.PtLimaPtL,Protocols.PtMumbai2,Protocols.PtNairobi,Protocols.ProxfordY,Protocols.ProtoALpha;var ChainIds;(function(_){_.MAINNET="NetXdQprcVkpaWU",_.CARTHAGENET="NetXjD3HPJJjmcd",_.DELPHINET="NetXm8tYqnMWky1",_.EDONET="NetXSgo1ZT2DRUG",_.FLORENCENET="NetXxkAx4woPLyu",_.GRANADANET="NetXz969SFaFn8k",_.HANGZHOUNET="NetXZSsxBpMQeAT",_.ITHACANET="NetXbhmtAbMukLc",_.ITHACANET2="NetXnHfVqm9iesp",_.JAKARTANET2="NetXLH1uAxK7CCh",_.KATHMANDUNET="NetXazhm4yetmff",_.LIMANET="NetXizpkH94bocH",_.MUMBAINET="NetXQw6nWSnrJ5t",_.MUMBAINET2="NetXgbcrNtXD2yA",_.NAIROBINET="NetXyuzvDo2Ugzb",_.OXFORDNET2="NetXxWsskGahzQB"})(ChainIds||(ChainIds={}));const getRevealGasLimit=_=>Math.round(getRevealGasLimitInternal(_)*37/10),getRevealGasLimitInternal=_=>{switch(_.substring(0,3)){case"tz1":return REVEAL_GAS_LIMIT.TZ1;case"tz2":return REVEAL_GAS_LIMIT.TZ2;case"tz3":return REVEAL_GAS_LIMIT.TZ3;case"tz4":return REVEAL_GAS_LIMIT.TZ4;default:throw new Error(`Cannot estimate reveal gas limit for ${_}`)}},getRevealFee=_=>Math.round(getRevealFeeInternal(_)*12/10),getRevealFeeInternal=_=>{switch(_.substring(0,3)){case"tz1":return REVEAL_FEE.TZ1;case"tz2":return REVEAL_FEE.TZ2;case"tz3":return REVEAL_FEE.TZ3;case"tz4":return REVEAL_FEE.TZ4;default:throw new Error(`Cannot estimate reveal fee for ${_}`)}};class InvalidParameterError extends ParameterValidationError{constructor(a,$,j){super(),this.smartContractMethodName=a,this.sigs=$,this.invalidParams=j,this.name="InvalidParameterError",this.message=`${a} Received ${j.length} arguments while expecting one of the following signatures (${JSON.stringify($)})`}}class InvalidDelegationSource extends ParameterValidationError{constructor(a){super(),this.source=a,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${a}. Please use the smart contract abstraction to set your delegate.`}}class InvalidCodeParameter extends ParameterValidationError{constructor(a,$){super(),this.message=a,this.data=$,this.name="InvalidCodeParameter"}}class InvalidInitParameter extends ParameterValidationError{constructor(a,$){super(),this.message=a,this.data=$,this.name="InvalidInitParameter"}}class ViewSimulationError extends RpcError{constructor(a,$,j,et){super(),this.message=a,this.viewName=$,this.failWith=j,this.cause=et,this.name="ViewSimulationError"}}const validateAndExtractFailwith=_=>{if(isJsonString(_.body)){const a=JSON.parse(_.body);if(Array.isArray(a)&&"with"in a[a.length-1])return a[a.length-1].with}},isJsonString=_=>{try{JSON.parse(_)}catch{return!1}return!0};class InvalidViewSimulationContext extends ParameterValidationError{constructor(a){super(),this.info=a,this.name="InvalidViewSimulationContext",this.message=`${a} Please configure the context of the view execution in the executeView method.`}}class RevealOperationError extends RpcError{constructor(a){super(),this.message=a,this.name="RevealOperationError"}}class OriginationParameterError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name}}class InvalidBalanceError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidBalanceError"}}const createActivationOperation=({pkh:_,secret:a})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.ACTIVATION,pkh:_,secret:a}}),createOriginationOperation=({code:_,init:a,balance:$="0",delegate:j,storage:et,fee:tt,gasLimit:rt,storageLimit:nt,mutez:it=!1})=>__awaiter(void 0,void 0,void 0,function*(){if(et!==void 0&&a!==void 0)throw new OriginationParameterError("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(_))throw new InvalidCodeParameter("Wrong code parameter type, expected an array",_);let ot;if(et!==void 0){const ut=_.find(bt=>"prim"in bt&&bt.prim==="storage");if((ut==null?void 0:ut.args)===void 0)throw new InvalidCodeParameter("The storage section is missing from the script",_);ot=new Schema(ut.args[0]).Encode(et)}else if(a!==void 0&&typeof a=="object")ot=a;else throw new InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",a);const st={code:_,storage:ot};if(isNaN(Number($)))throw new InvalidBalanceError(`Invalid Balance "${$}", cannot be converted to a number`);const at={kind:OpKind.ORIGINATION,fee:tt,gas_limit:rt,storage_limit:nt,balance:it?$.toString():format$1("tz","mutez",$).toString(),script:st};return j&&(at.delegate=j),at}),createTransferOperation=({to:_,amount:a,parameter:$,fee:j,gasLimit:et,storageLimit:tt,mutez:rt=!1})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.TRANSACTION,fee:j,gas_limit:et,storage_limit:tt,amount:rt?a.toString():format$1("tz","mutez",a).toString(),destination:_,parameters:$}}),createSetDelegateOperation=({delegate:_,source:a,fee:$,gasLimit:j,storageLimit:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DELEGATION,source:a,fee:$,gas_limit:j,storage_limit:et,delegate:_}}),createRegisterDelegateOperation=({fee:_,gasLimit:a,storageLimit:$},j)=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DELEGATION,fee:_,gas_limit:a,storage_limit:$,delegate:j}}),createRevealOperation=({fee:_,gasLimit:a,storageLimit:$},j,et)=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.REVEAL,fee:_,public_key:et,source:j,gas_limit:a??getRevealGasLimit(j),storage_limit:$}}),createRegisterGlobalConstantOperation=({value:_,source:a,fee:$,gasLimit:j,storageLimit:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.REGISTER_GLOBAL_CONSTANT,value:_,fee:$,gas_limit:j,storage_limit:et,source:a}}),createTransferTicketOperation=({ticketContents:_,ticketTy:a,ticketTicketer:$,ticketAmount:j,destination:et,entrypoint:tt,source:rt,fee:nt,gasLimit:it,storageLimit:ot})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.TRANSFER_TICKET,fee:nt,gas_limit:it,storage_limit:ot,source:rt,ticket_contents:_,ticket_ty:a,ticket_ticketer:$,ticket_amount:j,destination:et,entrypoint:tt}}),createIncreasePaidStorageOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,amount:et,destination:tt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.INCREASE_PAID_STORAGE,source:_,fee:a,gas_limit:$,storage_limit:j,amount:et,destination:tt}}),createDrainDelegateOperation=({consensus_key:_,delegate:a,destination:$})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DRAIN_DELEGATE,consensus_key:_,delegate:a,destination:$}}),createBallotOperation=({source:_,proposal:a,ballot:$})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.BALLOT,source:_,proposal:a,ballot:$}}),createProposalsOperation=({source:_,proposals:a})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.PROPOSALS,source:_,proposals:a}}),createUpdateConsensusKeyOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,pk:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.UPDATE_CONSENSUS_KEY,source:_,fee:a,gas_limit:$,storage_limit:j,pk:et}}),createSmartRollupAddMessagesOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,message:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_ADD_MESSAGES,source:_,fee:a,gas_limit:$,storage_limit:j,message:et}}),createSmartRollupOriginateOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,pvmKind:et,kernel:tt,parametersType:rt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_ORIGINATE,source:_,fee:a,gas_limit:$,storage_limit:j,pvm_kind:et,kernel:tt,parameters_ty:rt}}),createSmartRollupExecuteOutboxMessageOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,rollup:et,cementedCommitment:tt,outputProof:rt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,source:_,fee:a,gas_limit:$,storage_limit:j,rollup:et,cemented_commitment:tt,output_proof:rt}}),attachKind=(_,a)=>Object.assign(Object.assign({},_),{kind:a}),findWithKind=(_,a)=>{if(Array.isArray(_)){const $=_.find(j=>j.kind===a);if($&&isKind($,a))return $}},isKind=(_,a)=>_.kind===a,isOpWithGasBuffer=_=>_.kind===OpKind.TRANSACTION&&_.parameters?!0:["origination","register_global_constant","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(_.kind)!==-1,isOpWithFee=_=>["transaction","delegation","origination","reveal","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate","smart_rollup_execute_outbox_message"].indexOf(_.kind)!==-1,isOpRequireReveal=_=>["transaction","delegation","origination","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate","smart_rollup_execute_outbox_message"].indexOf(_.kind)!==-1,hasMetadata=_=>"metadata"in _,hasMetadataWithResult=_=>hasMetadata(_)&&"operation_result"in _.metadata,hasMetadataWithInternalOperationResult=_=>hasMetadata(_)&&"internal_operation_results"in _.metadata,isErrorWithMessage=_=>"with"in _;class TezosOperationError extends RpcError{constructor(a,$,j){super(),this.errors=a,this.errorDetails=$,this.operationsWithResults=j,this.name="TezosOperationError",this.lastError=a[a.length-1],this.message=`(${this.kind}) ${this.id}`,isErrorWithMessage(this.lastError)&&(this.lastError.with.string?this.message=this.lastError.with.string:this.lastError.with.int?this.message=this.lastError.with.int:this.message=JSON.stringify(this.lastError.with))}get id(){return this.lastError.id}get kind(){return this.lastError.kind}}class TezosPreapplyFailureError extends Error{constructor(a){super(),this.result=a,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}const flattenOperationResult=_=>{const a=Array.isArray(_)?_:[_],$=[];for(let j=0;j$.push(rt.result)))}return $},flattenErrors=(_,a="failed")=>{const $=Array.isArray(_)?_:[_];let j=[];for(let et=0;et<$.length;et++)for(let tt=0;tt<$[et].contents.length;tt++){const rt=$[et].contents[tt];if(hasMetadata(rt)&&(hasMetadataWithResult(rt)&&rt.metadata.operation_result.status===a&&(j=j.concat(rt.metadata.operation_result.errors||[])),hasMetadataWithInternalOperationResult(rt)&&Array.isArray(rt.metadata.internal_operation_results)))for(const nt of rt.metadata.internal_operation_results)"result"in nt&&nt.result.status===a&&(j=j.concat(nt.result.errors||[]))}return j};class OriginationOperationError extends TaquitoError{constructor(a){super(),this.message=a,this.name="OriginationOperationError"}}class InvalidEstimateValueError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidEstimateValueError"}}class InvalidConfirmationCountError extends ParameterValidationError{constructor(a){super(),this.invalidConfirmations=a,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${a} expecting at least 1`}}class ConfirmationTimeoutError extends NetworkError{constructor(a){super(),this.message=a,this.name="ConfirmationTimeoutError"}}class RPCResponseError extends RpcError{constructor(a,$){super(),this.message=a,this.cause=$,this.name="RPCResponseError"}}class Operation{get includedInBlock(){return this._foundAt}constructor(a,$,j,et){if(this.hash=a,this.raw=$,this.results=j,this.context=et,this._pollingConfig$=new ReplaySubject(1),this.currentHead$=this._pollingConfig$.pipe(switchMap(tt=>new BehaviorSubject(tt).pipe(timeout({each:tt.timeout*1e3,with:()=>throwError(()=>new ConfirmationTimeoutError("Confirmation polling timed out"))}))),switchMap(()=>defer(()=>createObservableFromSubscription(this.context.stream.subscribeBlock("head"))).pipe(switchMap(tt=>{var rt,nt;const it=(nt=(rt=this.lastHead)===null||rt===void 0?void 0:rt.header.level)!==null&&nt!==void 0?nt:tt.header.level-1;return range(it+1,tt.header.level-it-1).pipe(concatMap(ot=>this.context.readProvider.getBlock(ot)),endWith(tt))}),tap(tt=>this.lastHead=tt))),shareReplay({refCount:!0})),this.confirmed$=this.currentHead$.pipe(map$1(tt=>{for(let rt=3;rt>=0;rt--)tt.operations[rt].forEach(nt=>{nt.hash===this.hash&&(this._foundAt=tt.header.level)});if(tt.header.level-this._foundAt>=0)return this._foundAt}),filter(tt=>tt!==void 0),first(),shareReplay()),this._foundAt=Number.POSITIVE_INFINITY,validateOperation(this.hash)!==ValidationResult.VALID)throw new InvalidOperationHashError(this.hash);this.confirmed$.pipe(first(),catchError(()=>of(EMPTY))).subscribe()}get revealOperation(){return Array.isArray(this.results)&&this.results.find(a=>a.kind==="reveal")}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map(a=>hasMetadataWithResult(a)?a.metadata.operation_result.status:"unknown")[0]||"unknown"}confirmation(a,$){return __awaiter(this,void 0,void 0,function*(){if(typeof a<"u"&&a<1)throw new InvalidConfirmationCountError(a);const{defaultConfirmationCount:j,confirmationPollingTimeoutSecond:et}=this.context.config;this._pollingConfig$.next({timeout:$||et});const tt=a!==void 0?a:j;return new Promise((rt,nt)=>{this.confirmed$.pipe(switchMap(()=>this.currentHead$),filter(it=>it.header.level-this._foundAt>=tt-1),first()).subscribe({error:it=>nt(it),complete:()=>rt(this._foundAt+(tt-1))})})})}}class BatchOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}sumProp(a,$){return a.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}getOriginatedContractAddresses(){const a=this.results.filter(j=>j.kind==="origination");let $=[];for(const j of a)j.metadata.operation_result.originated_contracts&&($=[...$,...j.metadata.operation_result.originated_contracts]);return $}get status(){return this.results.filter(a=>BATCH_KINDS.indexOf(a.kind)!==-1).map(a=>hasMetadataWithResult(a)?a.metadata.operation_result.status:"unknown")[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(flattenOperationResult({contents:this.results}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(flattenOperationResult({contents:this.results}),"paid_storage_size_diff"))}get errors(){return flattenErrors({contents:this.results})}}class Provider{get rpc(){return this.context.rpc}get signer(){return this.context.signer}constructor(a){this.context=a}forge({opOb:{branch:a,contents:$,protocol:j},counter:et}){return __awaiter(this,void 0,void 0,function*(){return{opbytes:yield this.context.forger.forge({branch:a,contents:$}),opOb:{branch:a,contents:$,protocol:j},counter:et}})}estimate(a,$){var{fee:j,gasLimit:et,storageLimit:tt}=a,rt=__rest(a,["fee","gasLimit","storageLimit"]);return __awaiter(this,void 0,void 0,function*(){let nt=j,it=et,ot=tt;if(nt&&nt%1!==0)throw new InvalidEstimateValueError(`Fee value must not be a decimal: ${nt}`);if(it&&it%1!==0)throw new InvalidEstimateValueError(`Gas Limit value must not be a decimal: ${it}`);if(ot&&ot%1!==0)throw new InvalidEstimateValueError(`Storage Limit value must not be a decimal: ${ot}`);if(j===void 0||et===void 0||tt===void 0){const st=yield $(Object.assign({fee:j,gasLimit:et,storageLimit:tt},rt));nt??(nt=st.suggestedFeeMutez),it??(it=st.gasLimit),ot??(ot=st.storageLimit)}return{fee:nt,gasLimit:it,storageLimit:ot}})}getRPCOp(a){return __awaiter(this,void 0,void 0,function*(){switch(a.kind){case OpKind.TRANSACTION:return createTransferOperation(Object.assign({},a));case OpKind.ORIGINATION:return createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},a)));case OpKind.DELEGATION:return createSetDelegateOperation(Object.assign({},a));case OpKind.REGISTER_GLOBAL_CONSTANT:return createRegisterGlobalConstantOperation(Object.assign({},a));case OpKind.INCREASE_PAID_STORAGE:return createIncreasePaidStorageOperation(Object.assign({},a));case OpKind.TRANSFER_TICKET:return createTransferTicketOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ADD_MESSAGES:return createSmartRollupAddMessagesOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ORIGINATE:return createSmartRollupOriginateOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return createSmartRollupExecuteOutboxMessageOperation(Object.assign({},a));default:throw new InvalidOperationKindError(a.kind)}})}runOperation(a){return __awaiter(this,void 0,void 0,function*(){return{opResponse:yield this.rpc.runOperation(a),op:a,context:this.context.clone()}})}simulate(a){return __awaiter(this,void 0,void 0,function*(){return{opResponse:yield this.rpc.simulateOperation(a),op:a,context:this.context.clone()}})}isRevealOpNeeded(a,$){return __awaiter(this,void 0,void 0,function*(){return!(!(yield this.isAccountRevealRequired($))||!this.isRevealRequiredForOpType(a))})}isAccountRevealRequired(a){return __awaiter(this,void 0,void 0,function*(){return!(yield this.context.readProvider.isAccountRevealed(a,"head"))})}isRevealRequiredForOpType(a){let $=!1;for(const j of a)isOpRequireReveal(j)&&($=!0);return $}signAndInject(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.sign(a.opbytes,new Uint8Array([3]));a.opbytes=$.sbytes,a.opOb.signature=$.prefixSig;const j=[],et=yield this.rpc.preapplyOperations([a.opOb]);if(!Array.isArray(et))throw new TezosPreapplyFailureError(et);for(let rt=0;rt__awaiter(this,void 0,void 0,function*(){return a}));case OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},a))}));case OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a}));case OpKind.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a}));default:throw new InvalidOperationKindError(JSON.stringify(a.kind))}})}with(a){for(const $ of a)switch($.kind){case OpKind.TRANSACTION:this.withTransfer($);break;case OpKind.ORIGINATION:this.withOrigination($);break;case OpKind.DELEGATION:this.withDelegation($);break;case OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage($);break;default:throw new InvalidOperationKindError(JSON.stringify($.kind))}return this}send(){return __awaiter(this,void 0,void 0,function*(){const a=[];for(const j of this.operations)a.push(yield this.mapOperation(j));const $=yield this.walletProvider.sendOperations(a);return this.context.operationFactory.createBatchOperation($)})}}class Wallet{constructor(a){this.context=a,this.walletCommand=$=>({send:$})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:a}={}){return __awaiter(this,void 0,void 0,function*(){return(!this._pkh||a)&&(this._pkh=yield this.walletProvider.getPKH()),this._pkh})}pk({forceRefetch:a}={}){return __awaiter(this,void 0,void 0,function*(){return(!this._pk||a)&&(this._pk=yield this.walletProvider.getPK()),this._pk})}originate(a){return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const $=yield this.walletProvider.mapOriginateParamsToWalletParams(()=>this.context.parser.prepareCodeOrigination(Object.assign({},a))),j=yield this.walletProvider.sendOperations([$]);return this.context.operationFactory.createOriginationOperation(j)}))}setDelegate(a){var $;const j=validateAddress(($=a.delegate)!==null&&$!==void 0?$:"");if(a.delegate&&j!==ValidationResult.VALID)throw new InvalidAddressError(a.delegate,invalidDetail(j));return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const et=yield this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a})),tt=yield this.walletProvider.sendOperations([et]);return this.context.operationFactory.createDelegationOperation(tt)}))}signFailingNoop(a){return __awaiter(this,void 0,void 0,function*(){const $={kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary},j=yield this.context.readProvider.getBlockHash(a.basedOnBlock),et=yield this.context.forger.forge({branch:j,contents:[$]});return{signature:yield this.walletProvider.sign(et,Uint8Array.from([3])),bytes:et,signedContent:{branch:j,contents:[{kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary}]}}})}registerDelegate(){return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const a=yield this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return{delegate:yield this.pkh()}})),$=yield this.walletProvider.sendOperations([a]);return this.context.operationFactory.createDelegationOperation($)}))}transfer(a){const $=validateAddress(a.to);if($!==ValidationResult.VALID)throw new InvalidAddressError(a.to,invalidDetail($));return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const j=yield this.walletProvider.mapTransferParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a})),et=yield this.walletProvider.sendOperations([j]);return this.context.operationFactory.createTransactionOperation(et)}))}increasePaidStorage(a){const $=validateAddress(a.destination);if($!==ValidationResult.VALID)throw new InvalidAddressError(a.destination,invalidDetail($));return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const j=yield this.walletProvider.mapIncreasePaidStorageWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a})),et=yield this.walletProvider.sendOperations([j]);return this.context.operationFactory.createIncreasePaidStorageOperation(et)}))}batch(a){const $=new WalletOperationBatch(this.walletProvider,this.context);return Array.isArray(a)&&$.with(a),$}at(a,$=j=>j){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(a);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(j));const et=this.context.withExtensions().rpc,tt=this.context.withExtensions().readProvider,rt=yield tt.getScript(a,"head"),nt=yield tt.getEntrypoints(a),it=new ContractAbstraction(a,rt,this,this.context.contract,nt,et,tt);return $(it,this.context)})}getPK(){return __awaiter(this,void 0,void 0,function*(){return yield this.pk()})}}const receiptFromOperation=(_,{ALLOCATION_BURN:a,ORIGINATION_BURN:$}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP});const j=flattenOperationResult({contents:_});let et=new BigNumber(0),tt=new BigNumber(0),rt=new BigNumber(0),nt=new BigNumber(0),it=new BigNumber(0),ot=new BigNumber(0);return j.forEach(st=>{rt=rt.plus(st.fee||0),nt=nt.plus(Array.isArray(st.originated_contracts)?st.originated_contracts.length*$:0),it=it.plus("allocated_destination_contract"in st?a:0),et=et.plus(st.consumed_milligas||0),ot=ot.plus("paid_storage_size_diff"in st&&Number(st.paid_storage_size_diff)||0)}),tt=tt.plus(it).plus(nt).plus(ot),{totalFee:rt,totalMilliGas:et,totalGas:et.dividedBy(1e3),totalStorage:tt,totalAllocationBurn:it,totalOriginationBurn:nt,totalPaidStorageDiff:ot,totalStorageBurn:new BigNumber(tt.multipliedBy(COST_PER_BYTE))}};class ConfirmationUndefinedError extends TezosToolkitConfigError{constructor(){super(),this.name="ConfirmationUndefinedError",this.message="Default confirmation count can not be undefined"}}class ObservableError extends NetworkError{constructor(a){super(),this.message=a,this.name="ObservableError"}}const MAX_BRANCH_ANCESTORS=60;class WalletOperation{operationResults(){return __awaiter(this,void 0,void 0,function*(){return this._operationResult.pipe(first()).toPromise()})}receipt(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(!a)throw new ObservableError("Unable to get operation results");return receiptFromOperation(a)})}constructor(a,$,j){if(this.opHash=a,this.context=$,this._newHead$=j,this._operationResult=new ReplaySubject(1),this._includedInBlock=new ReplaySubject(1),this._included=!1,this.newHead$=this._newHead$.pipe(switchMap(et=>{var tt,rt;const nt=(rt=(tt=this.lastHead)===null||tt===void 0?void 0:tt.header.level)!==null&&rt!==void 0?rt:et.header.level-1;return range(nt+1,et.header.level-nt-1).pipe(concatMap(it=>this.context.readProvider.getBlock(it)),endWith(et))}),tap(et=>this.lastHead=et),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),this.confirmed$=this.newHead$.pipe(map$1(et=>{for(const tt of et.operations)for(const rt of tt)if(rt.hash===this.opHash)return this._included=!0,this._includedInBlock.next(et),this._operationResult.next(rt.contents),et}),filter(et=>typeof et<"u"),first(),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),validateOperation(this.opHash)!==ValidationResult.VALID)throw new InvalidOperationHashError(this.opHash);this.confirmed$.pipe(first(),catchError(()=>of(void 0))).subscribe()}getCurrentConfirmation(){return __awaiter(this,void 0,void 0,function*(){return this._included?combineLatest([this._includedInBlock,from(this.context.readProvider.getBlock("head"))]).pipe(map$1(([a,$])=>$.header.level-a.header.level+1),first()).toPromise():0})}isInCurrentBranch(a="head"){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return!0;const $=yield this.context.readProvider.getBlockLevel(a),j=yield this._includedInBlock.pipe(first()).toPromise();if(!j)throw new ObservableError("Inclusion block is undefined");const et=$-j.header.level;if(et<=0)return!0;const tt=Math.min(j.header.level+et,j.header.level+MAX_BRANCH_ANCESTORS);return new Set(yield this.context.readProvider.getLiveBlocks(tt)).has(j.hash)})}confirmationObservable(a){if(typeof a<"u"&&a<1)throw new InvalidConfirmationCountError(a);const{defaultConfirmationCount:$}=this.context.config,j=a!==void 0?a:$;if(j===void 0)throw new ConfirmationUndefinedError;return combineLatest([this._includedInBlock,this.newHead$]).pipe(distinctUntilChanged(([,et],[,tt])=>et.hash===tt.hash),map$1(([et,tt])=>({block:tt,expectedConfirmation:j,currentConfirmation:tt.header.level-et.header.level+1,completed:tt.header.level-et.header.level>=j-1,isInCurrentBranch:()=>this.isInCurrentBranch(tt.hash)})),takeWhile(({completed:et})=>!et,!0))}confirmation(a){return this.confirmationObservable(a).toPromise()}}class TransactionWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(!a)throw new ObservableError("operationResult returned undefined");return a.find($=>$.kind===OpKind.REVEAL)})}transactionOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(!a)throw new ObservableError("operationResult returned undefined");return a.find($=>$.kind===OpKind.TRANSACTION)})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.transactionOperation();return a?a.metadata.operation_result.status:"unknown"})}}class OriginationWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}originationOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return findWithKind(a,OpKind.ORIGINATION);throw new ObservableError("Unable to fetch operation result")})}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return findWithKind(a,OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.originationOperation();return a?a.metadata.operation_result.status:"unknown"})}contract(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.originationOperation(),$=((a==null?void 0:a.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at($)})}}class DelegationWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}delegationOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.DELEGATION);throw new ObservableError("Unable to fetch operation result")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.delegationOperation();return a?a.metadata.operation_result.status:"unknown"})}}class LegacyWalletProvider{constructor(a){this.context=a}getPKH(){return __awaiter(this,void 0,void 0,function*(){return this.context.signer.publicKeyHash()})}getPK(){return __awaiter(this,void 0,void 0,function*(){return this.context.signer.publicKey()})}mapTransferParamsToWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.TRANSACTION)})}mapOriginateParamsToWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.ORIGINATION)})}mapDelegateParamsToWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.DELEGATION)})}mapIncreasePaidStorageWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.INCREASE_PAID_STORAGE)})}sendOperations(a){return __awaiter(this,void 0,void 0,function*(){return(yield this.context.batch.batch(a).send()).hash})}sign(a,$){return __awaiter(this,void 0,void 0,function*(){const{prefixSig:j}=yield this.context.signer.sign(a,$);return j})}}class ContractMethodObject{constructor(a,$,j,et,tt="unit",rt=!0,nt=!1){this.provider=a,this.address=$,this.parameterSchema=j,this.name=et,this.args=tt,this.isMultipleEntrypoint=rt,this.isAnonymous=nt}getSignature(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}send(a={}){return this.provider instanceof Wallet?this.provider.transfer(this.toTransferParams(a)).send():this.provider.transfer(this.toTransferParams(a))}toTransferParams({fee:a,gasLimit:$,storageLimit:j,source:et,amount:tt=0,mutez:rt=!1}={}){return{to:this.address,amount:tt,fee:a,mutez:rt,source:et,gasLimit:$,storageLimit:j,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}class ContractMethod{constructor(a,$,j,et,tt,rt=!0,nt=!1){this.provider=a,this.address=$,this.parameterSchema=j,this.name=et,this.args=tt,this.isMultipleEntrypoint=rt,this.isAnonymous=nt}validateArgs(a,$,j){const et=$.ExtractSignatures();if(!et.find(tt=>tt.length===a.length))throw new InvalidParameterError(j,et,a)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(this.isAnonymous){const a=this.parameterSchema.ExtractSignatures().find($=>$[0]===this.name);if(a)return a.shift(),a}else{const a=this.parameterSchema.ExtractSignatures();return a.length==1?a[0]:a}}send(a={}){return this.provider instanceof Wallet?this.provider.transfer(this.toTransferParams(a)).send():this.provider.transfer(this.toTransferParams(a))}toTransferParams({fee:a,gasLimit:$,storageLimit:j,source:et,amount:tt=0,mutez:rt=!1}={}){return{to:this.address,amount:tt,fee:a,mutez:rt,source:et,gasLimit:$,storageLimit:j,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.Encode(this.name,...this.args):this.parameterSchema.Encode(...this.args)}}}}class OnChainView{constructor(a,$,j,et,tt,rt="Unit"){this._rpc=a,this._readProvider=$,this._contractAddress=j,this._smartContractViewSchema=et,this._contractStorageType=tt,this._args=rt}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}executeView(a){return __awaiter(this,void 0,void 0,function*(){this.verifyContextExecution(a);const $=yield this._readProvider.getChainId(),j=this.transformArgsToMichelson(),et={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:j,chain_id:$,source:a.viewCaller};return a.source&&(et.payer=a.source),this.executeViewAndDecodeResult(et)})}verifyContextExecution(a){if(a.source&&validateAddress(a.source)!==ValidationResult.VALID)throw new InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${a.source}.`);if(!a.viewCaller||validateAddress(a.viewCaller)!==ValidationResult.VALID)throw new InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${a.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(a){throw new InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,a)}}adaptViewCodeToContext(a,$,j){const et={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:j}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:$}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return a.forEach((tt,rt)=>{tt.prim in et&&(a[rt]=Object(et)[tt.prim]),tt.args&&tt.args.length!==0?this.adaptViewCodeToContext(tt.args,$,j):Array.isArray(tt)&&this.adaptViewCodeToContext(tt,$,j)}),a}executeViewAndDecodeResult(a){return __awaiter(this,void 0,void 0,function*(){let $;try{$=(yield this._rpc.runScriptView(a)).data}catch(j){const et=validateAndExtractFailwith(j);throw et?new ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(et)}`,this._smartContractViewSchema.viewName,et,j):j}return this._smartContractViewSchema.decodeViewResult($)})}}class ContractMethodFactory{constructor(a,$){this.provider=a,this.contractAddress=$}createContractMethodFlatParams(a,$,j,et=!0,tt=!1){return new ContractMethod(this.provider,this.contractAddress,a,$,j,et,tt)}createContractMethodObjectParam(a,$,j,et=!0,tt=!1){return new ContractMethodObject(this.provider,this.contractAddress,a,$,j,et,tt)}createContractViewObjectParam(a,$,j,et,tt){return new OnChainView(a,$,this.contractAddress,j,et,tt)}}const DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class ContractView{constructor(a,$,j,et,tt,rt,nt){this.currentContract=a,this.name=$,this.callbackParametersSchema=j,this.parameterSchema=et,this.args=tt,this.rpc=rt,this.readProvider=nt}read(a){return __awaiter(this,void 0,void 0,function*(){const $=validateChain(a??"");if(validateContractAddress(a??"")==ValidationResult.VALID)throw new DeprecationError("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(a&&$!==ValidationResult.VALID)throw new InvalidChainIdError(a,invalidDetail($));const j=this.parameterSchema.Encode(...this.args),et=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:j,chain_id:a||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(et.data)})}}const validateArgs=(_,a,$)=>{const j=a.ExtractSignatures();if(!j.find(et=>et.length===_.length))throw new InvalidParameterError($,j,_)},isView$2=_=>{let a=!1;if("prim"in _&&_.prim==="pair"&&_.args){const $=_.args[_.args.length-1];"prim"in $&&$.prim==="contract"&&(a=!0)}return a};class ContractAbstraction{constructor(a,$,j,et,tt,rt,nt){this.address=a,this.script=$,this.storageProvider=et,this.entrypoints=tt,this.rpc=rt,this.readProvider=nt,this.methods={},this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new ContractMethodFactory(j,a),this.schema=Schema.fromRPCResponse({script:this.script}),this.parameterSchema=ParameterSchema.fromRPCResponse({script:this.script}),this.viewSchema=ViewSchema.fromRPCResponse({script:this.script}),this.viewSchema.length!==0&&this._initializeOnChainViews(this,rt,this.readProvider,this.viewSchema),this.eventSchema=EventSchema.fromRPCResponse({script:this.script}),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(a,$,j,et){const tt=this.parameterSchema,rt=Object.keys($);if(tt.isMultipleEntryPoint)rt.forEach(it=>{const ot=new ParameterSchema($[it]);if(this.methods[it]=function(...st){return a.contractMethodFactory.createContractMethodFlatParams(ot,it,st)},this.methodsObject[it]=function(st){return a.contractMethodFactory.createContractMethodObjectParam(ot,it,st)},isView$2($[it])){const st=function(...at){const ut=$[it].args[0],ht=new ParameterSchema(ut),bt=$[it].args[1].args[0],Et=new ParameterSchema(bt);return validateArgs(at,ht,it),new ContractView(a,it,Et,ht,at,j,et)};this.views[it]=st}}),Object.keys(tt.ExtractSchema()).filter(it=>Object.keys($).indexOf(it)===-1).forEach(it=>{this.methods[it]=function(...ot){return a.contractMethodFactory.createContractMethodFlatParams(tt,it,ot,!1,!0)},this.methodsObject[it]=function(ot){return a.contractMethodFactory.createContractMethodObjectParam(tt,it,ot,!1,!0)}});else{const nt=this.parameterSchema;this.methods[DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...it){return a.contractMethodFactory.createContractMethodFlatParams(nt,DEFAULT_SMART_CONTRACT_METHOD_NAME,it,!1)},this.methodsObject[DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(it){return a.contractMethodFactory.createContractMethodObjectParam(nt,DEFAULT_SMART_CONTRACT_METHOD_NAME,it,!1)}}}_initializeOnChainViews(a,$,j,et){const tt=this.schema.val;et.forEach(rt=>{this.contractViews[rt.viewName]=function(nt){return a.contractMethodFactory.createContractViewObjectParam($,j,rt,tt,nt)}})}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(a){return this.storageProvider.getBigMapKey(this.address,a,this.schema)}}const setDelegate=_=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:_}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit=(_,a)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:_}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${a}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],removeDelegate=()=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"NONE",args:[{prim:"key_hash"}]},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferToContract=(_,a)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"address"},{string:_}]},{prim:"CONTRACT",args:[{prim:"unit"}]},{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:`${a}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],MANAGER_LAMBDA={setDelegate,removeDelegate,transferImplicit,transferToContract};class SaplingStateAbstraction{constructor(a,$){this.id=a,this.provider=$}getSaplingDiff(a){return __awaiter(this,void 0,void 0,function*(){return this.provider.getSaplingDiffByID(this.id.toString(),a)})}getId(){return this.id.toString()}}class BigMapAbstraction{constructor(a,$,j){this.id=a,this.schema=$,this.provider=j}get(a,$){return __awaiter(this,void 0,void 0,function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),a,this.schema,$)}catch(j){if(j instanceof HttpResponseError&&j.status===STATUS_CODE.NOT_FOUND)return;throw j}})}getMultipleValues(a,$,j=5){return __awaiter(this,void 0,void 0,function*(){return this.provider.getBigMapKeysByID(this.id.toString(),a,this.schema,$,j)})}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}const smartContractAbstractionSemantic=_=>({big_map:(a,$)=>{if(!a||!("int"in a)||a.int===void 0)return{};{const j=new Schema($);return new BigMapAbstraction(new BigNumber(a.int),j,_)}},sapling_state:a=>!a||!("int"in a)||a.int===void 0?{}:new SaplingStateAbstraction(new BigNumber(a.int),_)});var _PrepareProvider_counters;const mergeLimits=(_,a)=>{var $,j,et;return{fee:($=_.fee)!==null&&$!==void 0?$:a.fee,gasLimit:(j=_.gasLimit)!==null&&j!==void 0?j:a.gasLimit,storageLimit:(et=_.storageLimit)!==null&&et!==void 0?et:a.storageLimit}};class PrepareProvider extends Provider{constructor(a){super(a),this.context=a,_PrepareProvider_counters.set(this,void 0),__classPrivateFieldSet(this,_PrepareProvider_counters,{})}getBlockHash(a){return __awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getBlockHash(a??"head~2")})}getProtocolHash(){return __awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getNextProtocol("head")})}getHeadCounter(a){var $;return __awaiter(this,void 0,void 0,function*(){return($=this.context.readProvider.getCounter(a,"head"))!==null&&$!==void 0?$:"0"})}adjustGasForBatchOperation(a,$,j){return BigNumber.min($,a.div(j+1))}getOperationLimits(a,$){return __awaiter(this,void 0,void 0,function*(){const{hard_gas_limit_per_operation:j,hard_gas_limit_per_block:et,hard_storage_limit_per_operation:tt}=a;return{fee:0,gasLimit:$?Math.floor(this.adjustGasForBatchOperation(et,j,$).toNumber()):j.toNumber(),storageLimit:tt.toNumber()}})}getFee(a,$,j){return(!__classPrivateFieldGet(this,_PrepareProvider_counters,"f")[$]||__classPrivateFieldGet(this,_PrepareProvider_counters,"f")[$]"u"?"0":`${a.fee}`,gas_limit:typeof a.gas_limit>"u"?"0":`${a.gas_limit}`,storage_limit:typeof a.storage_limit>"u"?"0":`${a.storage_limit}`}}getSource(a,$,j){return{source:typeof a.source>"u"?j||$:a.source}}addRevealOperationIfNeeded(a,$){return __awaiter(this,void 0,void 0,function*(){if(isOpRequireReveal(a)){const j=[a],{publicKey:et,pkh:tt}=yield this.getKeys();if(yield this.isAccountRevealRequired($)){if(!et)throw new PublicKeyNotFoundError(tt);return j.unshift(yield createRevealOperation({fee:getRevealFee(tt),storageLimit:REVEAL_STORAGE_LIMIT,gasLimit:getRevealGasLimit(tt)},$,et)),j}}return a})}getKeys(){return __awaiter(this,void 0,void 0,function*(){const a=this.context.isAnySignerConfigured();return{pkh:a?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:a?yield this.signer.publicKey():void 0}})}convertIntoArray(a){return Array.isArray(a)?[...a]:[a]}constructOpContents(a,$,j,et,tt){return a.map(rt=>{switch(rt.kind){case OpKind.ACTIVATION:case OpKind.DRAIN_DELEGATE:return Object.assign({},rt);case OpKind.ORIGINATION:return Object.assign(Object.assign(Object.assign(Object.assign({},rt),{balance:typeof rt.balance<"u"?`${rt.balance}`:"0"}),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.TRANSACTION:{const nt=Object.assign(Object.assign(Object.assign(Object.assign({},rt),{amount:typeof rt.amount<"u"?`${rt.amount}`:"0"}),this.getSource(rt,j,et)),this.getFee(rt,j,$));if(nt.source.toLowerCase().startsWith("kt1"))throw new DeprecationError(`KT1 addresses are not supported as source since ${Protocols.PsBabyM1}`);return nt}case OpKind.REVEAL:case OpKind.DELEGATION:case OpKind.REGISTER_GLOBAL_CONSTANT:case OpKind.UPDATE_CONSENSUS_KEY:case OpKind.SMART_ROLLUP_ADD_MESSAGES:case OpKind.SMART_ROLLUP_ORIGINATE:case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return Object.assign(Object.assign(Object.assign({},rt),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.TRANSFER_TICKET:return Object.assign(Object.assign(Object.assign(Object.assign({},rt),{ticket_amount:`${rt.ticket_amount}`}),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.INCREASE_PAID_STORAGE:return Object.assign(Object.assign(Object.assign(Object.assign({},rt),{amount:`${rt.amount}`}),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.BALLOT:if(tt===void 0)throw new RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},rt),{period:tt==null?void 0:tt.voting_period.index});case OpKind.PROPOSALS:if(tt===void 0)throw new RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},rt),{period:tt==null?void 0:tt.voting_period.index});default:throw new InvalidOperationKindError(rt.kind)}})}activate({pkh:a,secret:$}){return __awaiter(this,void 0,void 0,function*(){const j=yield createActivationOperation({pkh:a,secret:$}),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter(a),10),it=this.constructOpContents(et,nt,a);return{opOb:{branch:tt,contents:it,protocol:rt},counter:nt}})}reveal({fee:a,gasLimit:$,storageLimit:j}){return __awaiter(this,void 0,void 0,function*(){const{pkh:et,publicKey:tt}=yield this.getKeys();if(!tt)throw new PublicKeyNotFoundError(et);const rt=yield this.context.readProvider.getProtocolConstants("head"),nt=yield this.getOperationLimits(rt),it=mergeLimits({fee:a,storageLimit:j,gasLimit:$},nt),ot=yield createRevealOperation({fee:it.fee,gasLimit:it.gasLimit,storageLimit:it.storageLimit},et,tt),st=this.convertIntoArray(ot),at=yield this.getBlockHash(),ut=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const ht=parseInt(yield this.getHeadCounter(et),10),bt=this.constructOpContents(st,ht,et);return{opOb:{branch:at,contents:bt,protocol:ut},counter:ht}})}originate(a,$){var{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:nt}=yield this.getKeys(),it=yield this.context.readProvider.getProtocolConstants("head"),ot=yield this.getOperationLimits(it),st=yield createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},rt),mergeLimits({fee:j,storageLimit:et,gasLimit:tt},ot)))),at=yield this.addRevealOperationIfNeeded(st,nt),ut=this.convertIntoArray(at),ht=yield this.getBlockHash(),bt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const Et=parseInt(yield this.getHeadCounter(nt),10),Ct=this.constructOpContents(ut,Et,nt,$);return{opOb:{branch:ht,contents:Ct,protocol:bt},counter:Et}})}transaction(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createTransferOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}delegation(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createSetDelegateOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}registerDelegate({fee:a,storageLimit:$,gasLimit:j},et){return __awaiter(this,void 0,void 0,function*(){const{pkh:tt}=yield this.getKeys(),rt=yield this.context.readProvider.getProtocolConstants("head"),nt=yield this.getOperationLimits(rt),it=mergeLimits({fee:a,storageLimit:$,gasLimit:j},nt),ot=yield createRegisterDelegateOperation({fee:it.fee,storageLimit:it.storageLimit,gasLimit:it.gasLimit},tt),st=yield this.addRevealOperationIfNeeded(ot,tt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(tt),10),Et=this.constructOpContents(at,bt,tt,et);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}registerGlobalConstant(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createRegisterGlobalConstantOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}updateConsensusKey(a,$){var{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:nt}=yield this.getKeys(),it=yield this.context.readProvider.getProtocolConstants("head"),ot=yield this.getOperationLimits(it),st=yield createUpdateConsensusKeyOperation(Object.assign(Object.assign({},rt),mergeLimits({fee:j,storageLimit:et,gasLimit:tt},ot))),at=yield this.addRevealOperationIfNeeded(st,nt),ut=this.convertIntoArray(at),ht=yield this.getBlockHash(),bt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const Et=parseInt(yield this.getHeadCounter(nt),10),Ct=this.constructOpContents(ut,Et,nt,$);return{opOb:{branch:ht,contents:Ct,protocol:bt},counter:Et}})}increasePaidStorage(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createIncreasePaidStorageOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}ballot(a){return __awaiter(this,void 0,void 0,function*(){const{pkh:$}=yield this.getKeys(),j=yield createBallotOperation(Object.assign({},a)),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter($),10);let it;try{it=yield this.rpc.getCurrentPeriod()}catch{throw new RPCResponseError("Failed to get the current voting period index")}const ot=this.constructOpContents(et,nt,$,void 0,it);return{opOb:{branch:tt,contents:ot,protocol:rt},counter:nt}})}proposals(a){return __awaiter(this,void 0,void 0,function*(){const{pkh:$}=yield this.getKeys(),j=yield createProposalsOperation(Object.assign({},a)),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter($),10);let it;try{it=yield this.rpc.getCurrentPeriod()}catch{throw new RPCResponseError("Failed to get the current voting period index")}const ot=this.constructOpContents(et,nt,$,void 0,it);return{opOb:{branch:tt,contents:ot,protocol:rt},counter:nt}})}drainDelegate(a,$){return __awaiter(this,void 0,void 0,function*(){const{pkh:j}=yield this.getKeys(),et=yield createDrainDelegateOperation(Object.assign({},a)),tt=this.convertIntoArray(et),rt=yield this.getBlockHash(),nt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const it=parseInt(yield this.getHeadCounter(j),10),ot=this.constructOpContents(tt,it,j,$);return{opOb:{branch:rt,contents:ot,protocol:nt},counter:it}})}transferTicket(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createTransferTicketOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}smartRollupAddMessages(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createSmartRollupAddMessagesOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}smartRollupOriginate(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createSmartRollupOriginateOperation(Object.assign(Object.assign({},mergeLimits({fee:$,storageLimit:j,gasLimit:et},it)),tt)),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}smartRollupExecuteOutboxMessage(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),ot=yield createSmartRollupExecuteOutboxMessageOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(ot,rt),at=this.convertIntoArray(st),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const bt=parseInt(yield this.getHeadCounter(rt),10),Et=this.constructOpContents(at,bt,rt,tt.source);return{opOb:{branch:ut,contents:Et,protocol:ht},counter:bt}})}batch(a,$){return __awaiter(this,void 0,void 0,function*(){const{pkh:j,publicKey:et}=yield this.getKeys(),tt=yield this.context.readProvider.getProtocolConstants("head"),rt=yield this.getOperationLimits(tt,a.length),nt=yield this.isRevealOpNeeded(a,j),it=[];if($)for(const ht of a)if(isOpWithFee(ht)){const bt=$.shift(),Et=mergeLimits(ht,{fee:bt.suggestedFeeMutez,storageLimit:bt.storageLimit,gasLimit:bt.gasLimit});it.push(yield this.getRPCOp(Object.assign(Object.assign({},ht),Et)))}else it.push(Object.assign({},ht));else for(const ht of a)if(isOpWithFee(ht)){const bt=mergeLimits(ht,rt);it.push(yield this.getRPCOp(Object.assign(Object.assign({},ht),bt)))}else it.push(Object.assign({},ht));if(nt){if(!et)throw new PublicKeyNotFoundError(j);it.unshift(yield createRevealOperation({fee:getRevealFee(j),storageLimit:REVEAL_STORAGE_LIMIT,gasLimit:getRevealGasLimit(j)},j,et))}const ot=yield this.getBlockHash(),st=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const at=parseInt(yield this.getHeadCounter(j),10),ut=this.constructOpContents(it,at,j);return{opOb:{branch:ot,contents:ut,protocol:st},counter:at}})}contractCall(a){var $,j,et;return __awaiter(this,void 0,void 0,function*(){const tt=yield this.getBlockHash(),rt=yield this.getProtocolHash(),{pkh:nt}=yield this.getKeys();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const it=parseInt(yield this.getHeadCounter(nt),10),ot=a.toTransferParams(),st=yield this.context.readProvider.getProtocolConstants("head"),at=yield this.getOperationLimits(st),ut=mergeLimits({fee:ot.fee,storageLimit:ot.storageLimit,gasLimit:ot.gasLimit},at),ht={kind:OpKind.TRANSACTION,fee:($=ot.fee)!==null&&$!==void 0?$:ut.fee,gas_limit:(j=ot.gasLimit)!==null&&j!==void 0?j:ut.gasLimit,storage_limit:(et=ot.storageLimit)!==null&&et!==void 0?et:ut.storageLimit,amount:String(ot.amount),destination:ot.to,parameters:ot.parameter},bt=yield this.addRevealOperationIfNeeded(ht,nt),Et=this.convertIntoArray(bt),Ct=this.constructOpContents(Et,it,nt);return{opOb:{branch:tt,contents:Ct,protocol:rt},counter:it}})}toPreapply(a){return __awaiter(this,void 0,void 0,function*(){const{opOb:{contents:$,branch:j,protocol:et}}=a,tt=this.toForge(a),rt=yield this.context.forger.forge(tt),nt=yield this.context.signer.sign(rt,new Uint8Array([3]));return[{contents:$,branch:j,protocol:et,signature:nt.prefixSig}]})}toForge({opOb:{contents:a,branch:$}}){return{branch:$,contents:a}}}_PrepareProvider_counters=new WeakMap;const BATCH_KINDS=[OpKind.ACTIVATION,OpKind.ORIGINATION,OpKind.TRANSACTION,OpKind.DELEGATION];class OperationBatch extends Provider{constructor(a,$){super(a),this.estimator=$,this.operations=[],this.prepare=new PrepareProvider(this.context)}withTransfer(a){const $=validateAddress(a.to);if(a.amount<0)throw new InvalidAmountError(a.amount.toString());if($!==ValidationResult.VALID)throw new InvalidAddressError(a.to,invalidDetail($));return this.operations.push(Object.assign({kind:OpKind.TRANSACTION},a)),this}withTransferTicket(a){const $=validateAddress(a.destination);if($!==ValidationResult.VALID)throw new InvalidAddressError(a.destination,invalidDetail($));return this.operations.push(Object.assign({kind:OpKind.TRANSFER_TICKET},a)),this}withContractCall(a,$={}){return this.withTransfer(a.toTransferParams($))}withDelegation(a){var $;const j=validateAddress(a.source);if(a.source&&j!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(j));const et=validateAddress(($=a.delegate)!==null&&$!==void 0?$:"");if(a.delegate&&et!==ValidationResult.VALID)throw new InvalidAddressError(a.delegate,invalidDetail(et));return this.operations.push(Object.assign({kind:OpKind.DELEGATION},a)),this}withActivation({pkh:a,secret:$}){const j=validateKeyHash(a);if(j!==ValidationResult.VALID)throw new InvalidKeyHashError(a,invalidDetail(j));return this.operations.push({kind:OpKind.ACTIVATION,pkh:a,secret:$}),this}withOrigination(a){return this.operations.push(Object.assign({kind:OpKind.ORIGINATION},a)),this}withRegisterGlobalConstant(a){return this.operations.push(Object.assign({kind:OpKind.REGISTER_GLOBAL_CONSTANT},a)),this}withIncreasePaidStorage(a){return this.operations.push(Object.assign({kind:OpKind.INCREASE_PAID_STORAGE},a)),this}withSmartRollupAddMessages(a){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_ADD_MESSAGES},a)),this}withSmartRollupOriginate(a){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_ORIGINATE},a)),this}withSmartRollupExecuteOutboxMessage(a){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE},a)),this}getRPCOp(a){return __awaiter(this,void 0,void 0,function*(){switch(a.kind){case OpKind.TRANSACTION:return createTransferOperation(Object.assign({},a));case OpKind.ORIGINATION:return createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},a)));case OpKind.DELEGATION:return createSetDelegateOperation(Object.assign({},a));case OpKind.REGISTER_GLOBAL_CONSTANT:return createRegisterGlobalConstantOperation(Object.assign({},a));case OpKind.INCREASE_PAID_STORAGE:return createIncreasePaidStorageOperation(Object.assign({},a));case OpKind.TRANSFER_TICKET:return createTransferTicketOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ADD_MESSAGES:return createSmartRollupAddMessagesOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ORIGINATE:return createSmartRollupOriginateOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return createSmartRollupExecuteOutboxMessageOperation(Object.assign({},a));default:throw new InvalidOperationKindError(JSON.stringify(a.kind))}})}with(a){for(const $ of a)switch($.kind){case OpKind.TRANSACTION:this.withTransfer($);break;case OpKind.ORIGINATION:this.withOrigination($);break;case OpKind.DELEGATION:this.withDelegation($);break;case OpKind.ACTIVATION:this.withActivation($);break;case OpKind.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant($);break;case OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage($);break;case OpKind.TRANSFER_TICKET:this.withTransferTicket($);break;case OpKind.SMART_ROLLUP_ADD_MESSAGES:this.withSmartRollupAddMessages($);break;case OpKind.SMART_ROLLUP_ORIGINATE:this.withSmartRollupOriginate($);break;case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:this.withSmartRollupExecuteOutboxMessage($);break;default:throw new InvalidOperationKindError(JSON.stringify($.kind))}return this}send(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=a&&a.source||$,et=yield this.estimator.batch(this.operations);et.length!==this.operations.length&&et.shift();const tt=yield this.prepare.batch(this.operations,et),rt=yield this.forge(tt),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new BatchOperation(nt,tt.opOb.contents,j,ot,st,it)})}}class RPCBatchProvider{constructor(a,$){this.context=a,this.estimator=$}batch(a){const $=new OperationBatch(this.context,this.estimator);return Array.isArray(a)&&$.with(a),$}}class BatchWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$,this.getOriginatedContractAddresses=()=>__awaiter(this,void 0,void 0,function*(){const et=yield this.operationResults();if(et){const tt=et.filter(nt=>nt.kind==="origination");let rt=[];for(const nt of tt)nt.metadata.operation_result.originated_contracts&&(rt=[...rt,...nt.metadata.operation_result.originated_contracts]);return rt}else throw new ObservableError("Unable to fetch operation results")})}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation results")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.operationResults();if(a)return a.filter($=>BATCH_KINDS.indexOf($.kind)!==-1).map($=>hasMetadataWithResult($)?$.metadata.operation_result.status:"unknown")[0]||"unknown";throw new ObservableError("Unable to fetch operation results")})}}class IncreasePaidStorageWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}increasePaidStorageOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.INCREASE_PAID_STORAGE);throw new ObservableError("Unable to fetch operation result")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.increasePaidStorageOperation();return a?a.metadata.operation_result.status:"unknown"})}}function timeoutAfter(_){return function($){return new BehaviorSubject(null).pipe(timeout({each:_,with:()=>throwError(()=>new ConfirmationTimeoutError("Confirmation polling timed out"))}),mergeMap(()=>$))}}const createNewPollingBasedHeadObservable=(_,a,$)=>_.pipe(timeoutAfter(a.config.confirmationPollingTimeoutSecond*1e3),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1}));class OperationFactory{constructor(a){this.context=a,this.sharedHeadObs=defer(()=>createObservableFromSubscription(this.context.stream.subscribeBlock("head")))}createNewHeadObservable(){return __awaiter(this,void 0,void 0,function*(){return createNewPollingBasedHeadObservable(this.sharedHeadObs,this.context)})}createPastBlockWalker(a,$=1){return from(this.context.readProvider.getBlock(a)).pipe(switchMap(j=>$===1?of(j):range(j.header.level,$-1).pipe(startWith(j),concatMap(et=>__awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getBlock(typeof et=="number"?et:et.header.level)})))))}createHeadObservableFromConfig({blockIdentifier:a}){return __awaiter(this,void 0,void 0,function*(){const $=[];return a&&$.push(this.createPastBlockWalker(a)),$.push(yield this.createNewHeadObservable()),concat(...$)})}createOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new WalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createBatchOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new BatchWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createTransactionOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new TransactionWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createDelegationOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new DelegationWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createOriginationOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new OriginationWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createIncreasePaidStorageOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new IncreasePaidStorageWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}}class RpcTzProvider extends Provider{constructor(a){super(a),this.prepare=new PrepareProvider(this.context)}getBalance(a){return __awaiter(this,void 0,void 0,function*(){const $=validateAddress(a);if($!==ValidationResult.VALID)throw new InvalidAddressError(a,invalidDetail($));return this.context.readProvider.getBalance(a,"head")})}getDelegate(a){return __awaiter(this,void 0,void 0,function*(){const $=validateAddress(a);if($!==ValidationResult.VALID)throw new InvalidAddressError(a,invalidDetail($));return this.context.readProvider.getDelegate(a,"head")})}activate(a,$){return __awaiter(this,void 0,void 0,function*(){const j=validateKeyHash(a);if(j!==ValidationResult.VALID)throw new InvalidKeyHashError(a,invalidDetail(j));const et=yield this.prepare.activate({pkh:a,secret:$}),tt=yield this.forge(et),rt=`${tt.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new Operation(yield this.rpc.injectOperation(rt),Object.assign(Object.assign({},tt),{opbytes:rt}),[],this.context.clone())})}}const MINIMAL_FEE_MUTEZ=100,MINIMAL_FEE_PER_BYTE_MUTEZ=1,MINIMAL_FEE_PER_GAS_MUTEZ=.1;class Estimate{constructor(a,$,j,et,tt=MINIMAL_FEE_MUTEZ){this._milligasLimit=a,this._storageLimit=$,this.opSize=j,this.minimalFeePerStorageByteMutez=et,this.baseFeeMutez=tt}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){return Math.max(Number(this._storageLimit),0)}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3)}get operationFeeMutez(){return this.gasLimit*MINIMAL_FEE_PER_GAS_MUTEZ+Number(this.opSize)*MINIMAL_FEE_PER_BYTE_MUTEZ}roundUp(a){return Math.ceil(Number(a))}get minimalFeeMutez(){return this.roundUp(this.operationFeeMutez+MINIMAL_FEE_MUTEZ)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+MINIMAL_FEE_MUTEZ*1.2)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),MINIMAL_FEE_MUTEZ)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(a){let $=0,j=0,et=0,tt=0,rt;return a.forEach(nt=>{$+=nt.milligasLimit,j+=nt.storageLimit,et+=nt.opSize,tt=Math.max(nt.minimalFeePerStorageByteMutez,tt),nt.baseFeeMutez&&(rt=rt?rt+nt.baseFeeMutez:nt.baseFeeMutez)}),new Estimate($,j,et,tt,rt)}static createArrayEstimateInstancesFromProperties(a){return a.map($=>new Estimate($.milligasLimit,$.storageLimit,$.opSize,$.minimalFeePerStorageByteMutez,$.baseFeeMutez))}}class RevealEstimateError extends TaquitoError{constructor(){super(),this.name="RevealEstimateError",this.message="Public key is unknown, unable to estimate the reveal operation in Wallet API."}}const STUB_SIGNATURE="edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg";class RPCEstimateProvider extends Provider{constructor(){super(...arguments),this.OP_SIZE_REVEAL=324,this.MILLIGAS_BUFFER=100*1e3,this.STORAGE_BUFFER=20,this.prepare=new PrepareProvider(this.context)}getKeys(){return __awaiter(this,void 0,void 0,function*(){const a=this.context.isAnySignerConfigured();return{publicKeyHash:a?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:a?yield this.signer.publicKey():void 0}})}getEstimationPropertiesFromOperationContent(a,$,j,et){const tt=flattenOperationResult({contents:[a]});let rt=0,nt=0;return tt.forEach(it=>{rt+=Number(it.consumed_milligas)||0,nt+="allocated_destination_contract"in it?et:0,nt+="originated_contracts"in it&&Array.isArray(it.originated_contracts)?it.originated_contracts.length*et:0,nt+="storage_size"in it&&"global_address"in it&&Number(it.storage_size)||0,nt+="paid_storage_size_diff"in it&&Number(it.paid_storage_size_diff)||0,nt+="genesis_commitment_hash"in it&&Number(it.size)||0}),isOpWithFee(a)?{milligasLimit:isOpWithGasBuffer(a)?rt+Number(this.MILLIGAS_BUFFER):rt,storageLimit:nt>0?nt+this.STORAGE_BUFFER:0,opSize:$,minimalFeePerStorageByteMutez:j.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:$,minimalFeePerStorageByteMutez:j.toNumber(),baseFeeMutez:0}}calculateEstimates(a,$){return __awaiter(this,void 0,void 0,function*(){const{opbytes:j,opOb:{branch:et,contents:tt}}=yield this.forge(a),rt={operation:{branch:et,contents:tt,signature:STUB_SIGNATURE},chain_id:yield this.context.readProvider.getChainId()},{opResponse:nt}=yield this.simulate(rt),{cost_per_byte:it,origination_size:ot}=$,st=[...flattenErrors(nt,"backtracked"),...flattenErrors(nt)];if(st.length)throw new TezosOperationError(st,"Error occurred during estimation",nt.contents);let at=1;return Array.isArray(a.opOb.contents)&&a.opOb.contents.length>1&&(at=nt.contents[0].kind==="reveal"?a.opOb.contents.length-1:a.opOb.contents.length),nt.contents.map(ut=>this.getEstimationPropertiesFromOperationContent(ut,ut.kind==="reveal"?this.OP_SIZE_REVEAL/2:(j.length+130)/2/at,it,ot??257))})}originate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.prepare.originate(a),j=yield this.context.readProvider.getProtocolConstants("head"),et=yield this.calculateEstimates($,j);return $.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}transfer(a){var $,{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=validateAddress(rt.to);if(nt!==ValidationResult.VALID)throw new InvalidAddressError(rt.to,invalidDetail(nt));const it=validateAddress(($=rt.source)!==null&&$!==void 0?$:"");if(rt.source&&it!==ValidationResult.VALID)throw new InvalidAddressError(rt.source,invalidDetail(it));if(rt.amount<0)throw new InvalidAmountError(rt.amount.toString());const ot=yield this.prepare.transaction(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt)),st=yield this.context.readProvider.getProtocolConstants("head"),at=yield this.calculateEstimates(ot,st);return ot.opOb.contents[0].kind==="reveal"&&(at.shift(),at[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(at)})}transferTicket(a){var $,{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=validateAddress(rt.destination);if(nt!==ValidationResult.VALID)throw new InvalidAddressError(rt.destination,invalidDetail(nt));const it=validateAddress(($=rt.source)!==null&&$!==void 0?$:"");if(rt.source&&it!==ValidationResult.VALID)throw new InvalidAddressError(rt.source,invalidDetail(it));const ot=yield this.context.readProvider.getProtocolConstants("head"),st=yield this.prepare.transferTicket(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt)),at=yield this.calculateEstimates(st,ot);return st.opOb.contents[0].kind==="reveal"&&(at.shift(),at[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(at)})}setDelegate(a){var $,{fee:j,gasLimit:et,storageLimit:tt}=a,rt=__rest(a,["fee","gasLimit","storageLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=validateAddress(rt.source);if(rt.source&&nt!==ValidationResult.VALID)throw new InvalidAddressError(rt.source,invalidDetail(nt));const it=validateAddress(($=rt.delegate)!==null&&$!==void 0?$:"");if(rt.delegate&&it!==ValidationResult.VALID)throw new InvalidAddressError(rt.delegate,invalidDetail(it));const ot=yield this.prepare.delegation(Object.assign({fee:j,storageLimit:tt,gasLimit:et},rt)),st=yield this.context.readProvider.getProtocolConstants("head"),at=yield this.calculateEstimates(ot,st);return ot.opOb.contents[0].kind==="reveal"&&(at.shift(),at[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(at)})}batch(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.batch(a),et=yield this.calculateEstimates(j,$);return Estimate.createArrayEstimateInstancesFromProperties(et)})}registerDelegate(a,$){var{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=(yield this.getKeys()).publicKeyHash,it=yield this.context.readProvider.getProtocolConstants("head"),ot=$||nt,st=yield this.prepare.registerDelegate(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt),ot),at=yield this.calculateEstimates(st,it);return st.opOb.contents[0].kind==="reveal"&&(at.shift(),at[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(at)})}reveal(a){return __awaiter(this,void 0,void 0,function*(){const{publicKeyHash:$,publicKey:j}=yield this.getKeys();if(!j)throw new RevealEstimateError;if(yield this.isAccountRevealRequired($)){const et=yield this.context.readProvider.getProtocolConstants("head"),tt=a?yield this.prepare.reveal(a):yield this.prepare.reveal({}),rt=yield this.calculateEstimates(tt,et);return Estimate.createEstimateInstanceFromProperties(rt)}})}registerGlobalConstant(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const rt=yield this.prepare.registerGlobalConstant(Object.assign({fee:$,storageLimit:j,gasLimit:et},tt)),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.calculateEstimates(rt,nt);return rt.opOb.contents[0].kind==="reveal"&&(it.shift(),it[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(it)})}increasePaidStorage(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){if(tt.amount<0)throw new InvalidAmountError(tt.amount.toString());const rt=yield this.context.readProvider.getProtocolConstants("head"),nt=yield this.prepare.increasePaidStorage(Object.assign({fee:$,storageLimit:j,gasLimit:et},tt)),it=yield this.calculateEstimates(nt,rt);return nt.opOb.contents[0].kind==="reveal"&&(it.shift(),it[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(it)})}updateConsensusKey(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.updateConsensusKey(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}smartRollupAddMessages(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupAddMessages(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}smartRollupOriginate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupOriginate(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}smartRollupExecuteOutboxMessage(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupExecuteOutboxMessage(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&et.shift(),Estimate.createEstimateInstanceFromProperties(et)})}contractCall(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.contractCall(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}}class DelegateOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="delegation"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get delegate(){return this.params.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class OriginationOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,j,et,tt),this.params=$,this.contractProvider=rt;const nt=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(nt)&&(this.contractAddress=nt[0])}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="origination"),$=a&&hasMetadataWithResult(a)&&a.metadata.operation_result;return $||void 0}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get storageDiff(){const a=this.operationResults&&this.operationResults.paid_storage_size_diff;return a||void 0}get storageSize(){const a=this.operationResults&&this.operationResults.storage_size;return a||void 0}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}contract(a,$){return __awaiter(this,void 0,void 0,function*(){if(!this.contractAddress)throw new OriginationOperationError("No contract was originated in this operation");return yield this.confirmation(a,$),this.contractProvider.at(this.contractAddress)})}}class RegisterGlobalConstantOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="register_global_constant"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get registeredExpression(){return this.params.value}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}}class RevealOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find($=>$.kind==="reveal");return a?[a]:[]}get status(){const $=this.operationResults[0];return $?$.metadata.operation_result.status:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get publicKey(){return this.params.public_key}sumProp(a,$){return a.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"storage_size"))}get errors(){return flattenErrors({contents:this.operationResults})}}class TransactionOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find($=>$.kind==="transaction");return a?[a]:[]}get status(){const $=this.operationResults[0];return $?$.metadata.operation_result.status:"unknown"}get amount(){return new BigNumber(this.params.amount)}get destination(){return this.params.destination}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}sumProp(a,$){return a.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"storage_size"))}get errors(){return flattenErrors({contents:this.operationResults})}}class IncreasePaidStorageOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="increase_paid_storage"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}class UpdateConsensusKeyOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="update_consensus_key"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class SmartRollupAddMessagesOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="smart_rollup_add_messages"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get message(){return this.params.message}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class SmartRollupOriginateOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.SMART_ROLLUP_ORIGINATE),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class BallotOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const $=Array.isArray(this.results)&&this.results.find(j=>j.kind==="ballot");return $||void 0}get period(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}class DrainDelegateOperation extends Operation{constructor(a,$,j,et,tt){super(a,j,et,tt),this.params=$}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="drain_delegate"),$=a&&a.metadata&&a.metadata.balance_updates;return $||void 0}get consensusKey(){return this.params.consensus_key}get delegate(){return this.params.delegate}get destination(){return this.params.destination}}class ProposalsOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const $=Array.isArray(this.results)&&this.results.find(j=>j.kind==="proposals");return $||void 0}get proposals(){return this.params.proposals}get period(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.period}}class TransferTicketOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.TRANSFER_TICKET),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}}class SmartRollupExecuteOutboxMessageOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get rollup(){return this.params.rollup}get cementedCommitment(){return this.params.cemented_commitment}get outputProof(){return this.params.output_proof}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class RpcContractProvider extends Provider{constructor(a,$){super(a),this.estimator=$,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new PrepareProvider(this.context)}getStorage(a,$){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(a);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(j));const et=yield this.context.readProvider.getScript(a,"head");$||($=et);let tt;return Schema.isSchema($)?tt=$:tt=Schema.fromRPCResponse({script:$}),tt.Execute(et.storage,smartContractAbstractionSemantic(this))})}getBigMapKey(a,$,j){return __awaiter(this,void 0,void 0,function*(){const et=validateContractAddress(a);if(et!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(et));j||(j=(yield this.rpc.getContract(a)).script);let tt;Schema.isSchema(j)?tt=j:tt=Schema.fromRPCResponse({script:j});const rt=tt.EncodeBigMapKey($),nt=yield this.rpc.getBigMapKey(a,rt);return tt.ExecuteOnBigMapValue(nt)})}getBigMapKeyByID(a,$,j,et){return __awaiter(this,void 0,void 0,function*(){const{key:tt,type:rt}=j.EncodeBigMapKey($),{packed:nt}=yield this.context.packer.packData({data:tt,type:rt}),it=encodeExpr(nt),ot=et?yield this.context.readProvider.getBigMapValue({id:a.toString(),expr:it},et):yield this.context.readProvider.getBigMapValue({id:a.toString(),expr:it},"head");return j.ExecuteOnBigMapValue(ot,smartContractAbstractionSemantic(this))})}getBigMapKeysByID(a,$,j,et,tt=5){return __awaiter(this,void 0,void 0,function*(){const rt=yield this.getBlockForRequest($,et),nt=new MichelsonMap;let it=0,ot=[];for(;it<$.length;){const at=$.slice(it,it+tt).map(ut=>this.getBigMapValueOrUndefined(ut,a,j,rt));ot=[...ot,...yield Promise.all(at)],it+=tt}for(let st=0;stst.kind===OpKind.ORIGINATION),tt=yield this.forge(j),{hash:rt,context:nt,forgedBytes:it,opResponse:ot}=yield this.signAndInject(tt);return new OriginationOperation(rt,et,it,ot,nt,this)})}setDelegate(a){var $;return __awaiter(this,void 0,void 0,function*(){const j=validateAddress(a.source);if(a.source&&j!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(j));const et=validateAddress(($=a.delegate)!==null&&$!==void 0?$:"");if(a.delegate&&et!==ValidationResult.VALID)throw new InvalidAddressError(a.delegate,invalidDetail(et));if(/kt1/i.test(a.source))throw new InvalidDelegationSource(a.source);const tt=yield this.signer.publicKeyHash(),rt=a.source||tt,nt=yield this.estimate(a,this.estimator.setDelegate.bind(this.estimator)),it=yield this.prepare.delegation(Object.assign(Object.assign({},a),nt)),ot=it.opOb.contents.find(Et=>Et.kind===OpKind.DELEGATION),st=yield this.forge(it),{hash:at,context:ut,forgedBytes:ht,opResponse:bt}=yield this.signAndInject(st);return new DelegateOperation(at,ot,rt,ht,bt,ut)})}registerDelegate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.estimate(a,this.estimator.registerDelegate.bind(this.estimator)),j=yield this.signer.publicKeyHash(),et=yield this.prepare.registerDelegate(Object.assign(Object.assign({},a),$)),tt=et.opOb.contents.find(at=>at.kind===OpKind.DELEGATION),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new DelegateOperation(nt,tt,j,ot,st,it)})}transfer(a){var $;return __awaiter(this,void 0,void 0,function*(){const j=validateAddress(a.to);if(j!==ValidationResult.VALID)throw new InvalidAddressError(a.to,invalidDetail(j));const et=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&et!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(et));if(a.amount<0)throw new InvalidAmountError(a.amount.toString());const tt=yield this.signer.publicKeyHash(),rt=yield this.estimate(a,this.estimator.transfer.bind(this.estimator)),nt=a.source||tt,it=yield this.prepare.transaction(Object.assign(Object.assign({},a),rt)),ot=it.opOb.contents.find(Et=>Et.kind===OpKind.TRANSACTION),st=yield this.forge(it),{hash:at,context:ut,forgedBytes:ht,opResponse:bt}=yield this.signAndInject(st);return new TransactionOperation(at,ot,nt,ht,bt,ut)})}transferTicket(a){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=validateAddress(a.destination);if(et!==ValidationResult.VALID)throw new InvalidAddressError(a.destination,invalidDetail(et));const tt=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(tt));const rt=yield this.signer.publicKeyHash(),nt=(j=a.source)!==null&&j!==void 0?j:rt,it=yield this.estimate(a,this.estimator.transferTicket.bind(this.estimator)),ot=yield this.prepare.transferTicket(Object.assign(Object.assign({},a),it)),st=ot.opOb.contents.find(Ct=>Ct.kind===OpKind.TRANSFER_TICKET),at=yield this.forge(ot),{hash:ut,context:ht,forgedBytes:bt,opResponse:Et}=yield this.signAndInject(at);return new TransferTicketOperation(ut,st,nt,bt,Et,ht)})}reveal(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimator.reveal(a);if(j){const et=yield this.estimate(a,()=>__awaiter(this,void 0,void 0,function*(){return j})),tt=yield this.prepare.reveal(Object.assign(Object.assign({},a),et)),rt=tt.opOb.contents.find(ut=>ut.kind===OpKind.REVEAL),nt=yield this.forge(tt),{hash:it,context:ot,forgedBytes:st,opResponse:at}=yield this.signAndInject(nt);return new RevealOperation(it,rt,$,st,at,ot)}else throw new RevealOperationError(`The publicKeyHash '${$}' has already been revealed.`)})}registerGlobalConstant(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.registerGlobalConstant.bind(this.estimator)),et=yield this.prepare.registerGlobalConstant(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.REGISTER_GLOBAL_CONSTANT),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new RegisterGlobalConstantOperation(nt,tt,$,ot,st,it)})}increasePaidStorage(a){return __awaiter(this,void 0,void 0,function*(){if(a.amount<0)throw new InvalidAmountError(a.amount.toString());const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.increasePaidStorage.bind(this.estimator)),et=yield this.prepare.increasePaidStorage(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.INCREASE_PAID_STORAGE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new IncreasePaidStorageOperation(nt,tt,$,ot,st,it)})}drainDelegate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.prepare.drainDelegate(a),j=$.opOb.contents.find(ot=>ot.kind===OpKind.DRAIN_DELEGATE),et=yield this.forge($),{hash:tt,context:rt,forgedBytes:nt,opResponse:it}=yield this.signAndInject(et);return new DrainDelegateOperation(tt,j,nt,it,rt)})}ballot(a){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=yield this.signer.publicKeyHash(),tt=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(tt));const rt=(j=a.source)!==null&&j!==void 0?j:et,nt=yield this.prepare.ballot(Object.assign(Object.assign({},a),{source:rt})),it=nt.opOb.contents.find(bt=>bt.kind===OpKind.BALLOT),ot=yield this.forge(nt),{hash:st,context:at,forgedBytes:ut,opResponse:ht}=yield this.signAndInject(ot);return new BallotOperation(st,it,et,ut,ht,at)})}proposals(a){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=yield this.signer.publicKeyHash(),tt=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(tt));const rt=(j=a.source)!==null&&j!==void 0?j:et,nt=yield this.prepare.proposals(Object.assign(Object.assign({},a),{source:rt})),it=nt.opOb.contents.find(bt=>bt.kind===OpKind.PROPOSALS),ot=yield this.forge(nt),{hash:st,context:at,forgedBytes:ut,opResponse:ht}=yield this.signAndInject(ot);return new ProposalsOperation(st,it,et,ut,ht,at)})}updateConsensusKey(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.updateConsensusKey.bind(this.estimator)),et=yield this.prepare.updateConsensusKey(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.UPDATE_CONSENSUS_KEY),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new UpdateConsensusKeyOperation(nt,tt,$,ot,st,it)})}smartRollupAddMessages(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.smartRollupAddMessages.bind(this.estimator)),et=yield this.prepare.smartRollupAddMessages(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.SMART_ROLLUP_ADD_MESSAGES),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new SmartRollupAddMessagesOperation(nt,tt,$,ot,st,it)})}smartRollupOriginate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.smartRollupOriginate.bind(this.estimator)),et=yield this.prepare.smartRollupOriginate(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.SMART_ROLLUP_ORIGINATE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new SmartRollupOriginateOperation(nt,tt,$,ot,st,it)})}smartRollupExecuteOutboxMessage(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)),et=yield this.prepare.smartRollupExecuteOutboxMessage(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:ot,opResponse:st}=yield this.signAndInject(rt);return new SmartRollupExecuteOutboxMessageOperation(nt,tt,$,ot,st,it)})}failingNoop(a){return __awaiter(this,void 0,void 0,function*(){const $={kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary},j=yield this.context.readProvider.getBlockHash(a.basedOnBlock),et=yield this.context.forger.forge({branch:j,contents:[$]}),{prefixSig:tt}=yield this.signer.sign(et,new Uint8Array([3]));return{signature:tt,bytes:et,signedContent:{branch:j,contents:[{kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary}]}}})}at(a,$=j=>j){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(a);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(j));const et=this.context.withExtensions().rpc,tt=this.context.withExtensions().readProvider,rt=yield tt.getScript(a,"head"),nt=yield tt.getEntrypoints(a),it=new ContractAbstraction(a,rt,this,this,nt,et,tt);return $(it,this.context)})}batch(a){const $=new OperationBatch(this.context,this.estimator);return Array.isArray(a)&&$.with(a),$}}class MichelCodecParser{constructor(a){this.context=a}getNextProto(){return __awaiter(this,void 0,void 0,function*(){if(!this.context.proto){const a=yield this.context.readProvider.getNextProtocol("head");this.context.proto=a}return this.context.proto})}parseScript(a){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseScript(a)})}parseMichelineExpression(a){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseMichelineExpression(a)})}parseJSON(a){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseJSON(a)})}prepareCodeOrigination(a){return __awaiter(this,void 0,void 0,function*(){const $=a;if($.code=yield this.formatCodeParam(a.code),a.init)$.init=yield this.formatInitParam(a.init);else if(a.storage){const j=$.code.find(rt=>"prim"in rt&&rt.prim==="storage");if(!(j!=null&&j.args))throw new InvalidCodeParameter("The storage section is missing from the script",a.code);const et=new Schema(j.args[0]),tt=yield this.findGlobalConstantsHashAndValue(et);if(Object.keys(tt).length!==0){const nt=new Parser$1({expandGlobalConstant:tt}).parseJSON(j.args[0]),it=new Schema(nt);$.init=it.Encode(a.storage)}else $.init=et.Encode(a.storage);delete $.storage}return $})}formatCodeParam(a){return __awaiter(this,void 0,void 0,function*(){let $;if(typeof a=="string"){const j=yield this.parseScript(a);if(j===null)throw new InvalidCodeParameter("Unable to parse",a);$=j}else{const j=yield this.parseJSON(a),et=["parameter","storage","code"];$=j.sort((tt,rt)=>et.indexOf(tt.prim)-et.indexOf(rt.prim))}return $})}formatInitParam(a){return __awaiter(this,void 0,void 0,function*(){let $;if(typeof a=="string"){const j=yield this.parseMichelineExpression(a);if(j===null)throw new InvalidInitParameter("Invalid init parameter",a);$=j}else $=yield this.parseJSON(a);return $})}findGlobalConstantsHashAndValue(a){return __awaiter(this,void 0,void 0,function*(){const $=a.findToken("constant"),j={};if($.length!==0)for(const et of $){const tt=et.tokenVal.args;if(tt){const rt=tt[0];if(rt.string){const nt=rt.string,it=yield this.context.globalConstantsProvider.getGlobalConstantByHash(nt);Object.assign(j,{[nt]:it})}}}return j})}}class RpcPacker{constructor(a){this.context=a}packData(a){return __awaiter(this,void 0,void 0,function*(){return this.context.rpc.packData(a)})}}class UnconfiguredGlobalConstantsProviderError extends TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredGlobalConstantsProviderError",this.message="No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."}}class NoopGlobalConstantsProvider{getGlobalConstantByHash(a){return __awaiter(this,void 0,void 0,function*(){throw new UnconfiguredGlobalConstantsProviderError})}}class RpcReadAdapter{constructor(a){this.rpc=a}getBalance(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBalance(a,{block:String($)})})}getDelegate(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getDelegate(a,{block:String($)})})}getNextProtocol(a){return __awaiter(this,void 0,void 0,function*(){return(yield this.rpc.getProtocols({block:String(a)})).next_protocol})}getProtocolConstants(a){return __awaiter(this,void 0,void 0,function*(){const{time_between_blocks:$,minimal_block_delay:j,hard_gas_limit_per_operation:et,hard_gas_limit_per_block:tt,hard_storage_limit_per_operation:rt,cost_per_byte:nt,smart_rollup_origination_size:it}=yield this.rpc.getConstants({block:String(a)});return{time_between_blocks:$,minimal_block_delay:j,hard_gas_limit_per_operation:et,hard_gas_limit_per_block:tt,hard_storage_limit_per_operation:rt,cost_per_byte:nt,smart_rollup_origination_size:it}})}getScript(a,$){return __awaiter(this,void 0,void 0,function*(){const{script:j}=yield this.rpc.getContract(a,{block:String($)});return j})}getStorage(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getStorage(a,{block:String($)})})}getBlockHash(a){return __awaiter(this,void 0,void 0,function*(){const{hash:$}=yield this.rpc.getBlockHeader({block:String(a)});return $})}getBlockLevel(a){return __awaiter(this,void 0,void 0,function*(){const{level:$}=yield this.rpc.getBlockHeader({block:String(a)});return $})}getCounter(a,$){return __awaiter(this,void 0,void 0,function*(){const{counter:j}=yield this.rpc.getContract(a,{block:String($)});return j||"0"})}getBlockTimestamp(a){return __awaiter(this,void 0,void 0,function*(){const{timestamp:$}=yield this.rpc.getBlockHeader({block:String(a)});return $})}getBigMapValue(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBigMapExpr(a.id,a.expr,{block:String($)})})}getSaplingDiffById(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getSaplingDiffById(a.id,{block:String($)})})}getSaplingDiffByContract(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getSaplingDiffByContract(a,{block:String($)})})}getEntrypoints(a){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getEntrypoints(a)})}getChainId(){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getChainId()})}isAccountRevealed(a,$){return __awaiter(this,void 0,void 0,function*(){const j=yield this.rpc.getManagerKey(a,{block:String($)});return j&&typeof j=="object"?!!j.key:!!j})}getBlock(a){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBlock({block:String(a)})})}getLiveBlocks(a){return this.rpc.getLiveBlocks({block:String(a)})}}class UnsupportedEventError extends ParameterValidationError{constructor(a){super(),this.type=a,this.name="UnsupportedEventError",this.message=`Unsupported event type "${a}" expecting one of the "data", "error", or "close".`}}class InvalidFilterExpressionError extends ParameterValidationError{constructor(a){super(),this.invalidExpression=a,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}const opHashFilter=(_,a)=>_.hash===a.opHash,sourceFilter=(_,a)=>{switch(_.kind){case"attestation":return"metadata"in _&&_.metadata.delegate===a.source;case"endorsement":return"metadata"in _&&_.metadata.delegate===a.source;case"activate_account":return"metadata"in _&&_.pkh===a.source;default:return"source"in _&&_.source===a.source}},kindFilter=(_,a)=>"kind"in _&&_.kind===a.kind,destinationFilter=(_,a)=>{switch(_.kind){case"delegation":return _.delegate===a.destination;case"origination":if("metadata"in _&&"operation_result"in _.metadata&&"originated_contracts"in _.metadata.operation_result&&Array.isArray(_.metadata.operation_result.originated_contracts))return _.metadata.operation_result.originated_contracts.some($=>$===a.destination);break;case"transaction":return _.destination===a.destination;default:return!1}},eventFilter=(_,a,$,j)=>!(_.kind!=="event"||$&&_.tag!==$||a&&_.source!==a||j&&_.result.status!=="applied"),evaluateOpFilter=(_,a)=>"opHash"in a?opHashFilter(_,a):"source"in a?sourceFilter(_,a):"kind"in a?kindFilter(_,a):"destination"in a?destinationFilter(_,a):!1,evaluateExpression=(_,a)=>{if(Array.isArray(a.and))return a.and.every($=>evaluateFilter(_,$));if(Array.isArray(a.or))return a.or.some($=>evaluateFilter(_,$));throw new InvalidFilterExpressionError(a)},evaluateFilter=(_,a)=>{const $=[];return Array.isArray(a)?$.push(...a):$.push(a),$.every(j=>"and"in j||"or"in j?evaluateExpression(_,j):evaluateOpFilter(_,j))};class ObservableSubscription{constructor(a,$=!1,j=retry()){this.shouldRetry=$,this.operatorFunction=j,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new Subject,a.pipe(takeUntil(this.completed$),tap(et=>{this.call(this.messageListeners,et)},et=>{this.call(this.errorListeners,et)},()=>{this.call(this.closeListeners)}),this.shouldRetry?j:tap(),catchError(()=>NEVER)).subscribe()}call(a,$){for(const j of a)try{j($)}catch(et){console.error(et)}}remove(a,$){const j=a.indexOf($);j!==-1&&a.splice(j,1)}on(a,$){switch(a){case"data":this.messageListeners.push($);break;case"error":this.errorListeners.push($);break;case"close":this.closeListeners.push($);break;default:throw new UnsupportedEventError(a)}}off(a,$){switch(a){case"data":this.remove(this.messageListeners,$);break;case"error":this.remove(this.errorListeners,$);break;case"close":this.remove(this.closeListeners,$);break;default:throw new UnsupportedEventError(a)}}close(){this.completed$.next()}}const defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:retry()},getLastBlock=_=>from(_.rpc.getBlock()).pipe(first()),applyFilter=_=>concatMap(a=>new Observable($=>{for(const j of a.operations)for(const et of j)for(const tt of et.contents)evaluateFilter(Object.assign({hash:et.hash},tt),_)&&$.next(Object.assign({hash:et.hash},tt));$.complete()})),applyEventFilter=_=>concatMap(a=>new Observable($=>{for(const j of a.operations)for(const et of j)for(const tt of et.contents){const nt=tt.metadata.internal_operation_results;if(nt)for(const it of nt)eventFilter(it,_==null?void 0:_.address,_==null?void 0:_.tag,_==null?void 0:_.excludeFailedOperations)&&$.next(Object.assign({opHash:et.hash,blockHash:a.hash,level:a.header.level},it))}$.complete()}));class PollingSubscribeProvider{constructor(a,$={}){this.context=a,this._config$=new BehaviorSubject(Object.assign(Object.assign({},defaultConfigStreamer),$)),this.timer$=this._config$.pipe(pluck("pollingIntervalMilliseconds"),switchMap(j=>j?timer(0,j):from(this.getConfirmationPollingInterval()).pipe(switchMap(et=>timer(0,et))))),this.newBlock$=this.timer$.pipe(switchMap(()=>getLastBlock(this.context)),distinctUntilKeyChanged("hash"),publish(),refCount())}get config(){return this._config$.getValue()}getConfirmationPollingInterval(){return __awaiter(this,void 0,void 0,function*(){if(!this.config.pollingIntervalMilliseconds)try{const j=yield this.context.readProvider.getProtocolConstants("head"),tt=(j.minimal_block_delay?j.minimal_block_delay.multipliedBy(1e3):j.time_between_blocks?j.time_between_blocks[0].multipliedBy(1e3):new BigNumber(5e3)).dividedBy(3);this.config.pollingIntervalMilliseconds=tt.toNumber()===0?1e3:tt.toNumber()}catch{return 5e3}return this.config.pollingIntervalMilliseconds})}subscribeBlock(a){return new ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(a){return new ObservableSubscription(this.newBlock$.pipe(pluck("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(a){return new ObservableSubscription(this.newBlock$.pipe(applyFilter(a)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(a){return new ObservableSubscription(this.newBlock$.pipe(applyEventFilter(a)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}}class TaquitoLocalForger{constructor(a){this.context=a}getNextProto(){return __awaiter(this,void 0,void 0,function*(){if(!this.context.proto){const a=yield this.context.readProvider.getNextProtocol("head");this.context.proto=a}return this.context.proto})}forge({branch:a,contents:$}){return __awaiter(this,void 0,void 0,function*(){return new LocalForger(yield this.getNextProto()).forge({branch:a,contents:$})})}}const defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class Context{constructor(a,$=new NoopSigner,j,et=new BehaviorSubject(Object.assign({},defaultConfigConfirmation)),tt,rt,nt,it,ot,st,at,ut){this._rpc=a,this._signer=$,this._proto=j,this._config=et,this.providerDecorator=[],this.tz=new RpcTzProvider(this),this.estimate=new RPCEstimateProvider(this),this.contract=new RpcContractProvider(this,this.estimate),this.prepare=new PrepareProvider(this),this.batch=new RPCBatchProvider(this,this.estimate),this.wallet=new Wallet(this),this.withExtensions=()=>{let ht=this.clone();return this.providerDecorator.forEach(bt=>{ht=bt(ht)}),ht},typeof this._rpc=="string"?this._rpcClient=new RpcClient(this._rpc):this._rpcClient=this._rpc,this._forger=tt||new TaquitoLocalForger(this),this._injector=rt||new RpcInjector(this),this.operationFactory=new OperationFactory(this),this._walletProvider=it||new LegacyWalletProvider(this),this._parser=ot||new MichelCodecParser(this),this._packer=nt||new RpcPacker(this),this._globalConstantsProvider=st||new NoopGlobalConstantsProvider,this._readProvider=at||new RpcReadAdapter(this._rpcClient),this._stream=ut||new PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(a){this._config.next(Object.assign({},a))}setPartialConfig(a){this._config.next(Object.assign(Object.assign({},this._config.getValue()),a))}get rpc(){return this._rpcClient}set rpc(a){this._rpcClient=a}get injector(){return this._injector}set injector(a){this._injector=a}get forger(){return this._forger}set forger(a){this._forger=a}get signer(){return this._signer}set signer(a){this._signer=a}get walletProvider(){return this._walletProvider}set walletProvider(a){this._walletProvider=a}set proto(a){this._proto=a}get proto(){return this._proto}get parser(){return this._parser}set parser(a){this._parser=a}get packer(){return this._packer}set packer(a){this._packer=a}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(a){this._globalConstantsProvider=a}get readProvider(){return this._readProvider}set readProvider(a){this._readProvider=a}get stream(){return this._stream}set stream(a){this._stream=a}isAnyProtocolActive(a=[]){return __awaiter(this,void 0,void 0,function*(){if(this._proto)return a.includes(this._proto);{const $=yield this.readProvider.getNextProtocol("head");return a.includes($)}})}isAnySignerConfigured(){return!(this.signer instanceof NoopSigner)}clone(){return new Context(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(a){this.providerDecorator.push(a)}}const VERSION={commitHash:"2e05f6f865be17a1b367b284542b24ffa9823271",version:"19.2.1"};class TezosToolkit{constructor(a){this._rpc=a,this._options={},this.format=format$1,typeof this._rpc=="string"?this._rpcClient=new RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new Context(a),this._wallet=new Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:a,stream:$,signer:j,protocol:et,config:tt,forger:rt,wallet:nt,packer:it,globalConstantsProvider:ot,readProvider:st,parserProvider:at,injectorProvider:ut}){this.setRpcProvider(a),this.setStreamProvider($),this.setSignerProvider(j),this.setForgerProvider(rt),this.setWalletProvider(nt),this.setPackerProvider(it),this.setGlobalConstantsProvider(ot),this.setReadProvider(st),this.setParserProvider(at),this.setInjectorProvider(ut),this._context.proto=et,tt&&this._context.setPartialConfig(tt)}setSignerProvider(a){!this._options.signer&&typeof a>"u"?(this._context.signer=new NoopSigner,this._options.signer=a):typeof a<"u"&&(this._context.signer=a,this._options.signer=a)}setRpcProvider(a){typeof a=="string"?this._rpcClient=new RpcClient(a):a===void 0||(this._rpcClient=a),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(a){if(typeof a<"u")this._options.forger=a,this._context.forger=a;else if(this._options.forger===void 0){const $=this.getFactory(TaquitoLocalForger)();this._options.forger=$,this._context.forger=$}}setStreamProvider(a){if(typeof a=="string"){const $=new PollingSubscribeProvider(new Context(new RpcClient(a)));this._options.stream=$,this._context.stream=$}else if(typeof a<"u")this._options.stream=a,this._context.stream=a;else if(this._options.stream===void 0){const $=this.getFactory(PollingSubscribeProvider)();this._options.stream=$,this._context.stream=$}}setWalletProvider(a){if(!this._options.wallet&&typeof a>"u"){const $=this.getFactory(LegacyWalletProvider)();this._options.wallet=$,this._context.walletProvider=$}else typeof a<"u"&&(this._options.wallet=a,this._context.walletProvider=a)}setPackerProvider(a){if(!this._options.packer&&typeof a>"u"){const $=this.getFactory(RpcPacker)();this._context.packer=$,this._options.packer=$}else typeof a<"u"&&(this._context.packer=a,this._options.packer=a)}setGlobalConstantsProvider(a){if(!this._options.globalConstantsProvider&&typeof a>"u"){const $=new NoopGlobalConstantsProvider;this._context.globalConstantsProvider=$,this._options.globalConstantsProvider=$}else typeof a<"u"&&(this._context.globalConstantsProvider=a,this._options.globalConstantsProvider=a)}setReadProvider(a){const $=a||new RpcReadAdapter(this._context.rpc);this._options.readProvider=$,this._context.readProvider=$}setParserProvider(a){if(!this._options.parserProvider&&typeof a>"u"){const $=new MichelCodecParser(this._context);this._context.parser=$,this._options.parserProvider=$}else typeof a<"u"&&(this._context.parser=a,this._options.parserProvider=a)}setInjectorProvider(a){if(!this._options.injectorProvider&&typeof a>"u"){const $=new RpcInjector(this._context);this._context.injector=$,this._options.injectorProvider=$}else typeof a<"u"&&(this._context.injector=a,this._options.injectorProvider=a)}get tz(){return this._context.tz}get contract(){return this._context.contract}get prepare(){return this._context.prepare}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}get globalConstants(){return this._context.globalConstantsProvider}addExtension(a){Array.isArray(a)?a.forEach($=>$.configureContext(this._context)):a.configureContext(this._context)}getFactory(a){return(...$)=>new a(this._context,...$)}getVersionInfo(){return VERSION}}class FakeSigner{constructor(a,$){this.pk=a,this.pkh=$}async publicKey(){return Promise.resolve(this.pk)}async publicKeyHash(){return Promise.resolve(this.pkh)}async sign(){return Promise.reject(new Error("`sign` method not available"))}async secretKey(){return Promise.reject(new Error("empty secret key"))}}const LAMBDA_HEADER=[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]}],makeMultisigApproveOrExecuteOperation=(_,a,$)=>makeContractCallOperation(_,a,{int:$}),makeMultisigProposeOperation=(_,a)=>{const $=toBatchLambda(a);return makeContractCallOperation(_,"propose",$)},makeContractCallOperation=(_,a,$,j="0")=>({type:"contract_call",contract:_,entrypoint:a,args:$,amount:j}),headlessLambda=_=>lodashExports.isEqual(_.slice(0,2),LAMBDA_HEADER)?_.slice(2):_,toLambda=_=>{switch(_.type){case"tez":switch(_.recipient.type){case"implicit":return MANAGER_LAMBDA.transferImplicit(_.recipient.pkh,Number(_.amount));case"contract":return MANAGER_LAMBDA.transferToContract(_.recipient.pkh,Number(_.amount))}case"fa1.2":return contractLambda(_,FA12_TRANSFER_ARG_TYPES,makeFA12TransactionParameter(_));case"fa2":return contractLambda(_,FA2_TRANSFER_ARG_TYPES,makeFA2TransactionParameter(_));case"delegation":return MANAGER_LAMBDA.setDelegate(_.recipient.pkh);case"undelegation":return MANAGER_LAMBDA.removeDelegate();case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},toBatchLambda=_=>{const a=_.map($=>toLambda($)).flatMap(headlessLambda);return[...LAMBDA_HEADER,...a]},FA2_TRANSFER_ARG_TYPES={args:[{args:[{annots:["%from_"],prim:"address"},{annots:["%txs"],args:[{args:[{annots:["%to_"],prim:"address"},{args:[{annots:["%token_id"],prim:"nat"},{annots:["%amount"],prim:"nat"}],prim:"pair"}],prim:"pair"}],prim:"list"}],prim:"pair"}],prim:"list"},FA12_TRANSFER_ARG_TYPES={args:[{annots:[":from"],prim:"address"},{args:[{annots:[":to"],prim:"address"},{annots:[":value"],prim:"nat"}],prim:"pair"}],prim:"pair"},contractLambda=(_,a,$)=>[...LAMBDA_HEADER,{prim:"PUSH",args:[{prim:"address"},{string:_.contract.pkh+"%"+$.entrypoint}]},{prim:"CONTRACT",args:[a]},[{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]}],{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"PUSH",args:[a,$.value]},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],makeFA12TransactionParameter=({sender:_,recipient:a,amount:$})=>({entrypoint:"transfer",value:{prim:"Pair",args:[{string:_.pkh},{prim:"Pair",args:[{string:a.pkh},{int:$}]}]}}),makeFA2TransactionParameter=({sender:_,recipient:a,tokenId:$,amount:j})=>({entrypoint:"transfer",value:[{prim:"Pair",args:[{string:_.pkh},[{prim:"Pair",args:[{string:a.pkh},{prim:"Pair",args:[{int:$},{int:j}]}]}]]}]}),addressExists=async(_,a)=>{try{const $=`${a.tzktApiUrl}/v1/accounts/${_}`,{data:{type:j}}=await axios.get($);return j!=="empty"}catch($){throw new Error(`Error fetching account from tzkt ${$.message}`)}},getFingerPrint=async _=>{const a=new TextEncoder().encode(_),$=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array($)).map(tt=>tt.toString(16).padStart(2,"0")).join("").slice(0,8)},curvesToDerivationPath=_=>{switch(_){case"ed25519":return DerivationType.ED25519;case"secp256k1":return DerivationType.SECP256K1;case"p256":return DerivationType.P256;case"bip25519":throw new Error("bip25519 is not supported in Tezos")}},makeSigner=async _=>{switch(_.type){case"social":case"mnemonic":case"secret_key":return new InMemorySigner(_.secretKey);case"ledger":{const a=await TransportWebUSB.list();for(let et=0;et{const a=new TezosToolkit(_.network.rpcUrl),$=await makeSigner(_);return a.setSignerProvider($),a},getPublicKeyPairFromSk=async _=>{const a=new InMemorySigner(_);return{pk:await a.publicKey(),pkh:await a.publicKeyHash()}},derivePublicKeyPair=async(_,a,$="ed25519")=>deriveSecretKey(_,a,$).then(getPublicKeyPairFromSk),deriveSecretKey=(_,a,$)=>InMemorySigner.fromMnemonic({mnemonic:_,derivationPath:a,curve:$}).secretKey(),selectRandomElements=(_,a)=>lodashExports.shuffle(_.map(($,j)=>({value:$,index:j}))).slice(0,a).sort(($,j)=>$.index-j.index),sumTez=_=>_.reduce((a,$)=>a.plus($),new BigNumber(0)),operationToTaquitoOperation=_=>{switch(_.type){case"tez":return{kind:OpKind.TRANSACTION,to:_.recipient.pkh,amount:parseInt(_.amount),mutez:!0};case"contract_call":return{kind:OpKind.TRANSACTION,to:_.contract.pkh,amount:parseInt(_.amount),mutez:!0,parameter:{entrypoint:_.entrypoint,value:_.args}};case"delegation":return{kind:OpKind.DELEGATION,source:_.sender.pkh,delegate:_.recipient.pkh};case"undelegation":return{kind:OpKind.DELEGATION,source:_.sender.pkh,delegate:void 0};case"fa1.2":return{kind:OpKind.TRANSACTION,amount:0,to:_.contract.pkh,parameter:makeFA12TransactionParameter(_)};case"fa2":return{kind:OpKind.TRANSACTION,amount:0,to:_.contract.pkh,parameter:makeFA2TransactionParameter(_)};case"contract_origination":return{kind:OpKind.ORIGINATION,..._}}},operationsToBatchParams=({type:_,operations:a,sender:$})=>(_==="implicit"?a:[makeMultisigProposeOperation($.address,a)]).map(operationToTaquitoOperation),operationsToWalletParams=operationsToBatchParams,estimate=async(_,a)=>{const $=await makeToolkit({type:"fake",signer:_.signer,network:a});try{const j=await $.estimate.batch(operationsToBatchParams(_));return sumTez(j.map(et=>Math.max(et.suggestedFeeMutez,et.totalCost).toString()))}catch(j){throw await addressExists(_.signer.address.pkh,a)?(j instanceof Error&&(j.message=handleTezError(j)),j):new Error(`Signer address is not revealed on the ${a.name}.`)}},handleTezError=_=>_.message.includes("subtraction_underflow")?"Insufficient balance, please make sure you have enough funds.":_.message.includes("contract.non_existing_contract")?"Contract does not exist, please check if the correct network is selected.":_.message,getAccounts=async(_,a)=>withRateLimit(()=>accountsGet({address:{in:[_.join(",")]},select:{fields:["address,balance,delegationLevel"]}},{baseUrl:a.tzktApiUrl})),getTokenBalances=async(_,a)=>withRateLimit(()=>tokensGetTokenBalances({account:{in:[_.join(",")]},balance:{gt:"0"},limit:1e4},{baseUrl:a.tzktApiUrl})),getDelegations=async(_,a,$)=>withRateLimit(()=>operationsGetDelegations({sender:{in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})),getTransactions=async(_,a,$)=>withRateLimit(()=>operationsGetTransactions({anyof:{fields:["sender","target","initiator"],in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})),getOriginations=async(_,a,$)=>withRateLimit(()=>operationsGetOriginations({sender:{in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})),getCombinedOperations=async(_,a,$)=>{const j=($==null?void 0:$.limit)||100,et=($==null?void 0:$.sort)??"desc",tt={limit:j,offset:$!=null&&$.lastId?{cr:$.lastId}:void 0,sort:{[et]:"id"}},rt=await Promise.all([getTransactions(_,a,tt),getDelegations(_,a,tt),getOriginations(_,a,tt),getTokenTransfers(_,a,tt)]);return lodashExports.sortBy(rt.flat(),nt=>et==="asc"?nt.id:-nt.id).slice(0,j)},getRelatedTokenTransfers=async(_,a)=>_.length===0?[]:withRateLimit(()=>tokensGetTokenTransfers({transactionId:{in:[_.join(",")]}},{baseUrl:a.tzktApiUrl})),getTokenTransfers=async(_,a,$)=>withRateLimit(async()=>(await tokensGetTokenTransfers({anyof:{fields:["from","to"],in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})).map(et=>({...et,type:"token_transfer"}))),getLastDelegation=(_,a)=>getDelegations([_],a,{limit:1,sort:{desc:"id"}}).then(lodashExports.first),getTezosPriceInUSD=()=>withRateLimit(()=>quotesGetLast().then(_=>_.usd)),getLatestBlockLevel=async _=>withRateLimit(async()=>await blocksGetCount({baseUrl:_.tzktApiUrl})),getBakers=async _=>withRateLimit(()=>delegatesGet({sort:{desc:"stakingBalance"},active:{eq:!0},limit:1e4,select:{fields:["address,alias,stakingBalance"]}},{baseUrl:_.tzktApiUrl}).then(a=>a.map($=>({name:$.alias||"Unknown baker",address:$.address,stakingBalance:$.stakingBalance})))),executeOperations=async(_,a)=>{const $=operationsToWalletParams(_);return a.wallet.batch($).send()},TEZ="ꜩ",TEZ_DECIMALS=6,truncate=(_,a)=>_.length>a?_.slice(0,a-3)+"...":_,tezToMutez=_=>format$1("tz","mutez",_),mutezToTez=_=>format$1("mutez","tz",_),prettyTezAmount=_=>{const a=BigNumber(mutezToTez(_)).toNumber();return`${new Intl.NumberFormat("en-US",{minimumFractionDigits:TEZ_DECIMALS,maximumFractionDigits:TEZ_DECIMALS}).format(a)} ${TEZ}`},formatPkh=_=>`${_.slice(0,5)}...${_.slice(-5)}`,useBlockLevel=()=>useAppSelector(_=>_.assets.blockLevel),useIsBlockFinalised=_=>{const a=useBlockLevel();return a!==null?a-_>=2:null},useAllNfts=()=>{const _=useGetAccountNFTs(),a=useAppSelector(j=>j.assets.balances.tokens),$=Object.keys(a);return lodashExports.fromPairs($.map(j=>[j,_(j)]))},useGetAccountAssets=()=>{const _=useGetToken(),a=useAppSelector($=>$.assets.balances.tokens);return $=>{const j=a[$]||[];return lodashExports.compact(j.map(({contract:et,tokenId:tt,...rt})=>{const nt=_(et,tt);return nt&&{...nt,...rt}}))}},useGetAccountFA2Tokens=()=>{const _=useGetAccountAssets();return a=>keepFA2s(_(a))},useGetAccountFA1Tokens=()=>{const _=useGetAccountAssets();return a=>keepFA1s(_(a))},useGetAccountAllTokens=()=>{const _=useGetAccountFA1Tokens(),a=useGetAccountFA2Tokens();return $=>[..._($),...a($)]},useGetAccountNFTs=()=>{const _=useGetAccountAssets();return a=>keepNFTs(_(a))},useGetTokenTransfer=()=>{const _=useAppSelector(a=>a.assets.transfers.tokens);return a=>{const $=_[a];return $&&{...$,type:"token_transfer"}}},useConversionRate=()=>useAppSelector(_=>_.assets.conversionRate),useTezToDollar=()=>{const _=useConversionRate();return _?a=>BigNumber(a).multipliedBy(_).decimalPlaces(2,BigNumber.ROUND_UP):()=>{}},useGetDollarBalance=()=>{const _=useTezToDollar(),a=useGetAccountBalance();return $=>{const j=a($);return j===void 0?void 0:_(mutezToTez(j))}},useTotalBalance=()=>{const _=useAppSelector(tt=>tt.assets.balances.mutez),a=useTezToDollar(),$=Object.values(_);if($.length===0)return null;const j=$.reduce((tt,rt)=>tt.plus(rt),BigNumber(0)),et=a(mutezToTez(j));return{mutez:j.toFixed(),usd:et}},useGetAccountBalance=()=>{const _=useAppSelector(a=>a.assets.balances.mutez);return a=>_[a]},useBakerList=()=>useAppSelector(_=>_.assets.bakers),useGetBaker=()=>{const _=useBakerList();return a=>_.find($=>$.address===a)},useRefetchTrigger=()=>useAppSelector(_=>_.assets.refetchTrigger),useIsLoading=()=>useAppSelector(_=>_.assets.isLoading),useLastTimeUpdated=()=>useAppSelector(_=>_.assets.lastTimeUpdated),useMultisigAccounts=()=>useAppSelector(_=>_.multisigs.items),useGetPendingMultisigOperations=()=>{const _=useAppSelector(a=>a.multisigs.pendingOperations);return a=>[..._[a.pendingOperationsBigmapId]??[]].sort((j,et)=>Number(et.id)-Number(j.id))},useSeedPhrases=()=>useAppSelector(_=>_.accounts.seedPhrases),useSecretKeys=()=>useAppSelector(_=>_.accounts.secretKeys),useImplicitAccounts=()=>useAppSelector(_=>_.accounts.items),useGetImplicitAccountSafe=()=>{const _=useImplicitAccounts();return a=>_.find($=>$.address.pkh===a)},useGetImplicitAccount=()=>{const _=useGetImplicitAccountSafe();return a=>{const $=_(a);if(!$)throw new Error(`Unknown account: ${a}`);return $}},useGetAccountsByType=()=>{const _=useImplicitAccounts();return a=>_.filter($=>$.type===a)},useGetAccountsByFingerPrint=()=>{const _=useGetAccountsByType();return a=>_("mnemonic").filter($=>$.seedFingerPrint===a)},useAllAccounts=()=>{const _=useImplicitAccounts(),a=useMultisigAccounts();return[..._,...a]},useGetOwnedAccountSafe=()=>{const _=useAllAccounts();return a=>_.find($=>$.address.pkh===a)},useGetOwnedAccount=()=>{const _=useGetOwnedAccountSafe();return a=>{const $=_(a);if(!$)throw new Error(`Unknown account: ${a}`);return $}},useValidateMasterPassword=()=>{const _=useSeedPhrases(),a=useSecretKeys(),$=Object.values({...a,..._})[0];return $?async j=>{await decrypt$1($,j)}:null},useIsOwnedAddress=()=>{const _=useAllAccounts(),a=new Set(_.map($=>$.address.pkh));return $=>!!$&&a.has($)},useGetMultisigSigners=()=>{const _=useImplicitAccounts();return a=>{const $=_.filter(j=>a.signers.some(et=>et.pkh===j.address.pkh));return $.length===0&&console.warn("Wallet doesn't own any signers for multisig contract "+a.address.pkh),$}},useGetOwnedSignersForAccount=()=>{const _=useGetMultisigSigners();return a=>{switch(a.type){case"ledger":case"mnemonic":case"social":case"secret_key":return[a];case"multisig":return _(a)}}},useGetBestSignerForAccount=()=>{const _=useGetOwnedSignersForAccount(),a=useGetMostFundedImplicitAccount();return $=>a(_($))},useGetMostFundedImplicitAccount=()=>{const _=useGetAccountBalance();return a=>lodashExports.maxBy(a,$=>Number(_($.address.pkh)||"0"))},useGetSecretKey=()=>{const _=useSeedPhrases(),a=useSecretKeys();return async($,j)=>{if($.type==="secret_key"){const et=a[$.address.pkh];if(!et)throw new Error(`Missing secret key for account ${$.address.pkh}`);return decrypt$1(et,j)}else{const et=_[$.seedFingerPrint];if(!et)throw new Error(`Missing seedphrase for account ${$.address.pkh}`);const tt=await decrypt$1(et,j);return deriveSecretKey(tt,$.derivationPath,$.curve)}}},useAllContacts=()=>useAppSelector(_=>_.contacts),useContactsForSelectedNetwork=()=>{const _=useSelectedNetwork(),a=useAllContacts();return Object.values(a).filter($=>isValidImplicitPkh($.pkh)||$.network===_.name).map($=>$)},useSortedContacts=()=>useContactsForSelectedNetwork().sort((a,$)=>a.name.localeCompare($.name)).map(a=>a),useAddressExistsInContacts=()=>{const _=useAllContacts();return a=>a in _},useGetContactName=()=>{const _=useAllContacts();return a=>a in _?_[a].name:void 0},useValidateNewContactPkh=()=>{const _=useAddressExistsInContacts(),a=useGetOwnedAccountSafe();return $=>isAddressValid($)?a($)?"Address is already used in accounts":!_($)||"Address is already registered":"Invalid address"},useValidateName=_=>{const a=useIsUniqueLabel();return $=>{const j=$.trim();return j.length===0?"Name should not be empty":_!==void 0&&j===_?"Name was not changed":a(j)?!0:"Name must be unique across all accounts and contacts"}},useGetNextAvailableAccountLabels=()=>{const _=useIsUniqueLabel();return(a,$=1)=>{const j=[];for(let et=1;j.length<$;et++){const tt=et===1?a:`${a} ${et}`;_(tt)&&j.push(tt)}return j}},useIsUniqueLabel=()=>{const _=useAllAccounts().map($=>$.label),a=Object.values(useAllContacts()).map($=>$.name);return $=>![..._,...a].includes($)};var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(_){return this.listeners.add(_),this.onSubscribe(),()=>{this.listeners.delete(_),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$2(){}function functionalUpdate(_,a){return typeof _=="function"?_(a):_}function isValidTimeout(_){return typeof _=="number"&&_>=0&&_!==1/0}function timeUntilStale(_,a){return Math.max(_+(a||0)-Date.now(),0)}function matchQuery(_,a){const{type:$="all",exact:j,fetchStatus:et,predicate:tt,queryKey:rt,stale:nt}=_;if(rt){if(j){if(a.queryHash!==hashQueryKeyByOptions(rt,a.options))return!1}else if(!partialMatchKey(a.queryKey,rt))return!1}if($!=="all"){const it=a.isActive();if($==="active"&&!it||$==="inactive"&&it)return!1}return!(typeof nt=="boolean"&&a.isStale()!==nt||et&&et!==a.state.fetchStatus||tt&&!tt(a))}function matchMutation(_,a){const{exact:$,status:j,predicate:et,mutationKey:tt}=_;if(tt){if(!a.options.mutationKey)return!1;if($){if(hashKey(a.options.mutationKey)!==hashKey(tt))return!1}else if(!partialMatchKey(a.options.mutationKey,tt))return!1}return!(j&&a.state.status!==j||et&&!et(a))}function hashQueryKeyByOptions(_,a){return((a==null?void 0:a.queryKeyHashFn)||hashKey)(_)}function hashKey(_){return JSON.stringify(_,(a,$)=>isPlainObject($)?Object.keys($).sort().reduce((j,et)=>(j[et]=$[et],j),{}):$)}function partialMatchKey(_,a){return _===a?!0:typeof _!=typeof a?!1:_&&a&&typeof _=="object"&&typeof a=="object"?!Object.keys(a).some($=>!partialMatchKey(_[$],a[$])):!1}function replaceEqualDeep(_,a){if(_===a)return _;const $=isPlainArray(_)&&isPlainArray(a);if($||isPlainObject(_)&&isPlainObject(a)){const j=$?_:Object.keys(_),et=j.length,tt=$?a:Object.keys(a),rt=tt.length,nt=$?[]:{};let it=0;for(let ot=0;ot{setTimeout(a,_)})}function replaceData(_,a,$){return typeof $.structuralSharing=="function"?$.structuralSharing(_,a):$.structuralSharing!==!1?replaceEqualDeep(_,a):a}function addToEnd(_,a,$=0){const j=[..._,a];return $&&j.length>$?j.slice(1):j}function addToStart(_,a,$=0){const j=[a,..._];return $&&j.length>$?j.slice(0,-1):j}var skipToken=Symbol(),au,Hl,Tu,vv,FocusManager=(vv=class extends Subscribable{constructor(){super();Mn(this,au,void 0);Mn(this,Hl,void 0);Mn(this,Tu,void 0);kn(this,Tu,a=>{if(!isServer&&window.addEventListener){const $=()=>a();return window.addEventListener("visibilitychange",$,!1),()=>{window.removeEventListener("visibilitychange",$)}}})}onSubscribe(){Nr(this,Hl)||this.setEventListener(Nr(this,Tu))}onUnsubscribe(){var a;this.hasListeners()||((a=Nr(this,Hl))==null||a.call(this),kn(this,Hl,void 0))}setEventListener(a){var $;kn(this,Tu,a),($=Nr(this,Hl))==null||$.call(this),kn(this,Hl,a(j=>{typeof j=="boolean"?this.setFocused(j):this.onFocus()}))}setFocused(a){Nr(this,au)!==a&&(kn(this,au,a),this.onFocus())}onFocus(){const a=this.isFocused();this.listeners.forEach($=>{$(a)})}isFocused(){var a;return typeof Nr(this,au)=="boolean"?Nr(this,au):((a=globalThis.document)==null?void 0:a.visibilityState)!=="hidden"}},au=new WeakMap,Hl=new WeakMap,Tu=new WeakMap,vv),focusManager=new FocusManager,Cu,Vl,ku,bv,OnlineManager=(bv=class extends Subscribable{constructor(){super();Mn(this,Cu,!0);Mn(this,Vl,void 0);Mn(this,ku,void 0);kn(this,ku,a=>{if(!isServer&&window.addEventListener){const $=()=>a(!0),j=()=>a(!1);return window.addEventListener("online",$,!1),window.addEventListener("offline",j,!1),()=>{window.removeEventListener("online",$),window.removeEventListener("offline",j)}}})}onSubscribe(){Nr(this,Vl)||this.setEventListener(Nr(this,ku))}onUnsubscribe(){var a;this.hasListeners()||((a=Nr(this,Vl))==null||a.call(this),kn(this,Vl,void 0))}setEventListener(a){var $;kn(this,ku,a),($=Nr(this,Vl))==null||$.call(this),kn(this,Vl,a(this.setOnline.bind(this)))}setOnline(a){Nr(this,Cu)!==a&&(kn(this,Cu,a),this.listeners.forEach(j=>{j(a)}))}isOnline(){return Nr(this,Cu)}},Cu=new WeakMap,Vl=new WeakMap,ku=new WeakMap,bv),onlineManager=new OnlineManager;function defaultRetryDelay(_){return Math.min(1e3*2**_,3e4)}function canFetch(_){return(_??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class{constructor(_){this.revert=_==null?void 0:_.revert,this.silent=_==null?void 0:_.silent}};function isCancelledError(_){return _ instanceof CancelledError}function createRetryer(_){let a=!1,$=0,j=!1,et,tt,rt;const nt=new Promise((Pt,Tt)=>{tt=Pt,rt=Tt}),it=Pt=>{var Tt;j||(bt(new CancelledError(Pt)),(Tt=_.abort)==null||Tt.call(_))},ot=()=>{a=!0},st=()=>{a=!1},at=()=>focusManager.isFocused()&&(_.networkMode==="always"||onlineManager.isOnline())&&_.canRun(),ut=()=>canFetch(_.networkMode)&&_.canRun(),ht=Pt=>{var Tt;j||(j=!0,(Tt=_.onSuccess)==null||Tt.call(_,Pt),et==null||et(),tt(Pt))},bt=Pt=>{var Tt;j||(j=!0,(Tt=_.onError)==null||Tt.call(_,Pt),et==null||et(),rt(Pt))},Et=()=>new Promise(Pt=>{var Tt;et=It=>{(j||at())&&Pt(It)},(Tt=_.onPause)==null||Tt.call(_)}).then(()=>{var Pt;et=void 0,j||(Pt=_.onContinue)==null||Pt.call(_)}),Ct=()=>{if(j)return;let Pt;try{Pt=_.fn()}catch(Tt){Pt=Promise.reject(Tt)}Promise.resolve(Pt).then(ht).catch(Tt=>{var jt;if(j)return;const It=_.retry??(isServer?0:3),Lt=_.retryDelay??defaultRetryDelay,Nt=typeof Lt=="function"?Lt($,Tt):Lt,Ut=It===!0||typeof It=="number"&&$at()?void 0:Et()).then(()=>{a?bt(Tt):Ct()})})};return{promise:nt,cancel:it,continue:()=>(et==null||et(),nt),cancelRetry:ot,continueRetry:st,canStart:ut,start:()=>(ut()?Ct():Et().then(Ct),nt)}}function createNotifyManager(){let _=[],a=0,$=ut=>{ut()},j=ut=>{ut()},et=ut=>setTimeout(ut,0);const tt=ut=>{et=ut},rt=ut=>{let ht;a++;try{ht=ut()}finally{a--,a||ot()}return ht},nt=ut=>{a?_.push(ut):et(()=>{$(ut)})},it=ut=>(...ht)=>{nt(()=>{ut(...ht)})},ot=()=>{const ut=_;_=[],ut.length&&et(()=>{j(()=>{ut.forEach(ht=>{$(ht)})})})};return{batch:rt,batchCalls:it,schedule:nt,setNotifyFunction:ut=>{$=ut},setBatchNotifyFunction:ut=>{j=ut},setScheduler:tt}}var notifyManager=createNotifyManager(),cu,yv,Removable=(yv=class{constructor(){Mn(this,cu,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&kn(this,cu,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(_){this.gcTime=Math.max(this.gcTime||0,_??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Nr(this,cu)&&(clearTimeout(Nr(this,cu)),kn(this,cu,void 0))}},cu=new WeakMap,yv),Iu,Mu,Eo,Ks,op,lu,Oo,$a,xv,Query=(xv=class extends Removable{constructor(a){super();Mn(this,Oo);Mn(this,Iu,void 0);Mn(this,Mu,void 0);Mn(this,Eo,void 0);Mn(this,Ks,void 0);Mn(this,op,void 0);Mn(this,lu,void 0);kn(this,lu,!1),kn(this,op,a.defaultOptions),this.setOptions(a.options),this.observers=[],kn(this,Eo,a.cache),this.queryKey=a.queryKey,this.queryHash=a.queryHash,kn(this,Iu,a.state||getDefaultState$1(this.options)),this.state=Nr(this,Iu),this.scheduleGc()}get meta(){return this.options.meta}setOptions(a){this.options={...Nr(this,op),...a},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Nr(this,Eo).remove(this)}setData(a,$){const j=replaceData(this.state.data,a,this.options);return Zn(this,Oo,$a).call(this,{data:j,type:"success",dataUpdatedAt:$==null?void 0:$.updatedAt,manual:$==null?void 0:$.manual}),j}setState(a,$){Zn(this,Oo,$a).call(this,{type:"setState",state:a,setStateOptions:$})}cancel(a){var j,et;const $=(j=Nr(this,Ks))==null?void 0:j.promise;return(et=Nr(this,Ks))==null||et.cancel(a),$?$.then(noop$2).catch(noop$2):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Nr(this,Iu))}isActive(){return this.observers.some(a=>a.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(a=>a.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(a=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,a)}onFocus(){var $;const a=this.observers.find(j=>j.shouldFetchOnWindowFocus());a==null||a.refetch({cancelRefetch:!1}),($=Nr(this,Ks))==null||$.continue()}onOnline(){var $;const a=this.observers.find(j=>j.shouldFetchOnReconnect());a==null||a.refetch({cancelRefetch:!1}),($=Nr(this,Ks))==null||$.continue()}addObserver(a){this.observers.includes(a)||(this.observers.push(a),this.clearGcTimeout(),Nr(this,Eo).notify({type:"observerAdded",query:this,observer:a}))}removeObserver(a){this.observers.includes(a)&&(this.observers=this.observers.filter($=>$!==a),this.observers.length||(Nr(this,Ks)&&(Nr(this,lu)?Nr(this,Ks).cancel({revert:!0}):Nr(this,Ks).cancelRetry()),this.scheduleGc()),Nr(this,Eo).notify({type:"observerRemoved",query:this,observer:a}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Zn(this,Oo,$a).call(this,{type:"invalidate"})}fetch(a,$){var ot,st,at;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&($!=null&&$.cancelRefetch))this.cancel({silent:!0});else if(Nr(this,Ks))return Nr(this,Ks).continueRetry(),Nr(this,Ks).promise}if(a&&this.setOptions(a),!this.options.queryFn){const ut=this.observers.find(ht=>ht.options.queryFn);ut&&this.setOptions(ut.options)}const j=new AbortController,et={queryKey:this.queryKey,meta:this.meta},tt=ut=>{Object.defineProperty(ut,"signal",{enumerable:!0,get:()=>(kn(this,lu,!0),j.signal)})};tt(et);const rt=()=>!this.options.queryFn||this.options.queryFn===skipToken?Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)):(kn(this,lu,!1),this.options.persister?this.options.persister(this.options.queryFn,et,this):this.options.queryFn(et)),nt={fetchOptions:$,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:rt};tt(nt),(ot=this.options.behavior)==null||ot.onFetch(nt,this),kn(this,Mu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((st=nt.fetchOptions)==null?void 0:st.meta))&&Zn(this,Oo,$a).call(this,{type:"fetch",meta:(at=nt.fetchOptions)==null?void 0:at.meta});const it=ut=>{var ht,bt,Et,Ct;isCancelledError(ut)&&ut.silent||Zn(this,Oo,$a).call(this,{type:"error",error:ut}),isCancelledError(ut)||((bt=(ht=Nr(this,Eo).config).onError)==null||bt.call(ht,ut,this),(Ct=(Et=Nr(this,Eo).config).onSettled)==null||Ct.call(Et,this.state.data,ut,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return kn(this,Ks,createRetryer({fn:nt.fetchFn,abort:j.abort.bind(j),onSuccess:ut=>{var ht,bt,Et,Ct;if(ut===void 0){it(new Error(`${this.queryHash} data is undefined`));return}this.setData(ut),(bt=(ht=Nr(this,Eo).config).onSuccess)==null||bt.call(ht,ut,this),(Ct=(Et=Nr(this,Eo).config).onSettled)==null||Ct.call(Et,ut,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:it,onFail:(ut,ht)=>{Zn(this,Oo,$a).call(this,{type:"failed",failureCount:ut,error:ht})},onPause:()=>{Zn(this,Oo,$a).call(this,{type:"pause"})},onContinue:()=>{Zn(this,Oo,$a).call(this,{type:"continue"})},retry:nt.options.retry,retryDelay:nt.options.retryDelay,networkMode:nt.options.networkMode,canRun:()=>!0})),Nr(this,Ks).start()}},Iu=new WeakMap,Mu=new WeakMap,Eo=new WeakMap,Ks=new WeakMap,op=new WeakMap,lu=new WeakMap,Oo=new WeakSet,$a=function(a){const $=j=>{switch(a.type){case"failed":return{...j,fetchFailureCount:a.failureCount,fetchFailureReason:a.error};case"pause":return{...j,fetchStatus:"paused"};case"continue":return{...j,fetchStatus:"fetching"};case"fetch":return{...j,...fetchState(j.data,this.options),fetchMeta:a.meta??null};case"success":return{...j,data:a.data,dataUpdateCount:j.dataUpdateCount+1,dataUpdatedAt:a.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!a.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const et=a.error;return isCancelledError(et)&&et.revert&&Nr(this,Mu)?{...Nr(this,Mu),fetchStatus:"idle"}:{...j,error:et,errorUpdateCount:j.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:j.fetchFailureCount+1,fetchFailureReason:et,fetchStatus:"idle",status:"error"};case"invalidate":return{...j,isInvalidated:!0};case"setState":return{...j,...a.state}}};this.state=$(this.state),notifyManager.batch(()=>{this.observers.forEach(j=>{j.onQueryUpdate()}),Nr(this,Eo).notify({query:this,type:"updated",action:a})})},xv);function fetchState(_,a){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(a.networkMode)?"fetching":"paused",..._===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(_){const a=typeof _.initialData=="function"?_.initialData():_.initialData,$=a!==void 0,j=$?typeof _.initialDataUpdatedAt=="function"?_.initialDataUpdatedAt():_.initialDataUpdatedAt:0;return{data:a,dataUpdateCount:0,dataUpdatedAt:$?j??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:$?"success":"pending",fetchStatus:"idle"}}var Ho,Ev,QueryCache=(Ev=class extends Subscribable{constructor(a={}){super();Mn(this,Ho,void 0);this.config=a,kn(this,Ho,new Map)}build(a,$,j){const et=$.queryKey,tt=$.queryHash??hashQueryKeyByOptions(et,$);let rt=this.get(tt);return rt||(rt=new Query({cache:this,queryKey:et,queryHash:tt,options:a.defaultQueryOptions($),state:j,defaultOptions:a.getQueryDefaults(et)}),this.add(rt)),rt}add(a){Nr(this,Ho).has(a.queryHash)||(Nr(this,Ho).set(a.queryHash,a),this.notify({type:"added",query:a}))}remove(a){const $=Nr(this,Ho).get(a.queryHash);$&&(a.destroy(),$===a&&Nr(this,Ho).delete(a.queryHash),this.notify({type:"removed",query:a}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(a=>{this.remove(a)})})}get(a){return Nr(this,Ho).get(a)}getAll(){return[...Nr(this,Ho).values()]}find(a){const $={exact:!0,...a};return this.getAll().find(j=>matchQuery($,j))}findAll(a={}){const $=this.getAll();return Object.keys(a).length>0?$.filter(j=>matchQuery(a,j)):$}notify(a){notifyManager.batch(()=>{this.listeners.forEach($=>{$(a)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(a=>{a.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(a=>{a.onOnline()})})}},Ho=new WeakMap,Ev),Vo,Ws,uu,qo,Ul,wv,Mutation=(wv=class extends Removable{constructor(a){super();Mn(this,qo);Mn(this,Vo,void 0);Mn(this,Ws,void 0);Mn(this,uu,void 0);this.mutationId=a.mutationId,kn(this,Ws,a.mutationCache),kn(this,Vo,[]),this.state=a.state||getDefaultState(),this.setOptions(a.options),this.scheduleGc()}setOptions(a){this.options=a,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(a){Nr(this,Vo).includes(a)||(Nr(this,Vo).push(a),this.clearGcTimeout(),Nr(this,Ws).notify({type:"observerAdded",mutation:this,observer:a}))}removeObserver(a){kn(this,Vo,Nr(this,Vo).filter($=>$!==a)),this.scheduleGc(),Nr(this,Ws).notify({type:"observerRemoved",mutation:this,observer:a})}optionalRemove(){Nr(this,Vo).length||(this.state.status==="pending"?this.scheduleGc():Nr(this,Ws).remove(this))}continue(){var a;return((a=Nr(this,uu))==null?void 0:a.continue())??this.execute(this.state.variables)}async execute(a){var et,tt,rt,nt,it,ot,st,at,ut,ht,bt,Et,Ct,Pt,Tt,It,Lt,Nt,Ut,jt;kn(this,uu,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(a):Promise.reject(new Error("No mutationFn found")),onFail:(Mt,Dt)=>{Zn(this,qo,Ul).call(this,{type:"failed",failureCount:Mt,error:Dt})},onPause:()=>{Zn(this,qo,Ul).call(this,{type:"pause"})},onContinue:()=>{Zn(this,qo,Ul).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Nr(this,Ws).canRun(this)}));const $=this.state.status==="pending",j=!Nr(this,uu).canStart();try{if(!$){Zn(this,qo,Ul).call(this,{type:"pending",variables:a,isPaused:j}),await((tt=(et=Nr(this,Ws).config).onMutate)==null?void 0:tt.call(et,a,this));const Dt=await((nt=(rt=this.options).onMutate)==null?void 0:nt.call(rt,a));Dt!==this.state.context&&Zn(this,qo,Ul).call(this,{type:"pending",context:Dt,variables:a,isPaused:j})}const Mt=await Nr(this,uu).start();return await((ot=(it=Nr(this,Ws).config).onSuccess)==null?void 0:ot.call(it,Mt,a,this.state.context,this)),await((at=(st=this.options).onSuccess)==null?void 0:at.call(st,Mt,a,this.state.context)),await((ht=(ut=Nr(this,Ws).config).onSettled)==null?void 0:ht.call(ut,Mt,null,this.state.variables,this.state.context,this)),await((Et=(bt=this.options).onSettled)==null?void 0:Et.call(bt,Mt,null,a,this.state.context)),Zn(this,qo,Ul).call(this,{type:"success",data:Mt}),Mt}catch(Mt){try{throw await((Pt=(Ct=Nr(this,Ws).config).onError)==null?void 0:Pt.call(Ct,Mt,a,this.state.context,this)),await((It=(Tt=this.options).onError)==null?void 0:It.call(Tt,Mt,a,this.state.context)),await((Nt=(Lt=Nr(this,Ws).config).onSettled)==null?void 0:Nt.call(Lt,void 0,Mt,this.state.variables,this.state.context,this)),await((jt=(Ut=this.options).onSettled)==null?void 0:jt.call(Ut,void 0,Mt,a,this.state.context)),Mt}finally{Zn(this,qo,Ul).call(this,{type:"error",error:Mt})}}finally{Nr(this,Ws).runNext(this)}}},Vo=new WeakMap,Ws=new WeakMap,uu=new WeakMap,qo=new WeakSet,Ul=function(a){const $=j=>{switch(a.type){case"failed":return{...j,failureCount:a.failureCount,failureReason:a.error};case"pause":return{...j,isPaused:!0};case"continue":return{...j,isPaused:!1};case"pending":return{...j,context:a.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:a.isPaused,status:"pending",variables:a.variables,submittedAt:Date.now()};case"success":return{...j,data:a.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...j,data:void 0,error:a.error,failureCount:j.failureCount+1,failureReason:a.error,isPaused:!1,status:"error"}}};this.state=$(this.state),notifyManager.batch(()=>{Nr(this,Vo).forEach(j=>{j.onMutationUpdate(a)}),Nr(this,Ws).notify({mutation:this,type:"updated",action:a})})},wv);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var co,ap,_v,MutationCache=(_v=class extends Subscribable{constructor(a={}){super();Mn(this,co,void 0);Mn(this,ap,void 0);this.config=a,kn(this,co,new Map),kn(this,ap,Date.now())}build(a,$,j){const et=new Mutation({mutationCache:this,mutationId:++r0(this,ap)._,options:a.defaultMutationOptions($),state:j});return this.add(et),et}add(a){const $=scopeFor(a),j=Nr(this,co).get($)??[];j.push(a),Nr(this,co).set($,j),this.notify({type:"added",mutation:a})}remove(a){var j;const $=scopeFor(a);if(Nr(this,co).has($)){const et=(j=Nr(this,co).get($))==null?void 0:j.filter(tt=>tt!==a);et&&(et.length===0?Nr(this,co).delete($):Nr(this,co).set($,et))}this.notify({type:"removed",mutation:a})}canRun(a){var j;const $=(j=Nr(this,co).get(scopeFor(a)))==null?void 0:j.find(et=>et.state.status==="pending");return!$||$===a}runNext(a){var j;const $=(j=Nr(this,co).get(scopeFor(a)))==null?void 0:j.find(et=>et!==a&&et.state.isPaused);return($==null?void 0:$.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(a=>{this.remove(a)})})}getAll(){return[...Nr(this,co).values()].flat()}find(a){const $={exact:!0,...a};return this.getAll().find(j=>matchMutation($,j))}findAll(a={}){return this.getAll().filter($=>matchMutation(a,$))}notify(a){notifyManager.batch(()=>{this.listeners.forEach($=>{$(a)})})}resumePausedMutations(){const a=this.getAll().filter($=>$.state.isPaused);return notifyManager.batch(()=>Promise.all(a.map($=>$.continue().catch(noop$2))))}},co=new WeakMap,ap=new WeakMap,_v);function scopeFor(_){var a;return((a=_.options.scope)==null?void 0:a.id)??String(_.mutationId)}function infiniteQueryBehavior(_){return{onFetch:(a,$)=>{const j=async()=>{var bt,Et,Ct,Pt,Tt;const et=a.options,tt=(Ct=(Et=(bt=a.fetchOptions)==null?void 0:bt.meta)==null?void 0:Et.fetchMore)==null?void 0:Ct.direction,rt=((Pt=a.state.data)==null?void 0:Pt.pages)||[],nt=((Tt=a.state.data)==null?void 0:Tt.pageParams)||[],it={pages:[],pageParams:[]};let ot=!1;const st=It=>{Object.defineProperty(It,"signal",{enumerable:!0,get:()=>(a.signal.aborted?ot=!0:a.signal.addEventListener("abort",()=>{ot=!0}),a.signal)})},at=a.options.queryFn&&a.options.queryFn!==skipToken?a.options.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${a.options.queryHash}'`)),ut=async(It,Lt,Nt)=>{if(ot)return Promise.reject();if(Lt==null&&It.pages.length)return Promise.resolve(It);const Ut={queryKey:a.queryKey,pageParam:Lt,direction:Nt?"backward":"forward",meta:a.options.meta};st(Ut);const jt=await at(Ut),{maxPages:Mt}=a.options,Dt=Nt?addToStart:addToEnd;return{pages:Dt(It.pages,jt,Mt),pageParams:Dt(It.pageParams,Lt,Mt)}};let ht;if(tt&&rt.length){const It=tt==="backward",Lt=It?getPreviousPageParam:getNextPageParam,Nt={pages:rt,pageParams:nt},Ut=Lt(et,Nt);ht=await ut(Nt,Ut,It)}else{ht=await ut(it,nt[0]??et.initialPageParam);const It=_??rt.length;for(let Lt=1;Lt{var et,tt;return(tt=(et=a.options).persister)==null?void 0:tt.call(et,j,{queryKey:a.queryKey,meta:a.options.meta,signal:a.signal},$)}:a.fetchFn=j}}}function getNextPageParam(_,{pages:a,pageParams:$}){const j=a.length-1;return _.getNextPageParam(a[j],a,$[j],$)}function getPreviousPageParam(_,{pages:a,pageParams:$}){var j;return(j=_.getPreviousPageParam)==null?void 0:j.call(_,a[0],a,$[0],$)}function hasNextPage(_,a){return a?getNextPageParam(_,a)!=null:!1}function hasPreviousPage(_,a){return!a||!_.getPreviousPageParam?!1:getPreviousPageParam(_,a)!=null}var Ss,Kl,Wl,Ou,ju,Gl,Bu,Nu,Sv,QueryClient=(Sv=class{constructor(_={}){Mn(this,Ss,void 0);Mn(this,Kl,void 0);Mn(this,Wl,void 0);Mn(this,Ou,void 0);Mn(this,ju,void 0);Mn(this,Gl,void 0);Mn(this,Bu,void 0);Mn(this,Nu,void 0);kn(this,Ss,_.queryCache||new QueryCache),kn(this,Kl,_.mutationCache||new MutationCache),kn(this,Wl,_.defaultOptions||{}),kn(this,Ou,new Map),kn(this,ju,new Map),kn(this,Gl,0)}mount(){r0(this,Gl)._++,Nr(this,Gl)===1&&(kn(this,Bu,focusManager.subscribe(async _=>{_&&(await this.resumePausedMutations(),Nr(this,Ss).onFocus())})),kn(this,Nu,onlineManager.subscribe(async _=>{_&&(await this.resumePausedMutations(),Nr(this,Ss).onOnline())})))}unmount(){var _,a;r0(this,Gl)._--,Nr(this,Gl)===0&&((_=Nr(this,Bu))==null||_.call(this),kn(this,Bu,void 0),(a=Nr(this,Nu))==null||a.call(this),kn(this,Nu,void 0))}isFetching(_){return Nr(this,Ss).findAll({..._,fetchStatus:"fetching"}).length}isMutating(_){return Nr(this,Kl).findAll({..._,status:"pending"}).length}getQueryData(_){var $;const a=this.defaultQueryOptions({queryKey:_});return($=Nr(this,Ss).get(a.queryHash))==null?void 0:$.state.data}ensureQueryData(_){const a=this.getQueryData(_.queryKey);if(a===void 0)return this.fetchQuery(_);{const $=this.defaultQueryOptions(_),j=Nr(this,Ss).build(this,$);return _.revalidateIfStale&&j.isStaleByTime($.staleTime)&&this.prefetchQuery($),Promise.resolve(a)}}getQueriesData(_){return Nr(this,Ss).findAll(_).map(({queryKey:a,state:$})=>{const j=$.data;return[a,j]})}setQueryData(_,a,$){const j=this.defaultQueryOptions({queryKey:_}),et=Nr(this,Ss).get(j.queryHash),tt=et==null?void 0:et.state.data,rt=functionalUpdate(a,tt);if(rt!==void 0)return Nr(this,Ss).build(this,j).setData(rt,{...$,manual:!0})}setQueriesData(_,a,$){return notifyManager.batch(()=>Nr(this,Ss).findAll(_).map(({queryKey:j})=>[j,this.setQueryData(j,a,$)]))}getQueryState(_){var $;const a=this.defaultQueryOptions({queryKey:_});return($=Nr(this,Ss).get(a.queryHash))==null?void 0:$.state}removeQueries(_){const a=Nr(this,Ss);notifyManager.batch(()=>{a.findAll(_).forEach($=>{a.remove($)})})}resetQueries(_,a){const $=Nr(this,Ss),j={type:"active",..._};return notifyManager.batch(()=>($.findAll(_).forEach(et=>{et.reset()}),this.refetchQueries(j,a)))}cancelQueries(_={},a={}){const $={revert:!0,...a},j=notifyManager.batch(()=>Nr(this,Ss).findAll(_).map(et=>et.cancel($)));return Promise.all(j).then(noop$2).catch(noop$2)}invalidateQueries(_={},a={}){return notifyManager.batch(()=>{if(Nr(this,Ss).findAll(_).forEach(j=>{j.invalidate()}),_.refetchType==="none")return Promise.resolve();const $={..._,type:_.refetchType??_.type??"active"};return this.refetchQueries($,a)})}refetchQueries(_={},a){const $={...a,cancelRefetch:(a==null?void 0:a.cancelRefetch)??!0},j=notifyManager.batch(()=>Nr(this,Ss).findAll(_).filter(et=>!et.isDisabled()).map(et=>{let tt=et.fetch(void 0,$);return $.throwOnError||(tt=tt.catch(noop$2)),et.state.fetchStatus==="paused"?Promise.resolve():tt}));return Promise.all(j).then(noop$2)}fetchQuery(_){const a=this.defaultQueryOptions(_);a.retry===void 0&&(a.retry=!1);const $=Nr(this,Ss).build(this,a);return $.isStaleByTime(a.staleTime)?$.fetch(a):Promise.resolve($.state.data)}prefetchQuery(_){return this.fetchQuery(_).then(noop$2).catch(noop$2)}fetchInfiniteQuery(_){return _.behavior=infiniteQueryBehavior(_.pages),this.fetchQuery(_)}prefetchInfiniteQuery(_){return this.fetchInfiniteQuery(_).then(noop$2).catch(noop$2)}resumePausedMutations(){return onlineManager.isOnline()?Nr(this,Kl).resumePausedMutations():Promise.resolve()}getQueryCache(){return Nr(this,Ss)}getMutationCache(){return Nr(this,Kl)}getDefaultOptions(){return Nr(this,Wl)}setDefaultOptions(_){kn(this,Wl,_)}setQueryDefaults(_,a){Nr(this,Ou).set(hashKey(_),{queryKey:_,defaultOptions:a})}getQueryDefaults(_){const a=[...Nr(this,Ou).values()];let $={};return a.forEach(j=>{partialMatchKey(_,j.queryKey)&&($={...$,...j.defaultOptions})}),$}setMutationDefaults(_,a){Nr(this,ju).set(hashKey(_),{mutationKey:_,defaultOptions:a})}getMutationDefaults(_){const a=[...Nr(this,ju).values()];let $={};return a.forEach(j=>{partialMatchKey(_,j.mutationKey)&&($={...$,...j.defaultOptions})}),$}defaultQueryOptions(_){if(_._defaulted)return _;const a={...Nr(this,Wl).queries,...this.getQueryDefaults(_.queryKey),..._,_defaulted:!0};return a.queryHash||(a.queryHash=hashQueryKeyByOptions(a.queryKey,a)),a.refetchOnReconnect===void 0&&(a.refetchOnReconnect=a.networkMode!=="always"),a.throwOnError===void 0&&(a.throwOnError=!!a.suspense),!a.networkMode&&a.persister&&(a.networkMode="offlineFirst"),a.enabled!==!0&&a.queryFn===skipToken&&(a.enabled=!1),a}defaultMutationOptions(_){return _!=null&&_._defaulted?_:{...Nr(this,Wl).mutations,...(_==null?void 0:_.mutationKey)&&this.getMutationDefaults(_.mutationKey),..._,_defaulted:!0}}clear(){Nr(this,Ss).clear(),Nr(this,Kl).clear()}},Ss=new WeakMap,Kl=new WeakMap,Wl=new WeakMap,Ou=new WeakMap,ju=new WeakMap,Gl=new WeakMap,Bu=new WeakMap,Nu=new WeakMap,Sv),ro,ys,cp,Gs,du,Lu,Ko,lp,Du,Fu,fu,hu,Zl,Uu,pu,sp,up,um,dp,dm,fp,fm,hp,hm,pp,pm,mp,mm,gp,gm,i0,Av,$v,QueryObserver=($v=class extends Subscribable{constructor(a,$){super();Mn(this,pu);Mn(this,up);Mn(this,dp);Mn(this,fp);Mn(this,hp);Mn(this,pp);Mn(this,mp);Mn(this,gp);Mn(this,i0);Mn(this,ro,void 0);Mn(this,ys,void 0);Mn(this,cp,void 0);Mn(this,Gs,void 0);Mn(this,du,void 0);Mn(this,Lu,void 0);Mn(this,Ko,void 0);Mn(this,lp,void 0);Mn(this,Du,void 0);Mn(this,Fu,void 0);Mn(this,fu,void 0);Mn(this,hu,void 0);Mn(this,Zl,void 0);Mn(this,Uu,new Set);this.options=$,kn(this,ro,a),kn(this,Ko,null),this.bindMethods(),this.setOptions($)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Nr(this,ys).addObserver(this),shouldFetchOnMount(Nr(this,ys),this.options)?Zn(this,pu,sp).call(this):this.updateResult(),Zn(this,hp,hm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Nr(this,ys),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Nr(this,ys),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Zn(this,pp,pm).call(this),Zn(this,mp,mm).call(this),Nr(this,ys).removeObserver(this)}setOptions(a,$){const j=this.options,et=Nr(this,ys);if(this.options=Nr(this,ro).defaultQueryOptions(a),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");Zn(this,gp,gm).call(this),Nr(this,ys).setOptions(this.options),j._defaulted&&!shallowEqualObjects(this.options,j)&&Nr(this,ro).getQueryCache().notify({type:"observerOptionsUpdated",query:Nr(this,ys),observer:this});const tt=this.hasListeners();tt&&shouldFetchOptionally(Nr(this,ys),et,this.options,j)&&Zn(this,pu,sp).call(this),this.updateResult($),tt&&(Nr(this,ys)!==et||this.options.enabled!==j.enabled||this.options.staleTime!==j.staleTime)&&Zn(this,up,um).call(this);const rt=Zn(this,dp,dm).call(this);tt&&(Nr(this,ys)!==et||this.options.enabled!==j.enabled||rt!==Nr(this,Zl))&&Zn(this,fp,fm).call(this,rt)}getOptimisticResult(a){const $=Nr(this,ro).getQueryCache().build(Nr(this,ro),a),j=this.createResult($,a);return shouldAssignObserverCurrentProperties(this,j)&&(kn(this,Gs,j),kn(this,Lu,this.options),kn(this,du,Nr(this,ys).state)),j}getCurrentResult(){return Nr(this,Gs)}trackResult(a,$){const j={};return Object.keys(a).forEach(et=>{Object.defineProperty(j,et,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(et),$==null||$(et),a[et])})}),j}trackProp(a){Nr(this,Uu).add(a)}getCurrentQuery(){return Nr(this,ys)}refetch({...a}={}){return this.fetch({...a})}fetchOptimistic(a){const $=Nr(this,ro).defaultQueryOptions(a),j=Nr(this,ro).getQueryCache().build(Nr(this,ro),$);return j.isFetchingOptimistic=!0,j.fetch().then(()=>this.createResult(j,$))}fetch(a){return Zn(this,pu,sp).call(this,{...a,cancelRefetch:a.cancelRefetch??!0}).then(()=>(this.updateResult(),Nr(this,Gs)))}createResult(a,$){var jt;const j=Nr(this,ys),et=this.options,tt=Nr(this,Gs),rt=Nr(this,du),nt=Nr(this,Lu),ot=a!==j?a.state:Nr(this,cp),{state:st}=a;let at={...st},ut=!1,ht;if($._optimisticResults){const Mt=this.hasListeners(),Dt=!Mt&&shouldFetchOnMount(a,$),Ft=Mt&&shouldFetchOptionally(a,j,$,et);(Dt||Ft)&&(at={...at,...fetchState(st.data,a.options)}),$._optimisticResults==="isRestoring"&&(at.fetchStatus="idle")}let{error:bt,errorUpdatedAt:Et,status:Ct}=at;if($.select&&at.data!==void 0)if(tt&&at.data===(rt==null?void 0:rt.data)&&$.select===Nr(this,lp))ht=Nr(this,Du);else try{kn(this,lp,$.select),ht=$.select(at.data),ht=replaceData(tt==null?void 0:tt.data,ht,$),kn(this,Du,ht),kn(this,Ko,null)}catch(Mt){kn(this,Ko,Mt)}else ht=at.data;if($.placeholderData!==void 0&&ht===void 0&&Ct==="pending"){let Mt;if(tt!=null&&tt.isPlaceholderData&&$.placeholderData===(nt==null?void 0:nt.placeholderData))Mt=tt.data;else if(Mt=typeof $.placeholderData=="function"?$.placeholderData((jt=Nr(this,Fu))==null?void 0:jt.state.data,Nr(this,Fu)):$.placeholderData,$.select&&Mt!==void 0)try{Mt=$.select(Mt),kn(this,Ko,null)}catch(Dt){kn(this,Ko,Dt)}Mt!==void 0&&(Ct="success",ht=replaceData(tt==null?void 0:tt.data,Mt,$),ut=!0)}Nr(this,Ko)&&(bt=Nr(this,Ko),ht=Nr(this,Du),Et=Date.now(),Ct="error");const Pt=at.fetchStatus==="fetching",Tt=Ct==="pending",It=Ct==="error",Lt=Tt&&Pt,Nt=ht!==void 0;return{status:Ct,fetchStatus:at.fetchStatus,isPending:Tt,isSuccess:Ct==="success",isError:It,isInitialLoading:Lt,isLoading:Lt,data:ht,dataUpdatedAt:at.dataUpdatedAt,error:bt,errorUpdatedAt:Et,failureCount:at.fetchFailureCount,failureReason:at.fetchFailureReason,errorUpdateCount:at.errorUpdateCount,isFetched:at.dataUpdateCount>0||at.errorUpdateCount>0,isFetchedAfterMount:at.dataUpdateCount>ot.dataUpdateCount||at.errorUpdateCount>ot.errorUpdateCount,isFetching:Pt,isRefetching:Pt&&!Tt,isLoadingError:It&&!Nt,isPaused:at.fetchStatus==="paused",isPlaceholderData:ut,isRefetchError:It&&Nt,isStale:isStale(a,$),refetch:this.refetch}}updateResult(a){const $=Nr(this,Gs),j=this.createResult(Nr(this,ys),this.options);if(kn(this,du,Nr(this,ys).state),kn(this,Lu,this.options),Nr(this,du).data!==void 0&&kn(this,Fu,Nr(this,ys)),shallowEqualObjects(j,$))return;kn(this,Gs,j);const et={},tt=()=>{if(!$)return!0;const{notifyOnChangeProps:rt}=this.options,nt=typeof rt=="function"?rt():rt;if(nt==="all"||!nt&&!Nr(this,Uu).size)return!0;const it=new Set(nt??Nr(this,Uu));return this.options.throwOnError&&it.add("error"),Object.keys(Nr(this,Gs)).some(ot=>{const st=ot;return Nr(this,Gs)[st]!==$[st]&&it.has(st)})};(a==null?void 0:a.listeners)!==!1&&tt()&&(et.listeners=!0),Zn(this,i0,Av).call(this,{...et,...a})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Zn(this,hp,hm).call(this)}},ro=new WeakMap,ys=new WeakMap,cp=new WeakMap,Gs=new WeakMap,du=new WeakMap,Lu=new WeakMap,Ko=new WeakMap,lp=new WeakMap,Du=new WeakMap,Fu=new WeakMap,fu=new WeakMap,hu=new WeakMap,Zl=new WeakMap,Uu=new WeakMap,pu=new WeakSet,sp=function(a){Zn(this,gp,gm).call(this);let $=Nr(this,ys).fetch(this.options,a);return a!=null&&a.throwOnError||($=$.catch(noop$2)),$},up=new WeakSet,um=function(){if(Zn(this,pp,pm).call(this),isServer||Nr(this,Gs).isStale||!isValidTimeout(this.options.staleTime))return;const $=timeUntilStale(Nr(this,Gs).dataUpdatedAt,this.options.staleTime)+1;kn(this,fu,setTimeout(()=>{Nr(this,Gs).isStale||this.updateResult()},$))},dp=new WeakSet,dm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Nr(this,ys)):this.options.refetchInterval)??!1},fp=new WeakSet,fm=function(a){Zn(this,mp,mm).call(this),kn(this,Zl,a),!(isServer||this.options.enabled===!1||!isValidTimeout(Nr(this,Zl))||Nr(this,Zl)===0)&&kn(this,hu,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&Zn(this,pu,sp).call(this)},Nr(this,Zl)))},hp=new WeakSet,hm=function(){Zn(this,up,um).call(this),Zn(this,fp,fm).call(this,Zn(this,dp,dm).call(this))},pp=new WeakSet,pm=function(){Nr(this,fu)&&(clearTimeout(Nr(this,fu)),kn(this,fu,void 0))},mp=new WeakSet,mm=function(){Nr(this,hu)&&(clearInterval(Nr(this,hu)),kn(this,hu,void 0))},gp=new WeakSet,gm=function(){const a=Nr(this,ro).getQueryCache().build(Nr(this,ro),this.options);if(a===Nr(this,ys))return;const $=Nr(this,ys);kn(this,ys,a),kn(this,cp,a.state),this.hasListeners()&&($==null||$.removeObserver(this),a.addObserver(this))},i0=new WeakSet,Av=function(a){notifyManager.batch(()=>{a.listeners&&this.listeners.forEach($=>{$(Nr(this,Gs))}),Nr(this,ro).getQueryCache().notify({query:Nr(this,ys),type:"observerResultsUpdated"})})},$v);function shouldLoadOnMount(_,a){return a.enabled!==!1&&_.state.data===void 0&&!(_.state.status==="error"&&a.retryOnMount===!1)}function shouldFetchOnMount(_,a){return shouldLoadOnMount(_,a)||_.state.data!==void 0&&shouldFetchOn(_,a,a.refetchOnMount)}function shouldFetchOn(_,a,$){if(a.enabled!==!1){const j=typeof $=="function"?$(_):$;return j==="always"||j!==!1&&isStale(_,a)}return!1}function shouldFetchOptionally(_,a,$,j){return(_!==a||j.enabled===!1)&&(!$.suspense||_.state.status!=="error")&&isStale(_,$)}function isStale(_,a){return a.enabled!==!1&&_.isStaleByTime(a.staleTime)}function shouldAssignObserverCurrentProperties(_,a){return!shallowEqualObjects(_.getCurrentResult(),a)}var InfiniteQueryObserver=class extends QueryObserver{constructor(_,a){super(_,a)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(_,a){super.setOptions({..._,behavior:infiniteQueryBehavior()},a)}getOptimisticResult(_){return _.behavior=infiniteQueryBehavior(),super.getOptimisticResult(_)}fetchNextPage(_){return this.fetch({..._,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(_){return this.fetch({..._,meta:{fetchMore:{direction:"backward"}}})}createResult(_,a){var bt,Et;const{state:$}=_,j=super.createResult(_,a),{isFetching:et,isRefetching:tt,isError:rt,isRefetchError:nt}=j,it=(Et=(bt=$.fetchMeta)==null?void 0:bt.fetchMore)==null?void 0:Et.direction,ot=rt&&it==="forward",st=et&&it==="forward",at=rt&&it==="backward",ut=et&&it==="backward";return{...j,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hasNextPage(a,$.data),hasPreviousPage:hasPreviousPage(a,$.data),isFetchNextPageError:ot,isFetchingNextPage:st,isFetchPreviousPageError:at,isFetchingPreviousPage:ut,isRefetchError:nt&&!ot&&!at,isRefetching:tt&&!st&&!ut}}},QueryClientContext=reactExports.createContext(void 0),useQueryClient=_=>{const a=reactExports.useContext(QueryClientContext);if(!a)throw new Error("No QueryClient set, use QueryClientProvider to set one");return a},QueryClientProvider=({client:_,children:a})=>(reactExports.useEffect(()=>(_.mount(),()=>{_.unmount()}),[_]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:_,children:a})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let _=!1;return{clearReset:()=>{_=!1},reset:()=>{_=!0},isReset:()=>_}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(_,a){return typeof _=="function"?_(...a):!!_}var ensurePreventErrorBoundaryRetry=(_,a)=>{(_.suspense||_.throwOnError)&&(a.isReset()||(_.retryOnMount=!1))},useClearResetErrorBoundary=_=>{reactExports.useEffect(()=>{_.clearReset()},[_])},getHasError=({result:_,errorResetBoundary:a,throwOnError:$,query:j})=>_.isError&&!a.isReset()&&!_.isFetching&&j&&shouldThrowError($,[_.error,j]),ensureStaleTime=_=>{_.suspense&&typeof _.staleTime!="number"&&(_.staleTime=1e3)},shouldSuspend=(_,a)=>(_==null?void 0:_.suspense)&&a.isPending,fetchOptimistic=(_,a,$)=>a.fetchOptimistic(_).catch(()=>{$.clearReset()});function useBaseQuery(_,a,$){const j=useQueryClient(),et=useIsRestoring(),tt=useQueryErrorResetBoundary(),rt=j.defaultQueryOptions(_);rt._optimisticResults=et?"isRestoring":"optimistic",ensureStaleTime(rt),ensurePreventErrorBoundaryRetry(rt,tt),useClearResetErrorBoundary(tt);const[nt]=reactExports.useState(()=>new a(j,rt)),it=nt.getOptimisticResult(rt);if(reactExports.useSyncExternalStore(reactExports.useCallback(ot=>{const st=et?()=>{}:nt.subscribe(notifyManager.batchCalls(ot));return nt.updateResult(),st},[nt,et]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),reactExports.useEffect(()=>{nt.setOptions(rt,{listeners:!1})},[rt,nt]),shouldSuspend(rt,it))throw fetchOptimistic(rt,nt,tt);if(getHasError({result:it,errorResetBoundary:tt,throwOnError:rt.throwOnError,query:j.getQueryCache().get(rt.queryHash)}))throw it.error;return rt.notifyOnChangeProps?it:nt.trackResult(it)}function useQuery(_,a){return useBaseQuery(_,QueryObserver)}function useInfiniteQuery(_,a){return useBaseQuery(_,InfiniteQueryObserver)}const peerInfoSchema=z.object({id:z.string(),type:z.string(),name:z.string(),publicKey:z.string(),version:z.string(),icon:z.string().optional(),relayServer:z.string().optional()}),makePeerInfo=peerInfoSchema.parse,useGetConnectionInfo=_=>useAppSelector($=>$.beacon)[_],useGetPeersForAccounts=()=>{const _=useAppSelector(a=>a.beacon);return a=>lodashExports.uniq(Object.entries(_).filter(([$,j])=>a.includes(j.accountPkh)).map(([$,j])=>$))},useResetConnections=()=>{const _=useDispatch();return()=>_(beaconSlice.actions.reset())},useAddConnection=()=>{const _=useDispatch();return(a,$,j)=>_(beaconSlice.actions.addConnection({dAppId:a,accountPkh:$,networkType:j}))},useRemoveConnection=()=>{const _=useDispatch();return a=>_(beaconSlice.actions.removeConnection(a))},PEERS_QUERY_KEY="beaconPeers",useRefreshPeers=()=>{const _=useQueryClient();return()=>_.refetchQueries({queryKey:[PEERS_QUERY_KEY]})},usePeers=()=>useQuery({queryKey:[PEERS_QUERY_KEY],queryFn:()=>WalletClient.getPeers(),initialData:[]}).data,useRemovePeer=()=>{const _=useRefreshPeers(),a=useRemoveConnection();return $=>WalletClient.removePeer($,!0).then(()=>a($.senderId)).finally(()=>void _())},useRemovePeerBySenderId=()=>{const _=usePeers(),a=useRemovePeer();return $=>Promise.all(_.filter(j=>$===j.senderId).map(a))},useRemovePeersByAccounts=()=>{const _=useGetPeersForAccounts(),a=useRemovePeerBySenderId();return $=>Promise.all(_($).map(a))},useAddPeer=()=>{const _=useRefreshPeers(),a=useToast();return $=>new Serializer().deserialize($).then(makePeerInfo).then(j=>WalletClient.addPeer(j)).then(_).catch(j=>{a({description:"Beacon sync code in the clipboard is invalid. Please copy a beacon sync code from the dApp",status:"error"}),console.error(j)})},useRemoveDependenciesAndMultisigs=()=>{const _=useAppDispatch(),a=useGetMultisigsToRemove(),$=useRemoveAccountsDependencies();return j=>{const et=a(j);$([...j,...et]),_(multisigsSlice.actions.removeMultisigsData(et.map(tt=>tt.address.pkh)))}},useRemoveAccountsDependencies=()=>{const _=useAppDispatch(),a=useRemovePeersByAccounts();return $=>{const j=$.map(et=>et.address.pkh);_(batchesSlice.actions.removeByAccounts(j)),a(j),_(beaconSlice.actions.removeConnections(j)),_(assetsSlice.actions.removeAccountsData(j))}},useGetMultisigsToRemove=()=>{const _=useImplicitAccounts(),a=useMultisigAccounts();return $=>{const j=$.map(tt=>tt.address.pkh),et=_.map(tt=>tt.address.pkh).filter(tt=>!j.includes(tt));return a.filter(tt=>!tt.signers.some(rt=>et.includes(rt.pkh)))}},defaultDerivationPathTemplate="44'/1729'/?'/0'",DEFAULT_DERIVATION_PATH_TEMPLATE={label:"Default - m/44'/1729'/?'/0'",value:defaultDerivationPathTemplate},AVAILABLE_DERIVATION_PATH_TEMPLATES=[DEFAULT_DERIVATION_PATH_TEMPLATE,{label:"m/44'/1729'/0'/?'",value:"44'/1729'/0'/?'"},{label:"m/44'/1729'/?'/0'/0'",value:"44'/1729'/?'/0'/0'"},{label:"m/44'/1729'/0'/0'/?'",value:"44'/1729'/0'/0'/?'"}],getDefaultDerivationPath=_=>makeDerivationPath(defaultDerivationPathTemplate,_),makeDerivationPath=(_,a)=>_.replace("?",a.toString()),makeMnemonicAccount=(_,a,$,j,et,tt)=>({curve:"ed25519",derivationPath:$,derivationPathTemplate:j,pk:_,address:parseImplicitPkh(a),seedFingerPrint:et,label:tt,type:"mnemonic"}),generate24WordMnemonic=()=>generateMnemonic_1(256),restoreRevealedPublicKeyPairs=async(_,a,$)=>{const j=[];let et=0,tt=await derivePublicKeyPair(_,makeDerivationPath(a,et));do j.push(tt),et+=1,tt=await derivePublicKeyPair(_,makeDerivationPath(a,et));while(await addressExists(tt.pkh,$));return j},useRestoreRevealedMnemonicAccounts=()=>{const _=useGetNextAvailableAccountLabels();return async(a,$,j,et)=>{const tt=await restoreRevealedPublicKeyPairs(a,j,$),rt=await getFingerPrint(a),nt=_(et,tt.length);return tt.map(({pk:it,pkh:ot},st)=>makeMnemonicAccount(it,ot,makeDerivationPath(j,st),j,rt,nt[st]))}},getCurve=_=>{if(_.startsWith(Prefix.EDESK)||_.startsWith(Prefix.EDSK))return"ed25519";if(_.startsWith(Prefix.SPESK)||_.startsWith(Prefix.SPSK))return"secp256k1";if(_.startsWith(Prefix.P2ESK)||_.startsWith(Prefix.P2SK))return"p256";throw new Error("Invalid secret key")},isEncryptedSecretKeyPrefix=_=>_.substring(2,3)==="e",makeSecretKeyAccount=async({secretKey:_,label:a,password:$})=>{const{pk:j,pkh:et}=await getPublicKeyPairFromSk(_),tt=await encrypt$1(_,$);return{account:{type:"secret_key",pk:j,label:a,curve:getCurve(_),address:parseImplicitPkh(et)},encryptedSecretKey:tt}},restore=({secretKey:_,label:a,password:$})=>async j=>{const{account:et,encryptedSecretKey:tt}=await makeSecretKeyAccount({secretKey:_,label:a,password:$});j(accountsSlice.actions.addAccount(et)),j(accountsSlice.actions.addSecretKey({pkh:et.address.pkh,encryptedSecretKey:tt}))},{removeMnemonicAndAccounts,removeNonMnemonicAccounts}=accountsSlice.actions,{addAccount}=accountsSlice.actions,useRestoreFromMnemonic=()=>{const _=useSelectedNetwork(),a=useRestoreRevealedMnemonicAccounts(),$=useDispatch();return async({mnemonic:j,password:et,derivationPathTemplate:tt,label:rt})=>{const nt=await getFingerPrint(j),it=await a(j,_,tt,rt),ot=await encrypt$1(j,et);$(accountsSlice.actions.addMnemonicAccounts({seedFingerprint:nt,accounts:it,encryptedMnemonic:ot}))}},useDeriveMnemonicAccount=()=>{const _=useSeedPhrases(),a=useImplicitAccounts(),$=useGetNextAvailableAccountLabels(),j=useDispatch();return async({fingerPrint:et,password:tt,label:rt})=>{const nt=_[et];if(!nt)throw new Error(`No seedphrase found with fingerprint: ${et}`);const it=await decrypt$1(nt,tt),ot=a.filter(Pt=>Pt.type==="mnemonic"&&Pt.seedFingerPrint===et),st=ot.length,at=ot[0].derivationPathTemplate,ut=makeDerivationPath(at,st),{pk:ht,pkh:bt}=await derivePublicKeyPair(it,ut),Et=$(rt,1)[0],Ct=makeMnemonicAccount(ht,bt,ut,at,et,Et);j(accountsSlice.actions.addAccount(Ct))}},useRestoreFromSecretKey=()=>{const _=useAppDispatch();return(a,$,j)=>_(restore({secretKey:a,password:$,label:j}))},useRestoreLedger=()=>{const _=useAppDispatch();return(a,$,j,et,tt)=>{_(addAccount({derivationPathTemplate:a,derivationPath:$,curve:"ed25519",type:"ledger",pk:j,address:{type:"implicit",pkh:et},label:tt}))}},useRestoreSocial=()=>{const _=useAppDispatch();return reactExports.useCallback(($,j,et,tt)=>{_(addAccount({type:"social",pk:$,address:{type:"implicit",pkh:j},idp:tt,label:et}))},[_])},useRemoveMnemonic=()=>{const _=useAppDispatch(),a=useGetAccountsByFingerPrint(),$=useRemoveDependenciesAndMultisigs();return j=>{$(a(j)),_(removeMnemonicAndAccounts({fingerPrint:j}))}},useRemoveNonMnemonic=()=>{const _=useAppDispatch(),a=useGetAccountsByType(),$=useRemoveDependenciesAndMultisigs();return j=>{$(a(j)),_(removeNonMnemonicAccounts({accountType:j}))}},useRemoveAccount=()=>{const _=useAppDispatch(),a=useRemoveDependenciesAndMultisigs();return $=>{a([$]),_(accountsSlice.actions.removeAccount($))}},DEFAULT_TITLE="Name Your Account",NameAccountDisplay=({onSubmit:_,title:a=DEFAULT_TITLE,subtitle:$})=>{const{register:j,handleSubmit:et}=useForm({mode:"onChange"});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(EditAccountIcon,{}),subtitle:$,title:a,children:jsxRuntimeExports.jsxs("form",{onSubmit:et(_),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account name"}),jsxRuntimeExports.jsx(Input,{"data-testid":"name",type:"text",...j("accountName",{required:!1}),placeholder:"Optional"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",size:"lg",type:"submit",children:"Continue"})]})})},DEFAULT_ACCOUNT_LABEL="Account",NameAccount=({goToStep:_,account:a})=>{const $=useGetNextAvailableAccountLabels(),j=et=>{const tt=et.accountName.trim()||DEFAULT_ACCOUNT_LABEL,rt=$(tt)[0];switch(a.type){case"secret_key":return _({type:"masterPassword",account:{...a,label:rt}});case"ledger":return _({type:"derivationPath",account:{...a,label:rt}});case"mnemonic":return _({type:"derivationPath",account:{...a,label:tt}})}};return jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:j,subtitle:"Please choose a name for your first account. You can edit your account name later."})},reload=()=>window.location.reload(),useRestoreV1BackupFile=()=>{const _=useRestoreFromMnemonic();return async(a,$)=>{const j=a.recoveryPhrases,et=a.derivationPaths.map(rt=>rt.slice(0,2)==="m/"?rt.slice(2):rt),tt=[];try{for(const rt of j)tt.push(await decrypt$1(rt,$,"V1"))}catch{throw new Error("Invalid password.")}for(const[rt,nt]of tt.entries())await _({mnemonic:nt,password:$,label:DEFAULT_ACCOUNT_LABEL,derivationPathTemplate:et[rt]})}},restoreV2BackupFile=async(_,a)=>{const $=_["persist:accounts"];if(!$)throw new Error("Invalid backup file.");const j=JSON.parse($),et=JSON.parse(j.seedPhrases);try{for(const tt of Object.values(et))await decrypt$1(tt,a,"V2")}catch{throw new Error("Invalid password.")}persistor.pause(),localStorage.clear(),localStorage.setItem("persist:accounts",$),localStorage.setItem("persist:root",_["persist:root"])},downloadBackupFile=()=>{const _={version:packageInfo.version,"persist:accounts":localStorage.getItem("persist:accounts"),"persist:root":localStorage.getItem("persist:root")},a=`data:text/json;chatset=utf-8,${encodeURIComponent(JSON.stringify(_))}`,$=document.createElement("a");$.href=a,$.download="UmamiV2Backup.json",$.click()},BackgroundImage=""+new URL("background_image-BS5h8JYK.png",import.meta.url).href,feedbackEmailBodyTemplate="What is it about? (if a bug report please consider including your account address) %0A PLEASE FILL %0A%0A What is the feedback? %0A PLEASE FILL",refresh=()=>{window.location.href="/"},ErrorPage=()=>{const{modalElement:_,onOpen:a}=useOffboardingModal();return jsxRuntimeExports.jsxs(Center,{height:"100vh",padding:"60px",backgroundImage:BackgroundImage,backgroundSize:"cover",children:[jsxRuntimeExports.jsx(Box,{width:"480px",padding:"40px",background:colors.gray[900],border:"1px",borderColor:colors.gray[700],borderRadius:"8px",boxShadow:"0px 0px 30px rgba(0, 0, 0, 0.30)",children:jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(NoticeIcon,{}),subtitle:"Please refresh the app or use one of the following options:",title:"Oops! Something went wrong!",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",borderRadius:"4px",onClick:downloadBackupFile,size:"lg",children:"Save Backup"}),jsxRuntimeExports.jsx(Button,{width:"100%",borderRadius:"4px",onClick:a,size:"lg",variant:"warning",children:"Off-board Wallet"}),jsxRuntimeExports.jsx(Button,{width:"100%",borderColor:colors.gray[600],borderRadius:"4px",size:"lg",variant:"tertiary",children:jsxRuntimeExports.jsx(Link$1,{width:"100%",_hover:{textDecoration:"none"},href:`mailto:umami-support@trili.tech?subject=Umami V2 feedback&body=${feedbackEmailBodyTemplate}`,rel:"noopener noreferrer",target:"_blank",children:"Report Error"})}),jsxRuntimeExports.jsx(Link$1,{display:"block",marginTop:"14px",color:colors.blue,fill:colors.blue,_hover:{color:colors.blueL,fill:colors.blueL},onClick:refresh,children:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ReloadIcon,{marginRight:"7px"}),jsxRuntimeExports.jsx(Heading,{display:"inline",lineHeight:"22px",size:"md",children:"Refresh"})]})})]})})}),_]})},queryClient=new QueryClient,ReactQueryProvider=({children:_})=>jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:_}),ReduxStore=_=>jsxRuntimeExports.jsx(Provider_default,{store,children:_.children}),baseCircle={borderRadius:"full",bg:colors.gray[600],_disabled:{bg:colors.gray[700],color:colors.gray[450]},_hover:{color:colors.green,bg:colors.gray[500],_disabled:{bg:colors.gray[700],color:colors.gray[450]}}},buttonTheme={sizes:{md:{height:"38px",fontSize:"14px",minWidth:"38px"},lg:{height:"48px",fontSize:"16px",minWidth:"48px"}},variants:{primary:{bg:colors.blue,_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1},_hover:{_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1},bg:colors.blueL}},secondary:{border:"1px solid",borderColor:colors.green,_disabled:{color:colors.gray[450],borderColor:colors.gray[500],opacity:1},_hover:{bg:colors.green,_disabled:{color:colors.gray[450],borderColor:colors.gray[500],opacity:1}}},tertiary:{bg:"transparent",border:"1px solid",borderColor:colors.gray[500],_disabled:{color:colors.gray[450],opacity:1},_hover:{border:"1px solid",borderColor:colors.gray[600],bg:colors.gray[600],_disabled:{borderColor:colors.gray[500],color:colors.gray[450],opacity:1}}},warning:{bg:colors.orange,_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1},_hover:{bg:colors.orangeL,_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1}}},circle_without_hover_color:{...baseCircle,_hover:{color:colors.green,_disabled:{bg:colors.gray[700],color:colors.gray[450]}}},circle_without_color:baseCircle,circle:{...baseCircle,color:colors.gray[300]},specialCTA:{color:colors.greenL,_hover:{color:colors.green}},CTAWithIcon:{padding:"8px 7px",color:colors.gray[300],_hover:{color:colors.green},_disabled:{color:colors.gray[450]}},popover:{color:colors.gray[300],stroke:colors.gray[450],width:"100%",padding:0,height:"24px",justifyContent:"end",_hover:{color:colors.green,stroke:colors.green}},socialLogin:{width:"48px",height:"48px",background:"white",borderWidth:"0",borderRadius:"full",_hover:{background:colors.gray[600]}}},defaultProps:{variant:"primary",size:"md"}},{definePartsStyle:definePartsStyle$6,defineMultiStyleConfig:defineMultiStyleConfig$6}=createMultiStyleConfigHelpers(checkboxAnatomy.keys),baseStyle$3=definePartsStyle$6({icon:{color:"white"},control:{marginTop:"-20px",width:"20px",height:"20px",borderWidth:"2px",borderColor:colors.gray[400],borderRadius:"2px",_checked:{borderColor:colors.green,bg:colors.green,color:colors.white,_hover:{bg:colors.green,borderColor:colors.green}}}}),checkboxTheme=defineMultiStyleConfig$6({baseStyle:baseStyle$3}),{definePartsStyle:definePartsStyle$5,defineMultiStyleConfig:defineMultiStyleConfig$5}=createMultiStyleConfigHelpers(drawerAnatomy.keys),baseStyle$2=definePartsStyle$5(_=>({body:{padding:"18px 30px 30px 30px",borderLeft:`1px solid ${colors.gray[800]}`},dialog:{bg:colors.gray[900]}})),drawerTheme=defineMultiStyleConfig$5({baseStyle:baseStyle$2,sizes:{md:{dialog:{maxW:"594px"}}},defaultProps:{size:"md"}}),{definePartsStyle:definePartsStyle$4,defineMultiStyleConfig:defineMultiStyleConfig$4}=createMultiStyleConfigHelpers(listAnatomy.keys),onboardingNoticeStyle=definePartsStyle$4({item:{"&::marker":{color:colors.gray[400]}}}),suggestionsStyle=definePartsStyle$4({item:{_hover:{background:colors.gray[500]},background:colors.gray[700],borderRadius:"4px",cursor:"pointer",height:"28px",listStyleType:"none"},container:{background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px",listStyleType:"none",marginLeft:"0 !important",overflowX:"hidden",padding:"10px",position:"absolute",width:"100%",zIndex:2,maxHeight:"130px"}}),listTheme=defineMultiStyleConfig$4({variants:{onboardingNotice:onboardingNoticeStyle,suggestions:suggestionsStyle}}),{definePartsStyle:definePartsStyle$3,defineMultiStyleConfig:defineMultiStyleConfig$3}=createMultiStyleConfigHelpers(modalAnatomy.keys),modalButtonBaseStyle={top:"10px",position:"absolute",color:colors.gray[400],borderRadius:"18px"},closeButtonStyle={...modalButtonBaseStyle,insetEnd:"10px"},backButtonStyle={...modalButtonBaseStyle,insetStart:"10px"},baseStyle$1=definePartsStyle$3({dialog:{padding:"40px",_dark:{bg:colors.gray[900],border:"1px solid",borderColor:colors.gray[700],borderRadius:"8px"}},overlay:{_dark:{bg:"rgba(0, 0, 0, 0.85)"}},closeButton:closeButtonStyle,body:{padding:0},footer:{padding:"32px 0 0 0"},header:{padding:0}}),modalTheme=defineMultiStyleConfig$3({baseStyle:baseStyle$1,sizes:{md:{dialog:{maxW:"482px"}}}}),{definePartsStyle:definePartsStyle$2,defineMultiStyleConfig:defineMultiStyleConfig$2}=createMultiStyleConfigHelpers(radioAnatomy.keys),primary=definePartsStyle$2({control:{height:"16px",width:"16px",_dark:{borderColor:colors.gray[400]},_checked:{backgroundColor:colors.green,borderColor:colors.green,border:"none",color:"white"}}}),radioTheme=defineMultiStyleConfig$2({variants:{primary}}),{definePartsStyle:definePartsStyle$1,defineMultiStyleConfig:defineMultiStyleConfig$1}=createMultiStyleConfigHelpers(switchAnatomy.keys),danger=definePartsStyle$1({track:{backgroundColor:colors.gray[450],_checked:{backgroundColor:colors.orange}},thumb:{backgroundColor:"black"}}),switchTheme=defineMultiStyleConfig$1({variants:{danger}}),{definePartsStyle,defineMultiStyleConfig}=createMultiStyleConfigHelpers(tabsAnatomy.keys),baseStyle=definePartsStyle({tab:{_selected:{fontWeight:600,color:colors.white,borderColor:colors.orange,borderBottom:`2px solid ${colors.orange}`}}}),tabsTheme=defineMultiStyleConfig({baseStyle}),config$1={initialColorMode:"dark",useSystemColorMode:!1},sizes={xs:{fontSize:"12px"},sm:{fontSize:"14px"},md:{fontSize:"16px"},lg:{fontSize:"18px"},xl:{fontSize:"20px"},"2xl":{fontSize:"24px"},"3xl":{fontSize:"30px"},"4xl":{fontSize:"36px"},"5xl":{fontSize:"48px"},"6xl":{fontSize:"69px"}},theme=extendTheme({components:{Tabs:tabsTheme,Text:{baseStyle:{fontWeight:"400",fontFamily:"Inter"},sizes},Heading:{baseStyle:{fontWeight:"600",fontFamily:"Inter"},sizes},Checkbox:checkboxTheme,Input:{sizes:{md:{field:{height:"48px"}}},defaultProps:{variant:"filled"},variants:{filled:{field:{bg:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],_invalid:{borderColor:colors.orange},_hover:{bg:colors.gray[800]},_focusVisible:{bg:colors.gray[800],borderColor:colors.gray[450]}}}}},Button:buttonTheme,FormLabel:{baseStyle:{fontWeight:"600",marginBottom:"12px",size:"md"},sizes},Modal:modalTheme,Drawer:drawerTheme,Radio:radioTheme,List:listTheme,Switch:switchTheme},config:config$1,colors:{umami:colors,text:{dark:colors.gray[400]}},styles:{global:{body:{bg:colors.black,color:colors.white,fontFamily:"Inter"}}}}),UmamiTheme=_=>jsxRuntimeExports.jsxs(ChakraProvider,{theme,children:[jsxRuntimeExports.jsx(ColorModeScript,{initialColorMode:theme.config.initialColorMode}),_.children]});/** + `):"",this.name="UnsubscriptionError",this.errors=$}});function arrRemove(_,a){if(_){var $=_.indexOf(a);0<=$&&_.splice($,1)}}var Subscription=function(){function _(a){this.initialTeardown=a,this.closed=!1,this._parentage=null,this._finalizers=null}return _.prototype.unsubscribe=function(){var a,$,j,et,tt;if(!this.closed){this.closed=!0;var rt=this._parentage;if(rt)if(this._parentage=null,Array.isArray(rt))try{for(var nt=__values(rt),it=nt.next();!it.done;it=nt.next()){var at=it.value;at.remove(this)}}catch(xt){a={error:xt}}finally{try{it&&!it.done&&($=nt.return)&&$.call(nt)}finally{if(a)throw a.error}}else rt.remove(this);var st=this.initialTeardown;if(isFunction$1(st))try{st()}catch(xt){tt=xt instanceof UnsubscriptionError?xt.errors:[xt]}var ot=this._finalizers;if(ot){this._finalizers=null;try{for(var ut=__values(ot),dt=ut.next();!dt.done;dt=ut.next()){var mt=dt.value;try{execFinalizer(mt)}catch(xt){tt=tt??[],xt instanceof UnsubscriptionError?tt=__spreadArray(__spreadArray([],__read(tt)),__read(xt.errors)):tt.push(xt)}}}catch(xt){j={error:xt}}finally{try{dt&&!dt.done&&(et=ut.return)&&et.call(ut)}finally{if(j)throw j.error}}}if(tt)throw new UnsubscriptionError(tt)}},_.prototype.add=function(a){var $;if(a&&a!==this)if(this.closed)execFinalizer(a);else{if(a instanceof _){if(a.closed||a._hasParent(this))return;a._addParent(this)}(this._finalizers=($=this._finalizers)!==null&&$!==void 0?$:[]).push(a)}},_.prototype._hasParent=function(a){var $=this._parentage;return $===a||Array.isArray($)&&$.includes(a)},_.prototype._addParent=function(a){var $=this._parentage;this._parentage=Array.isArray($)?($.push(a),$):$?[$,a]:a},_.prototype._removeParent=function(a){var $=this._parentage;$===a?this._parentage=null:Array.isArray($)&&arrRemove($,a)},_.prototype.remove=function(a){var $=this._finalizers;$&&arrRemove($,a),a instanceof _&&a._removeParent(this)},_.EMPTY=function(){var a=new _;return a.closed=!0,a}(),_}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(_){return _ instanceof Subscription||_&&"closed"in _&&isFunction$1(_.remove)&&isFunction$1(_.add)&&isFunction$1(_.unsubscribe)}function execFinalizer(_){isFunction$1(_)?_():_.unsubscribe()}var config$2={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(_,a){for(var $=[],j=2;j0},enumerable:!1,configurable:!0}),a.prototype._trySubscribe=function($){return this._throwIfClosed(),_.prototype._trySubscribe.call(this,$)},a.prototype._subscribe=function($){return this._throwIfClosed(),this._checkFinalizedStatuses($),this._innerSubscribe($)},a.prototype._innerSubscribe=function($){var j=this,et=this,tt=et.hasError,rt=et.isStopped,nt=et.observers;return tt||rt?EMPTY_SUBSCRIPTION:(this.currentObservers=null,nt.push($),new Subscription(function(){j.currentObservers=null,arrRemove(nt,$)}))},a.prototype._checkFinalizedStatuses=function($){var j=this,et=j.hasError,tt=j.thrownError,rt=j.isStopped;et?$.error(tt):rt&&$.complete()},a.prototype.asObservable=function(){var $=new Observable;return $.source=this,$},a.create=function($,j){return new AnonymousSubject($,j)},a}(Observable),AnonymousSubject=function(_){__extends$1(a,_);function a($,j){var et=_.call(this)||this;return et.destination=$,et.source=j,et}return a.prototype.next=function($){var j,et;(et=(j=this.destination)===null||j===void 0?void 0:j.next)===null||et===void 0||et.call(j,$)},a.prototype.error=function($){var j,et;(et=(j=this.destination)===null||j===void 0?void 0:j.error)===null||et===void 0||et.call(j,$)},a.prototype.complete=function(){var $,j;(j=($=this.destination)===null||$===void 0?void 0:$.complete)===null||j===void 0||j.call($)},a.prototype._subscribe=function($){var j,et;return(et=(j=this.source)===null||j===void 0?void 0:j.subscribe($))!==null&&et!==void 0?et:EMPTY_SUBSCRIPTION},a}(Subject),BehaviorSubject=function(_){__extends$1(a,_);function a($){var j=_.call(this)||this;return j._value=$,j}return Object.defineProperty(a.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),a.prototype._subscribe=function($){var j=_.prototype._subscribe.call(this,$);return!j.closed&&$.next(this._value),j},a.prototype.getValue=function(){var $=this,j=$.hasError,et=$.thrownError,tt=$._value;if(j)throw et;return this._throwIfClosed(),tt},a.prototype.next=function($){_.prototype.next.call(this,this._value=$)},a}(Subject),dateTimestampProvider={now:function(){return(dateTimestampProvider.delegate||Date).now()},delegate:void 0},ReplaySubject=function(_){__extends$1(a,_);function a($,j,et){$===void 0&&($=1/0),j===void 0&&(j=1/0),et===void 0&&(et=dateTimestampProvider);var tt=_.call(this)||this;return tt._bufferSize=$,tt._windowTime=j,tt._timestampProvider=et,tt._buffer=[],tt._infiniteTimeWindow=!0,tt._infiniteTimeWindow=j===1/0,tt._bufferSize=Math.max(1,$),tt._windowTime=Math.max(1,j),tt}return a.prototype.next=function($){var j=this,et=j.isStopped,tt=j._buffer,rt=j._infiniteTimeWindow,nt=j._timestampProvider,it=j._windowTime;et||(tt.push($),!rt&&tt.push(nt.now()+it)),this._trimBuffer(),_.prototype.next.call(this,$)},a.prototype._subscribe=function($){this._throwIfClosed(),this._trimBuffer();for(var j=this._innerSubscribe($),et=this,tt=et._infiniteTimeWindow,rt=et._buffer,nt=rt.slice(),it=0;it0&&Pt(et)},void 0,void 0,function(){mt!=null&&mt.closed||mt==null||mt.unsubscribe(),xt=null})),!Ct&&Pt(j!=null?typeof j=="number"?j:+j-it.now():et)})}function timeoutErrorFactory(_){throw new TimeoutError(_)}function map$1(_,a){return operate(function($,j){var et=0;$.subscribe(createOperatorSubscriber(j,function(tt){j.next(_.call(a,tt,et++))}))})}var isArray$2=Array.isArray;function callOrApply(_,a){return isArray$2(a)?_.apply(void 0,__spreadArray([],__read(a))):_(a)}function mapOneOrManyArgs(_){return map$1(function(a){return callOrApply(_,a)})}var isArray$1=Array.isArray,getPrototypeOf=Object.getPrototypeOf,objectProto=Object.prototype,getKeys$1=Object.keys;function argsArgArrayOrObject(_){if(_.length===1){var a=_[0];if(isArray$1(a))return{args:a,keys:null};if(isPOJO(a)){var $=getKeys$1(a);return{args:$.map(function(j){return a[j]}),keys:$}}}return{args:_,keys:null}}function isPOJO(_){return _&&typeof _=="object"&&getPrototypeOf(_)===objectProto}function createObject(_,a){return _.reduce(function($,j,et){return $[j]=a[et],$},{})}function combineLatest(){for(var _=[],a=0;a=2;return function(j){return j.pipe(identity,take(1),$?defaultIfEmpty(a):throwIfEmpty(function(){return new EmptyError}))}}function multicast(_,a){var $=isFunction$1(_)?_:function(){return _};return isFunction$1(a)?connect(a,{connector:$}):function(j){return new ConnectableObservable(j,$)}}function pluck(){for(var _=[],a=0;a0&&(st=new SafeSubscriber({next:function(zt){return Nt.next(zt)},error:function(zt){xt=!0,Ct(),ot=handleReset(Pt,et,zt),Nt.error(zt)},complete:function(){mt=!0,Ct(),ot=handleReset(Pt,rt),Nt.complete()}}),innerFrom(kt).subscribe(st))})(at)}}function handleReset(_,a){for(var $=[],j=2;j{j.set(et,a[et])}),j}typecheckKey(a){this.keySchema&&this.keySchema.Typecheck(a)}typecheckValue(a){this.valueSchema&&this.valueSchema.Typecheck(a)}assertTypecheckValue(a){try{this.typecheckValue(a)}catch($){throw new MapTypecheckError(a,this.valueSchema,"value",$)}}assertTypecheckKey(a){try{this.typecheckKey(a)}catch($){throw new MapTypecheckError(a,this.keySchema,"key",$)}}serializeDeterministically(a){return stringify$2(a)}*keys(){for(const[a]of this.entries())yield a}*values(){for(const[,a]of this.entries())yield a}*entries(){for(const a of this.valueMap.keys())yield[this.keyMap.get(a),this.valueMap.get(a)]}get(a){this.assertTypecheckKey(a);const $=this.serializeDeterministically(a);return this.valueMap.get($)}set(a,$){this.assertTypecheckKey(a),this.assertTypecheckValue($);const j=this.serializeDeterministically(a);this.keyMap.set(j,a),this.valueMap.set(j,$)}delete(a){this.assertTypecheckKey(a),this.keyMap.delete(this.serializeDeterministically(a)),this.valueMap.delete(this.serializeDeterministically(a))}has(a){this.assertTypecheckKey(a);const $=this.serializeDeterministically(a);return this.keyMap.has($)&&this.valueMap.has($)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(a){for(const[$,j]of this.entries())a(j,$,this)}}_a$1=michelsonMapTypeSymbol;class TokenValidationError extends TaquitoError{constructor(a,$,j){super(),this.value=a,this.token=$,this.name="TokenValidationError";const et=this.token.annot(),tt=et?`[${et}] `:"";this.message=`${tt}${j}`}}class Token{constructor(a,$,j){this.val=a,this.idx=$,this.fac=j,this.createToken=this.fac}typeWithoutAnnotations(){const a=j=>{if(typeof j=="object"){if(Array.isArray(j))return j.map(rt=>a(rt));const et=j;return et.args?{prim:et.prim,args:et.args.map(tt=>a(tt))}:{prim:et.prim}}return j};return(j=>j.args?{prim:j.prim,args:j.args.map(et=>a(et))}:{prim:j.prim})(this.val)}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.ExtractSchema()]]}}class ComparableToken extends Token{compare(a,$){return a===$?0:a<$?-1:1}}class BigMapValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="BigMapValidationError"}}class BigMapToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}ExtractSchema(){return{big_map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:BigMapToken.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}validate(a){if(!MichelsonMap.isMichelsonMap(a))throw new BigMapValidationError(a,this,`Value ${JSON.stringify(a)} is not a MichelsonMap`)}objLitToMichelsonMap(a){return a instanceof MichelsonMap?a:typeof a=="object"?Object.keys(a).length===0?new MichelsonMap:MichelsonMap.fromLiteral(a):a}Encode(a){const $=this.objLitToMichelsonMap(a.pop());return this.validate($),Array.from($.keys()).sort((j,et)=>this.KeySchema.compare(j,et)).map(j=>({prim:"Elt",args:[this.KeySchema.EncodeObject(j),this.ValueSchema.EncodeObject($.get(j))]}))}EncodeObject(a,$){const j=this.objLitToMichelsonMap(a);return this.validate(j),$&&$[BigMapToken.prim]?$[BigMapToken.prim](j,this.val):Array.from(j.keys()).sort((et,tt)=>this.KeySchema.compare(et,tt)).map(et=>({prim:"Elt",args:[this.KeySchema.EncodeObject(et),this.ValueSchema.EncodeObject(j.get(et))]}))}Execute(a,$){if($&&$[BigMapToken.prim])return $[BigMapToken.prim](a,this.val);if(Array.isArray(a)){const j=new MichelsonMap(this.val);return a.forEach(et=>{j.set(this.KeySchema.ToKey(et.args[0]),this.ValueSchema.Execute(et.args[1]))}),j}else{if("int"in a)return a.int;throw new BigMapValidationError(a,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(a)}`)}}findAndReturnTokens(a,$){return BigMapToken.prim===a&&$.push(this),this.KeySchema.findAndReturnTokens(a,$),this.ValueSchema.findAndReturnTokens(a,$),$}}BigMapToken.prim="big_map";class OrValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="OrValidationError"}}class OrToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Encode(a){const $=a[a.length-1],j=this.createToken(this.val.args[0],this.idx);let et=1;j instanceof OrToken&&(et=Object.keys(j.ExtractSchema()).length);const tt=this.createToken(this.val.args[1],this.idx+et);if(String(j.annot())===String($)&&!(j instanceof OrToken))return a.pop(),{prim:"Left",args:[j.Encode(a)]};if(String(tt.annot())===String($)&&!(tt instanceof OrToken))return a.pop(),{prim:"Right",args:[tt.Encode(a)]};if(j instanceof OrToken){const rt=j.Encode(a);if(rt)return{prim:"Left",args:[rt]}}if(tt instanceof OrToken){const rt=tt.Encode(a);if(rt)return{prim:"Right",args:[rt]}}return null}ExtractSignature(){const a=this.createToken(this.val.args[0],this.idx);let $=1;a instanceof OrToken&&($=Object.keys(a.ExtractSchema()).length);const j=this.createToken(this.val.args[1],this.idx+$),et=[];if(a instanceof OrToken)et.push(...a.ExtractSignature());else for(const tt of a.ExtractSignature())et.push([a.annot(),...tt]);if(j instanceof OrToken)et.push(...j.ExtractSignature());else for(const tt of j.ExtractSignature())et.push([j.annot(),...tt]);return et}EncodeObject(a,$){this.validateJavascriptObject(a);const j=Object.keys(a)[0],et=this.createToken(this.val.args[0],this.idx);let tt=1;et instanceof OrToken&&(tt=Object.keys(et.ExtractSchema()).length);const rt=this.createToken(this.val.args[1],this.idx+tt);if(String(et.annot())===String(j)&&!(et instanceof OrToken))return{prim:"Left",args:[et.EncodeObject(a[j],$)]};if(String(rt.annot())===String(j)&&!(rt instanceof OrToken))return{prim:"Right",args:[rt.EncodeObject(a[j],$)]};if(et instanceof OrToken){const nt=et.EncodeObject(a,$);if(nt)return{prim:"Left",args:[nt]}}if(rt instanceof OrToken){const nt=rt.EncodeObject(a,$);if(nt)return{prim:"Right",args:[nt]}}return null}validateJavascriptObject(a){if(typeof a!="object"||Array.isArray(a)||a===null||Object.keys(a).length!==1)throw new OrValidationError(a,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(a)}`)}Execute(a,$){const j=this.createToken(this.val.args[0],this.idx);let et=1;j instanceof OrToken&&(et=Object.keys(j.ExtractSchema()).length);const tt=this.createToken(this.val.args[1],this.idx+et);if(a.prim==="Right")return tt instanceof OrToken?tt.Execute(a.args[0],$):{[tt.annot()]:tt.Execute(a.args[0],$)};if(a.prim==="Left")return j instanceof OrToken?j.Execute(a.args[0],$):{[j.annot()]:j.Execute(a.args[0],$)};throw new OrValidationError(a,this,`Was expecting Left or Right prim but got: ${JSON.stringify(a.prim)}`)}traversal(a,$,j){const et=this.createToken(this.val.args[0],this.idx);let tt=1,rt;et instanceof OrToken?(rt=a(et),tt=Object.keys(et.ExtractSchema()).length):rt={[et.annot()]:a(et)};const nt=this.createToken(this.val.args[1],this.idx+tt);let it;return nt instanceof OrToken?it=$(nt):it={[nt.annot()]:$(nt)},j(rt,it)}ExtractSchema(){return this.traversal(a=>a.ExtractSchema(),a=>a.ExtractSchema(),(a,$)=>Object.assign(Object.assign({},a),$))}generateSchema(){return{__michelsonType:OrToken.prim,schema:this.traversal(a=>a instanceof OrToken?a.generateSchema().schema:a.generateSchema(),a=>a instanceof OrToken?a.generateSchema().schema:a.generateSchema(),(a,$)=>Object.assign(Object.assign({},a),$))}}findToken(a){const $=this.createToken(this.val.args[0],this.idx);let j=1;$ instanceof OrToken&&(j=Object.keys($.ExtractSchema()).length);const et=this.createToken(this.val.args[1],this.idx+j);if(String($.annot())===String(a)&&!($ instanceof OrToken)&&$ instanceof ComparableToken)return $;if(String(et.annot())===String(a)&&!(et instanceof OrToken)&&et instanceof ComparableToken)return et;if($ instanceof OrToken){const tt=$.findToken(a);if(tt)return tt}if(et instanceof OrToken){const tt=et.findToken(a);if(tt)return tt}return null}compare(a,$){const j=Object.keys(a)[0],et=Object.keys($)[0];if(j===et){const tt=this.findToken(j);if(tt instanceof ComparableToken)return tt.compare(a[j],$[j])}else{const tt=JSON.stringify(this.EncodeObject(a)),rt=JSON.stringify(this.EncodeObject($));return ttj.findAndReturnTokens(a,$),j=>j.findAndReturnTokens(a,$),(j,et)=>Object.assign(Object.assign({},j),et)),$}}OrToken.prim="or";class TokenArgumentValidationError extends TaquitoError{constructor(a){super(a),this.message=a,this.name="TokenArgumentValidationError"}}class TokenComparisonError extends TaquitoError{constructor(a,$){super(),this.val1=a,this.val2=$,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(a)} and ${JSON.stringify($)} are not comparable`}}function collapse$1(_,a=PairToken.prim){if(Array.isArray(_))return collapse$1({prim:a,args:_},a);if(_.args===void 0)throw new TokenArgumentValidationError(`The value ${JSON.stringify(_)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return _.args.length>2?[_.args[0],{prim:a,args:_.args.slice(1)}]:[_.args[0],_.args[1]]}class PairToken extends ComparableToken{constructor(a,$,j){super(Array.isArray(a)?{prim:PairToken.prim,args:a}:a.prim?a:{prim:PairToken.prim,args:a},$,j)}args(){return collapse$1(this.val)}tokens(){let a=0;return this.args().map($=>{const j=this.createToken($,this.idx+a);return j instanceof PairToken?a+=Object.keys(j.ExtractSchema()).length:a++,j})}Encode(a){return{prim:"Pair",args:this.tokens().map($=>$.Encode(a))}}ExtractSignature(){const a=this.args(),$=this.createToken(a[0],this.idx);let j=1;$ instanceof OrToken&&(j=Object.keys($.ExtractSchema()).length);const et=this.createToken(a[1],this.idx+j),tt=[];for(const rt of $.ExtractSignature())for(const nt of et.ExtractSignature())tt.push([...rt,...nt]);return tt}ToBigMapKey(a){return{key:this.EncodeObject(a),type:this.typeWithoutAnnotations()}}ToKey(a){return this.Execute(a)}EncodeObject(a,$){const[j,et]=this.tokens();let tt;j instanceof PairToken&&!j.hasAnnotations()?tt=a:tt=a[j.annot()];let rt;return et instanceof PairToken&&!et.hasAnnotations()?rt=a:rt=a[et.annot()],{prim:"Pair",args:[j.EncodeObject(tt,$),et.EncodeObject(rt,$)]}}traversal(a,$){const j=this.args(),et=this.createToken(j[0],this.idx);let tt=1,rt;et instanceof PairToken&&!et.hasAnnotations()?(rt=a(et),et instanceof PairToken&&(tt=Object.keys(et.ExtractSchema()).length)):rt={[et.annot()]:a(et)};const nt=this.createToken(j[1],this.idx+tt);let it;return nt instanceof PairToken&&!nt.hasAnnotations()?it=$(nt):it={[nt.annot()]:$(nt)},Object.assign(Object.assign({},rt),it)}Execute(a,$){const j=collapse$1(a,"Pair");return this.traversal(et=>et.Execute(j[0],$),et=>et.Execute(j[1],$))}ExtractSchema(){return this.traversal(a=>a.ExtractSchema(),a=>a.ExtractSchema())}generateSchema(){return{__michelsonType:PairToken.prim,schema:this.traversal(a=>a instanceof PairToken&&!a.hasAnnotations()?a.generateSchema().schema:a.generateSchema(),a=>a instanceof PairToken&&!a.hasAnnotations()?a.generateSchema().schema:a.generateSchema())}}compare(a,$){const[j,et]=this.tokens(),tt=(rt,nt)=>rt instanceof PairToken&&!rt.hasAnnotations()?nt:nt[rt.annot()];if(j instanceof ComparableToken&&et instanceof ComparableToken){const rt=j.compare(tt(j,a),tt(j,$));return rt===0?et.compare(tt(et,a),tt(et,$)):rt}throw new TokenComparisonError(a,$)}findAndReturnTokens(a,$){return PairToken.prim===a&&$.push(this),this.tokens().map(j=>j.findAndReturnTokens(a,$)),$}}PairToken.prim="pair";class NatValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="NatValidationError"}}class NatToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){return new BigNumber(a[Object.keys(a)[0]])}Encode(a){const $=a.pop();return this.validate($),{int:new BigNumber($).toFixed()}}validate(a){const $=new BigNumber(a);if($.isNaN())throw new NatValidationError(a,this,`Value is not a number: ${JSON.stringify(a)}`);if($.isNegative())throw new NatValidationError(a,this,`Value cannot be negative: ${JSON.stringify(a)}`)}EncodeObject(a,$){return this.validate(a),$&&$[NatToken.prim]?$[NatToken.prim](a):{int:new BigNumber(a).toFixed()}}ExtractSchema(){return NatToken.prim}generateSchema(){return{__michelsonType:NatToken.prim,schema:NatToken.prim}}ToBigMapKey(a){return{key:{int:String(a)},type:{prim:NatToken.prim}}}ToKey({int:a}){return new BigNumber(a)}compare(a,$){const j=Number(a),et=Number($);return j===et?0:jrt.startsWith("tz"),et=j(a),tt=j($);return et&&!tt?-1:tt&&!et?1:super.compare(a,$)}findAndReturnTokens(a,$){return AddressToken.prim===a&&$.push(this),$}}AddressToken.prim="address";class MapValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="MapValidationError"}}class MapToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(a){if(!MichelsonMap.isMichelsonMap(a))throw new MapValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid MichelsonMap`)}Execute(a,$){const j=new MichelsonMap(this.val);return a.forEach(et=>{j.set(this.KeySchema.ToKey(et.args[0]),this.ValueSchema.Execute(et.args[1],$))}),j}objLitToMichelsonMap(a){return a instanceof MichelsonMap?a:typeof a=="object"?Object.keys(a).length===0?new MichelsonMap:MichelsonMap.fromLiteral(a):a}Encode(a){const $=this.objLitToMichelsonMap(a.pop());return this.validate($),Array.from($.keys()).sort((j,et)=>this.KeySchema.compare(j,et)).map(j=>({prim:"Elt",args:[this.KeySchema.EncodeObject(j),this.ValueSchema.EncodeObject($.get(j))]}))}EncodeObject(a,$){const j=this.objLitToMichelsonMap(a);return this.validate(j),$&&$[MapToken.prim]?$[MapToken.prim](j):Array.from(j.keys()).sort((et,tt)=>this.KeySchema.compare(et,tt)).map(et=>({prim:"Elt",args:[this.KeySchema.EncodeObject(et),this.ValueSchema.EncodeObject(j.get(et))]}))}ExtractSchema(){return{map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:MapToken.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(a,$){return MapToken.prim===a&&$.push(this),this.KeySchema.findAndReturnTokens(a,$),this.ValueSchema.findAndReturnTokens(a,$),$}}MapToken.prim="map";class BoolToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){return String(a.prim).toLowerCase()==="true"}Encode(a){return{prim:a.pop()?"True":"False"}}EncodeObject(a,$){return $&&$[BoolToken.prim]?$[BoolToken.prim](a):{prim:a?"True":"False"}}ExtractSchema(){return BoolToken.prim}generateSchema(){return{__michelsonType:BoolToken.prim,schema:BoolToken.prim}}ToBigMapKey(a){return{key:this.EncodeObject(a),type:{prim:BoolToken.prim}}}ToKey(a){return this.EncodeObject(a)}compare(a,$){return a&&$||!a&&!$?0:a?1:-1}findAndReturnTokens(a,$){return BoolToken.prim===a&&$.push(this),$}}BoolToken.prim="bool";class ContractValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ContractValidationError"}}class ContractToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(validateAddress(a)!==ValidationResult.VALID)throw new ContractValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid contract address.`);return null}Execute(a){if(a.string)return a.string;if(!a.bytes)throw new ContractValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid contract address. must contain bytes or string.`);return encodeAddress(a.bytes)}Encode(a){const $=a.pop();return this.validate($),{string:$}}EncodeObject(a,$){return this.validate(a),$&&$[ContractToken.prim]?$[ContractToken.prim](a):{string:a}}ExtractSchema(){return ContractToken.prim}generateSchema(){const a=this.createToken(this.val.args[0],0);return{__michelsonType:ContractToken.prim,schema:{parameter:this.val.args[0]?a.generateSchema():{}}}}findAndReturnTokens(a,$){return ContractToken.prim===a&&$.push(this),$}}ContractToken.prim="contract";class ListValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ListValidationError"}}class ListToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(a){if(!Array.isArray(a))throw new ListValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid array`)}Encode(a){const $=a.pop();this.validate($);const j=this.createToken(this.val.args[0],0);return $.reduce((et,tt)=>[...et,j.EncodeObject(tt)],[])}Execute(a,$){const j=this.createToken(this.val.args[0],0);return this.validate(a),a.reduce((et,tt)=>[...et,j.Execute(tt,$)],[])}EncodeObject(a,$){const j=this.createToken(this.val.args[0],0);return this.validate(a),$&&$[ListToken.prim]?$[ListToken.prim](a):a.reduce((et,tt)=>[...et,j.EncodeObject(tt)],[])}ExtractSchema(){return{[ListToken.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:ListToken.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(a,$){return ListToken.prim===a&&$.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(a,$),$}}ListToken.prim="list";class MutezValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="MutezValidationError"}}class MutezToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){return new BigNumber(a[Object.keys(a)[0]])}ExtractSchema(){return MutezToken.prim}generateSchema(){return{__michelsonType:MutezToken.prim,schema:MutezToken.prim}}validate(a){if(new BigNumber(a).isNaN())throw new MutezValidationError(a,this,`Value is not a number: ${a}`)}Encode(a){const $=a.pop();return this.validate($),{int:String($).toString()}}EncodeObject(a,$){return this.validate(a),$&&$[MutezToken.prim]?$[MutezToken.prim](a):{int:String(a).toString()}}ToBigMapKey(a){return{key:{int:String(a)},type:{prim:MutezToken.prim}}}ToKey({int:a}){return a}compare(a,$){const j=Number(a),et=Number($);return j===et?0:jthis.KeySchema.compare(j,et)).reduce((j,et)=>[...j,this.KeySchema.EncodeObject(et)],[])}Execute(a,$){return a.reduce((j,et)=>[...j,this.KeySchema.Execute(et,$)],[])}EncodeObject(a,$){return this.validate(a),$&&$[SetToken.prim]?$[SetToken.prim](a):a.sort((j,et)=>this.KeySchema.compare(j,et)).reduce((j,et)=>[...j,this.KeySchema.EncodeObject(et)],[])}ExtractSchema(){return SetToken.prim}generateSchema(){return{__michelsonType:SetToken.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(a,$){return SetToken.prim===a&&$.push(this),this.KeySchema.findAndReturnTokens(a,$),$}}SetToken.prim="set";class ChainIDValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ChainIDValidationError"}}class ChainIDToken extends ComparableToken{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(validateChain(a)!==ValidationResult.VALID)throw new ChainIDValidationError(a,this,`Value ${JSON.stringify(a)} is not a valid ChainID`)}Execute(a){return a[Object.keys(a)[0]]}ExtractSchema(){return ChainIDToken.prim}generateSchema(){return{__michelsonType:ChainIDToken.prim,schema:ChainIDToken.prim}}Encode(a){const $=a.pop();return this.validate($),{string:$}}EncodeObject(a,$){return this.validate(a),$&&$[ChainIDToken.prim]?$[ChainIDToken.prim](a):{string:a}}ToKey({string:a}){return a}ToBigMapKey(a){return{key:{string:a},type:{prim:ChainIDToken.prim}}}findAndReturnTokens(a,$){return ChainIDToken.prim===a&&$.push(this),$}}ChainIDToken.prim="chain_id";class EncodeTicketError extends TaquitoError{constructor(){super(),this.name="TicketEncodeError",this.message="Tickets cannot be sent to the blockchain; they are created on-chain"}}const ticketerType$1={prim:"contract"},amountType$1={prim:"int"};class TicketToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(a){throw new EncodeTicketError}EncodeObject(a,$){if($&&$[TicketToken.prim])return $[TicketToken.prim](a,this.val);throw new EncodeTicketError}Execute(a,$){if($&&$[TicketToken.prim])return $[TicketToken.prim](a,this.val);const j=this.createToken(ticketerType$1,this.idx),et=this.valueToken,tt=this.createToken(amountType$1,this.idx);return a.args[2]===void 0&&a.args[1].args!==void 0?{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1].args[0],$),amount:tt.Execute(a.args[1].args[1],$)}:{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1],$),amount:tt.Execute(a.args[2],$)}}ExtractSchema(){return{ticketer:ContractToken.prim,value:this.valueToken.ExtractSchema(),amount:IntToken.prim}}generateSchema(){return{__michelsonType:TicketToken.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:ContractToken.prim,schema:ContractToken.prim},amount:{__michelsonType:IntToken.prim,schema:IntToken.prim}}}}findAndReturnTokens(a,$){return TicketToken.prim===a&&$.push(this),this.valueToken.findAndReturnTokens(a,$),$}}TicketToken.prim="ticket";class EncodeTicketDeprecatedError extends TaquitoError{constructor(){super(),this.name="TicketDeprecatedEncodeError",this.message="Ticket_deprecated cannot be sent to the blockchain; they are created on-chain"}}const ticketerType={prim:"contract"},amountType={prim:"int"};class TicketDeprecatedToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(a){throw new EncodeTicketDeprecatedError}EncodeObject(a,$){if($&&$[TicketDeprecatedToken.prim])return $[TicketDeprecatedToken.prim](a,this.val);throw new EncodeTicketDeprecatedError}Execute(a,$){if($&&$[TicketDeprecatedToken.prim])return $[TicketDeprecatedToken.prim](a,this.val);const j=this.createToken(ticketerType,this.idx),et=this.valueToken,tt=this.createToken(amountType,this.idx);return a.args[2]===void 0&&a.args[1].args!==void 0?{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1].args[0],$),amount:tt.Execute(a.args[1].args[1],$)}:{ticketer:j.Execute(a.args[0],$),value:et.Execute(a.args[1],$),amount:tt.Execute(a.args[2],$)}}ExtractSchema(){return{ticketer:ContractToken.prim,value:this.valueToken.ExtractSchema(),amount:IntToken.prim}}generateSchema(){return{__michelsonType:TicketDeprecatedToken.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:ContractToken.prim,schema:ContractToken.prim},amount:{__michelsonType:IntToken.prim,schema:IntToken.prim}}}}findAndReturnTokens(a,$){return TicketDeprecatedToken.prim===a&&$.push(this),this.valueToken.findAndReturnTokens(a,$),$}}TicketDeprecatedToken.prim="ticket_deprecated";class NeverTokenError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="NeverTokenError"}}class NeverToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Encode(a){const $=a.pop();throw new NeverTokenError($,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify($)}.`)}EncodeObject(a,$){if($&&$[NeverToken.prim])return $[NeverToken.prim](a);throw new NeverTokenError(a,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(a)}.`)}Execute(a){throw new NeverTokenError(a,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(a)}.`)}ExtractSchema(){return NeverToken.prim}generateSchema(){return{__michelsonType:NeverToken.prim,schema:NeverToken.prim}}findAndReturnTokens(a,$){return NeverToken.prim===a&&$.push(this),$}}NeverToken.prim="never";class SaplingStateValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="SaplingStateValidationError"}}class SaplingStateToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}isValid(a){return typeof a=="object"&&Object.keys(a).length===0}Execute(a,$){if($&&$[SaplingStateToken.prim])return $[SaplingStateToken.prim](a,this.val);if("int"in a)return a.int;throw new SaplingStateValidationError(a,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(a)}`)}Encode(a){const $=a.pop();if(this.isValid($))return[];throw new SaplingStateValidationError($,this,`Invalid sapling_state. Received: ${JSON.stringify($)} while expecting: {}`)}EncodeObject(a,$){if($&&$[SaplingStateToken.prim])return $[SaplingStateToken.prim](a);if(this.isValid(a))return[];throw new SaplingStateValidationError(a,this,`Invalid sapling_state. Received: ${JSON.stringify(a)} while expecting: {}`)}ExtractSchema(){return{[SaplingStateToken.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:SaplingStateToken.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(a,$){return SaplingStateToken.prim===a&&$.push(this),$}}SaplingStateToken.prim="sapling_state";class SaplingTransactionValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="SaplingTransactionValidationError"}}class SaplingTransactionToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){throw new SaplingTransactionValidationError(a,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(a)}.`)}validateBytes(a){const $=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(a);if($&&$[2].length%2===0)return $[2];throw new SaplingTransactionValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.validateBytes(this.convertUint8ArrayToHexString($)),{bytes:String($).toString()}}EncodeObject(a,$){return a=this.validateBytes(this.convertUint8ArrayToHexString(a)),$&&$[SaplingTransactionToken.prim]?$[SaplingTransactionToken.prim](a):{bytes:String(a).toString()}}ExtractSchema(){return{[SaplingTransactionToken.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:SaplingTransactionToken.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(a,$){return SaplingTransactionToken.prim===a&&$.push(this),$}}SaplingTransactionToken.prim="sapling_transaction";class SaplingTransactionDeprecatedValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="SaplingTransactionDeprecatedValidationError"}}class SaplingTransactionDeprecatedToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a){throw new SaplingTransactionDeprecatedValidationError(a,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(a)}.`)}validateBytes(a){const $=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(a);if($&&$[2].length%2===0)return $[2];throw new SaplingTransactionDeprecatedValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.validateBytes(this.convertUint8ArrayToHexString($)),{bytes:String($).toString()}}EncodeObject(a,$){return a=this.validateBytes(this.convertUint8ArrayToHexString(a)),$&&$[SaplingTransactionDeprecatedToken.prim]?$[SaplingTransactionDeprecatedToken.prim](a):{bytes:String(a).toString()}}ExtractSchema(){return{[SaplingTransactionDeprecatedToken.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:SaplingTransactionDeprecatedToken.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(a,$){return SaplingTransactionDeprecatedToken.prim===a&&$.push(this),$}}SaplingTransactionDeprecatedToken.prim="sapling_transaction_deprecated";class Bls12381frValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="Bls12381frValidationError"}}class Bls12381frToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new Bls12381frValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return typeof $=="number"?{int:$.toString()}:($=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$})}EncodeObject(a,$){return $&&$[Bls12381frToken.prim]?$[Bls12381frToken.prim](a):typeof a=="number"?{int:a.toString()}:(a=this.convertUint8ArrayToHexString(a),this.validate(a),{bytes:a})}Execute(a){return a.bytes}ExtractSchema(){return Bls12381frToken.prim}generateSchema(){return{__michelsonType:Bls12381frToken.prim,schema:Bls12381frToken.prim}}findAndReturnTokens(a,$){return Bls12381frToken.prim===a&&$.push(this),$}}Bls12381frToken.prim="bls12_381_fr";class Bls12381g1ValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="Bls12381g1ValidationError"}}class Bls12381g1Token extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new Bls12381g1ValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[Bls12381g1Token.prim]?$[Bls12381g1Token.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return Bls12381g1Token.prim}generateSchema(){return{__michelsonType:Bls12381g1Token.prim,schema:Bls12381g1Token.prim}}findAndReturnTokens(a,$){return Bls12381g1Token.prim===a&&$.push(this),$}}Bls12381g1Token.prim="bls12_381_g1";class Bls12381g2ValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="Bls12381g2ValidationError"}}class Bls12381g2Token extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new Bls12381g2ValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[Bls12381g2Token.prim]?$[Bls12381g2Token.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return Bls12381g2Token.prim}generateSchema(){return{__michelsonType:Bls12381g2Token.prim,schema:Bls12381g2Token.prim}}findAndReturnTokens(a,$){return Bls12381g2Token.prim===a&&$.push(this),$}}Bls12381g2Token.prim="bls12_381_g2";class ChestValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ChestValidationError"}}class ChestToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2==0))throw new ChestValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[ChestToken.prim]?$[ChestToken.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return ChestToken.prim}generateSchema(){return{__michelsonType:ChestToken.prim,schema:ChestToken.prim}}findAndReturnTokens(a,$){return ChestToken.prim===a&&$.push(this),$}}ChestToken.prim="chest";class ChestKeyValidationError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="ChestKeyValidationError"}}class ChestKeyToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}validate(a){if(!(/^[0-9a-fA-F]*$/.test(a)&&a.length%2===0))throw new ChestKeyValidationError(a,this,`Invalid bytes: ${JSON.stringify(a)}`)}convertUint8ArrayToHexString(a){return a.constructor===Uint8Array?Buffer$g.from(a).toString("hex"):a}Encode(a){let $=a.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(a,$){return a=this.convertUint8ArrayToHexString(a),this.validate(a),$&&$[ChestKeyToken.prim]?$[ChestKeyToken.prim](a):{bytes:a}}Execute(a){return a.bytes}ExtractSchema(){return ChestKeyToken.prim}generateSchema(){return{__michelsonType:ChestKeyToken.prim,schema:ChestKeyToken.prim}}findAndReturnTokens(a,$){return ChestKeyToken.prim===a&&$.push(this),$}}ChestKeyToken.prim="chest_key";class GlobalConstantEncodingError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="GlobalConstantEncodingError"}}class GlobalConstantDecodingError extends TokenValidationError{constructor(a,$,j){super(a,$,j),this.value=a,this.token=$,this.name="GlobalConstantDecodingError"}}class GlobalConstantToken extends Token{constructor(a,$,j){super(a,$,j),this.val=a,this.idx=$,this.fac=j}Execute(a,$){if($&&$[GlobalConstantToken.prim])return $[GlobalConstantToken.prim](a,this.val);throw new GlobalConstantDecodingError(a,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(a){throw new GlobalConstantEncodingError(a,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(a,$){if($&&$[GlobalConstantToken.prim])return $[GlobalConstantToken.prim](a);throw new GlobalConstantEncodingError(a,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}ExtractSchema(){return GlobalConstantToken.prim}generateSchema(){return{__michelsonType:GlobalConstantToken.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(a,$){return GlobalConstantToken.prim===a&&$.push(this),$}}GlobalConstantToken.prim="constant";const tokens=[PairToken,NatToken,StringToken,BigMapToken,AddressToken,MapToken,BoolToken,OrToken,ContractToken,ListToken,MutezToken,BytesToken,OptionToken,TimestampToken,IntToken,UnitToken,KeyToken,KeyHashToken,SignatureToken,LambdaToken,OperationToken,SetToken,ChainIDToken,TicketToken,TicketDeprecatedToken,NeverToken,SaplingStateToken,SaplingTransactionToken,SaplingTransactionDeprecatedToken,Bls12381frToken,Bls12381g1Token,Bls12381g2Token,ChestToken,ChestKeyToken,GlobalConstantToken];class InvalidTokenError extends TaquitoError{constructor(a,$){super(a),this.message=a,this.data=$,this.name="Invalid token error"}}function createToken(_,a){if(Array.isArray(_))return new PairToken(_,a,createToken);const $=tokens.find(j=>j.prim===_.prim);if(!$)throw new InvalidTokenError(`Malformed data: ${JSON.stringify(_)}. Expected a value with a valid prim property`,_);return new $(_,a,createToken)}class ParameterEncodingError extends InvalidViewParameterError{constructor(a,$,j,et){super(a,$,j,et),this.viewName=a,this.sigs=$,this.args=j,this.cause=et,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(j)} received for name "${a}" expecting one of the following signatures ${JSON.stringify($)}`}}class InvalidScriptError extends TaquitoError{constructor(a,$){super(),this.script=a,this.reason=$,this.name="InvalidScriptError";let j="Invalid on-chain view found in the following script.";$&&(j+=` Reason: ${$}.`),j+=`Script: ${JSON.stringify(a)}`,this.message=j}}class InvalidRpcResponseError extends TaquitoError{constructor(a,$){super(),this.script=a,this.reason=$,this.name="InvalidRpcResponseError";let j="Invalid RPC response passed as argument(s).";$&&(j+=` Reason: ${$}.`),j+=` Received: ${JSON.stringify(a)}`,this.message=j}}class InvalidBigMapSchemaError extends TaquitoError{constructor(a){super(a),this.message=a,this.name="InvalidBigMapSchemaError"}}class InvalidBigMapDiffError extends TaquitoError{constructor(a,$){super(a),this.message=a,this.value=$,this.name="InvalidBigMapDiffError"}}class BigMapEncodingError extends TaquitoError{constructor(a,$,j,et){super(),this.details=$,this.schema=j,this.value=et,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${a}. Schema is: ${JSON.stringify(j)}. The ${a} is: ${JSON.stringify(et)}. Error details: ${$}`}}class StorageEncodingError extends TaquitoError{constructor(a,$,j,et,tt){super(),this.details=$,this.schema=j,this.value=et,this.semantics=tt,this.name="StorageEncodingError",this.message=`Unable to encode ${a}. The schema is: ${JSON.stringify(j)}, the value is: ${JSON.stringify(et)}.${tt?`And the semantic is: ${JSON.stringify(tt)}`:""}. Error details: ${$}`}}class MissingArgumentError extends TaquitoError{constructor(a){super(a),this.message=a,this.name="MissingArgumentError"}}var _a;const schemaTypeSymbol=Symbol.for("taquito-schema-type-symbol");function collapse(_,a=PairToken.prim){var $,j;if(Array.isArray(_))return collapse({prim:a,args:_},a);const et=_;return et.prim===a&&et.args&&et.args.length>2?Object.assign(Object.assign({},et),{args:[($=et.args)===null||$===void 0?void 0:$[0],{prim:a,args:(j=et.args)===null||j===void 0?void 0:j.slice(1)}]}):et}function deepEqual(_,a){if(_===void 0||a===void 0)return _===a;const $=collapse(_),j=collapse(a);return $.prim===j.prim&&($.args===void 0&&j.args===void 0||$.args!==void 0&&j.args!==void 0&&$.args.length===j.args.length&&$.args.every((et,tt)=>{var rt,nt;return deepEqual(et,(nt=(rt=j.args)===null||rt===void 0?void 0:rt[tt])!==null&&nt!==void 0?nt:{})}))&&($.annots===void 0&&j.annots===void 0||$.annots!==void 0&&j.annots!==void 0&&$.annots.length===j.annots.length&&$.annots.every((et,tt)=>{var rt;return et===((rt=j.annots)===null||rt===void 0?void 0:rt[tt])}))}class Schema{static isSchema(a){return a&&a[schemaTypeSymbol]===!0}static fromRPCResponse(a){if(!a)throw new InvalidRpcResponseError(a,"the RPC response is empty");if(!a.script)throw new InvalidRpcResponseError(a,"the RPC response has no script");if(!Array.isArray(a.script.code))throw new InvalidRpcResponseError(a,"The response.script.code should be an array");let $=a.script.code;for(;$.length===1&&Array.isArray($[0]);)$=$[0];const j=$.find(et=>"prim"in et&&et.prim==="storage");if(!j||!Array.isArray(j.args))throw new InvalidRpcResponseError(a,'The response.script.code has an element of type {prim: "storage"}, but its args is not an array');return new Schema(j.args[0])}isExpressionExtended(a){return"prim"in a&&Array.isArray(a.args)}constructor(a){if(this.val=a,this[_a]=!0,this.root=createToken(a,0),this.root instanceof BigMapToken)this.bigMap=this.root;else if(this.isExpressionExtended(a)&&a.prim==="pair"){const $=a.args[0];this.isExpressionExtended($)&&$.prim==="big_map"&&(this.bigMap=new BigMapToken($,0,createToken))}}removeTopLevelAnnotation(a){return(this.root instanceof PairToken||this.root instanceof OrToken)&&this.root.hasAnnotations()&&typeof a=="object"&&Object.keys(a).length===1?a[Object.keys(a)[0]]:a}Execute(a,$){const j=this.root.Execute(a,$);return this.removeTopLevelAnnotation(j)}Typecheck(a){this.root instanceof BigMapToken&&Number.isInteger(Number(a))||this.root instanceof TicketToken&&a.ticketer&&a.value&&a.amount||this.root instanceof TicketDeprecatedToken&&a.ticketer&&a.value&&a.amount||this.root instanceof MapToken&&this.root.ValueSchema instanceof BigMapToken||this.root.EncodeObject(a)}ExecuteOnBigMapDiff(a,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");if(!Array.isArray(a))throw new InvalidBigMapDiffError(`Big map diff must be an array, got: ${JSON.stringify(a)}`,a);const j=a.map(({key:et,value:tt})=>({args:[et,tt]}));return this.bigMap.Execute(j,$)}ExecuteOnBigMapValue(a,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");return this.bigMap.ValueSchema.Execute(a,$)}EncodeBigMapKey(a){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(a)}catch($){throw new BigMapEncodingError("key",$,this.bigMap.KeySchema,a)}}Encode(a,$){try{return this.root.EncodeObject(a,$)}catch(j){throw j instanceof TokenValidationError?j:new StorageEncodingError("storage object",j,this.root,a,$)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(a,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");const j=a.reduce((et,tt)=>Object.assign(Object.assign({},et),this.ExecuteOnBigMapDiff(tt.contents[0].metadata.operation_result.big_map_diff)),{});return Object.assign(Object.assign({},this.Execute($)),{[this.bigMap.annot()]:j})}FindFirstInTopLevelPair(a,$){return this.findValue(this.root.val,a,$)}findValue(a,$,j){if(deepEqual(j,a))return $;if(Array.isArray(a)||a.prim==="pair"){const et=collapse(a),tt=collapse($,"Pair");if(et.args===void 0||tt.args===void 0)throw new MissingArgumentError("Tokens have no arguments");if(et.args[0])return this.findValue(et.args[0],tt.args[0],j)||this.findValue(et.args[1],tt.args[1],j)}}findToken(a){const $=[];return this.root.findAndReturnTokens(a,$)}}_a=schemaTypeSymbol;class ParameterSchema{static fromRPCResponse(a){if(!a)throw new InvalidRpcResponseError(a,"the RPC response is empty");if(!a.script)throw new InvalidRpcResponseError(a,"the RPC response has no script");if(!Array.isArray(a.script.code))throw new InvalidRpcResponseError(a,"The response.script.code should be an array");const $=a.script.code.find(j=>"prim"in j&&j.prim==="parameter");if(!$)throw new InvalidRpcResponseError(a,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray($.args))throw new InvalidRpcResponseError(a,'The response.script.code has an element of type {prim: "parameter"}, but its args is not an array');return new ParameterSchema($.args[0])}get isMultipleEntryPoint(){return this.root instanceof OrToken||this.root instanceof OptionToken&&this.root.subToken()instanceof OrToken}get hasAnnotation(){return this.isMultipleEntryPoint?Object.keys(this.ExtractSchema())[0]!=="0":!0}constructor(a){this.root=createToken(a,0)}Execute(a,$){return this.root.Execute(a,$)}Encode(...a){try{return this.root.Encode(a.reverse())}catch($){throw $ instanceof TokenValidationError?$:new ParameterEncodingError("Unable to encode parameter",this.root,a,$)}}EncodeObject(a,$){try{return this.root.EncodeObject(a,$)}catch(j){throw j instanceof TokenValidationError?j:new ParameterEncodingError("Unable to encode parameter object",this.root,a,j)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class ViewSchema{static fromRPCResponse(a){const $=[],j=a&&a.script&&Array.isArray(a.script.code)&&a.script.code.filter(et=>et.prim==="view");return j&&j.forEach(et=>{$.push(new ViewSchema(et.args))}),$}constructor(a){if(!a)throw new InvalidScriptError(a,"the args are not defined");if(a.length!==4)throw new InvalidScriptError(a,"there should be exactly 4 arguments");if(!("string"in a[0])||!a[0].string)throw new InvalidScriptError(a,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=a[0].string,this.viewArgsType=a[1],this.viewReturnType=a[2],this.instructions=a[3],this.rootArgsType=createToken(this.viewArgsType,0),this.rootReturnType=createToken(this.viewReturnType,0)}encodeViewArgs(a){try{return this.rootArgsType.EncodeObject(a)}catch($){throw new ParameterEncodingError(this.viewName,void 0,a,$)}}decodeViewResult(a,$){return this.rootReturnType.Execute(a,$)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}class EventSchema{constructor(a,$){this.tag=a,this.type=$}static fromMichelineValue(a){var $,j;return new EventSchema(($=a.annots)===null||$===void 0?void 0:$[0],(j=a.args)===null||j===void 0?void 0:j[0])}static fromRPCResponse(a){const $=[];return a.script.code.forEach(j=>{!("prim"in j)||j.prim!=="code"||!("args"in j)||!j.args||$.push(...EventSchema.extractEventsRecursively(j.args))}),EventSchema.removeDuplicates($)}static removeDuplicates(a){const $=[];return a.forEach(j=>{$.findIndex(tt=>tt.tag===j.tag&&deepEqual(tt.type,j.type))===-1&&$.push(j)}),$}static extractEventsRecursively(a){return Array.isArray(a)?a.flatMap($=>EventSchema.extractEventsRecursively($)):"prim"in a?a.prim==="EMIT"?[EventSchema.fromMichelineValue(a)]:!("args"in a)||!a.args?[]:a.args.flatMap($=>EventSchema.extractEventsRecursively($)):[]}}const UnitValue=Symbol(),sourceReference=Symbol("source_reference");class ScanError extends TaquitoError{constructor(a,$,j){super(),this.src=a,this.idx=$,this.message=j,this.name="ScanError"}}var Literal;(function(_){_[_.Comment=0]="Comment",_[_.Number=1]="Number",_[_.String=2]="String",_[_.Bytes=3]="Bytes",_[_.Ident=4]="Ident"})(Literal||(Literal={}));const isSpace=new RegExp("\\s"),isIdentStart=new RegExp("[:@%_A-Za-z]"),isIdent=new RegExp("[@%_\\.A-Za-z0-9]"),isDigit=new RegExp("[0-9]"),isHex=new RegExp("[0-9a-fA-F]");function*scan(_,a=!1){let $=0;for(;$<_.length;){for(;$<_.length&&isSpace.test(_[$]);)$++;if($===_.length)return;const j=_[$],et=$;if(isIdentStart.test(j)){for($++;$<_.length&&isIdent.test(_[$]);)$++;yield{t:Literal.Ident,v:_.slice(et,$),first:et,last:$}}else if(_.length-$>1&&_.substring($,$+2)==="0x"){for($+=2;$<_.length&&isHex.test(_[$]);)$++;if($-et&1)throw new ScanError(_,$,"Bytes literal length is expected to be power of two");yield{t:Literal.Bytes,v:_.slice(et,$),first:et,last:$}}else if(isDigit.test(j)||j==="-"){j==="-"&&$++;const tt=$;for(;$<_.length&&isDigit.test(_[$]);)$++;if(tt===$)throw new ScanError(_,$,"Number literal is too short");yield{t:Literal.Number,v:_.slice(et,$),first:et,last:$}}else if(j==='"'){$++;let tt=!1;for(;$<_.length&&(tt||_[$]!=='"');$++)!tt&&_[$]==="\\"?tt=!0:tt=!1;if($===_.length)throw new ScanError(_,$,"Unterminated string literal");$++,yield{t:Literal.String,v:_.slice(et,$),first:et,last:$}}else if(j==="#"){for($++;$<_.length&&_[$]!==` +`;)$++;a&&(yield{t:Literal.Comment,v:_.slice(et,$),first:et,last:$})}else if(_.length-$>1&&_.substring($,$+2)==="/*"){for($+=2;$<_.length&&!(_.length-$>1&&_.substring($,$+2)==="*/");)$++;if($===_.length)throw new ScanError(_,$,"Unterminated C style comment");$+=2,a&&(yield{t:Literal.Comment,v:_.slice(et,$),first:et,last:$})}else if(j==="("||j===")"||j==="{"||j==="}"||j===";")$++,yield{t:j,v:j,first:et,last:$};else throw new ScanError(_,$,`Invalid character at offset ${$}: \`${j}'`)}}const refContract=Symbol("ref_contract");var Protocol;(function(_){_.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",_.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",_.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",_.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",_.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",_.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",_.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",_.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",_.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",_.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",_.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",_.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",_.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",_.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",_.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",_.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",_.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",_.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",_.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",_.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",_.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",_.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",_.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",_.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",_.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",_.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(Protocol||(Protocol={}));const DefaultProtocol=Protocol.Psithaca2,protoLevel={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:12,PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw:13,PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY:13,PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg:14,PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW:15,PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc:16,PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1:16,PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf:17,ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH:19,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:20};function ProtoInferiorTo(_,a){return protoLevel[_][dt+1,mt]),et+=ot,tt+=ut;break}case"I":tt!==$.length&&(rt[1]=$[tt++]);break;default:throw new MacroError(_,`${_.prim}: unexpected character: ${it}`)}return{r:j(nt,at,[0,rt]),n:et,an:tt}}function parseSetMapCadr(_,a,$,j){const et=a[0];switch(et){case"A":return a.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},parseSetMapCadr(_,a.slice(1),[],j)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...$]}]:j.a;case"D":return a.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},parseSetMapCadr(_,a.slice(1),[],j)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...$]}]:j.d;default:throw new MacroError(_,`${_.prim}: unexpected character: ${et}`)}}function trimLast(_,a){let $=_.length;for(;$>0&&_[$-1]===a;)$--;return _.slice(0,$)}function filterAnnotations(_){const a=[],$=[];if(_!==void 0)for(const j of _)(j.length!==0&&j[0]==="%"?a:$).push(j);return{fields:a,rest:$}}function mkPrim({prim:_,annots:a,args:$}){return Object.assign(Object.assign({prim:_},a&&{annots:a}),$&&{args:$})}const pairRe=/^P[PAI]{3,}R$/,unpairRe=/^UNP[PAI]{2,}R$/,cadrRe=/^C[AD]{2,}R$/,setCadrRe=/^SET_C[AD]+R$/,mapCadrRe=/^MAP_C[AD]+R$/,diipRe=/^DI{2,}P$/,duupRe=/^DU+P$/;function expandMacros(_,a){const $=(a==null?void 0:a.protocol)||DefaultProtocol;function j(et){return et!==void 0?[{prim:"RENAME",annots:et}]:[]}switch(_.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(assertArgs$1(_,0))return[{prim:"COMPARE"},mkPrim({prim:_.prim.slice(3),annots:_.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(assertArgs$1(_,2))return[{prim:_.prim.slice(2)},mkPrim({prim:"IF",annots:_.annots,args:_.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(assertArgs$1(_,2))return[{prim:"COMPARE"},{prim:_.prim.slice(5)},mkPrim({prim:"IF",annots:_.annots,args:_.args})];break;case"FAIL":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:_.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[[{prim:"COMPARE"},{prim:_.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(assertArgs$1(_,0)&&assertNoAnnots(_))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(assertArgs$1(_,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],j(_.annots)]}];break;case"ASSERT_LEFT":if(assertArgs$1(_,0))return[{prim:"IF_LEFT",args:[j(_.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(assertArgs$1(_,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],j(_.annots)]}];break;case"IF_SOME":if(assertArgs$1(_,2))return[mkPrim({prim:"IF_NONE",annots:_.annots,args:[_.args[1],_.args[0]]})];break;case"IF_RIGHT":if(assertArgs$1(_,2))return[mkPrim({prim:"IF_LEFT",annots:_.annots,args:[_.args[1],_.args[0]]})];break;case"CAR":case"CDR":if(_.args!==void 0){if(assertArgs$1(_,1)&&assertIntArg(_,_.args[0])){const et=parseInt(_.args[0].int,10);return mkPrim({prim:"GET",args:[{int:_.prim==="CAR"?String(et*2+1):String(et*2)}],annots:_.annots})}}else return _}if(pairRe.test(_.prim)&&assertArgs$1(_,0)){const{fields:et,rest:tt}=filterAnnotations(_.annots),{r:rt}=parsePairUnpairExpr(_,_.prim.slice(1),et,(nt,it,at)=>[...nt||[],...it||[],at]);return rt.map(([nt,it],at)=>{const st=[...trimLast(it,null).map(ut=>ut===null?"%":ut),...nt===0&&at===rt.length-1?tt:[]],ot=mkPrim({prim:"PAIR",annots:st.length!==0?st:void 0});return nt===0?ot:{prim:"DIP",args:nt===1?[[ot]]:[{int:String(nt)},[ot]]}})}if(unpairRe.test(_.prim))if(ProtoInferiorTo($,Protocol.PtEdo2Zk)&&assertArgs$1(_,0)){const{r:et}=parsePairUnpairExpr(_,_.prim.slice(3),_.annots||[],(tt,rt,nt)=>[nt,...rt||[],...tt||[]]);return et.map(([tt,rt])=>{const nt=[{prim:"DUP"},mkPrim({prim:"CAR",annots:rt[0]!==null?[rt[0]]:void 0}),{prim:"DIP",args:[[mkPrim({prim:"CDR",annots:rt[1]!==null?[rt[1]]:void 0})]]}];return tt===0?nt:{prim:"DIP",args:tt===1?[[nt]]:[{int:String(tt)},[nt]]}})}else{if(_.prim==="UNPAIR")return _;if(assertArgs$1(_,0)){const{r:et}=parsePairUnpairExpr(_,_.prim.slice(3),[],(tt,rt,nt)=>[nt,...rt||[],...tt||[]]);return et.map(([tt])=>{const rt=mkPrim({prim:"UNPAIR"});return tt===0?rt:{prim:"DIP",args:tt===1?[[rt]]:[{int:String(tt)},[rt]]}})}}if(cadrRe.test(_.prim)&&assertArgs$1(_,0)){const et=[..._.prim.slice(1,_.prim.length-1)];return et.map((tt,rt)=>{const nt=rt===et.length-1?_.annots:void 0;switch(tt){case"A":return mkPrim({prim:"CAR",annots:nt});case"D":return mkPrim({prim:"CDR",annots:nt});default:throw new MacroError(_,`unexpected character: ${tt}`)}})}if(setCadrRe.test(_.prim)&&assertArgs$1(_,0)){const{fields:et,rest:tt}=filterAnnotations(_.annots);if(et.length>1)throw new MacroError(_,`unexpected annotation on macro ${_.prim}: ${et}`);const rt=et.length!==0?{a:[{prim:"DUP"},{prim:"CAR",annots:et},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[et[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:et},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",et[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return parseSetMapCadr(_,_.prim.slice(5,_.prim.length-1),tt,rt)}if(mapCadrRe.test(_.prim)&&assertArgs$1(_,1)){const{fields:et}=filterAnnotations(_.annots);if(et.length>1)throw new MacroError(_,`unexpected annotation on macro ${_.prim}: ${et}`);const tt={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[mkPrim({prim:"CAR",annots:et.length!==0?["@"+et[0].slice(1)]:void 0}),_.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[et.length!==0?et[0]:"%","%@"]}],d:[{prim:"DUP"},mkPrim({prim:"CDR",annots:et.length!==0?["@"+et[0].slice(1)]:void 0}),_.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",et.length!==0?et[0]:"%"]}]};return parseSetMapCadr(_,_.prim.slice(5,_.prim.length-1),[],tt)}if(diipRe.test(_.prim)&&assertArgs$1(_,1)){let et=0;for(;_.prim[1+et]==="I";)et++;return mkPrim({prim:"DIP",args:[{int:String(et)},_.args[0]]})}if(duupRe.test(_.prim)){let et=0;for(;_.prim[1+et]==="U";)et++;if(ProtoInferiorTo($,Protocol.PtEdo2Zk)){if(et===1){if(_.args===void 0)return _;assertArgs$1(_,1)&&assertIntArg(_,_.args[0])&&(et=parseInt(_.args[0].int,10))}else assertArgs$1(_,0);return et===1?[mkPrim({prim:"DUP",annots:_.annots})]:et===2?[{prim:"DIP",args:[[mkPrim({prim:"DUP",annots:_.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(et-1)},[mkPrim({prim:"DUP",annots:_.annots})]]},{prim:"DIG",args:[{int:String(et)}]}]}else{if(et===1)return _;if(assertArgs$1(_,0))return mkPrim({prim:"DUP",args:[{int:String(et)}],annots:_.annots})}}return _}function expandGlobalConstants(_,a){return _.args!==void 0&&_.args.length===1&&"string"in _.args[0]&&_.args[0].string in a?a[_.args[0].string]:_}class MichelineParseError extends TaquitoError{constructor(a,$){super(),this.token=a,this.message=$,this.name="MichelineParseError"}}class JSONParseError extends TaquitoError{constructor(a,$){super(),this.node=a,this.message=$,this.name="JSONParseError"}}const errEOF=new MichelineParseError(null,"Unexpected EOF");function isAnnotation(_){return _.t===Literal.Ident&&(_.v[0]==="@"||_.v[0]==="%"||_.v[0]===":")}const intRe=new RegExp("^-?[0-9]+$"),bytesRe=new RegExp("^([0-9a-fA-F]{2})*$");let Parser$1=class{constructor(a){this.opt=a}expand(a){var $,j,et;if((($=this.opt)===null||$===void 0?void 0:$.expandGlobalConstant)!==void 0&&a.prim==="constant"){const tt=expandGlobalConstants(a,this.opt.expandGlobalConstant);return tt!==a&&(tt[sourceReference]=Object.assign(Object.assign({},a[sourceReference]||{first:0,last:0}),{globalConstant:a})),tt}if(((j=this.opt)===null||j===void 0?void 0:j.expandMacros)===void 0||!((et=this.opt)===null||et===void 0)&&et.expandMacros){const tt=expandMacros(a,this.opt);return tt!==a&&(tt[sourceReference]=Object.assign(Object.assign({},a[sourceReference]||{first:0,last:0}),{macro:a})),tt}else return a}parseListExpr(a,$){var j;const et={first:$.first,last:$.last},tt=$.t==="(";let rt;if(tt){if(rt=a.next(),rt.done)throw errEOF;et.last=rt.value.last}else rt={value:$};if(rt.value.t!==Literal.Ident)throw new MichelineParseError(rt.value,`not an identifier: ${rt.value.v}`);const nt={prim:rt.value.v,[sourceReference]:et};for(;;){const it=a.next();if(it.done){if(tt)throw errEOF;break}else if(it.value.t===")"){if(!tt)throw new MichelineParseError(it.value,"unexpected closing bracket");et.last=it.value.last;break}else if(isAnnotation(it.value))nt.annots=nt.annots||[],nt.annots.push(it.value.v),et.last=it.value.last;else{nt.args=nt.args||[];const at=this.parseExpr(a,it.value);et.last=((j=at[sourceReference])===null||j===void 0?void 0:j.last)||et.last,nt.args.push(at)}}return this.expand(nt)}parseArgs(a,$){var j;const et={first:$.first,last:$.last},tt={prim:$.v,[sourceReference]:et};for(;;){const rt=a.next();if(rt.done||rt.value.t==="}"||rt.value.t===";")return[tt,rt];if(isAnnotation(rt.value))et.last=rt.value.last,tt.annots=tt.annots||[],tt.annots.push(rt.value.v);else{const nt=this.parseExpr(a,rt.value);et.last=((j=nt[sourceReference])===null||j===void 0?void 0:j.last)||et.last,tt.args=tt.args||[],tt.args.push(nt)}}}parseSequenceExpr(a,$){var j,et;const tt={first:$.first,last:$.last},rt=[];rt[sourceReference]=tt;const nt=$.t==="{";let it=$.t==="{"?null:{value:$};for(;;){if(it===null&&(it=a.next(),it.done||(tt.last=it.value.last)),it.done){if(nt)throw errEOF;return rt}if(it.value.t==="}"){if(nt)return rt;throw new MichelineParseError(it.value,"unexpected closing bracket")}else if(it.value.t===Literal.Ident){const[at,st]=this.parseArgs(a,it.value);tt.last=((j=at[sourceReference])===null||j===void 0?void 0:j.last)||tt.last,rt.push(this.expand(at)),it=st}else{const at=this.parseExpr(a,it.value);tt.last=((et=at[sourceReference])===null||et===void 0?void 0:et.last)||tt.last,rt.push(at),it=null}it===null&&(it=a.next(),it.done||(tt.last=it.value.last)),!it.done&&it.value.t===";"&&(it=null)}}parseExpr(a,$){switch($.t){case Literal.Ident:return this.expand({prim:$.v,[sourceReference]:{first:$.first,last:$.last}});case Literal.Number:return{int:$.v,[sourceReference]:{first:$.first,last:$.last}};case Literal.String:return{string:JSON.parse($.v),[sourceReference]:{first:$.first,last:$.last}};case Literal.Bytes:return{bytes:$.v.slice(2),[sourceReference]:{first:$.first,last:$.last}};case"{":return this.parseSequenceExpr(a,$);default:return this.parseListExpr(a,$)}}parseSequence(a){if(typeof a!="string")throw new TypeError(`string type was expected, got ${typeof a} instead`);const $=scan(a),j=$.next();return j.done?null:this.parseSequenceExpr($,j.value)}parseList(a){if(typeof a!="string")throw new TypeError(`string type was expected, got ${typeof a} instead`);const $=scan(a),j=$.next();return j.done?null:this.parseListExpr($,j.value)}parseMichelineExpression(a){if(typeof a!="string")throw new TypeError(`string type was expected, got ${typeof a} instead`);const $=scan(a),j=$.next();return j.done?null:this.parseExpr($,j.value)}parseScript(a){return this.parseSequence(a)}parseData(a){return this.parseList(a)}parseJSON(a){if(typeof a!="object")throw new TypeError(`object type was expected, got ${typeof a} instead`);if(Array.isArray(a)){const $=[];for(const j of a){if(j===null||typeof j!="object")throw new JSONParseError(j,`unexpected sequence element: ${j}`);$.push(this.parseJSON(j))}return $}else if("prim"in a){const $=a;if(typeof $.prim=="string"&&($.annots===void 0||Array.isArray($.annots))&&($.args===void 0||Array.isArray($.args))){const j={prim:$.prim};if($.annots!==void 0){for(const et of $.annots)if(typeof et!="string")throw new JSONParseError(et,`string expected: ${et}`);j.annots=$.annots}if($.args!==void 0){j.args=[];for(const et of $.args){if(et===null||typeof et!="object")throw new JSONParseError(et,`unexpected argument: ${et}`);j.args.push(this.parseJSON(et))}}return this.expand(j)}throw new JSONParseError(a,`malformed prim expression: ${a}`)}else if("string"in a){if(typeof a.string=="string")return{string:a.string};throw new JSONParseError(a,`malformed string literal: ${a}`)}else if("int"in a){if(typeof a.int=="string"&&intRe.test(a.int))return{int:a.int};throw new JSONParseError(a,`malformed int literal: ${a}`)}else if("bytes"in a){if(typeof a.bytes=="string"&&bytesRe.test(a.bytes))return{bytes:a.bytes};throw new JSONParseError(a,`malformed bytes literal: ${a}`)}else throw new JSONParseError(a,`unexpected object: ${a}`)}};const H=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],K=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class Base58DecodingError extends TaquitoError{constructor(a){super(),this.message=a,this.name="Base58DecodingError"}}function sha256(_){const a=(_.length+9)%64,$=a===0?0:64-a;if(_.length>268435455)throw new InvalidMessageError("",`: Invalid length ${_.length} is too big -- SHA-256.`);const j=_.length<<3,et=[..._,128,...new Array($).fill(0),0,0,0,0,j>>24&255,j>>16&255,j>>8&255,j&255];function tt(st,ot){return st>>>ot|st<<32-ot}const rt=[...H],nt=new Array(64),it=new Array(8);for(let st=0;st>>3,mt=tt(nt[ut-2],17)^tt(nt[ut-2],19)^nt[ut-2]>>>10;nt[ut]=(mt|0)+nt[ut-7]+dt+nt[ut-16]|0,ut++}for(let dt=0;dt<8;dt++)it[dt]=rt[dt];for(let dt=0;dt<64;dt++){const mt=tt(it[0],2)^tt(it[0],13)^tt(it[0],22),xt=tt(it[4],6)^tt(it[4],11)^tt(it[4],25),Ct=it[7]+xt+(it[4]&it[5]^~it[4]&it[6])+K[dt]+nt[dt]|0,Pt=mt+(it[0]&it[1]^it[0]&it[2]^it[1]&it[2])|0;it[7]=it[6],it[6]=it[5],it[5]=it[4],it[4]=it[3]+Ct|0,it[3]=it[2],it[2]=it[1],it[1]=it[0],it[0]=Ct+Pt|0}for(let dt=0;dt<8;dt++)rt[dt]=rt[dt]+it[dt]|0}const at=[];for(const st of rt)at.push(st>>24&255),at.push(st>>16&255),at.push(st>>8&255),at.push(st&255);return at}const base58alphabetFwd=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57];function byteAt(_,a){const $=_.charCodeAt(a)-49;if($>=base58alphabetFwd.length||base58alphabetFwd[$]===-1)throw new Base58DecodingError(`Unexpected character at position ${a}: ${_[a]}`);return base58alphabetFwd[$]}function decodeBase58(_){const a=[];let $=0;for(;$<_.length&&byteAt(_,$)===0;)$++;let j=$;for(;$<_.length;){let et=byteAt(_,$++),tt=0;for(;et!==0||tt0;)a.push(0);return a.reverse()}function decodeBase58Check(_){const a=decodeBase58(_);if(a.length<4)throw new Base58DecodingError(`Data is too short ${a.length}`);const $=a.slice(0,a.length-4),j=a.slice(a.length-4),et=sha256(sha256($));if(j[0]!==et[0]||j[1]!==et[1]||j[2]!==et[2]||j[3]!==et[3])throw new Base58DecodingError("Invalid checksum");return $}class InvalidMichelsonError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidMichelsonError"}}class InvalidTypeExpressionError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidTypeExpressionError"}}class InvalidDataExpressionError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidDataExpressionError"}}class InvalidEntrypointError extends ParameterValidationError{constructor(a){super(),this.entrypoint=a,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${a}"`}}class LongIntegerError extends TaquitoError{constructor(a){super(),this.message=a,this.name="LongIntegerError"}}class MichelsonError extends TaquitoError{constructor(a,$){super(),this.val=a,this.message=$,this.name="MichelsonError"}}class MichelsonTypeError extends MichelsonError{constructor(a,$,j){super(a,$),this.val=a,this.message=$,this.name="MichelsonTypeError",j!==void 0&&(this.data=j)}}class LongInteger{append(a){let $=0;for(;a!==0||$57)throw new LongIntegerError(`unexpected character in integer constant "${a[$]}"`);this.append(j-48)}}else a<0?(this.neg=!0,this.append(-a)):this.append(a)}cmp(a){if(this.neg!==a.neg)return(a.neg?1:0)-(this.neg?1:0);{let $=0;if(this.buf.length!==a.buf.length)$=this.buf.length=0&&this.buf[j]===a.buf[j];)j--;$=j<0?0:this.buf[j]=0}catch{return!1}}const annRe=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function unpackAnnotations(_,a){if(Array.isArray(_))return{};let $,j,et;if(_.annots!==void 0){for(const tt of _.annots)if(tt.length!==0){if(!annRe.test(tt)||!(a!=null&&a.specialVar)&&(tt==="@%"||tt==="@%%")||!(a!=null&&a.specialFields)&&tt==="%@")throw new MichelsonError(_,`${_.prim}: unexpected annotation: ${tt}`);switch(tt[0]){case"%":(a!=null&&a.emptyFields||tt.length>1)&&($=$||[],$.push(tt));break;case":":tt.length>1&&(j=j||[],j.push(tt));break;case"@":(a!=null&&a.emptyVar||tt.length>1)&&(et=et||[],et.push(tt));break}}}return{f:$,t:j,v:et}}const tezosPrefix={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]],RollupAddress:[20,[1,128,120,31]]};function checkDecodeTezosID(_,...a){const $=decodeBase58Check(_);for(const j of a){const[et,tt]=tezosPrefix[j];if($.length===et+tt.length){let rt=0;for(;rt0?assertArgs(_,1):assertArgs(_,0);break;default:throw new MichelsonValidationError(_,"instruction expected")}}return!0}function assertMichelsonComparableType(_){if(assertPrimOrSeq(_)){if(Array.isArray(_)||_.prim==="pair"||_.prim==="or"||_.prim==="option")traverseType(_,a=>assertMichelsonComparableType(a));else if(!Object.prototype.hasOwnProperty.call(simpleComparableTypeIDs,_.prim))throw new MichelsonValidationError(_,`${_.prim}: type is not comparable`)}return!0}function assertMichelsonPackableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="big_map"||_.prim==="operation"||_.prim==="sapling_state"||_.prim==="ticket")throw new MichelsonValidationError(_,`${_.prim}: type can't be used inside PACK/UNPACK instructions`);traverseType(_,a=>assertMichelsonPackableType(a))}return!0}function assertMichelsonPushableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="big_map"||_.prim==="operation"||_.prim==="sapling_state"||_.prim==="ticket"||_.prim==="contract")throw new MichelsonValidationError(_,`${_.prim}: type can't be pushed`);traverseType(_,a=>assertMichelsonPushableType(a))}return!0}function assertMichelsonStorableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="operation"||_.prim==="contract")throw new MichelsonValidationError(_,`${_.prim}: type can't be used as part of a storage`);traverseType(_,a=>assertMichelsonStorableType(a))}return!0}function assertMichelsonPassableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="operation")throw new MichelsonValidationError(_,`${_.prim}: type can't be used as part of a parameter`);traverseType(_,a=>assertMichelsonPassableType(a))}return!0}function assertMichelsonBigMapStorableType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim)||_.prim==="big_map"||_.prim==="operation"||_.prim==="sapling_state")throw new MichelsonValidationError(_,`${_.prim}: type can't be used inside a big_map`);traverseType(_,a=>assertMichelsonBigMapStorableType(a))}return!0}const viewRe=new RegExp("^[a-zA-Z0-9_.%@]*$");function assertViewNameValid(_){if(_.string.length>maxViewNameLength)throw new MichelsonValidationError(_,`view name too long: ${_.string}`);if(!viewRe.test(_.string))throw new MichelsonValidationError(_,`invalid character(s) in view name: ${_.string}`)}function assertMichelsonType(_){if(assertPrimOrSeq(_)&&isPrim$1(_)){if(!Object.prototype.hasOwnProperty.call(typeIDs,_.prim))throw new MichelsonValidationError(_,"type expected");traverseType(_,a=>assertMichelsonType(a))}return!0}function traverseType(_,a){if(Array.isArray(_)||_.prim==="pair"){const $=Array.isArray(_)?_:_.args;if($===void 0||$.length<2)throw new MichelsonValidationError(_,"at least 2 arguments expected");return $.forEach(j=>{assertPrimOrSeq(j)&&a(j)}),!0}switch(_.prim){case"option":case"list":assertArgs(_,1)&&assertPrimOrSeq(_.args[0])&&a(_.args[0]);break;case"contract":assertArgs(_,1)&&assertMichelsonPassableType(_.args[0]);break;case"or":assertArgs(_,2)&&assertPrimOrSeq(_.args[0])&&assertPrimOrSeq(_.args[1])&&(a(_.args[0]),a(_.args[1]));break;case"lambda":assertArgs(_,2)&&(assertMichelsonType(_.args[0]),assertMichelsonType(_.args[1]));break;case"set":assertArgs(_,1)&&assertMichelsonComparableType(_.args[0]);break;case"map":assertArgs(_,2)&&assertPrimOrSeq(_.args[0])&&assertPrimOrSeq(_.args[1])&&(assertMichelsonComparableType(_.args[0]),a(_.args[1]));break;case"big_map":assertArgs(_,2)&&assertPrimOrSeq(_.args[0])&&assertPrimOrSeq(_.args[1])&&(assertMichelsonComparableType(_.args[0]),assertMichelsonBigMapStorableType(_.args[1]),a(_.args[1]));break;case"ticket":assertArgs(_,1)&&assertPrimOrSeq(_.args[0])&&assertMichelsonComparableType(_.args[0]);break;case"sapling_state":case"sapling_transaction":assertArgs(_,1)&&assertIntLiteral(_.args[0]);break;default:assertArgs(_,0)}return!0}function assertMichelsonData(_){if("int"in _||"string"in _||"bytes"in _)return!0;if(Array.isArray(_)){let a=0;for(const $ of _)isPrim$1($)&&$.prim==="Elt"?(assertArgs($,2)&&(assertMichelsonData($.args[0]),assertMichelsonData($.args[1])),a++):assertMichelsonData($);if(a!==0&&a!==_.length)throw new MichelsonValidationError(_,"data entries and map elements can't be intermixed");return!0}if(isPrim$1(_))switch(_.prim){case"Unit":case"True":case"False":case"None":assertArgs(_,0);break;case"Pair":if(_.args===void 0||_.args.length<2)throw new MichelsonValidationError(_,"at least 2 arguments expected");for(const a of _.args)assertMichelsonData(a);break;case"Left":case"Right":case"Some":assertArgs(_,1)&&assertMichelsonData(_.args[0]);break;case"Lambda_rec":_.args&&assertMichelsonInstruction(_.args);break;default:if(Object.prototype.hasOwnProperty.call(instructionIDs,_.prim))assertMichelsonInstruction(_);else throw new MichelsonValidationError(_,"data entry or instruction expected")}else throw new MichelsonValidationError(_,"data entry expected");return!0}function assertMichelsonContract(_){if(assertSeq(_)){const a={},$={};for(const j of _)if(assertPrim(j)){if(j.prim!=="view"){if(j.prim in a)throw new MichelsonValidationError(_,`duplicate contract section: ${j.prim}`);a[j.prim]=!0}switch(j.prim){case"code":assertArgs(j,1)&&assertSeq(j.args[0])&&assertMichelsonInstruction(j.args[0]);break;case"parameter":if(assertArgs(j,1)&&assertMichelsonPassableType(j.args[0]),j.annots)throw new MichelsonValidationError(j,"Annotation must be part of the parameter type");break;case"storage":assertArgs(j,1)&&assertMichelsonStorableType(j.args[0]);break;case"view":if(assertArgs(j,4)){if(assertStringLiteral(j.args[0])){const et=j.args[0];if(et.string in $)throw new MichelsonValidationError(_,`duplicate view name: ${et.string}`);$[et.string]=!0,assertViewNameValid(et)}assertMichelsonPushableType(j.args[1]),assertMichelsonPushableType(j.args[2]),assertSeq(j.args[3])&&assertMichelsonInstruction(j.args[3])}break;default:throw new MichelsonValidationError(_,`unexpected contract section: ${j.prim}`)}}}return!0}function isInstruction(_){return Object.prototype.hasOwnProperty.call(instructionIDs,_.prim)}function assertDataListIfAny(_){if(!Array.isArray(_))return!1;for(const a of _)if("prim"in a){if(isInstruction(a))throw new MichelsonError(_,`Instruction outside of a lambda: ${JSON.stringify(_)}`);if(a.prim==="Elt")throw new MichelsonError(_,`Elt item outside of a map literal: ${JSON.stringify(_)}`)}return!0}function __rest$1(_,a){var $={};for(var j in _)Object.prototype.hasOwnProperty.call(_,j)&&a.indexOf(j)<0&&($[j]=_[j]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(_);et({[_]:a})));var Tag;(function(_){_[_.Int=0]="Int",_[_.String=1]="String",_[_.Sequence=2]="Sequence",_[_.Prim0=3]="Prim0",_[_.Prim0Annot=4]="Prim0Annot",_[_.Prim1=5]="Prim1",_[_.Prim1Annot=6]="Prim1Annot",_[_.Prim2=7]="Prim2",_[_.Prim2Annot=8]="Prim2Annot",_[_.Prim=9]="Prim",_[_.Bytes=10]="Bytes"})(Tag||(Tag={}));const boundsErr=new Error("bounds out of range");class Reader{constructor(a,$=0,j=a.length){this.buffer=a,this.idx=$,this.cap=j}get length(){return this.cap-this.idx}readBytes(a){if(this.cap-this.idx>>0}readUint16(){if(this.cap-this.idx<2)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++];return(a<<8|$)>>>0}readUint32(){if(this.cap-this.idx<4)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++],j=this.buffer[this.idx++],et=this.buffer[this.idx++];return(a<<24|$<<16|j<<8|et)>>>0}readInt8(){if(this.cap-this.idx<1)throw boundsErr;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++];return(a<<8|$)<<16>>16}readInt32(){if(this.cap-this.idx<4)throw boundsErr;const a=this.buffer[this.idx++],$=this.buffer[this.idx++],j=this.buffer[this.idx++],et=this.buffer[this.idx++];return a<<24|$<<16|j<<8|et}}var ContractID;(function(_){_[_.Implicit=0]="Implicit",_[_.Originated=1]="Originated"})(ContractID||(ContractID={}));var PublicKeyHashID;(function(_){_[_.ED25519=0]="ED25519",_[_.SECP256K1=1]="SECP256K1",_[_.P256=2]="P256"})(PublicKeyHashID||(PublicKeyHashID={}));function readPublicKeyHash(_){let a;const $=_.readUint8();switch($){case PublicKeyHashID.ED25519:a="ED25519PublicKeyHash";break;case PublicKeyHashID.SECP256K1:a="SECP256K1PublicKeyHash";break;case PublicKeyHashID.P256:a="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${$}`)}return{type:a,hash:_.readBytes(20)}}function readAddress(_){let a;const $=_.readUint8();switch($){case ContractID.Implicit:a=readPublicKeyHash(_);break;case ContractID.Originated:a={type:"ContractHash",hash:_.readBytes(20)},_.readBytes(1);break;default:throw new Error(`unknown address tag: ${$}`)}if(_.length!==0){const j=new TextDecoder;a.entryPoint=j.decode(new Uint8Array(_.readBytes(_.length)))}return a}var PublicKeyID;(function(_){_[_.ED25519=0]="ED25519",_[_.SECP256K1=1]="SECP256K1",_[_.P256=2]="P256"})(PublicKeyID||(PublicKeyID={}));function readPublicKey(_){let a,$;const j=_.readUint8();switch(j){case PublicKeyID.ED25519:$="ED25519PublicKey",a=32;break;case PublicKeyID.SECP256K1:$="SECP256K1PublicKey",a=33;break;case PublicKeyID.P256:$="P256PublicKey",a=33;break;default:throw new Error(`unknown public key tag: ${j}`)}return{type:$,publicKey:_.readBytes(a)}}function decodeAddressBytes(_){const a=parseBytes$6(_.bytes);if(a===null)throw new Error(`can't parse bytes: "${_.bytes}"`);const $=new Reader(new Uint8Array(a));return readAddress($)}function decodePublicKeyHashBytes(_){const a=parseBytes$6(_.bytes);if(a===null)throw new Error(`can't parse bytes: "${_.bytes}"`);const $=new Reader(new Uint8Array(a));return readPublicKeyHash($)}function decodePublicKeyBytes(_){const a=parseBytes$6(_.bytes);if(a===null)throw new Error(`can't parse bytes: "${_.bytes}"`);const $=new Reader(new Uint8Array(a));return readPublicKey($)}class MichelsonInstructionError extends MichelsonError{constructor(a,$,j){super(a,j),this.val=a,this.stackState=$,this.message=j,this.name="MichelsonInstructionError"}}function typeID(_){return Array.isArray(_)?"pair":_.prim}function typeArgs(_){return"prim"in _?_.args:_}function assertScalarTypesEqual(_,a,$=!1){if(typeID(_)!==typeID(a))throw new MichelsonTypeError(_,`types mismatch: ${typeID(_)} != ${typeID(a)}`,void 0);const j=[unpackAnnotations(_),unpackAnnotations(a)];if(j[0].t&&j[1].t&&j[0].t[0]!==j[1].t[0])throw new MichelsonTypeError(_,`${typeID(_)}: type names mismatch: ${j[0].t[0]} != ${j[1].t[0]}`,void 0);if($&&j[0].f&&j[1].f&&j[0].f[0]!==j[1].f[0])throw new MichelsonTypeError(_,`${typeID(_)}: field names mismatch: ${j[0].f[0]} != ${j[1].f}`,void 0);if(isPairType(_)){const et=unpackComb("pair",_),tt=unpackComb("pair",a);assertScalarTypesEqual(et.args[0],tt.args[0],!0),assertScalarTypesEqual(et.args[1],tt.args[1],!0);return}switch(_.prim){case"option":case"list":case"contract":case"set":case"ticket":assertScalarTypesEqual(_.args[0],a.args[0]);break;case"or":assertScalarTypesEqual(_.args[0],a.args[0],!0),assertScalarTypesEqual(_.args[1],a.args[1],!0);break;case"lambda":case"map":case"big_map":assertScalarTypesEqual(_.args[0],a.args[0]),assertScalarTypesEqual(_.args[1],a.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(_.args[0].int,10)!==parseInt(a.args[0].int,10))throw new MichelsonTypeError(_,`${typeID(_)}: type argument mismatch: ${_.args[0].int} != ${a.args[0].int}`,void 0)}}function assertStacksEqual(_,a){if(_.length!==a.length)throw new MichelsonTypeError(_,`stack length mismatch: ${_.length} != ${a.length}`,void 0);for(let $=0;$<_.length;$++)assertScalarTypesEqual(_[$],a[$])}function assertTypeAnnotationsValid(_,a=!1){var $,j,et;if(!Array.isArray(_)){const tt=unpackAnnotations(_);if(((($=tt.t)===null||$===void 0?void 0:$.length)||0)>1)throw new MichelsonTypeError(_,`${_.prim}: at most one type annotation allowed: ${_.annots}`,void 0);if(a){if((((j=tt.f)===null||j===void 0?void 0:j.length)||0)>1)throw new MichelsonTypeError(_,`${_.prim}: at most one field annotation allowed: ${_.annots}`,void 0)}else if((((et=tt.f)===null||et===void 0?void 0:et.length)||0)>0)throw new MichelsonTypeError(_,`${_.prim}: field annotations aren't allowed: ${_.annots}`,void 0)}if(isPairType(_)){const tt=typeArgs(_);for(const rt of tt)assertTypeAnnotationsValid(rt,!0);return}switch(_.prim){case"option":case"list":case"contract":case"set":assertTypeAnnotationsValid(_.args[0]);break;case"or":for(const tt of _.args)assertTypeAnnotationsValid(tt,!0);break;case"lambda":case"map":case"big_map":assertTypeAnnotationsValid(_.args[0]),assertTypeAnnotationsValid(_.args[1])}}function isFunction(_){if(!Array.isArray(_))return!1;for(const a of _)if(!(Array.isArray(a)&&isFunction(a)||"prim"in a&&isInstruction(a)))return!1;return!0}function assertDataValidInternal(_,a,$){if(isPairType(a)){if(isPairData(_)){assertDataListIfAny(_);const j=unpackComb("Pair",_),et=unpackComb("pair",a);assertDataValidInternal(j.args[0],et.args[0],$),assertDataValidInternal(j.args[1],et.args[1],$);return}throw new MichelsonTypeError(a,`pair expected: ${JSON.stringify(_)}`,_)}switch(a.prim){case"int":if("int"in _&&isDecimal(_.int))return;throw new MichelsonTypeError(a,`integer value expected: ${JSON.stringify(_)}`,_);case"nat":case"mutez":if("int"in _&&isNatural(_.int))return;throw new MichelsonTypeError(a,`natural value expected: ${JSON.stringify(_)}`,_);case"string":if("string"in _)return;throw new MichelsonTypeError(a,`string value expected: ${JSON.stringify(_)}`,_);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in _&&parseBytes$6(_.bytes)!==null)return;throw new MichelsonTypeError(a,`bytes value expected: ${JSON.stringify(_)}`,_);case"bool":if("prim"in _&&(_.prim==="True"||_.prim==="False"))return;throw new MichelsonTypeError(a,`boolean value expected: ${JSON.stringify(_)}`,_);case"key_hash":if("string"in _&&checkDecodeTezosID(_.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash")!==null)return;if("bytes"in _)try{decodePublicKeyHashBytes(_);return}catch{}throw new MichelsonTypeError(a,`key hash expected: ${JSON.stringify(_)}`,_);case"timestamp":if(("string"in _||"int"in _)&&parseDate(_)!==null)return;throw new MichelsonTypeError(a,`timestamp expected: ${JSON.stringify(_)}`,_);case"address":if("string"in _){let j=_.string;const et=_.string.indexOf("%");if(et>=0&&(j=_.string.slice(0,et)),checkDecodeTezosID(j,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress")!==null)return}else if("bytes"in _)try{decodeAddressBytes(_);return}catch{}throw new MichelsonTypeError(a,`address expected: ${JSON.stringify(_)}`,_);case"key":if("string"in _&&checkDecodeTezosID(_.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey")!==null)return;if("bytes"in _)try{decodePublicKeyBytes(_);return}catch{}throw new MichelsonTypeError(a,`public key expected: ${JSON.stringify(_)}`,_);case"unit":if("prim"in _&&_.prim==="Unit")return;throw new MichelsonTypeError(a,`unit value expected: ${JSON.stringify(_)}`,_);case"signature":if("bytes"in _||"string"in _&&checkDecodeTezosID(_.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature")!==null)return;throw new MichelsonTypeError(a,`signature expected: ${JSON.stringify(_)}`,_);case"chain_id":if(("bytes"in _||"string"in _)&&("string"in _?decodeBase58Check(_.string):parseBytes$6(_.bytes))!==null)return;throw new MichelsonTypeError(a,`chain id expected: ${JSON.stringify(_)}`,_);case"option":if("prim"in _){if(_.prim==="None")return;if(_.prim==="Some"){assertDataValidInternal(_.args[0],a.args[0],$);return}}throw new MichelsonTypeError(a,`option expected: ${JSON.stringify(_)}`,_);case"list":case"set":if(assertDataListIfAny(_)){for(const j of _)assertDataValidInternal(j,a.args[0],$);return}throw new MichelsonTypeError(a,`${a.prim} expected: ${JSON.stringify(_)}`,_);case"or":if("prim"in _){if(_.prim==="Left"){assertDataValidInternal(_.args[0],a.args[0],$);return}else if(_.prim==="Right"){assertDataValidInternal(_.args[0],a.args[1],$);return}}throw new MichelsonTypeError(a,`union (or) expected: ${JSON.stringify(_)}`,_);case"lambda":if(isFunction(_)){const j=functionTypeInternal(_,[a.args[0]],$);if("failed"in j)throw new MichelsonTypeError(a,`function is failed with error type: ${j.failed}`,_);if(j.length!==1)throw new MichelsonTypeError(a,"function must return a value",_);assertScalarTypesEqual(a.args[1],j[0]);return}throw new MichelsonTypeError(a,`function expected: ${JSON.stringify(_)}`,_);case"map":case"big_map":if(Array.isArray(_)){for(const j of _){if(!("prim"in j)||j.prim!=="Elt")throw new MichelsonTypeError(a,`map elements expected: ${JSON.stringify(_)}`,_);assertDataValidInternal(j.args[0],a.args[0],$),assertDataValidInternal(j.args[1],a.args[1],$)}return}throw new MichelsonTypeError(a,`${a.prim} expected: ${JSON.stringify(_)}`,_);case"bls12_381_fr":if("int"in _&&isDecimal(_.int)||"bytes"in _&&parseBytes$6(_.bytes)!==null)return;throw new MichelsonTypeError(a,`BLS12-381 element expected: ${JSON.stringify(_)}`,_);case"sapling_state":if(Array.isArray(_))return;throw new MichelsonTypeError(a,`sapling state expected: ${JSON.stringify(_)}`,_);case"ticket":assertDataValidInternal(_,{prim:"pair",args:[{prim:"address"},a.args[0],{prim:"nat"}]},$);return;default:throw new MichelsonTypeError(a,`type ${typeID(a)} don't have Michelson literal representation`,_)}}function instructionListType(_,a,$){let j=a,et=a,tt=0;for(const rt of _){const nt=functionTypeInternal(rt,et,$);if(j=nt,"failed"in nt)break;et=nt,tt++}if("failed"in j&&j.level==0&&(!("prim"in j.failed)||j.failed.prim!=="never")&&tt!==_.length-1)throw new MichelsonInstructionError(_,j,"FAIL must appear in a tail position");if(($==null?void 0:$.traceCallback)!==void 0){const rt={op:_,in:a,out:j};$.traceCallback(rt)}return"failed"in j?{failed:j.failed,level:j.level+1}:j}function functionTypeInternal(_,a,$){const j=($==null?void 0:$.protocol)||DefaultProtocol;if(Array.isArray(_))return instructionListType(_,a,$);const et=_;function tt(Ft,...Bt){if(a.length{try{return Ft(...Bt)}catch(yt){throw yt instanceof MichelsonError?new MichelsonInstructionError(et,a,yt.message):yt}}}function nt(Ft){return Bt=>{try{return Ft(Bt)}catch(yt){throw yt instanceof MichelsonError?new MichelsonInstructionError(et,a,yt.message):yt}}}const it=rt(unpackAnnotations),at=rt(assertStacksEqual),st=rt(assertScalarTypesEqual),ot=nt(assertMichelsonComparableType),ut=nt(assertMichelsonPackableType),dt=nt(assertMichelsonStorableType),mt=nt(assertMichelsonPushableType),xt=nt(assertMichelsonBigMapStorableType);function Ct(Ft,Bt){const yt=it(et,Object.assign(Object.assign({},Bt),{emptyFields:Ft.f!==void 0&&Ft.f>1,emptyVar:Ft.v!==void 0&&Ft.v>1})),bt=(ct,ht,vt)=>{if(ct&&ct.length>(ht||0))throw new MichelsonInstructionError(et,a,`${et.prim}: at most ${ht||0} ${vt} annotations allowed`)};return bt(yt.f,Ft.f,"field"),bt(yt.t,Ft.t,"type"),bt(yt.v,Ft.v,"variable"),yt}function Pt(Ft,Bt){const yt=Ft,bt=Array.isArray(yt)?{prim:"pair",args:yt}:yt,ct=it(bt),ht=Bt.v!==void 0||Bt.t!==void 0||Bt.f!==void 0?[...(Bt.v===null?ct.v:Bt.v)||[],...(Bt.t===null?ct.t:Bt.t)||[],...(Bt.f===null?ct.f:Bt.f)||[]]:void 0,vt=__rest$1(bt,["annots"]);return Object.assign(Object.assign({},vt),ht&&ht.length!==0&&{annots:ht})}function Tt(Ft,Bt){const yt=Ct({v:1});return Pt(Ft,{v:yt.v!==void 0?yt.v:Bt!==void 0?[Bt]:null,t:null})}function kt(Ft,Bt,yt,bt,ct){var ht,vt,St,Rt;const $t=(ht=it(Bt).f)===null||ht===void 0?void 0:ht[0],Et=(vt=yt.f)===null||vt===void 0?void 0:vt[bt];if(Et!==void 0&&Et!=="%"&&$t!==void 0&&Et!==$t)throw new MichelsonInstructionError(et,a,`${et.prim}: field names doesn't match: ${Et} !== ${$t}`);const At=(St=yt.v)===null||St===void 0?void 0:St[bt],wt=(Rt=it(Ft).v)===null||Rt===void 0?void 0:Rt[0];return Pt(Bt,{t:null,v:At?At==="@%"?$t?["@"+$t.slice(1)]:void 0:At==="@%%"?wt?["@"+wt.slice(1)+"."+($t?$t.slice(1):ct)]:$t?["@"+$t.slice(1)]:void 0:[At]:null})}function Lt(Ft,Bt,yt=Bt){const bt=unpackComb("pair",Ft);if(yt===1)return[bt.args[0]];if(yt===2)return bt.args;const ct=bt.args[1];if(isPairType(ct))return[bt.args[0],...Lt(ct,Bt,yt-1)];throw new MichelsonInstructionError(et,a,`${et.prim}: at least ${Bt} fields are expected`)}function Nt(Ft,Bt,yt=Bt){if(yt===0)return Ft;const bt=unpackComb("pair",Ft);if(yt===1)return bt.args[0];const ct=bt.args[1];if(isPairType(ct))return Nt(ct,Bt,yt-2);if(yt===2)return ct;throw new MichelsonInstructionError(et,a,`${et.prim}: at least ${Bt+1} fields are expected`)}function zt(Ft,Bt,yt,bt=yt){if(bt===0)return Bt;const ct=unpackComb("pair",Ft);if(bt===1)return Object.assign(Object.assign({},ct),{args:[Bt,ct.args[1]]});const ht=ct.args[1];if(isPairType(ht))return Object.assign(Object.assign({},ct),{args:[ct.args[0],zt(ht,Bt,yt,bt-2)]});if(bt===2)return Object.assign(Object.assign({},ct),{args:[ct.args[0],Bt]});throw new MichelsonInstructionError(et,a,`${et.prim}: at least ${yt+1} fields are expected`)}const jt=(Ft,Bt)=>["@"+(Ft.v?Ft.v[0].slice(1)+".":"")+Bt];function Mt(Ft,Bt){return"failed"in Ft||"failed"in Bt?"failed"in Ft?Bt:Ft:(at(Ft,Bt),Ft)}const Dt=(Ft=>{var Bt,yt,bt,ct,ht;switch(Ft.prim){case"DUP":{const vt=Ft.args?parseInt(Ft.args[0].int,10):1;if(vt===0)throw new MichelsonInstructionError(Ft,a,"DUP 0 is forbidden");const St=tt(vt-1,null)[0];if(typeID(St)==="ticket")throw new MichelsonInstructionError(Ft,a,"ticket can't be DUPed");return[St,...a]}case"SWAP":{const vt=tt(0,null,null);return Ct({}),[vt[1],vt[0],...a.slice(2)]}case"SOME":return[Pt({prim:"option",args:[tt(0,null)[0]]},Ct({t:1,v:1})),...a.slice(1)];case"UNIT":return[Pt({prim:"unit"},Ct({v:1,t:1})),...a];case"PAIR":{const vt=Ft.args?parseInt(Ft.args[0].int,10):2;if(vt<2)throw new MichelsonInstructionError(Ft,a,`PAIR ${vt} is forbidden`);const St=tt(0,...new Array(vt).fill(null)),Rt=Ct({f:vt,t:1,v:1},{specialFields:!0}),$t=At=>{const wt=At.lastIndexOf(".");return At.slice(wt>0?wt+1:1)},Et=St.map((At,wt)=>{var Ot;const tr=it(At),nr=Rt.f&&Rt.f.length>wt&&Rt.f[wt]!=="%"?Rt.f[wt]==="%@"?tr.v?["%"+$t(((Ot=tr.v)===null||Ot===void 0?void 0:Ot[0])||"")]:void 0:[Rt.f[wt]]:void 0;return Pt(At,{v:null,t:null,f:nr})});return[Pt({prim:"pair",args:Et},{t:Rt.t,v:Rt.v}),...a.slice(vt)]}case"UNPAIR":{const vt=Ft.args?parseInt(Ft.args[0].int,10):2;if(vt<2)throw new MichelsonInstructionError(Ft,a,`UNPAIR ${vt} is forbidden`);const St=tt(0,["pair"])[0],Rt=Ct({f:2,v:2},{specialVar:!0});return[...Lt(St,vt).map((Et,At)=>kt(St,Et,Rt,At,At===0?"car":"cdr")),...a.slice(1)]}case"CAR":case"CDR":{const vt=unpackComb("pair",tt(0,["pair"])[0]),St=vt.args[Ft.prim==="CAR"?0:1],Rt=Ct({f:1,v:1},{specialVar:!0});return[kt(vt,St,Rt,0,Ft.prim.toLocaleLowerCase()),...a.slice(1)]}case"CONS":{const vt=tt(0,null,["list"]);return st(vt[0],vt[1].args[0]),[Tt({prim:"list",args:[vt[1].args[0]]}),...a.slice(2)]}case"SIZE":return tt(0,["string","list","set","map","bytes"]),[Tt({prim:"nat"}),...a.slice(1)];case"MEM":{const vt=tt(0,null,["set","map","big_map"]);return ot(vt[0]),st(vt[0],vt[1].args[0]),[Tt({prim:"bool"}),...a.slice(2)]}case"GET":if(Ft.args){const vt=parseInt(Ft.args[0].int,10),St=tt(0,["pair"])[0];return[Tt(Nt(St,vt)),...a.slice(1)]}else{const vt=tt(0,null,["map","big_map"]);return ot(vt[0]),st(vt[0],vt[1].args[0]),[Tt({prim:"option",args:[vt[1].args[1]]}),...a.slice(2)]}case"UPDATE":if(Ft.args){const vt=parseInt(Ft.args[0].int,10),St=tt(0,null,["pair"]);return[Tt(zt(St[1],St[0],vt)),...a.slice(2)]}else{const vt=tt(0,null,["bool","option"]);if(ot(vt[0]),vt[1].prim==="bool"){const Rt=tt(2,["set"]);return st(vt[0],Rt[0].args[0]),[Tt({prim:"set",args:[Pt(vt[0],{t:null})]}),...a.slice(3)]}const St=tt(2,["map","big_map"]);return st(vt[0],St[0].args[0]),St[0].prim==="map"?[Tt({prim:"map",args:[Pt(vt[0],{t:null}),Pt(vt[1].args[0],{t:null})]}),...a.slice(3)]:(xt(vt[1].args[0]),[Tt({prim:"big_map",args:[Pt(vt[0],{t:null}),Pt(vt[1].args[0],{t:null})]}),...a.slice(3)])}case"GET_AND_UPDATE":{const vt=Ct({v:2}),St=tt(0,null,["option"],["map","big_map"]);ot(St[0]),st(St[0],St[2].args[0]),st(St[1].args[0],St[2].args[1]);const Rt=(Bt=vt.v)===null||Bt===void 0?void 0:Bt.map($t=>$t!=="@"?[$t]:void 0);return St[2].prim==="map"?[Pt({prim:"option",args:[St[2].args[1]]},{v:Rt==null?void 0:Rt[0]}),Pt({prim:"map",args:[Pt(St[0],{t:null}),Pt(St[1].args[0],{t:null})]},{v:Rt==null?void 0:Rt[1]}),...a.slice(3)]:(xt(St[1].args[0]),[Pt({prim:"option",args:[St[2].args[1]]},{v:Rt==null?void 0:Rt[0]}),Pt({prim:"big_map",args:[Pt(St[0],{t:null}),Pt(St[1].args[0],{t:null})]},{v:Rt==null?void 0:Rt[1]}),...a.slice(3)])}case"EXEC":{const vt=tt(0,null,["lambda"]);return st(vt[0],vt[1].args[0]),[Tt(vt[1].args[1]),...a.slice(2)]}case"APPLY":{const vt=tt(0,null,["lambda"]);if(dt(vt[0]),mt(vt[0]),!isPairType(vt[1].args[0]))throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: function's argument must be a pair: ${typeID(vt[1].args[0])}`);const St=vt[1].args[0];return st(vt[0],typeArgs(St)[0]),[Tt({prim:"lambda",args:[typeArgs(St)[1],vt[1].args[1]]}),...a.slice(2)]}case"FAILWITH":{const vt=tt(0,null)[0];return ProtoInferiorTo(j,Protocol.PtEdo2Zk)||ut(vt),{failed:vt,level:0}}case"NEVER":return tt(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[Tt(tt(0,null)[0]),...a.slice(1)];case"CONCAT":{const vt=tt(0,["string","list","bytes"]);if(vt[0].prim==="list"){if(typeID(vt[0].args[0])!=="string"&&typeID(vt[0].args[0])!=="bytes")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't concatenate list of ${typeID(vt[0].args[0])}'s`);return[Tt(vt[0].args[0]),...a.slice(1)]}const St=tt(1,["string","bytes"]);if(vt[0].prim!==St[0].prim)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't concatenate ${vt[0].prim} with ${St[0].prim}`);return[Tt(St[0]),...a.slice(2)]}case"SLICE":return[Tt({prim:"option",args:[tt(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...a.slice(3)];case"PACK":{const vt=tt(0,null)[0];return ut(vt),[Tt({prim:"bytes"},"@packed"),...a.slice(1)]}case"ADD":{const vt=tt(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if(vt[0].prim==="nat"&&vt[1].prim==="int"||vt[0].prim==="int"&&vt[1].prim==="nat")return[Tt({prim:"int"}),...a.slice(2)];if(vt[0].prim==="int"&&vt[1].prim==="timestamp"||vt[0].prim==="timestamp"&&vt[1].prim==="int")return[Tt({prim:"timestamp"}),...a.slice(2)];if((vt[0].prim==="int"||vt[0].prim==="nat"||vt[0].prim==="mutez"||vt[0].prim==="bls12_381_g1"||vt[0].prim==="bls12_381_g2"||vt[0].prim==="bls12_381_fr")&&vt[0].prim===vt[1].prim)return[Tt(vt[0]),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't add ${vt[0].prim} to ${vt[1].prim}`)}case"SUB":{const vt=ProtoInferiorTo(j,Protocol.PsiThaCa)?tt(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):tt(0,["nat","int","timestamp"],["nat","int","timestamp"]);if((vt[0].prim==="nat"||vt[0].prim==="int")&&(vt[1].prim==="nat"||vt[1].prim==="int")||vt[0].prim==="timestamp"&&vt[1].prim==="timestamp")return[Tt({prim:"int"}),...a.slice(2)];if(vt[0].prim==="timestamp"&&vt[1].prim==="int")return[Tt({prim:"timestamp"}),...a.slice(2)];if(vt[0].prim==="mutez"&&vt[1].prim==="mutez")return[Tt({prim:"mutez"}),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't subtract ${vt[0].prim} from ${vt[1].prim}`)}case"SUB_MUTEZ":return tt(0,["mutez"],["mutez"]),[Tt({prim:"option",args:[{prim:"mutez"}]}),...a.slice(2)];case"MUL":{const vt=tt(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if(vt[0].prim==="nat"&&vt[1].prim==="int"||vt[0].prim==="int"&&vt[1].prim==="nat")return[Tt({prim:"int"}),...a.slice(2)];if(vt[0].prim==="nat"&&vt[1].prim==="mutez"||vt[0].prim==="mutez"&&vt[1].prim==="nat")return[Tt({prim:"mutez"}),...a.slice(2)];if((vt[0].prim==="bls12_381_g1"||vt[0].prim==="bls12_381_g2"||vt[0].prim==="bls12_381_fr")&&vt[1].prim==="bls12_381_fr"||(vt[0].prim==="nat"||vt[0].prim==="int")&&vt[0].prim===vt[1].prim)return[Tt(vt[0]),...a.slice(2)];if((vt[0].prim==="nat"||vt[0].prim==="int")&&vt[1].prim==="bls12_381_fr"||(vt[1].prim==="nat"||vt[1].prim==="int")&&vt[0].prim==="bls12_381_fr")return[Tt({prim:"bls12_381_fr"}),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't multiply ${vt[0].prim} by ${vt[1].prim}`)}case"EDIV":{const vt=(Rt,$t)=>({prim:"option",args:[{prim:"pair",args:[{prim:Rt},{prim:$t}]}]}),St=tt(0,["nat","int","mutez"],["nat","int","mutez"]);if(St[0].prim==="nat"&&St[1].prim==="nat")return[Tt(vt("nat","nat")),...a.slice(2)];if((St[0].prim==="nat"||St[0].prim==="int")&&(St[1].prim==="nat"||St[1].prim==="int"))return[Tt(vt("int","nat")),...a.slice(2)];if(St[0].prim==="mutez"&&St[1].prim==="nat")return[Tt(vt("mutez","mutez")),...a.slice(2)];if(St[0].prim==="mutez"&&St[1].prim==="mutez")return[Tt(vt("nat","mutez")),...a.slice(2)];throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: can't euclideally divide ${St[0].prim} by ${St[1].prim}`)}case"ABS":return tt(0,["int"]),[Tt({prim:"nat"}),...a.slice(1)];case"ISNAT":return tt(0,["int"]),[Tt({prim:"option",args:[{prim:"nat"}]}),...a.slice(1)];case"INT":return tt(0,["nat","bls12_381_fr","bytes"]),[Tt({prim:"int"}),...a.slice(1)];case"BYTES":return tt(0,["nat","int"]),[Tt({prim:"bytes"}),...a.slice(1)];case"NAT":return tt(0,["bytes"]),[Tt({prim:"nat"}),...a.slice(1)];case"NEG":{const vt=tt(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return vt.prim==="nat"||vt.prim==="int"?[Tt({prim:"int"}),...a.slice(1)]:[Tt(vt),...a.slice(1)]}case"LSL":case"LSR":return tt(0,["nat","bytes"],["nat","bytes"]),[Tt({prim:"nat"}),...a.slice(2)];case"OR":case"XOR":{const vt=tt(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(vt[0].prim!==vt[1].prim)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: both arguments must be of the same type: ${vt[0].prim}, ${vt[1].prim}`);return[Tt(vt[1]),...a.slice(2)]}case"AND":{const vt=tt(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if((vt[0].prim!=="int"||vt[1].prim!=="nat")&&vt[0].prim!==vt[1].prim)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: both arguments must be of the same type: ${vt[0].prim}, ${vt[1].prim}`);return[Tt(vt[1]),...a.slice(2)]}case"NOT":return tt(0,["nat","bytes","bool","int"])[0].prim==="bool"?[Tt({prim:"bool"}),...a.slice(1)]:[Tt({prim:"int"}),...a.slice(1)];case"COMPARE":{const vt=tt(0,null,null);return ot(vt[0]),ot(vt[1]),[Tt({prim:"int"}),...a.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return tt(0,["int"]),[Tt({prim:"bool"}),...a.slice(1)];case"SELF":{if(($==null?void 0:$.contract)===void 0)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: contract required`);const vt=Ct({f:1,v:1}),St=contractEntryPoint($.contract,(yt=vt.f)===null||yt===void 0?void 0:yt[0]);if(St===null)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: contract has no entrypoint ${St}`);return[Pt({prim:"contract",args:[St]},{v:vt.v?vt.v:["@self"]}),...a]}case"TRANSFER_TOKENS":{const vt=tt(0,null,["mutez"],["contract"]);return st(vt[0],vt[2].args[0]),[Tt({prim:"operation"}),...a.slice(3)]}case"SET_DELEGATE":{const vt=tt(0,["option"])[0];if(typeID(vt.args[0])!=="key_hash")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: key hash expected: ${typeID(vt.args[0])}`);return[Tt({prim:"operation"}),...a.slice(1)]}case"IMPLICIT_ACCOUNT":return tt(0,["key_hash"]),[Tt({prim:"contract",args:[{prim:"unit"}]}),...a.slice(1)];case"NOW":return[Tt({prim:"timestamp"},"@now"),...a];case"AMOUNT":return[Tt({prim:"mutez"},"@amount"),...a];case"BALANCE":return[Tt({prim:"mutez"},"@balance"),...a];case"CHECK_SIGNATURE":return tt(0,["key"],["signature"],["bytes"]),[Tt({prim:"bool"}),...a.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return tt(0,["bytes"]),[Tt({prim:"bytes"}),...a.slice(1)];case"HASH_KEY":return tt(0,["key"]),[Tt({prim:"key_hash"}),...a.slice(1)];case"SOURCE":return[Tt({prim:"address"},"@source"),...a];case"SENDER":return[Tt({prim:"address"},"@sender"),...a];case"ADDRESS":{const vt=tt(0,["contract"])[0],St=Ct({v:1});return[Pt({prim:"address",[refContract]:vt},{v:St.v?St.v:jt(it(vt),"address")}),...a.slice(1)]}case"SELF_ADDRESS":{const vt={prim:"address"};return($==null?void 0:$.contract)!==void 0&&(vt[refContract]={prim:"contract",args:[contractSection($.contract,"parameter").args[0]]}),[Tt(vt,"@address"),...a]}case"CHAIN_ID":return[Tt({prim:"chain_id"}),...a];case"DROP":{Ct({});const vt=Ft.args!==void 0?parseInt(Ft.args[0].int,10):1;return tt(vt-1,null),a.slice(vt)}case"DIG":{Ct({});const vt=parseInt(Ft.args[0].int,10);return[tt(vt,null)[0],...a.slice(0,vt),...a.slice(vt+1)]}case"DUG":{Ct({});const vt=parseInt(Ft.args[0].int,10);return[...a.slice(1,vt+1),tt(0,null)[0],...a.slice(vt+1)]}case"NONE":return assertTypeAnnotationsValid(Ft.args[0]),[Pt({prim:"option",args:[Ft.args[0]]},Ct({t:1,v:1})),...a];case"LEFT":case"RIGHT":{const vt=tt(0,null)[0],St=Ct({f:2,t:1,v:1},{specialFields:!0}),Rt=it(vt),$t=[Pt(vt,{t:null,v:null,f:St.f&&St.f.length>0&&St.f[0]!=="%"?St.f[0]==="%@"?Rt.v?["%"+Rt.v[0].slice(1)]:void 0:St.f:void 0}),Pt(Ft.args[0],{t:null,f:St.f&&St.f.length>1&&St.f[1]!=="%"?St.f:void 0})];return[Pt({prim:"or",args:Ft.prim==="LEFT"?$t:[$t[1],$t[0]]},{t:St.t,v:St.v}),...a.slice(1)]}case"NIL":return assertTypeAnnotationsValid(Ft.args[0]),[Pt({prim:"list",args:[Ft.args[0]]},Ct({t:1,v:1})),...a];case"UNPACK":return tt(0,["bytes"]),assertTypeAnnotationsValid(Ft.args[0]),[Tt({prim:"option",args:[Ft.args[0]]},"@unpacked"),...a.slice(1)];case"CONTRACT":{const vt=tt(0,["address"])[0];assertTypeAnnotationsValid(Ft.args[0]);const St=Ct({v:1,f:1}),Rt=vt[refContract];if(Rt!==void 0){const $t=contractEntryPoint(Rt,(bt=St.f)===null||bt===void 0?void 0:bt[0]);if($t===null)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: contract has no entrypoint ${$t}`);st($t,Ft.args[0])}return[Pt({prim:"option",args:[{prim:"contract",args:[Ft.args[0]]}]},{v:St.v?St.v:jt(it(vt),"contract")}),...a.slice(1)]}case"CAST":{Ct({});const vt=tt(0,null)[0];return assertTypeAnnotationsValid(Ft.args[0]),st(Ft.args[0],vt),[Ft.args[0],...a.slice(1)]}case"IF_NONE":{Ct({});const vt=tt(0,["option"])[0],St=a.slice(1),Rt=functionTypeInternal(Ft.args[0],St,$),$t=functionTypeInternal(Ft.args[1],[Pt(vt.args[0],{t:null,v:jt(it(vt),"some")}),...St],$);return Mt(Rt,$t)}case"IF_LEFT":{Ct({});const vt=tt(0,["or"])[0],St=it(vt),Rt=it(vt.args[0]),$t=it(vt.args[1]),Et=a.slice(1),At=functionTypeInternal(Ft.args[0],[Pt(vt.args[0],{t:null,v:jt(St,Rt.f?Rt.f[0].slice(1):"left")}),...Et],$),wt=functionTypeInternal(Ft.args[1],[Pt(vt.args[1],{t:null,v:jt(St,$t.f?$t.f[0].slice(1):"right")}),...Et],$);return Mt(At,wt)}case"IF_CONS":{Ct({});const vt=tt(0,["list"])[0],St=it(vt),Rt=a.slice(1),$t=functionTypeInternal(Ft.args[0],[Pt(vt.args[0],{t:null,v:jt(St,"hd")}),Pt(vt,{t:null,v:jt(St,"tl")}),...Rt],$),Et=functionTypeInternal(Ft.args[1],Rt,$);return Mt($t,Et)}case"IF":{Ct({}),tt(0,["bool"]);const vt=a.slice(1),St=functionTypeInternal(Ft.args[0],vt,$),Rt=functionTypeInternal(Ft.args[1],vt,$);return Mt(St,Rt)}case"MAP":{const vt=tt(0,["list","map","option"])[0],St=a.slice(1),Rt=vt.prim==="map"?{prim:"pair",args:vt.args}:vt.args[0],$t=functionTypeInternal(Ft.args[0],[Pt(Rt,{t:null,v:jt(it(vt),"elt")}),...St],$);if("failed"in $t){if(!("prim"in $t.failed)||$t.failed.prim!=="never")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: FAIL is not allowed in MAP`);return{failed:$t.failed,level:$t.level+1}}if($t.length<1)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: function must return a value`);return at($t.slice(1),St),vt.prim==="list"?[Tt({prim:"list",args:[$t[0]]}),...St]:vt.prim==="map"?[Tt({prim:"map",args:[vt.args[0],$t[0]]}),...St]:[Tt({prim:"option",args:[$t[0]]}),...St]}case"ITER":{Ct({});const vt=tt(0,["set","list","map"])[0],St=a.slice(1),Rt=vt.prim==="map"?{prim:"pair",args:vt.args}:vt.args[0],$t=functionTypeInternal(Ft.args[0],[Pt(Rt,{t:null,v:jt(it(vt),"elt")}),...St],$);return"failed"in $t?{failed:$t.failed,level:$t.level+1}:(at($t,St),St)}case"LOOP":{Ct({}),tt(0,["bool"]);const vt=a.slice(1),St=functionTypeInternal(Ft.args[0],vt,$);return"failed"in St?{failed:St.failed,level:St.level+1}:(at(St,[{prim:"bool"},...vt]),vt)}case"LOOP_LEFT":{Ct({});const vt=tt(0,["or"])[0],St=a.slice(1),Rt=functionTypeInternal(Ft.args[0],[Pt(vt.args[0],{t:null,v:jt(it(vt),"left")}),...St],$);return"failed"in Rt?{failed:Rt.failed,level:Rt.level+1}:(at(Rt,[vt,...St]),[Pt(vt.args[1],{t:null,v:Ct({v:1}).v}),...St])}case"DIP":{Ct({});const vt=Ft.args.length===2?parseInt(Ft.args[0].int,10):1;tt(vt-1,null);const St=a.slice(0,vt),Rt=a.slice(vt),$t=Ft.args.length===2?functionTypeInternal(Ft.args[1],Rt,$):functionTypeInternal(Ft.args[0],Rt,$);return"failed"in $t?{failed:$t.failed,level:$t.level+1}:[...St,...$t]}case"CREATE_CONTRACT":{const vt=Ct({v:2}),St=tt(0,["option"],["mutez"],null);if(typeID(St[0].args[0])!=="key_hash")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: key hash expected: ${typeID(St[0].args[0])}`);dt(St[2])&&(assertContractValid(Ft.args[0]),assertScalarTypesEqual(contractSection(Ft.args[0],"storage").args[0],St[2]));const Rt=(ct=vt.v)===null||ct===void 0?void 0:ct.map($t=>$t!=="@"?[$t]:void 0);return[Pt({prim:"operation"},{v:Rt==null?void 0:Rt[0]}),Pt({prim:"address",[refContract]:{prim:"contract",args:[contractSection(Ft.args[0],"parameter").args[0]]}},{v:Rt==null?void 0:Rt[1]}),...a.slice(3)]}case"PUSH":return assertTypeAnnotationsValid(Ft.args[0]),assertDataValidInternal(Ft.args[1],Ft.args[0],Object.assign(Object.assign({},$),{contract:void 0})),[Tt(Ft.args[0]),...a];case"EMPTY_SET":return assertTypeAnnotationsValid(Ft.args[0]),ot(Ft.args[0]),[Pt({prim:"set",args:Ft.args},Ct({t:1,v:1})),...a];case"EMPTY_MAP":return assertTypeAnnotationsValid(Ft.args[0]),ot(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]),[Pt({prim:"map",args:Ft.args},Ct({t:1,v:1})),...a];case"EMPTY_BIG_MAP":return assertTypeAnnotationsValid(Ft.args[0]),ot(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]),xt(Ft.args[0]),[Pt({prim:"big_map",args:Ft.args},Ct({t:1,v:1})),...a];case"LAMBDA_REC":case"LAMBDA":{assertTypeAnnotationsValid(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]);const vt=[Ft.args[0]];Ft.prim==="LAMBDA_REC"&&vt.push({prim:"lambda",args:[Ft.args[0],Ft.args[1]]});const St=functionTypeInternal(Ft.args[2],vt,Object.assign(Object.assign({},$),{contract:void 0}));if("failed"in St)return{failed:St.failed,level:St.level+1};if(St.length!==1)throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: function must return a value`);return st(Ft.args[1],St[0]),[Tt({prim:"lambda",args:[Ft.args[0],Ft.args[1]]}),...a]}case"LEVEL":return[Tt({prim:"nat"},"@level"),...a];case"TOTAL_VOTING_POWER":return[Tt({prim:"nat"}),...a];case"VOTING_POWER":return tt(0,["key_hash"]),[Tt({prim:"nat"}),...a.slice(1)];case"TICKET":{const vt=tt(0,null,["nat"])[0];return ot(vt),ProtoInferiorTo(j,Protocol.PtLimaPtL)?[Pt({prim:"ticket",args:[vt]},Ct({t:1,v:1})),...a.slice(2)]:[Tt({prim:"option",args:[Pt({prim:"ticket",args:[vt]},Ct({t:1,v:1}))]}),...a.slice(2)]}case"JOIN_TICKETS":{const vt=unpackComb("pair",tt(0,["pair"])[0]);if(typeID(vt.args[0])!=="ticket")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: ticket expected: ${typeID(vt.args[0])}`);return st(vt.args[0],vt.args[1]),[Tt({prim:"option",args:[Pt(vt.args[0],{t:null})]}),...a.slice(1)]}case"SPLIT_TICKET":{const vt=tt(0,["ticket"],["pair"]),St=unpackComb("pair",vt[1]);if(typeID(St.args[0])!=="nat")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: nat expected: ${typeID(St.args[0])}`);return st(St.args[0],St.args[1]),[Tt({prim:"option",args:[{prim:"pair",args:[Pt(vt[0],{t:null}),Pt(vt[0],{t:null})]}]}),...a.slice(2)]}case"READ_TICKET":{const vt=Ct({v:2}),St=tt(0,["ticket"])[0],Rt=(ht=vt.v)===null||ht===void 0?void 0:ht.map($t=>$t!=="@"?[$t]:void 0);return[Pt({prim:"pair",args:[{prim:"address"},Pt(St.args[0],{t:null}),{prim:"nat"}]},{v:Rt==null?void 0:Rt[0]}),Pt(St,{v:Rt==null?void 0:Rt[1],t:null}),...a.slice(1)]}case"PAIRING_CHECK":{const vt=tt(0,["list"])[0].args[0];if(!isPairType(vt))throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: pair expected: ${typeID(vt)}`);const St=unpackComb("pair",vt);if(typeID(St.args[0])!=="bls12_381_g1")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: bls12_381_g1 expected: ${typeID(St.args[0])}`);if(typeID(St.args[1])!=="bls12_381_g2")throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: bls12_381_g2 expected: ${typeID(St.args[1])}`);return[Tt({prim:"bool"}),...a.slice(1)]}case"SAPLING_EMPTY_STATE":return[Pt({prim:"sapling_state",args:[Ft.args[0]]},Ct({v:1,t:1})),...a];case"SAPLING_VERIFY_UPDATE":{const vt=tt(0,["sapling_transaction"],["sapling_state"]);if(parseInt(vt[0].args[0].int,10)!==parseInt(vt[1].args[0].int,10))throw new MichelsonInstructionError(Ft,a,`${Ft.prim}: sapling memo size mismatch: ${vt[0].args[0].int} != ${vt[1].args[0].int}`);return ProtoInferiorTo(j,Protocol.PtJakarta)?[Tt({prim:"option",args:[{prim:"pair",args:[{prim:"int"},Pt(vt[1],{t:null})]}]}),...a.slice(2)]:[Tt({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},Pt(vt[1],{t:null})]}]}]}),...a.slice(2)]}case"OPEN_CHEST":return tt(0,["chest_key"],["chest"],["nat"]),[Tt({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...a.slice(3)];case"VIEW":{const vt=tt(0,null,["address"]);return mt(vt[0]),[Tt({prim:"option",args:[Ft.args[1]]}),...a.slice(2)]}case"MIN_BLOCK_TIME":return[Tt({prim:"nat"}),...a];case"EMIT":{const vt=Ct({f:1,t:1});if(Ft.args){const St=tt(0,null);return st(St[0],Ft.args[0]),[Pt({prim:"operation"},vt),...a.slice(1)]}return[Pt({prim:"operation"},vt),...a.slice(1)]}default:throw new MichelsonError(Ft,`unexpected instruction: ${Ft.prim}`)}})(et);if(($==null?void 0:$.traceCallback)!==void 0){const Ft={op:et,in:a,out:Dt};$.traceCallback(Ft)}return Dt}function contractSection(_,a){for(const $ of _)if($.prim===a)return $;throw new MichelsonError(_,`missing contract section: ${a}`)}function contractViews(_){const a={};for(const $ of _)$.prim==="view"&&(a[$.args[0].string]=$);return a}function isContract(_){if(Array.isArray(_)){for(const a of _)if("prim"in a&&(a.prim==="parameter"||a.prim==="storage"||a.prim==="code"))return!0}return!1}function contractEntryPoint(_,a){a=a||"%default";const $=contractEntryPoints(_).find(j=>j[0]===a);return $!==void 0?$[1]:a==="%default"?isContract(_)?contractSection(_,"parameter").args[0]:_:null}function isOrType(_){return Array.isArray(_)||_.prim==="or"}function contractEntryPoints(_){if(isContract(_)){const a=contractSection(_,"parameter"),$=contractEntryPoints(a.args[0]),j=unpackAnnotations(a);return j.f?[[j.f[0],a.args[0]],...$]:$}if(isOrType(_)){const a=typeArgs(_),$=j=>{const et=unpackAnnotations(a[j]);if(typeID(a[j])==="or"){const tt=contractEntryPoints(a[j]);return et.f?[[et.f[0],a[j]],...tt]:tt}return et.f?[[et.f[0],a[j]]]:[]};return[...$(0),...$(1)]}return[]}function assertContractValid(_,a){const $=(it,at,st,ot)=>{assertTypeAnnotationsValid(it,!0),assertTypeAnnotationsValid(at);const ut={prim:"pair",args:[Object.assign(Object.assign({},it),{annots:["@parameter"]}),Object.assign(Object.assign({},at),{annots:["@storage"]})]},dt=functionTypeInternal(ot,[ut],Object.assign(Object.assign({},a),{contract:_}));if("failed"in dt)return dt;try{assertStacksEqual(dt,[st])}catch(mt){throw mt instanceof MichelsonError?new MichelsonInstructionError(ot,dt,mt.message):mt}return dt},j=contractSection(_,"parameter").args[0],et=contractSection(_,"storage").args[0],tt=contractSection(_,"code").args[0],nt=$(j,et,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},et]},tt);for(const it of Object.values(contractViews(_)))$(it.args[1],et,it.args[2],it.args[3]);return nt}function assertDataValid(_,a,$){assertTypeAnnotationsValid(a),assertDataValidInternal(_,a,$||null)}function functionType(_,a,$){for(const j of a)assertTypeAnnotationsValid(j);if(($==null?void 0:$.contract)!==void 0)for(const j of["parameter","storage"]){const et=contractSection($.contract,j).args[0];assertTypeAnnotationsValid(et)}return functionTypeInternal(_,a,$||null)}function isDataValid(_,a,$){try{return assertDataValid(_,a,$),!0}catch{return!1}}class Contract{constructor(a,$){this.contract=a,this.ctx=Object.assign({contract:a},$),this.output=assertContractValid(a,this.ctx)}static parse(a,$){const j=new Parser$1($),et=typeof a=="string"?j.parseScript(a):j.parseJSON(a);if(et===null)throw new InvalidMichelsonError("empty Michelson");if(assertMichelsonContract(et))return new Contract(et,$)}static parseTypeExpression(a,$){const j=new Parser$1($),et=typeof a=="string"?j.parseScript(a):j.parseJSON(a);if(et===null)throw new InvalidTypeExpressionError("empty type expression");if(assertMichelsonType(et))return assertTypeAnnotationsValid(et),et}static parseDataExpression(a,$){const j=new Parser$1($),et=typeof a=="string"?j.parseScript(a):j.parseJSON(a);if(et===null)throw new InvalidDataExpressionError("empty data expression");if(assertMichelsonData(et))return et;throw void 0}section(a){return contractSection(this.contract,a)}entryPoints(){return contractEntryPoints(this.contract)}entryPoint(a){return contractEntryPoint(this.contract,a)}assertDataValid(a,$){assertDataValid(a,$,this.ctx)}isDataValid(a,$){return isDataValid(a,$,this.ctx)}assertParameterValid(a,$){const j=this.entryPoint(a||void 0);if(j===null)throw new InvalidEntrypointError(a==null?void 0:a.toString());this.assertDataValid($,j)}isParameterValid(a,$){try{return this.assertParameterValid(a,$),!0}catch{return!1}}functionType(a,$){return functionType(a,$,this.ctx)}}new Contract([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);const toHexString=_=>_.reduce((a,$)=>a+$.toString(16).padStart(2,"0"),""),pad=(_,a=8)=>_.toString(16).padStart(a,"0"),ENTRYPOINT_MAX_LENGTH=31;var CODEC;(function(_){_.SECRET="secret",_.RAW="raw",_.TZ1="tz1",_.BRANCH="branch",_.ZARITH="zarith",_.PUBLIC_KEY="public_key",_.PKH="pkh",_.PKH_ARR="pkhArr",_.DELEGATE="delegate",_.SCRIPT="script",_.BALLOT_STATEMENT="ballotStmt",_.PROPOSAL="proposal",_.PROPOSAL_ARR="proposalArr",_.INT32="int32",_.INT16="int16",_.PARAMETERS="parameters",_.ADDRESS="address",_.SMART_CONTRACT_ADDRESS="smart_contract_address",_.SMART_ROLLUP_ADDRESS="smart_rollup_address",_.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",_.VALUE="value",_.PADDED_BYTES="padded_bytes",_.SMART_ROLLUP_MESSAGE="smart_rollup_message",_.MANAGER="manager",_.BLOCK_PAYLOAD_HASH="blockPayloadHash",_.ENTRYPOINT="entrypoint",_.OPERATION="operation",_.OP_ACTIVATE_ACCOUNT="activate_account",_.OP_DELEGATION="delegation",_.OP_TRANSACTION="transaction",_.OP_ORIGINATION="origination",_.OP_BALLOT="ballot",_.OP_FAILING_NOOP="failing_noop",_.OP_ATTESTATION="attestation",_.OP_ENDORSEMENT="endorsement",_.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",_.OP_REVEAL="reveal",_.OP_PROPOSALS="proposals",_.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",_.OP_TRANSFER_TICKET="transfer_ticket",_.BURN_LIMIT="burn_limit",_.OP_INCREASE_PAID_STORAGE="increase_paid_storage",_.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",_.OP_DRAIN_DELEGATE="drain_delegate",_.DEPOSITS_LIMIT="deposits_limit",_.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",_.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",_.PVM_KIND="pvm_kind",_.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",_.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message"})(CODEC||(CODEC={}));const opMapping={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction_deprecated",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET_DEPRECATED",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ",94:"tx_rollup_l2_address",95:"MIN_BLOCK_TIME",96:"sapling_transaction",97:"EMIT",98:"Lambda_rec",99:"LAMBDA_REC","9a":"TICKET","9b":"BYTES","9c":"NAT"},opMappingReverse=(()=>{const _={};return Object.keys(opMapping).forEach(a=>{_[opMapping[a]]=a}),_})(),kindMapping={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",21:"attestation",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant",158:"transfer_ticket",112:"set_deposits_limit",113:"increase_paid_storage",114:"update_consensus_key",9:"drain_delegate",200:"smart_rollup_originate",201:"smart_rollup_add_messages",206:"smart_rollup_execute_outbox_message",17:"failing_noop"},kindMappingReverse=(()=>{const _={};return Object.keys(kindMapping).forEach(a=>{const $=typeof a=="string"?parseInt(a,10):a;_[kindMapping[$]]=pad($,2)}),_})(),entrypointMapping={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate","05":"deposit","06":"stake","07":"unstake","08":"finalize_unstake","09":"set_delegate_parameters"},entrypointMappingReverse=(()=>{const _={};return Object.keys(entrypointMapping).forEach(a=>{_[entrypointMapping[a]]=a}),_})();class InvalidOperationSchemaError extends ParameterValidationError{constructor(a,$){super(),this.operation=a,this.errorDetail=$,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",$&&(this.message+=` ${$}.`)}}class OversizedEntryPointError extends ParameterValidationError{constructor(a){super(),this.entrypoint=a,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${a.length}", maximum length is "${ENTRYPOINT_MAX_LENGTH}".`}}class InvalidBallotValueError extends ParameterValidationError{constructor(a){super(),this.ballotValue=a,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${a}" expecting one of the following: "yay", "nay", "pass".`}}class DecodeBallotValueError extends ParameterValidationError{constructor(a){super(),this.ballotValue=a,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${a}", cannot be decoded.`}}class UnexpectedMichelsonValueError extends ParameterValidationError{constructor(a){super(),this.value=a,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${a}", unalbe to encode.`}}class OperationDecodingError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="OperationDecodingError"}}class OperationEncodingError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="OperationEncodingError"}}class UnsupportedOperationError extends ParameterValidationError{constructor(a){super(),this.op=a,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${a}", can submit an issue on our github for feature request.`}}class UnsupportedPvmKindError extends ParameterValidationError{constructor(a){super(),this.pvm=a,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${a}" expecting either "arith" or "wasm_2_0_0".`}}class DecodePvmKindError extends ParameterValidationError{constructor(a){super(),this.pvm=a,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${a}", cannot be decoded.`}}class InvalidSmartRollupAddressError extends ParameterValidationError{constructor(a,$){super(),this.address=a,this.errorDetail=$,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${a}"`,$&&(this.message+=` ${$}.`)}}class InvalidSmartRollupCommitmentHashError extends ParameterValidationError{constructor(a,$){super(),this.hash=a,this.errorDetail=$,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${a}"`,$&&(this.message+=` ${$}.`)}}class Uint8ArrayConsumer{static fromHexString(a){const $=a.toLowerCase();if(/^(([a-f]|\d){2})*$/.test($)){const j=new Uint8Array(($.match(/([a-z]|\d){2}/g)||[]).map(et=>parseInt(et,16)));return new Uint8ArrayConsumer(j)}else throw new InvalidHexStringError($)}constructor(a,$=0){this.arr=a,this.offset=$}consume(a){const $=this.arr.subarray(this.offset,this.offset+a);return this.offset+=a,$}get(a){return this.arr[this.offset+a]}length(){return this.arr.length-this.offset}slice(a,$){return new Uint8ArrayConsumer(this.arr.slice(a,$))}}const isPrim=_=>"prim"in _,isBytes$2=_=>"bytes"in _&&typeof _.bytes=="string",isString=_=>"string"in _&&typeof _.string=="string",isInt=_=>"int"in _&&typeof _.int=="string",scriptEncoder=_=>{const a=valueEncoder(_.code),$=valueEncoder(_.storage);return`${pad(a.length/2,8)}${a}${pad($.length/2,8)}${$}`},scriptDecoder=_=>{const a=extractRequiredLen(_),$=extractRequiredLen(_);return{code:valueDecoder(new Uint8ArrayConsumer(a)),storage:valueDecoder(new Uint8ArrayConsumer($))}},valueEncoder=_=>{if(Array.isArray(_)){const a=_.map(j=>valueEncoder(j)).join(""),$=a.length/2;return`02${pad($)}${a}`}else{if(isPrim(_))return primEncoder(_);if(isBytes$2(_))return bytesEncoder(_);if(isString(_))return stringEncoder(_);if(isInt(_))return intEncoder(_)}throw new UnexpectedMichelsonValueError(JSON.stringify(_))},valueDecoder=_=>{const a=_.consume(1);switch(a[0]){case 10:return bytesDecoder(_);case 1:return stringDecoder(_);case 0:return intDecoder(_);case 2:{const $=new Uint8ArrayConsumer(extractRequiredLen(_)),j=[];for(;$.length()>0;)j.push(valueDecoder($));return j}default:return primDecoder(_,a)}},extractRequiredLen=(_,a=4)=>{const $=_.consume(a),j=parseInt(Buffer$g.from($).toString("hex"),16);return _.consume(j)},stripLengthPrefixFromBytes=(_,a=4)=>{const $=[];let j=_;for(;j.length();){const et=j.consume(a),tt=parseInt(Buffer$g.from(et).toString("hex"),16);$.push(j.consume(tt)),j=j.slice(tt+a)}return $},bytesEncoder=_=>{if(!/^([A-Fa-f0-9]{2})*$/.test(_.bytes))throw new InvalidHexStringError(_.bytes);const a=_.bytes.length/2;return`0a${pad(a)}${_.bytes}`},bytesDecoder=_=>{const a=extractRequiredLen(_);return{bytes:Buffer$g.from(a).toString("hex")}},stringEncoder=_=>{const a=Buffer$g.from(_.string,"utf8").toString("hex"),$=a.length/2;return`01${pad($)}${a}`},stringDecoder=_=>{const a=extractRequiredLen(_);return{string:Buffer$g.from(a).toString("utf8")}},intEncoder=({int:_})=>{const a=new BigNumber(_,10),$=a.toString(2)[0]==="-"?"1":"0",j=a.toString(2).replace(/-/g,""),et=j.length<=6?6:(j.length-6)%7?j.length+7-(j.length-6)%7:j.length,rt=j.padStart(et,"0").match(/\d{6,7}/g).reverse();return rt[0]=$+rt[0],`00${rt.map((it,at)=>parseInt((at===rt.length-1?"0":"1")+it,2).toString(16).padStart(2,"0")).join("")}`},intDecoder=_=>{let a=_.consume(1)[0];const $=[],j=128;for(;a&j;)$.push(a),a=_.consume(1)[0];$.push(a);const et=!!(64&$[0]);$[0]=$[0]&127;const tt=$.map((nt,it)=>nt.toString(2).slice(it===0?-6:-7).padStart(it===0?6:7,"0")).reverse();let rt=new BigNumber(tt.join(""),2);return et&&(rt=rt.times(-1)),{int:rt.toFixed()}},primEncoder=_=>{const a=+Array.isArray(_.annots),$=Array.isArray(_.args)?_.args.length:0,j=pad(Math.min(2*$+a+3,9),2),et=opMappingReverse[_.prim];let tt=(_.args||[]).map(nt=>valueEncoder(nt)).join("");const rt=Array.isArray(_.annots)?encodeAnnots(_.annots):"";return(_.prim==="LAMBDA"||_.prim==="LAMBDA_REC")&&$&&(tt=pad(tt.length/2)+tt+pad(0)),(_.prim==="pair"||_.prim==="Pair")&&$>2&&(tt=rt===""?pad(tt.length/2)+tt+pad(0):pad(tt.length/2)+tt),_.prim==="view"&&_.args&&(tt=pad(tt.length/2)+tt+pad(0)),`${j}${et}${tt}${rt}`},primDecoder=(_,a)=>{const $=(a[0]-3)%2===1;let j=Math.floor((a[0]-3)/2);const et=_.consume(1)[0].toString(16).padStart(2,"0"),tt={prim:opMapping[et]};if((opMapping[et]==="LAMBDA"||opMapping[et]==="LAMBDA_REC")&&_.consume(4),opMapping[et]==="view")return j!=0?primViewDecoder(_,tt):tt;let rt,nt;(opMapping[et]==="pair"||opMapping[et]==="Pair")&&j>2&&(rt=decodeCombPair(_),j=0,nt=decodeAnnots(_));const it=new Array(j).fill(0).map(()=>valueDecoder(_));return(opMapping[et]==="LAMBDA"||opMapping[et]==="LAMBDA_REC")&&_.consume(4),rt?tt.args=rt:it.length&&(tt.args=it),nt&&nt[0]!==""?tt.annots=nt:$&&(tt.annots=decodeAnnots(_)),tt},primViewDecoder=(_,a)=>(_.consume(4),a.args=new Array(4).fill(0).map(()=>valueDecoder(_)),_.consume(4),a),decodeCombPair=_=>{const a=new Uint8ArrayConsumer(extractRequiredLen(_)),$=[];for(;a.length()>0;)$.push(valueDecoder(a));return $},encodeAnnots=_=>{const a=_.map(j=>Buffer$g.from(j,"utf8").toString("hex")).join("20"),$=a.length/2;return`${pad($)}${a}`},decodeAnnots=_=>{const a=_.consume(4),$=parseInt(Buffer$g.from(a).toString("hex"),16),j=_.consume($);return Buffer$g.from(j).toString("hex").split("20").map(tt=>Buffer$g.from(tt,"hex").toString("utf8"))},prefixEncoder=_=>a=>buf2hex(Buffer$g.from(b58cdecode(a,prefix[_]))),prefixDecoder=_=>a=>{const $=a.consume(prefixLength[_]);return b58cencode($,prefix[_])},tz1Decoder=prefixDecoder(Prefix.TZ1),branchDecoder=prefixDecoder(Prefix.B),publicKeyHashDecoder=_=>{const a=_.consume(1);if(a[0]===0)return prefixDecoder(Prefix.TZ1)(_);if(a[0]===1)return prefixDecoder(Prefix.TZ2)(_);if(a[0]===2)return prefixDecoder(Prefix.TZ3)(_)},publicKeyHashesDecoder=_=>{if(!boolDecoder(_))return;const a=[];for(_.consume(4);_.length()>0;)a.push(publicKeyHashDecoder(_));return a},branchEncoder=prefixEncoder(Prefix.B),tz1Encoder=prefixEncoder(Prefix.TZ1),boolEncoder=_=>_?"ff":"00",proposalEncoder=_=>prefixEncoder(Prefix.P)(_),proposalDecoder=_=>prefixDecoder(Prefix.P)(_),proposalsDecoder=_=>{const a=[];for(_.consume(4);_.length()>0;)a.push(proposalDecoder(_));return a},proposalsEncoder=_=>pad(32*_.length)+_.map(a=>proposalEncoder(a)).join(""),ballotEncoder=_=>{switch(_){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new InvalidBallotValueError(_)}},ballotDecoder=_=>{const a=_.consume(1);switch(a[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new DecodeBallotValueError(a[0].toString())}},pvmKindEncoder=_=>{switch(_){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new UnsupportedPvmKindError(_)}},pvmKindDecoder=_=>{const a=_.consume(1);switch(a[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new DecodePvmKindError(a[0].toString())}},delegateEncoder=_=>_?boolEncoder(!0)+publicKeyHashEncoder(_):boolEncoder(!1),int32Encoder=_=>{const a=parseInt(String(_),10),$=[];for(let j=0;j<4;j++){const et=(4-(j+1))*8;$.push((a&255<>et)}return Buffer$g.from($).toString("hex")},int32Decoder=_=>{const a=_.consume(4);let $=0;for(let j=0;j{const a=parseInt(String(_),10),$=[];for(let j=0;j<2;j++){const et=(2-(j+1))*8;$.push((a&255<>et)}return Buffer$g.from($).toString("hex")},int16Decoder=_=>{const a=_.consume(2);let $=0;for(let j=0;j_.consume(1)[0]===255,delegateDecoder=_=>{if(boolDecoder(_))return publicKeyHashDecoder(_)},publicKeyHashEncoder=_=>{switch(_.substring(0,3)){case Prefix.TZ1:return"00"+prefixEncoder(Prefix.TZ1)(_);case Prefix.TZ2:return"01"+prefixEncoder(Prefix.TZ2)(_);case Prefix.TZ3:return"02"+prefixEncoder(Prefix.TZ3)(_);case Prefix.TZ4:return"03"+prefixEncoder(Prefix.TZ4)(_);default:throw new InvalidKeyHashError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one for the following "${Prefix.TZ1}", "${Prefix.TZ2}", "${Prefix.TZ3}" or "${Prefix.TZ4}".`)}},publicKeyHashesEncoder=_=>{if(!_)return boolEncoder(!1);if(_.length===0)return boolEncoder(!0)+pad(0);const a=_.reduce(($,j)=>$+publicKeyHashEncoder(j),"");return boolEncoder(!0)+pad(a.length/2)+a},publicKeyEncoder=_=>{switch(_.substring(0,4)){case Prefix.EDPK:return"00"+prefixEncoder(Prefix.EDPK)(_);case Prefix.SPPK:return"01"+prefixEncoder(Prefix.SPPK)(_);case Prefix.P2PK:return"02"+prefixEncoder(Prefix.P2PK)(_);default:throw new InvalidPublicKeyError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following '${Prefix.EDPK}', '${Prefix.SPPK}', '${Prefix.P2PK}' or '${Prefix.BLPK}'.`)}},addressEncoder=_=>{switch(_.substring(0,3)){case Prefix.TZ1:case Prefix.TZ2:case Prefix.TZ3:case Prefix.TZ4:return"00"+publicKeyHashEncoder(_);case Prefix.KT1:return"01"+prefixEncoder(Prefix.KT1)(_)+"00";default:throw new InvalidAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following prefix '${Prefix.TZ1}', ${Prefix.TZ2}', '${Prefix.TZ3}', '${Prefix.TZ4}' or '${Prefix.KT1}'.`)}},smartRollupAddressEncoder=_=>{if(_.substring(0,3)!==Prefix.SR1)throw new InvalidSmartRollupAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SR1}'.`);return prefixEncoder(Prefix.SR1)(_)},smartContractAddressEncoder=_=>{if(_.substring(0,3)===Prefix.KT1)return"01"+prefixEncoder(Prefix.KT1)(_)+"00";throw new InvalidContractAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.KT1}'.`)},publicKeyDecoder=_=>{switch(_.consume(1)[0]){case 0:return prefixDecoder(Prefix.EDPK)(_);case 1:return prefixDecoder(Prefix.SPPK)(_);case 2:return prefixDecoder(Prefix.P2PK)(_);default:throw new InvalidPublicKeyError(_.toString(),invalidDetail(ValidationResult.NO_PREFIX_MATCHED))}},smartRollupCommitmentHashEncoder=_=>{if(_.substring(0,4)===Prefix.SRC1)return prefixEncoder(Prefix.SRC1)(_);throw new InvalidSmartRollupCommitmentHashError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SRC1}'`)},addressDecoder=_=>{switch(_.consume(1)[0]){case 0:return publicKeyHashDecoder(_);case 1:{const $=prefixDecoder(Prefix.KT1)(_);return _.consume(1),$}default:throw new InvalidAddressError(_.toString(),": Unable to decode.")}},smartRollupAddressDecoder=_=>{const a=prefixDecoder(Prefix.SR1)(_);if(a.substring(0,3)!==Prefix.SR1)throw new InvalidSmartRollupAddressError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SR1}'.`);return a},smartContractAddressDecoder=_=>{if(_.consume(1)[0]===1){const $=prefixDecoder(Prefix.KT1)(_);return _.consume(1),$}throw new InvalidContractAddressError(_.toString(),invalidDetail(ValidationResult.NO_PREFIX_MATCHED))},smartRollupCommitmentHashDecoder=_=>{const a=prefixDecoder(Prefix.SRC1)(_);if(a.substring(0,4)!==Prefix.SRC1)throw new InvalidSmartRollupCommitmentHashError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SRC1}'`);return a},zarithEncoder=_=>{const a=[];let $=new BigNumber(_,10);if($.isNaN())throw new TypeError(`Invalid zarith number ${_}`);for(;;)if($.lt(128)){$.lt(16)&&a.push("0"),a.push($.toString(16));break}else{let j=$.mod(128);$=$.minus(j),$=$.dividedBy(128),j=j.plus(128),a.push(j.toString(16))}return a.join("")},zarithDecoder=_=>{let a=0;for(;a<_.length()&&_.get(a)&128;)a+=1;let $=new BigNumber(0);for(let j=a;j>=0;j-=1){const et=_.get(j)&127;$=$.multipliedBy(128),$=$.plus(et)}return _.consume(a+1),new BigNumber($).toString()},entrypointDecoder=_=>{const a=pad(_.consume(1)[0],2);if(a in entrypointMapping)return entrypointMapping[a];{const $=extractRequiredLen(_,1),j=Buffer$g.from($).toString("utf8");if(j.length>ENTRYPOINT_MAX_LENGTH)throw new OversizedEntryPointError(j);return j}},parametersDecoder=_=>{if(_.consume(1)[0]!==0){const $=entrypointDecoder(_),j=extractRequiredLen(_),et=valueDecoder(new Uint8ArrayConsumer(j));return{entrypoint:$,value:et}}},entrypointEncoder=_=>{if(_ in entrypointMappingReverse)return`${entrypointMappingReverse[_]}`;if(_.length>ENTRYPOINT_MAX_LENGTH)throw new OversizedEntryPointError(_);return`ff${valueEncoder({string:_}).slice(8)}`},parametersEncoder=_=>{if(!_||_.entrypoint==="default"&&"prim"in _.value&&_.value.prim==="Unit")return"00";const a=entrypointEncoder(_.entrypoint),$=valueEncoder(_.value),j=($.length/2).toString(16).padStart(8,"0");return`ff${a}${j}${$}`},valueParameterEncoder=_=>{const a=valueEncoder(_);return`${pad(a.length/2)}${a}`},valueParameterDecoder=_=>{const a=extractRequiredLen(_);return valueDecoder(new Uint8ArrayConsumer(a))},blockPayloadHashEncoder=prefixEncoder(Prefix.VH),blockPayloadHashDecoder=prefixDecoder(Prefix.VH),entrypointNameEncoder=_=>`${valueEncoder({string:_}).slice(2)}`,entrypointNameDecoder=_=>{const a=extractRequiredLen(_);return Buffer$g.from(a).toString("utf8")},burnLimitEncoder=_=>_?`ff${zarithEncoder(_)}`:"00",burnLimitDecoder=_=>{const a=_.consume(1);if(Buffer$g.from(a).toString("hex")!=="00")return zarithDecoder(_)},depositsLimitEncoder=_=>_?`ff${zarithEncoder(_)}`:"00",depositsLimitDecoder=_=>{const a=_.consume(1);if(Buffer$g.from(a).toString("hex")!=="00")return zarithDecoder(_)},paddedBytesEncoder=(_,a=8)=>`${pad(_.length/2,a)}${_}`,paddedBytesDecoder=_=>{const a=extractRequiredLen(_);return Buffer$g.from(a).toString("hex")},smartRollupMessageEncoder=_=>{const a=_.reduce(($,j)=>$+`${pad(j.length/2)}${j}`,"");return`${pad(a.length/2)}${a}`},smartRollupMessageDecoder=_=>{const a=extractRequiredLen(_);return stripLengthPrefixFromBytes(new Uint8ArrayConsumer(a)).map(j=>Buffer$g.from(j).toString("hex"))},ManagerOperationSchema={branch:CODEC.BRANCH,contents:[CODEC.OPERATION]},ActivationSchema={pkh:CODEC.TZ1,secret:CODEC.SECRET},RevealSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,public_key:CODEC.PUBLIC_KEY},DelegationSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,delegate:CODEC.DELEGATE},TransactionSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,amount:CODEC.ZARITH,destination:CODEC.ADDRESS,parameters:CODEC.PARAMETERS},OriginationSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,balance:CODEC.ZARITH,delegate:CODEC.DELEGATE,script:CODEC.SCRIPT},BallotSchema={source:CODEC.PKH,period:CODEC.INT32,proposal:CODEC.PROPOSAL,ballot:CODEC.BALLOT_STATEMENT},AttestationSchema={slot:CODEC.INT16,level:CODEC.INT32,round:CODEC.INT32,block_payload_hash:CODEC.BLOCK_PAYLOAD_HASH},EndorsementSchema={slot:CODEC.INT16,level:CODEC.INT32,round:CODEC.INT32,block_payload_hash:CODEC.BLOCK_PAYLOAD_HASH},SeedNonceRevelationSchema={level:CODEC.INT32,nonce:CODEC.RAW},ProposalsSchema={source:CODEC.PKH,period:CODEC.INT32,proposals:CODEC.PROPOSAL_ARR},RegisterGlobalConstantSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,value:CODEC.VALUE},TransferTicketSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,ticket_contents:CODEC.VALUE,ticket_ty:CODEC.VALUE,ticket_ticketer:CODEC.ADDRESS,ticket_amount:CODEC.ZARITH,destination:CODEC.ADDRESS,entrypoint:CODEC.ENTRYPOINT},IncreasePaidStorageSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,amount:CODEC.ZARITH,destination:CODEC.SMART_CONTRACT_ADDRESS},UpdateConsensusKeySchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,pk:CODEC.PUBLIC_KEY},DrainDelegateSchema={consensus_key:CODEC.PKH,delegate:CODEC.PKH,destination:CODEC.PKH},SetDepositsLimitSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,limit:CODEC.DEPOSITS_LIMIT},SmartRollupOriginateSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,pvm_kind:CODEC.PVM_KIND,kernel:CODEC.PADDED_BYTES,parameters_ty:CODEC.VALUE,whitelist:CODEC.PKH_ARR},SmartRollupAddMessagesSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,message:CODEC.SMART_ROLLUP_MESSAGE},SmartRollupExecuteOutboxMessageSchema={source:CODEC.PKH,fee:CODEC.ZARITH,counter:CODEC.ZARITH,gas_limit:CODEC.ZARITH,storage_limit:CODEC.ZARITH,rollup:CODEC.SMART_ROLLUP_ADDRESS,cemented_commitment:CODEC.SMART_ROLLUP_COMMITMENT_HASH,output_proof:CODEC.PADDED_BYTES},FailingNoopSchema={arbitrary:CODEC.PADDED_BYTES},operationEncoder=_=>a=>{if(!(a.kind in _)||!(a.kind in kindMappingReverse))throw new InvalidOperationKindError(a.kind);return kindMappingReverse[a.kind]+_[a.kind](a)},operationDecoder=_=>a=>{const $=a.consume(1),j=kindMapping[$[0]];if(j===void 0)throw new UnsupportedOperationError($[0].toString());const et=_[j](a);if(typeof et!="object")throw new OperationDecodingError("Invalid operation, cannot be decoded.");return Object.assign({kind:j},et)},schemaEncoder=_=>a=>$=>Object.keys(a).reduce((et,tt)=>{const rt=a[tt];if($&&Array.isArray(rt)){const nt=_[rt[0]],it=$[tt];if(!Array.isArray(it))throw new OperationEncodingError(`Invalid operation value "${JSON.stringify(it)}" of key "${tt}, expected value to be Array.`);return et+it.reduce((at,st)=>at+nt(st),"")}else{const nt=_[rt];return et+nt($[tt])}},""),schemaDecoder=_=>a=>$=>Object.keys(a).reduce((et,tt)=>{const rt=a[tt];if(Array.isArray(rt)){const nt=_[rt[0]],it=[],at=$.length();for(;$.length()>0;)if(it.push(nt($)),at===$.length())throw new OperationDecodingError("Unable to decode value");return Object.assign(Object.assign({},et),{[tt]:it})}else{const nt=_[rt],it=nt($);return typeof it<"u"?Object.assign(Object.assign({},et),{[tt]:it}):Object.assign({},et)}},{}),decoders={[CODEC.SECRET]:_=>toHexString(_.consume(20)),[CODEC.RAW]:_=>toHexString(_.consume(32)),[CODEC.TZ1]:tz1Decoder,[CODEC.BRANCH]:branchDecoder,[CODEC.ZARITH]:zarithDecoder,[CODEC.PUBLIC_KEY]:publicKeyDecoder,[CODEC.PKH]:publicKeyHashDecoder,[CODEC.PKH_ARR]:publicKeyHashesDecoder,[CODEC.DELEGATE]:delegateDecoder,[CODEC.INT32]:int32Decoder,[CODEC.SCRIPT]:scriptDecoder,[CODEC.BALLOT_STATEMENT]:ballotDecoder,[CODEC.PROPOSAL]:proposalDecoder,[CODEC.PROPOSAL_ARR]:proposalsDecoder,[CODEC.PARAMETERS]:parametersDecoder,[CODEC.ADDRESS]:addressDecoder,[CODEC.SMART_ROLLUP_ADDRESS]:smartRollupAddressDecoder,[CODEC.SMART_CONTRACT_ADDRESS]:smartContractAddressDecoder,[CODEC.SMART_ROLLUP_COMMITMENT_HASH]:smartRollupCommitmentHashDecoder,[CODEC.VALUE]:valueParameterDecoder,[CODEC.INT16]:int16Decoder,[CODEC.BLOCK_PAYLOAD_HASH]:blockPayloadHashDecoder,[CODEC.ENTRYPOINT]:entrypointNameDecoder,[CODEC.BURN_LIMIT]:burnLimitDecoder,[CODEC.DEPOSITS_LIMIT]:depositsLimitDecoder,[CODEC.PVM_KIND]:pvmKindDecoder,[CODEC.PADDED_BYTES]:paddedBytesDecoder,[CODEC.SMART_ROLLUP_MESSAGE]:smartRollupMessageDecoder};decoders[CODEC.OPERATION]=operationDecoder(decoders);decoders[CODEC.OP_ACTIVATE_ACCOUNT]=_=>schemaDecoder(decoders)(ActivationSchema)(_);decoders[CODEC.OP_FAILING_NOOP]=_=>schemaDecoder(decoders)(FailingNoopSchema)(_);decoders[CODEC.OP_DELEGATION]=_=>schemaDecoder(decoders)(DelegationSchema)(_);decoders[CODEC.OP_TRANSACTION]=_=>schemaDecoder(decoders)(TransactionSchema)(_);decoders[CODEC.OP_ORIGINATION]=_=>schemaDecoder(decoders)(OriginationSchema)(_);decoders[CODEC.OP_BALLOT]=_=>schemaDecoder(decoders)(BallotSchema)(_);decoders[CODEC.OP_ATTESTATION]=_=>schemaDecoder(decoders)(AttestationSchema)(_);decoders[CODEC.OP_ENDORSEMENT]=_=>schemaDecoder(decoders)(EndorsementSchema)(_);decoders[CODEC.OP_SEED_NONCE_REVELATION]=_=>schemaDecoder(decoders)(SeedNonceRevelationSchema)(_);decoders[CODEC.OP_PROPOSALS]=_=>schemaDecoder(decoders)(ProposalsSchema)(_);decoders[CODEC.OP_REVEAL]=_=>schemaDecoder(decoders)(RevealSchema)(_);decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT]=_=>schemaDecoder(decoders)(RegisterGlobalConstantSchema)(_);decoders[CODEC.OP_TRANSFER_TICKET]=_=>schemaDecoder(decoders)(TransferTicketSchema)(_);decoders[CODEC.OP_INCREASE_PAID_STORAGE]=_=>schemaDecoder(decoders)(IncreasePaidStorageSchema)(_);decoders[CODEC.OP_UPDATE_CONSENSUS_KEY]=_=>schemaDecoder(decoders)(UpdateConsensusKeySchema)(_);decoders[CODEC.OP_DRAIN_DELEGATE]=_=>schemaDecoder(decoders)(DrainDelegateSchema)(_);decoders[CODEC.OP_SMART_ROLLUP_ORIGINATE]=_=>schemaDecoder(decoders)(SmartRollupOriginateSchema)(_);decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES]=_=>schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(_);decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=_=>schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(_);decoders[CODEC.MANAGER]=schemaDecoder(decoders)(ManagerOperationSchema);decoders[CODEC.OP_SET_DEPOSITS_LIMIT]=_=>schemaDecoder(decoders)(SetDepositsLimitSchema)(_);const encoders={[CODEC.SECRET]:_=>_,[CODEC.RAW]:_=>_,[CODEC.TZ1]:tz1Encoder,[CODEC.BRANCH]:branchEncoder,[CODEC.ZARITH]:zarithEncoder,[CODEC.PUBLIC_KEY]:publicKeyEncoder,[CODEC.PKH]:publicKeyHashEncoder,[CODEC.PKH_ARR]:publicKeyHashesEncoder,[CODEC.DELEGATE]:delegateEncoder,[CODEC.SCRIPT]:scriptEncoder,[CODEC.BALLOT_STATEMENT]:ballotEncoder,[CODEC.PROPOSAL]:proposalEncoder,[CODEC.PROPOSAL_ARR]:proposalsEncoder,[CODEC.INT32]:int32Encoder,[CODEC.PARAMETERS]:parametersEncoder,[CODEC.ADDRESS]:addressEncoder,[CODEC.SMART_ROLLUP_ADDRESS]:smartRollupAddressEncoder,[CODEC.SMART_CONTRACT_ADDRESS]:smartContractAddressEncoder,[CODEC.SMART_ROLLUP_COMMITMENT_HASH]:smartRollupCommitmentHashEncoder,[CODEC.VALUE]:valueParameterEncoder,[CODEC.INT16]:int16Encoder,[CODEC.BLOCK_PAYLOAD_HASH]:blockPayloadHashEncoder,[CODEC.ENTRYPOINT]:entrypointNameEncoder,[CODEC.BURN_LIMIT]:burnLimitEncoder,[CODEC.DEPOSITS_LIMIT]:depositsLimitEncoder,[CODEC.PVM_KIND]:pvmKindEncoder,[CODEC.PADDED_BYTES]:paddedBytesEncoder,[CODEC.SMART_ROLLUP_MESSAGE]:smartRollupMessageEncoder};encoders[CODEC.OPERATION]=operationEncoder(encoders);encoders[CODEC.OP_ACTIVATE_ACCOUNT]=_=>schemaEncoder(encoders)(ActivationSchema)(_);encoders[CODEC.OP_DELEGATION]=_=>schemaEncoder(encoders)(DelegationSchema)(_);encoders[CODEC.OP_TRANSACTION]=_=>schemaEncoder(encoders)(TransactionSchema)(_);encoders[CODEC.OP_ORIGINATION]=_=>schemaEncoder(encoders)(OriginationSchema)(_);encoders[CODEC.OP_BALLOT]=_=>schemaEncoder(encoders)(BallotSchema)(_);encoders[CODEC.OP_ATTESTATION]=_=>schemaEncoder(encoders)(AttestationSchema)(_);encoders[CODEC.OP_ENDORSEMENT]=_=>schemaEncoder(encoders)(EndorsementSchema)(_);encoders[CODEC.OP_SEED_NONCE_REVELATION]=_=>schemaEncoder(encoders)(SeedNonceRevelationSchema)(_);encoders[CODEC.OP_PROPOSALS]=_=>schemaEncoder(encoders)(ProposalsSchema)(_);encoders[CODEC.OP_REVEAL]=_=>schemaEncoder(encoders)(RevealSchema)(_);encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT]=_=>schemaEncoder(encoders)(RegisterGlobalConstantSchema)(_);encoders[CODEC.OP_TRANSFER_TICKET]=_=>schemaEncoder(encoders)(TransferTicketSchema)(_);encoders[CODEC.OP_INCREASE_PAID_STORAGE]=_=>schemaEncoder(encoders)(IncreasePaidStorageSchema)(_);encoders[CODEC.OP_UPDATE_CONSENSUS_KEY]=_=>schemaEncoder(encoders)(UpdateConsensusKeySchema)(_);encoders[CODEC.OP_DRAIN_DELEGATE]=_=>schemaEncoder(encoders)(DrainDelegateSchema)(_);encoders[CODEC.OP_SMART_ROLLUP_ORIGINATE]=_=>schemaEncoder(encoders)(SmartRollupOriginateSchema)(_);encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES]=_=>schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(_);encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=_=>schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(_);encoders[CODEC.MANAGER]=schemaEncoder(encoders)(ManagerOperationSchema);encoders[CODEC.OP_SET_DEPOSITS_LIMIT]=_=>schemaEncoder(encoders)(SetDepositsLimitSchema)(_);encoders[CODEC.OP_FAILING_NOOP]=_=>schemaEncoder(encoders)(FailingNoopSchema)(_);const OperationKindMapping={activate_account:ActivationSchema,reveal:RevealSchema,delegation:DelegationSchema,transaction:TransactionSchema,origination:OriginationSchema,ballot:BallotSchema,attestation:AttestationSchema,endorsement:EndorsementSchema,seed_nonce_revelation:SeedNonceRevelationSchema,proposals:ProposalsSchema,register_global_constant:RegisterGlobalConstantSchema,transfer_ticket:TransferTicketSchema,increase_paid_storage:IncreasePaidStorageSchema,update_consensus_key:UpdateConsensusKeySchema,drain_delegate:DrainDelegateSchema,set_deposits_limit:SetDepositsLimitSchema,smart_rollup_originate:SmartRollupOriginateSchema,smart_rollup_add_messages:SmartRollupAddMessagesSchema,smart_rollup_execute_outbox_message:SmartRollupExecuteOutboxMessageSchema,failing_noop:FailingNoopSchema},getArrayDifference=(_,a)=>a.filter($=>!_.includes($)),deleteArrayElementByValue=(_,a)=>_.filter($=>$!==a),validateOperationKind=_=>Object.keys(OperationKindMapping).includes(_),validateMissingProperty=_=>{const a=_.kind,$=Object.keys(_),j=deleteArrayElementByValue($,"kind"),et=Object.keys(OperationKindMapping[a]);return getArrayDifference(j,et)};var ProtocolsHash;(function(_){_.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",_.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",_.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",_.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",_.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",_.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",_.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",_.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",_.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",_.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",_.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",_.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",_.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",_.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",_.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",_.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",_.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",_.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(ProtocolsHash||(ProtocolsHash={}));const PROTOCOL_CURRENT=ProtocolsHash.ProxfordY;function getCodec(_,a){return{encoder:encoders[_],decoder:$=>{const j=Uint8ArrayConsumer.fromHexString($);return decoders[_](j)}}}class LocalForger{constructor(a=PROTOCOL_CURRENT){this.protocolHash=a,this.codec=getCodec(CODEC.MANAGER,this.protocolHash)}forge(a){const $=validateBlock(a.branch);if($!==ValidationResult.VALID)throw new InvalidBlockHashError(a.branch,invalidDetail($));for(const et of a.contents){if(!validateOperationKind(et.kind))throw new InvalidOperationKindError(et.kind);const tt=validateMissingProperty(et);if(tt.length===1){if(et.kind==="delegation"&&tt[0]==="delegate")continue;if(et.kind==="origination"&&tt[0]==="delegate")continue;if(et.kind==="transaction"&&tt[0]==="parameters")continue;if(et.kind==="set_deposits_limit"&&tt[0]==="limit")continue;if(et.kind==="smart_rollup_originate"&&tt[0]==="whitelist")continue;throw new InvalidOperationSchemaError(et,`missing properties "${tt.join(", ")}"`)}else if(tt.length>1)throw new InvalidOperationSchemaError(et,`missing properties "${tt.join(", ")}"`)}const j=this.codec.encoder(a).toLowerCase();return Promise.resolve(j)}parse(a){return Promise.resolve(this.codec.decoder(a))}}new LocalForger;function __rest(_,a){var $={};for(var j in _)Object.prototype.hasOwnProperty.call(_,j)&&a.indexOf(j)<0&&($[j]=_[j]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(_);et(_.on("data",$=>{a.next($)}),_.on("error",$=>{a.error($)}),_.on("close",()=>{a.complete()}),()=>{_.close()}))}const REVEAL_GAS_LIMIT={TZ1:169,TZ2:155,TZ3:445,TZ4:1674},REVEAL_FEE={TZ1:276,TZ2:276,TZ3:305,TZ4:477},REVEAL_STORAGE_LIMIT=0,COST_PER_BYTE=250;var Protocols;(function(_){_.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",_.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",_.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",_.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",_.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",_.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",_.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",_.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",_.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",_.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",_.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",_.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",_.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",_.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",_.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",_.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",_.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",_.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",_.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(Protocols||(Protocols={}));Protocols.Pt24m4xi,Protocols.PsBABY5H,Protocols.PsBabyM1,Protocols.PsCARTHA,Protocols.PsDELPH1,Protocols.PtEdo2Zk,Protocols.PsFLorena,Protocols.PtGRANADs,Protocols.PtHangz2,Protocols.PsiThaCa,Protocols.Psithaca2,Protocols.PtJakart2,Protocols.PtKathman,Protocols.PtLimaPtL,Protocols.PtMumbai2,Protocols.PtNairobi,Protocols.ProxfordY,Protocols.ProtoALpha;var ChainIds;(function(_){_.MAINNET="NetXdQprcVkpaWU",_.CARTHAGENET="NetXjD3HPJJjmcd",_.DELPHINET="NetXm8tYqnMWky1",_.EDONET="NetXSgo1ZT2DRUG",_.FLORENCENET="NetXxkAx4woPLyu",_.GRANADANET="NetXz969SFaFn8k",_.HANGZHOUNET="NetXZSsxBpMQeAT",_.ITHACANET="NetXbhmtAbMukLc",_.ITHACANET2="NetXnHfVqm9iesp",_.JAKARTANET2="NetXLH1uAxK7CCh",_.KATHMANDUNET="NetXazhm4yetmff",_.LIMANET="NetXizpkH94bocH",_.MUMBAINET="NetXQw6nWSnrJ5t",_.MUMBAINET2="NetXgbcrNtXD2yA",_.NAIROBINET="NetXyuzvDo2Ugzb",_.OXFORDNET2="NetXxWsskGahzQB"})(ChainIds||(ChainIds={}));const getRevealGasLimit=_=>Math.round(getRevealGasLimitInternal(_)*37/10),getRevealGasLimitInternal=_=>{switch(_.substring(0,3)){case"tz1":return REVEAL_GAS_LIMIT.TZ1;case"tz2":return REVEAL_GAS_LIMIT.TZ2;case"tz3":return REVEAL_GAS_LIMIT.TZ3;case"tz4":return REVEAL_GAS_LIMIT.TZ4;default:throw new Error(`Cannot estimate reveal gas limit for ${_}`)}},getRevealFee=_=>Math.round(getRevealFeeInternal(_)*12/10),getRevealFeeInternal=_=>{switch(_.substring(0,3)){case"tz1":return REVEAL_FEE.TZ1;case"tz2":return REVEAL_FEE.TZ2;case"tz3":return REVEAL_FEE.TZ3;case"tz4":return REVEAL_FEE.TZ4;default:throw new Error(`Cannot estimate reveal fee for ${_}`)}};class InvalidParameterError extends ParameterValidationError{constructor(a,$,j){super(),this.smartContractMethodName=a,this.sigs=$,this.invalidParams=j,this.name="InvalidParameterError",this.message=`${a} Received ${j.length} arguments while expecting one of the following signatures (${JSON.stringify($)})`}}class InvalidDelegationSource extends ParameterValidationError{constructor(a){super(),this.source=a,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${a}. Please use the smart contract abstraction to set your delegate.`}}class InvalidCodeParameter extends ParameterValidationError{constructor(a,$){super(),this.message=a,this.data=$,this.name="InvalidCodeParameter"}}class InvalidInitParameter extends ParameterValidationError{constructor(a,$){super(),this.message=a,this.data=$,this.name="InvalidInitParameter"}}class ViewSimulationError extends RpcError{constructor(a,$,j,et){super(),this.message=a,this.viewName=$,this.failWith=j,this.cause=et,this.name="ViewSimulationError"}}const validateAndExtractFailwith=_=>{if(isJsonString(_.body)){const a=JSON.parse(_.body);if(Array.isArray(a)&&"with"in a[a.length-1])return a[a.length-1].with}},isJsonString=_=>{try{JSON.parse(_)}catch{return!1}return!0};class InvalidViewSimulationContext extends ParameterValidationError{constructor(a){super(),this.info=a,this.name="InvalidViewSimulationContext",this.message=`${a} Please configure the context of the view execution in the executeView method.`}}class RevealOperationError extends RpcError{constructor(a){super(),this.message=a,this.name="RevealOperationError"}}class OriginationParameterError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name}}class InvalidBalanceError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidBalanceError"}}const createActivationOperation=({pkh:_,secret:a})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.ACTIVATION,pkh:_,secret:a}}),createOriginationOperation=({code:_,init:a,balance:$="0",delegate:j,storage:et,fee:tt,gasLimit:rt,storageLimit:nt,mutez:it=!1})=>__awaiter(void 0,void 0,void 0,function*(){if(et!==void 0&&a!==void 0)throw new OriginationParameterError("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(_))throw new InvalidCodeParameter("Wrong code parameter type, expected an array",_);let at;if(et!==void 0){const ut=_.find(mt=>"prim"in mt&&mt.prim==="storage");if((ut==null?void 0:ut.args)===void 0)throw new InvalidCodeParameter("The storage section is missing from the script",_);at=new Schema(ut.args[0]).Encode(et)}else if(a!==void 0&&typeof a=="object")at=a;else throw new InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",a);const st={code:_,storage:at};if(isNaN(Number($)))throw new InvalidBalanceError(`Invalid Balance "${$}", cannot be converted to a number`);const ot={kind:OpKind.ORIGINATION,fee:tt,gas_limit:rt,storage_limit:nt,balance:it?$.toString():format$1("tz","mutez",$).toString(),script:st};return j&&(ot.delegate=j),ot}),createTransferOperation=({to:_,amount:a,parameter:$,fee:j,gasLimit:et,storageLimit:tt,mutez:rt=!1})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.TRANSACTION,fee:j,gas_limit:et,storage_limit:tt,amount:rt?a.toString():format$1("tz","mutez",a).toString(),destination:_,parameters:$}}),createSetDelegateOperation=({delegate:_,source:a,fee:$,gasLimit:j,storageLimit:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DELEGATION,source:a,fee:$,gas_limit:j,storage_limit:et,delegate:_}}),createRegisterDelegateOperation=({fee:_,gasLimit:a,storageLimit:$},j)=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DELEGATION,fee:_,gas_limit:a,storage_limit:$,delegate:j}}),createRevealOperation=({fee:_,gasLimit:a,storageLimit:$},j,et)=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.REVEAL,fee:_,public_key:et,source:j,gas_limit:a??getRevealGasLimit(j),storage_limit:$}}),createRegisterGlobalConstantOperation=({value:_,source:a,fee:$,gasLimit:j,storageLimit:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.REGISTER_GLOBAL_CONSTANT,value:_,fee:$,gas_limit:j,storage_limit:et,source:a}}),createTransferTicketOperation=({ticketContents:_,ticketTy:a,ticketTicketer:$,ticketAmount:j,destination:et,entrypoint:tt,source:rt,fee:nt,gasLimit:it,storageLimit:at})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.TRANSFER_TICKET,fee:nt,gas_limit:it,storage_limit:at,source:rt,ticket_contents:_,ticket_ty:a,ticket_ticketer:$,ticket_amount:j,destination:et,entrypoint:tt}}),createIncreasePaidStorageOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,amount:et,destination:tt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.INCREASE_PAID_STORAGE,source:_,fee:a,gas_limit:$,storage_limit:j,amount:et,destination:tt}}),createDrainDelegateOperation=({consensus_key:_,delegate:a,destination:$})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DRAIN_DELEGATE,consensus_key:_,delegate:a,destination:$}}),createBallotOperation=({source:_,proposal:a,ballot:$})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.BALLOT,source:_,proposal:a,ballot:$}}),createProposalsOperation=({source:_,proposals:a})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.PROPOSALS,source:_,proposals:a}}),createUpdateConsensusKeyOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,pk:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.UPDATE_CONSENSUS_KEY,source:_,fee:a,gas_limit:$,storage_limit:j,pk:et}}),createSmartRollupAddMessagesOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,message:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_ADD_MESSAGES,source:_,fee:a,gas_limit:$,storage_limit:j,message:et}}),createSmartRollupOriginateOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,pvmKind:et,kernel:tt,parametersType:rt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_ORIGINATE,source:_,fee:a,gas_limit:$,storage_limit:j,pvm_kind:et,kernel:tt,parameters_ty:rt}}),createSmartRollupExecuteOutboxMessageOperation=({source:_,fee:a,gasLimit:$,storageLimit:j,rollup:et,cementedCommitment:tt,outputProof:rt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,source:_,fee:a,gas_limit:$,storage_limit:j,rollup:et,cemented_commitment:tt,output_proof:rt}}),attachKind=(_,a)=>Object.assign(Object.assign({},_),{kind:a}),findWithKind=(_,a)=>{if(Array.isArray(_)){const $=_.find(j=>j.kind===a);if($&&isKind($,a))return $}},isKind=(_,a)=>_.kind===a,isOpWithGasBuffer=_=>_.kind===OpKind.TRANSACTION&&_.parameters?!0:["origination","register_global_constant","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(_.kind)!==-1,isOpWithFee=_=>["transaction","delegation","origination","reveal","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate","smart_rollup_execute_outbox_message"].indexOf(_.kind)!==-1,isOpRequireReveal=_=>["transaction","delegation","origination","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate","smart_rollup_execute_outbox_message"].indexOf(_.kind)!==-1,hasMetadata=_=>"metadata"in _,hasMetadataWithResult=_=>hasMetadata(_)&&"operation_result"in _.metadata,hasMetadataWithInternalOperationResult=_=>hasMetadata(_)&&"internal_operation_results"in _.metadata,isErrorWithMessage=_=>"with"in _;class TezosOperationError extends RpcError{constructor(a,$,j){super(),this.errors=a,this.errorDetails=$,this.operationsWithResults=j,this.name="TezosOperationError",this.lastError=a[a.length-1],this.message=`(${this.kind}) ${this.id}`,isErrorWithMessage(this.lastError)&&(this.lastError.with.string?this.message=this.lastError.with.string:this.lastError.with.int?this.message=this.lastError.with.int:this.message=JSON.stringify(this.lastError.with))}get id(){return this.lastError.id}get kind(){return this.lastError.kind}}class TezosPreapplyFailureError extends Error{constructor(a){super(),this.result=a,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}const flattenOperationResult=_=>{const a=Array.isArray(_)?_:[_],$=[];for(let j=0;j$.push(rt.result)))}return $},flattenErrors=(_,a="failed")=>{const $=Array.isArray(_)?_:[_];let j=[];for(let et=0;et<$.length;et++)for(let tt=0;tt<$[et].contents.length;tt++){const rt=$[et].contents[tt];if(hasMetadata(rt)&&(hasMetadataWithResult(rt)&&rt.metadata.operation_result.status===a&&(j=j.concat(rt.metadata.operation_result.errors||[])),hasMetadataWithInternalOperationResult(rt)&&Array.isArray(rt.metadata.internal_operation_results)))for(const nt of rt.metadata.internal_operation_results)"result"in nt&&nt.result.status===a&&(j=j.concat(nt.result.errors||[]))}return j};class OriginationOperationError extends TaquitoError{constructor(a){super(),this.message=a,this.name="OriginationOperationError"}}class InvalidEstimateValueError extends ParameterValidationError{constructor(a){super(),this.message=a,this.name="InvalidEstimateValueError"}}class InvalidConfirmationCountError extends ParameterValidationError{constructor(a){super(),this.invalidConfirmations=a,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${a} expecting at least 1`}}class ConfirmationTimeoutError extends NetworkError{constructor(a){super(),this.message=a,this.name="ConfirmationTimeoutError"}}class RPCResponseError extends RpcError{constructor(a,$){super(),this.message=a,this.cause=$,this.name="RPCResponseError"}}class Operation{get includedInBlock(){return this._foundAt}constructor(a,$,j,et){if(this.hash=a,this.raw=$,this.results=j,this.context=et,this._pollingConfig$=new ReplaySubject(1),this.currentHead$=this._pollingConfig$.pipe(switchMap(tt=>new BehaviorSubject(tt).pipe(timeout({each:tt.timeout*1e3,with:()=>throwError(()=>new ConfirmationTimeoutError("Confirmation polling timed out"))}))),switchMap(()=>defer(()=>createObservableFromSubscription(this.context.stream.subscribeBlock("head"))).pipe(switchMap(tt=>{var rt,nt;const it=(nt=(rt=this.lastHead)===null||rt===void 0?void 0:rt.header.level)!==null&&nt!==void 0?nt:tt.header.level-1;return range(it+1,tt.header.level-it-1).pipe(concatMap(at=>this.context.readProvider.getBlock(at)),endWith(tt))}),tap(tt=>this.lastHead=tt))),shareReplay({refCount:!0})),this.confirmed$=this.currentHead$.pipe(map$1(tt=>{for(let rt=3;rt>=0;rt--)tt.operations[rt].forEach(nt=>{nt.hash===this.hash&&(this._foundAt=tt.header.level)});if(tt.header.level-this._foundAt>=0)return this._foundAt}),filter(tt=>tt!==void 0),first(),shareReplay()),this._foundAt=Number.POSITIVE_INFINITY,validateOperation(this.hash)!==ValidationResult.VALID)throw new InvalidOperationHashError(this.hash);this.confirmed$.pipe(first(),catchError(()=>of(EMPTY))).subscribe()}get revealOperation(){return Array.isArray(this.results)&&this.results.find(a=>a.kind==="reveal")}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map(a=>hasMetadataWithResult(a)?a.metadata.operation_result.status:"unknown")[0]||"unknown"}confirmation(a,$){return __awaiter(this,void 0,void 0,function*(){if(typeof a<"u"&&a<1)throw new InvalidConfirmationCountError(a);const{defaultConfirmationCount:j,confirmationPollingTimeoutSecond:et}=this.context.config;this._pollingConfig$.next({timeout:$||et});const tt=a!==void 0?a:j;return new Promise((rt,nt)=>{this.confirmed$.pipe(switchMap(()=>this.currentHead$),filter(it=>it.header.level-this._foundAt>=tt-1),first()).subscribe({error:it=>nt(it),complete:()=>rt(this._foundAt+(tt-1))})})})}}class BatchOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}sumProp(a,$){return a.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}getOriginatedContractAddresses(){const a=this.results.filter(j=>j.kind==="origination");let $=[];for(const j of a)j.metadata.operation_result.originated_contracts&&($=[...$,...j.metadata.operation_result.originated_contracts]);return $}get status(){return this.results.filter(a=>BATCH_KINDS.indexOf(a.kind)!==-1).map(a=>hasMetadataWithResult(a)?a.metadata.operation_result.status:"unknown")[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(flattenOperationResult({contents:this.results}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(flattenOperationResult({contents:this.results}),"paid_storage_size_diff"))}get errors(){return flattenErrors({contents:this.results})}}class Provider{get rpc(){return this.context.rpc}get signer(){return this.context.signer}constructor(a){this.context=a}forge({opOb:{branch:a,contents:$,protocol:j},counter:et}){return __awaiter(this,void 0,void 0,function*(){return{opbytes:yield this.context.forger.forge({branch:a,contents:$}),opOb:{branch:a,contents:$,protocol:j},counter:et}})}estimate(a,$){var{fee:j,gasLimit:et,storageLimit:tt}=a,rt=__rest(a,["fee","gasLimit","storageLimit"]);return __awaiter(this,void 0,void 0,function*(){let nt=j,it=et,at=tt;if(nt&&nt%1!==0)throw new InvalidEstimateValueError(`Fee value must not be a decimal: ${nt}`);if(it&&it%1!==0)throw new InvalidEstimateValueError(`Gas Limit value must not be a decimal: ${it}`);if(at&&at%1!==0)throw new InvalidEstimateValueError(`Storage Limit value must not be a decimal: ${at}`);if(j===void 0||et===void 0||tt===void 0){const st=yield $(Object.assign({fee:j,gasLimit:et,storageLimit:tt},rt));nt??(nt=st.suggestedFeeMutez),it??(it=st.gasLimit),at??(at=st.storageLimit)}return{fee:nt,gasLimit:it,storageLimit:at}})}getRPCOp(a){return __awaiter(this,void 0,void 0,function*(){switch(a.kind){case OpKind.TRANSACTION:return createTransferOperation(Object.assign({},a));case OpKind.ORIGINATION:return createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},a)));case OpKind.DELEGATION:return createSetDelegateOperation(Object.assign({},a));case OpKind.REGISTER_GLOBAL_CONSTANT:return createRegisterGlobalConstantOperation(Object.assign({},a));case OpKind.INCREASE_PAID_STORAGE:return createIncreasePaidStorageOperation(Object.assign({},a));case OpKind.TRANSFER_TICKET:return createTransferTicketOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ADD_MESSAGES:return createSmartRollupAddMessagesOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ORIGINATE:return createSmartRollupOriginateOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return createSmartRollupExecuteOutboxMessageOperation(Object.assign({},a));default:throw new InvalidOperationKindError(a.kind)}})}runOperation(a){return __awaiter(this,void 0,void 0,function*(){return{opResponse:yield this.rpc.runOperation(a),op:a,context:this.context.clone()}})}simulate(a){return __awaiter(this,void 0,void 0,function*(){return{opResponse:yield this.rpc.simulateOperation(a),op:a,context:this.context.clone()}})}isRevealOpNeeded(a,$){return __awaiter(this,void 0,void 0,function*(){return!(!(yield this.isAccountRevealRequired($))||!this.isRevealRequiredForOpType(a))})}isAccountRevealRequired(a){return __awaiter(this,void 0,void 0,function*(){return!(yield this.context.readProvider.isAccountRevealed(a,"head"))})}isRevealRequiredForOpType(a){let $=!1;for(const j of a)isOpRequireReveal(j)&&($=!0);return $}signAndInject(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.sign(a.opbytes,new Uint8Array([3]));a.opbytes=$.sbytes,a.opOb.signature=$.prefixSig;const j=[],et=yield this.rpc.preapplyOperations([a.opOb]);if(!Array.isArray(et))throw new TezosPreapplyFailureError(et);for(let rt=0;rt__awaiter(this,void 0,void 0,function*(){return a}));case OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},a))}));case OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a}));case OpKind.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a}));default:throw new InvalidOperationKindError(JSON.stringify(a.kind))}})}with(a){for(const $ of a)switch($.kind){case OpKind.TRANSACTION:this.withTransfer($);break;case OpKind.ORIGINATION:this.withOrigination($);break;case OpKind.DELEGATION:this.withDelegation($);break;case OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage($);break;default:throw new InvalidOperationKindError(JSON.stringify($.kind))}return this}send(){return __awaiter(this,void 0,void 0,function*(){const a=[];for(const j of this.operations)a.push(yield this.mapOperation(j));const $=yield this.walletProvider.sendOperations(a);return this.context.operationFactory.createBatchOperation($)})}}class Wallet{constructor(a){this.context=a,this.walletCommand=$=>({send:$})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:a}={}){return __awaiter(this,void 0,void 0,function*(){return(!this._pkh||a)&&(this._pkh=yield this.walletProvider.getPKH()),this._pkh})}pk({forceRefetch:a}={}){return __awaiter(this,void 0,void 0,function*(){return(!this._pk||a)&&(this._pk=yield this.walletProvider.getPK()),this._pk})}originate(a){return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const $=yield this.walletProvider.mapOriginateParamsToWalletParams(()=>this.context.parser.prepareCodeOrigination(Object.assign({},a))),j=yield this.walletProvider.sendOperations([$]);return this.context.operationFactory.createOriginationOperation(j)}))}setDelegate(a){var $;const j=validateAddress(($=a.delegate)!==null&&$!==void 0?$:"");if(a.delegate&&j!==ValidationResult.VALID)throw new InvalidAddressError(a.delegate,invalidDetail(j));return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const et=yield this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a})),tt=yield this.walletProvider.sendOperations([et]);return this.context.operationFactory.createDelegationOperation(tt)}))}signFailingNoop(a){return __awaiter(this,void 0,void 0,function*(){const $={kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary},j=yield this.context.readProvider.getBlockHash(a.basedOnBlock),et=yield this.context.forger.forge({branch:j,contents:[$]});return{signature:yield this.walletProvider.sign(et,Uint8Array.from([3])),bytes:et,signedContent:{branch:j,contents:[{kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary}]}}})}registerDelegate(){return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const a=yield this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return{delegate:yield this.pkh()}})),$=yield this.walletProvider.sendOperations([a]);return this.context.operationFactory.createDelegationOperation($)}))}transfer(a){const $=validateAddress(a.to);if($!==ValidationResult.VALID)throw new InvalidAddressError(a.to,invalidDetail($));return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const j=yield this.walletProvider.mapTransferParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a})),et=yield this.walletProvider.sendOperations([j]);return this.context.operationFactory.createTransactionOperation(et)}))}increasePaidStorage(a){const $=validateAddress(a.destination);if($!==ValidationResult.VALID)throw new InvalidAddressError(a.destination,invalidDetail($));return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const j=yield this.walletProvider.mapIncreasePaidStorageWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return a})),et=yield this.walletProvider.sendOperations([j]);return this.context.operationFactory.createIncreasePaidStorageOperation(et)}))}batch(a){const $=new WalletOperationBatch(this.walletProvider,this.context);return Array.isArray(a)&&$.with(a),$}at(a,$=j=>j){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(a);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(j));const et=this.context.withExtensions().rpc,tt=this.context.withExtensions().readProvider,rt=yield tt.getScript(a,"head"),nt=yield tt.getEntrypoints(a),it=new ContractAbstraction(a,rt,this,this.context.contract,nt,et,tt);return $(it,this.context)})}getPK(){return __awaiter(this,void 0,void 0,function*(){return yield this.pk()})}}const receiptFromOperation=(_,{ALLOCATION_BURN:a,ORIGINATION_BURN:$}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP});const j=flattenOperationResult({contents:_});let et=new BigNumber(0),tt=new BigNumber(0),rt=new BigNumber(0),nt=new BigNumber(0),it=new BigNumber(0),at=new BigNumber(0);return j.forEach(st=>{rt=rt.plus(st.fee||0),nt=nt.plus(Array.isArray(st.originated_contracts)?st.originated_contracts.length*$:0),it=it.plus("allocated_destination_contract"in st?a:0),et=et.plus(st.consumed_milligas||0),at=at.plus("paid_storage_size_diff"in st&&Number(st.paid_storage_size_diff)||0)}),tt=tt.plus(it).plus(nt).plus(at),{totalFee:rt,totalMilliGas:et,totalGas:et.dividedBy(1e3),totalStorage:tt,totalAllocationBurn:it,totalOriginationBurn:nt,totalPaidStorageDiff:at,totalStorageBurn:new BigNumber(tt.multipliedBy(COST_PER_BYTE))}};class ConfirmationUndefinedError extends TezosToolkitConfigError{constructor(){super(),this.name="ConfirmationUndefinedError",this.message="Default confirmation count can not be undefined"}}class ObservableError extends NetworkError{constructor(a){super(),this.message=a,this.name="ObservableError"}}const MAX_BRANCH_ANCESTORS=60;class WalletOperation{operationResults(){return __awaiter(this,void 0,void 0,function*(){return this._operationResult.pipe(first()).toPromise()})}receipt(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(!a)throw new ObservableError("Unable to get operation results");return receiptFromOperation(a)})}constructor(a,$,j){if(this.opHash=a,this.context=$,this._newHead$=j,this._operationResult=new ReplaySubject(1),this._includedInBlock=new ReplaySubject(1),this._included=!1,this.newHead$=this._newHead$.pipe(switchMap(et=>{var tt,rt;const nt=(rt=(tt=this.lastHead)===null||tt===void 0?void 0:tt.header.level)!==null&&rt!==void 0?rt:et.header.level-1;return range(nt+1,et.header.level-nt-1).pipe(concatMap(it=>this.context.readProvider.getBlock(it)),endWith(et))}),tap(et=>this.lastHead=et),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),this.confirmed$=this.newHead$.pipe(map$1(et=>{for(const tt of et.operations)for(const rt of tt)if(rt.hash===this.opHash)return this._included=!0,this._includedInBlock.next(et),this._operationResult.next(rt.contents),et}),filter(et=>typeof et<"u"),first(),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),validateOperation(this.opHash)!==ValidationResult.VALID)throw new InvalidOperationHashError(this.opHash);this.confirmed$.pipe(first(),catchError(()=>of(void 0))).subscribe()}getCurrentConfirmation(){return __awaiter(this,void 0,void 0,function*(){return this._included?combineLatest([this._includedInBlock,from(this.context.readProvider.getBlock("head"))]).pipe(map$1(([a,$])=>$.header.level-a.header.level+1),first()).toPromise():0})}isInCurrentBranch(a="head"){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return!0;const $=yield this.context.readProvider.getBlockLevel(a),j=yield this._includedInBlock.pipe(first()).toPromise();if(!j)throw new ObservableError("Inclusion block is undefined");const et=$-j.header.level;if(et<=0)return!0;const tt=Math.min(j.header.level+et,j.header.level+MAX_BRANCH_ANCESTORS);return new Set(yield this.context.readProvider.getLiveBlocks(tt)).has(j.hash)})}confirmationObservable(a){if(typeof a<"u"&&a<1)throw new InvalidConfirmationCountError(a);const{defaultConfirmationCount:$}=this.context.config,j=a!==void 0?a:$;if(j===void 0)throw new ConfirmationUndefinedError;return combineLatest([this._includedInBlock,this.newHead$]).pipe(distinctUntilChanged(([,et],[,tt])=>et.hash===tt.hash),map$1(([et,tt])=>({block:tt,expectedConfirmation:j,currentConfirmation:tt.header.level-et.header.level+1,completed:tt.header.level-et.header.level>=j-1,isInCurrentBranch:()=>this.isInCurrentBranch(tt.hash)})),takeWhile(({completed:et})=>!et,!0))}confirmation(a){return this.confirmationObservable(a).toPromise()}}class TransactionWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(!a)throw new ObservableError("operationResult returned undefined");return a.find($=>$.kind===OpKind.REVEAL)})}transactionOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(!a)throw new ObservableError("operationResult returned undefined");return a.find($=>$.kind===OpKind.TRANSACTION)})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.transactionOperation();return a?a.metadata.operation_result.status:"unknown"})}}class OriginationWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}originationOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return findWithKind(a,OpKind.ORIGINATION);throw new ObservableError("Unable to fetch operation result")})}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return findWithKind(a,OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.originationOperation();return a?a.metadata.operation_result.status:"unknown"})}contract(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.originationOperation(),$=((a==null?void 0:a.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at($)})}}class DelegationWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}delegationOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.DELEGATION);throw new ObservableError("Unable to fetch operation result")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.delegationOperation();return a?a.metadata.operation_result.status:"unknown"})}}class LegacyWalletProvider{constructor(a){this.context=a}getPKH(){return __awaiter(this,void 0,void 0,function*(){return this.context.signer.publicKeyHash()})}getPK(){return __awaiter(this,void 0,void 0,function*(){return this.context.signer.publicKey()})}mapTransferParamsToWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.TRANSACTION)})}mapOriginateParamsToWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.ORIGINATION)})}mapDelegateParamsToWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.DELEGATION)})}mapIncreasePaidStorageWalletParams(a){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield a(),OpKind.INCREASE_PAID_STORAGE)})}sendOperations(a){return __awaiter(this,void 0,void 0,function*(){return(yield this.context.batch.batch(a).send()).hash})}sign(a,$){return __awaiter(this,void 0,void 0,function*(){const{prefixSig:j}=yield this.context.signer.sign(a,$);return j})}}class ContractMethodObject{constructor(a,$,j,et,tt="unit",rt=!0,nt=!1){this.provider=a,this.address=$,this.parameterSchema=j,this.name=et,this.args=tt,this.isMultipleEntrypoint=rt,this.isAnonymous=nt}getSignature(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}send(a={}){return this.provider instanceof Wallet?this.provider.transfer(this.toTransferParams(a)).send():this.provider.transfer(this.toTransferParams(a))}toTransferParams({fee:a,gasLimit:$,storageLimit:j,source:et,amount:tt=0,mutez:rt=!1}={}){return{to:this.address,amount:tt,fee:a,mutez:rt,source:et,gasLimit:$,storageLimit:j,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}class ContractMethod{constructor(a,$,j,et,tt,rt=!0,nt=!1){this.provider=a,this.address=$,this.parameterSchema=j,this.name=et,this.args=tt,this.isMultipleEntrypoint=rt,this.isAnonymous=nt}validateArgs(a,$,j){const et=$.ExtractSignatures();if(!et.find(tt=>tt.length===a.length))throw new InvalidParameterError(j,et,a)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(this.isAnonymous){const a=this.parameterSchema.ExtractSignatures().find($=>$[0]===this.name);if(a)return a.shift(),a}else{const a=this.parameterSchema.ExtractSignatures();return a.length==1?a[0]:a}}send(a={}){return this.provider instanceof Wallet?this.provider.transfer(this.toTransferParams(a)).send():this.provider.transfer(this.toTransferParams(a))}toTransferParams({fee:a,gasLimit:$,storageLimit:j,source:et,amount:tt=0,mutez:rt=!1}={}){return{to:this.address,amount:tt,fee:a,mutez:rt,source:et,gasLimit:$,storageLimit:j,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.Encode(this.name,...this.args):this.parameterSchema.Encode(...this.args)}}}}class OnChainView{constructor(a,$,j,et,tt,rt="Unit"){this._rpc=a,this._readProvider=$,this._contractAddress=j,this._smartContractViewSchema=et,this._contractStorageType=tt,this._args=rt}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}executeView(a){return __awaiter(this,void 0,void 0,function*(){this.verifyContextExecution(a);const $=yield this._readProvider.getChainId(),j=this.transformArgsToMichelson(),et={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:j,chain_id:$,source:a.viewCaller};return a.source&&(et.payer=a.source),this.executeViewAndDecodeResult(et)})}verifyContextExecution(a){if(a.source&&validateAddress(a.source)!==ValidationResult.VALID)throw new InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${a.source}.`);if(!a.viewCaller||validateAddress(a.viewCaller)!==ValidationResult.VALID)throw new InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${a.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(a){throw new InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,a)}}adaptViewCodeToContext(a,$,j){const et={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:j}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:$}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return a.forEach((tt,rt)=>{tt.prim in et&&(a[rt]=Object(et)[tt.prim]),tt.args&&tt.args.length!==0?this.adaptViewCodeToContext(tt.args,$,j):Array.isArray(tt)&&this.adaptViewCodeToContext(tt,$,j)}),a}executeViewAndDecodeResult(a){return __awaiter(this,void 0,void 0,function*(){let $;try{$=(yield this._rpc.runScriptView(a)).data}catch(j){const et=validateAndExtractFailwith(j);throw et?new ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(et)}`,this._smartContractViewSchema.viewName,et,j):j}return this._smartContractViewSchema.decodeViewResult($)})}}class ContractMethodFactory{constructor(a,$){this.provider=a,this.contractAddress=$}createContractMethodFlatParams(a,$,j,et=!0,tt=!1){return new ContractMethod(this.provider,this.contractAddress,a,$,j,et,tt)}createContractMethodObjectParam(a,$,j,et=!0,tt=!1){return new ContractMethodObject(this.provider,this.contractAddress,a,$,j,et,tt)}createContractViewObjectParam(a,$,j,et,tt){return new OnChainView(a,$,this.contractAddress,j,et,tt)}}const DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class ContractView{constructor(a,$,j,et,tt,rt,nt){this.currentContract=a,this.name=$,this.callbackParametersSchema=j,this.parameterSchema=et,this.args=tt,this.rpc=rt,this.readProvider=nt}read(a){return __awaiter(this,void 0,void 0,function*(){const $=validateChain(a??"");if(validateContractAddress(a??"")==ValidationResult.VALID)throw new DeprecationError("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(a&&$!==ValidationResult.VALID)throw new InvalidChainIdError(a,invalidDetail($));const j=this.parameterSchema.Encode(...this.args),et=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:j,chain_id:a||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(et.data)})}}const validateArgs=(_,a,$)=>{const j=a.ExtractSignatures();if(!j.find(et=>et.length===_.length))throw new InvalidParameterError($,j,_)},isView$2=_=>{let a=!1;if("prim"in _&&_.prim==="pair"&&_.args){const $=_.args[_.args.length-1];"prim"in $&&$.prim==="contract"&&(a=!0)}return a};class ContractAbstraction{constructor(a,$,j,et,tt,rt,nt){this.address=a,this.script=$,this.storageProvider=et,this.entrypoints=tt,this.rpc=rt,this.readProvider=nt,this.methods={},this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new ContractMethodFactory(j,a),this.schema=Schema.fromRPCResponse({script:this.script}),this.parameterSchema=ParameterSchema.fromRPCResponse({script:this.script}),this.viewSchema=ViewSchema.fromRPCResponse({script:this.script}),this.viewSchema.length!==0&&this._initializeOnChainViews(this,rt,this.readProvider,this.viewSchema),this.eventSchema=EventSchema.fromRPCResponse({script:this.script}),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(a,$,j,et){const tt=this.parameterSchema,rt=Object.keys($);if(tt.isMultipleEntryPoint)rt.forEach(it=>{const at=new ParameterSchema($[it]);if(this.methods[it]=function(...st){return a.contractMethodFactory.createContractMethodFlatParams(at,it,st)},this.methodsObject[it]=function(st){return a.contractMethodFactory.createContractMethodObjectParam(at,it,st)},isView$2($[it])){const st=function(...ot){const ut=$[it].args[0],dt=new ParameterSchema(ut),mt=$[it].args[1].args[0],xt=new ParameterSchema(mt);return validateArgs(ot,dt,it),new ContractView(a,it,xt,dt,ot,j,et)};this.views[it]=st}}),Object.keys(tt.ExtractSchema()).filter(it=>Object.keys($).indexOf(it)===-1).forEach(it=>{this.methods[it]=function(...at){return a.contractMethodFactory.createContractMethodFlatParams(tt,it,at,!1,!0)},this.methodsObject[it]=function(at){return a.contractMethodFactory.createContractMethodObjectParam(tt,it,at,!1,!0)}});else{const nt=this.parameterSchema;this.methods[DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...it){return a.contractMethodFactory.createContractMethodFlatParams(nt,DEFAULT_SMART_CONTRACT_METHOD_NAME,it,!1)},this.methodsObject[DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(it){return a.contractMethodFactory.createContractMethodObjectParam(nt,DEFAULT_SMART_CONTRACT_METHOD_NAME,it,!1)}}}_initializeOnChainViews(a,$,j,et){const tt=this.schema.val;et.forEach(rt=>{this.contractViews[rt.viewName]=function(nt){return a.contractMethodFactory.createContractViewObjectParam($,j,rt,tt,nt)}})}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(a){return this.storageProvider.getBigMapKey(this.address,a,this.schema)}}const setDelegate=_=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:_}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit=(_,a)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:_}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${a}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],removeDelegate=()=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"NONE",args:[{prim:"key_hash"}]},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferToContract=(_,a)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"address"},{string:_}]},{prim:"CONTRACT",args:[{prim:"unit"}]},{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:`${a}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],MANAGER_LAMBDA={setDelegate,removeDelegate,transferImplicit,transferToContract};class SaplingStateAbstraction{constructor(a,$){this.id=a,this.provider=$}getSaplingDiff(a){return __awaiter(this,void 0,void 0,function*(){return this.provider.getSaplingDiffByID(this.id.toString(),a)})}getId(){return this.id.toString()}}class BigMapAbstraction{constructor(a,$,j){this.id=a,this.schema=$,this.provider=j}get(a,$){return __awaiter(this,void 0,void 0,function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),a,this.schema,$)}catch(j){if(j instanceof HttpResponseError&&j.status===STATUS_CODE.NOT_FOUND)return;throw j}})}getMultipleValues(a,$,j=5){return __awaiter(this,void 0,void 0,function*(){return this.provider.getBigMapKeysByID(this.id.toString(),a,this.schema,$,j)})}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}const smartContractAbstractionSemantic=_=>({big_map:(a,$)=>{if(!a||!("int"in a)||a.int===void 0)return{};{const j=new Schema($);return new BigMapAbstraction(new BigNumber(a.int),j,_)}},sapling_state:a=>!a||!("int"in a)||a.int===void 0?{}:new SaplingStateAbstraction(new BigNumber(a.int),_)});var _PrepareProvider_counters;const mergeLimits=(_,a)=>{var $,j,et;return{fee:($=_.fee)!==null&&$!==void 0?$:a.fee,gasLimit:(j=_.gasLimit)!==null&&j!==void 0?j:a.gasLimit,storageLimit:(et=_.storageLimit)!==null&&et!==void 0?et:a.storageLimit}};class PrepareProvider extends Provider{constructor(a){super(a),this.context=a,_PrepareProvider_counters.set(this,void 0),__classPrivateFieldSet(this,_PrepareProvider_counters,{})}getBlockHash(a){return __awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getBlockHash(a??"head~2")})}getProtocolHash(){return __awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getNextProtocol("head")})}getHeadCounter(a){var $;return __awaiter(this,void 0,void 0,function*(){return($=this.context.readProvider.getCounter(a,"head"))!==null&&$!==void 0?$:"0"})}adjustGasForBatchOperation(a,$,j){return BigNumber.min($,a.div(j+1))}getOperationLimits(a,$){return __awaiter(this,void 0,void 0,function*(){const{hard_gas_limit_per_operation:j,hard_gas_limit_per_block:et,hard_storage_limit_per_operation:tt}=a;return{fee:0,gasLimit:$?Math.floor(this.adjustGasForBatchOperation(et,j,$).toNumber()):j.toNumber(),storageLimit:tt.toNumber()}})}getFee(a,$,j){return(!__classPrivateFieldGet(this,_PrepareProvider_counters,"f")[$]||__classPrivateFieldGet(this,_PrepareProvider_counters,"f")[$]"u"?"0":`${a.fee}`,gas_limit:typeof a.gas_limit>"u"?"0":`${a.gas_limit}`,storage_limit:typeof a.storage_limit>"u"?"0":`${a.storage_limit}`}}getSource(a,$,j){return{source:typeof a.source>"u"?j||$:a.source}}addRevealOperationIfNeeded(a,$){return __awaiter(this,void 0,void 0,function*(){if(isOpRequireReveal(a)){const j=[a],{publicKey:et,pkh:tt}=yield this.getKeys();if(yield this.isAccountRevealRequired($)){if(!et)throw new PublicKeyNotFoundError(tt);return j.unshift(yield createRevealOperation({fee:getRevealFee(tt),storageLimit:REVEAL_STORAGE_LIMIT,gasLimit:getRevealGasLimit(tt)},$,et)),j}}return a})}getKeys(){return __awaiter(this,void 0,void 0,function*(){const a=this.context.isAnySignerConfigured();return{pkh:a?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:a?yield this.signer.publicKey():void 0}})}convertIntoArray(a){return Array.isArray(a)?[...a]:[a]}constructOpContents(a,$,j,et,tt){return a.map(rt=>{switch(rt.kind){case OpKind.ACTIVATION:case OpKind.DRAIN_DELEGATE:return Object.assign({},rt);case OpKind.ORIGINATION:return Object.assign(Object.assign(Object.assign(Object.assign({},rt),{balance:typeof rt.balance<"u"?`${rt.balance}`:"0"}),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.TRANSACTION:{const nt=Object.assign(Object.assign(Object.assign(Object.assign({},rt),{amount:typeof rt.amount<"u"?`${rt.amount}`:"0"}),this.getSource(rt,j,et)),this.getFee(rt,j,$));if(nt.source.toLowerCase().startsWith("kt1"))throw new DeprecationError(`KT1 addresses are not supported as source since ${Protocols.PsBabyM1}`);return nt}case OpKind.REVEAL:case OpKind.DELEGATION:case OpKind.REGISTER_GLOBAL_CONSTANT:case OpKind.UPDATE_CONSENSUS_KEY:case OpKind.SMART_ROLLUP_ADD_MESSAGES:case OpKind.SMART_ROLLUP_ORIGINATE:case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return Object.assign(Object.assign(Object.assign({},rt),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.TRANSFER_TICKET:return Object.assign(Object.assign(Object.assign(Object.assign({},rt),{ticket_amount:`${rt.ticket_amount}`}),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.INCREASE_PAID_STORAGE:return Object.assign(Object.assign(Object.assign(Object.assign({},rt),{amount:`${rt.amount}`}),this.getSource(rt,j,et)),this.getFee(rt,j,$));case OpKind.BALLOT:if(tt===void 0)throw new RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},rt),{period:tt==null?void 0:tt.voting_period.index});case OpKind.PROPOSALS:if(tt===void 0)throw new RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},rt),{period:tt==null?void 0:tt.voting_period.index});default:throw new InvalidOperationKindError(rt.kind)}})}activate({pkh:a,secret:$}){return __awaiter(this,void 0,void 0,function*(){const j=yield createActivationOperation({pkh:a,secret:$}),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter(a),10),it=this.constructOpContents(et,nt,a);return{opOb:{branch:tt,contents:it,protocol:rt},counter:nt}})}reveal({fee:a,gasLimit:$,storageLimit:j}){return __awaiter(this,void 0,void 0,function*(){const{pkh:et,publicKey:tt}=yield this.getKeys();if(!tt)throw new PublicKeyNotFoundError(et);const rt=yield this.context.readProvider.getProtocolConstants("head"),nt=yield this.getOperationLimits(rt),it=mergeLimits({fee:a,storageLimit:j,gasLimit:$},nt),at=yield createRevealOperation({fee:it.fee,gasLimit:it.gasLimit,storageLimit:it.storageLimit},et,tt),st=this.convertIntoArray(at),ot=yield this.getBlockHash(),ut=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const dt=parseInt(yield this.getHeadCounter(et),10),mt=this.constructOpContents(st,dt,et);return{opOb:{branch:ot,contents:mt,protocol:ut},counter:dt}})}originate(a,$){var{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:nt}=yield this.getKeys(),it=yield this.context.readProvider.getProtocolConstants("head"),at=yield this.getOperationLimits(it),st=yield createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},rt),mergeLimits({fee:j,storageLimit:et,gasLimit:tt},at)))),ot=yield this.addRevealOperationIfNeeded(st,nt),ut=this.convertIntoArray(ot),dt=yield this.getBlockHash(),mt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const xt=parseInt(yield this.getHeadCounter(nt),10),Ct=this.constructOpContents(ut,xt,nt,$);return{opOb:{branch:dt,contents:Ct,protocol:mt},counter:xt}})}transaction(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createTransferOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}delegation(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createSetDelegateOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}registerDelegate({fee:a,storageLimit:$,gasLimit:j},et){return __awaiter(this,void 0,void 0,function*(){const{pkh:tt}=yield this.getKeys(),rt=yield this.context.readProvider.getProtocolConstants("head"),nt=yield this.getOperationLimits(rt),it=mergeLimits({fee:a,storageLimit:$,gasLimit:j},nt),at=yield createRegisterDelegateOperation({fee:it.fee,storageLimit:it.storageLimit,gasLimit:it.gasLimit},tt),st=yield this.addRevealOperationIfNeeded(at,tt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(tt),10),xt=this.constructOpContents(ot,mt,tt,et);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}registerGlobalConstant(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createRegisterGlobalConstantOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}updateConsensusKey(a,$){var{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:nt}=yield this.getKeys(),it=yield this.context.readProvider.getProtocolConstants("head"),at=yield this.getOperationLimits(it),st=yield createUpdateConsensusKeyOperation(Object.assign(Object.assign({},rt),mergeLimits({fee:j,storageLimit:et,gasLimit:tt},at))),ot=yield this.addRevealOperationIfNeeded(st,nt),ut=this.convertIntoArray(ot),dt=yield this.getBlockHash(),mt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const xt=parseInt(yield this.getHeadCounter(nt),10),Ct=this.constructOpContents(ut,xt,nt,$);return{opOb:{branch:dt,contents:Ct,protocol:mt},counter:xt}})}increasePaidStorage(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createIncreasePaidStorageOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}ballot(a){return __awaiter(this,void 0,void 0,function*(){const{pkh:$}=yield this.getKeys(),j=yield createBallotOperation(Object.assign({},a)),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter($),10);let it;try{it=yield this.rpc.getCurrentPeriod()}catch{throw new RPCResponseError("Failed to get the current voting period index")}const at=this.constructOpContents(et,nt,$,void 0,it);return{opOb:{branch:tt,contents:at,protocol:rt},counter:nt}})}proposals(a){return __awaiter(this,void 0,void 0,function*(){const{pkh:$}=yield this.getKeys(),j=yield createProposalsOperation(Object.assign({},a)),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter($),10);let it;try{it=yield this.rpc.getCurrentPeriod()}catch{throw new RPCResponseError("Failed to get the current voting period index")}const at=this.constructOpContents(et,nt,$,void 0,it);return{opOb:{branch:tt,contents:at,protocol:rt},counter:nt}})}drainDelegate(a,$){return __awaiter(this,void 0,void 0,function*(){const{pkh:j}=yield this.getKeys(),et=yield createDrainDelegateOperation(Object.assign({},a)),tt=this.convertIntoArray(et),rt=yield this.getBlockHash(),nt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const it=parseInt(yield this.getHeadCounter(j),10),at=this.constructOpContents(tt,it,j,$);return{opOb:{branch:rt,contents:at,protocol:nt},counter:it}})}transferTicket(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createTransferTicketOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}smartRollupAddMessages(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createSmartRollupAddMessagesOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}smartRollupOriginate(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createSmartRollupOriginateOperation(Object.assign(Object.assign({},mergeLimits({fee:$,storageLimit:j,gasLimit:et},it)),tt)),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}smartRollupExecuteOutboxMessage(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:rt}=yield this.getKeys(),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.getOperationLimits(nt),at=yield createSmartRollupExecuteOutboxMessageOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),st=yield this.addRevealOperationIfNeeded(at,rt),ot=this.convertIntoArray(st),ut=yield this.getBlockHash(),dt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const mt=parseInt(yield this.getHeadCounter(rt),10),xt=this.constructOpContents(ot,mt,rt,tt.source);return{opOb:{branch:ut,contents:xt,protocol:dt},counter:mt}})}batch(a,$){return __awaiter(this,void 0,void 0,function*(){const{pkh:j,publicKey:et}=yield this.getKeys(),tt=yield this.context.readProvider.getProtocolConstants("head"),rt=yield this.getOperationLimits(tt,a.length),nt=yield this.isRevealOpNeeded(a,j),it=[];if($)for(const dt of a)if(isOpWithFee(dt)){const mt=$.shift(),xt=mergeLimits(dt,{fee:mt.suggestedFeeMutez,storageLimit:mt.storageLimit,gasLimit:mt.gasLimit});it.push(yield this.getRPCOp(Object.assign(Object.assign({},dt),xt)))}else it.push(Object.assign({},dt));else for(const dt of a)if(isOpWithFee(dt)){const mt=mergeLimits(dt,rt);it.push(yield this.getRPCOp(Object.assign(Object.assign({},dt),mt)))}else it.push(Object.assign({},dt));if(nt){if(!et)throw new PublicKeyNotFoundError(j);it.unshift(yield createRevealOperation({fee:getRevealFee(j),storageLimit:REVEAL_STORAGE_LIMIT,gasLimit:getRevealGasLimit(j)},j,et))}const at=yield this.getBlockHash(),st=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const ot=parseInt(yield this.getHeadCounter(j),10),ut=this.constructOpContents(it,ot,j);return{opOb:{branch:at,contents:ut,protocol:st},counter:ot}})}contractCall(a){var $,j,et;return __awaiter(this,void 0,void 0,function*(){const tt=yield this.getBlockHash(),rt=yield this.getProtocolHash(),{pkh:nt}=yield this.getKeys();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const it=parseInt(yield this.getHeadCounter(nt),10),at=a.toTransferParams(),st=yield this.context.readProvider.getProtocolConstants("head"),ot=yield this.getOperationLimits(st),ut=mergeLimits({fee:at.fee,storageLimit:at.storageLimit,gasLimit:at.gasLimit},ot),dt={kind:OpKind.TRANSACTION,fee:($=at.fee)!==null&&$!==void 0?$:ut.fee,gas_limit:(j=at.gasLimit)!==null&&j!==void 0?j:ut.gasLimit,storage_limit:(et=at.storageLimit)!==null&&et!==void 0?et:ut.storageLimit,amount:String(at.amount),destination:at.to,parameters:at.parameter},mt=yield this.addRevealOperationIfNeeded(dt,nt),xt=this.convertIntoArray(mt),Ct=this.constructOpContents(xt,it,nt);return{opOb:{branch:tt,contents:Ct,protocol:rt},counter:it}})}toPreapply(a){return __awaiter(this,void 0,void 0,function*(){const{opOb:{contents:$,branch:j,protocol:et}}=a,tt=this.toForge(a),rt=yield this.context.forger.forge(tt),nt=yield this.context.signer.sign(rt,new Uint8Array([3]));return[{contents:$,branch:j,protocol:et,signature:nt.prefixSig}]})}toForge({opOb:{contents:a,branch:$}}){return{branch:$,contents:a}}}_PrepareProvider_counters=new WeakMap;const BATCH_KINDS=[OpKind.ACTIVATION,OpKind.ORIGINATION,OpKind.TRANSACTION,OpKind.DELEGATION];class OperationBatch extends Provider{constructor(a,$){super(a),this.estimator=$,this.operations=[],this.prepare=new PrepareProvider(this.context)}withTransfer(a){const $=validateAddress(a.to);if(a.amount<0)throw new InvalidAmountError(a.amount.toString());if($!==ValidationResult.VALID)throw new InvalidAddressError(a.to,invalidDetail($));return this.operations.push(Object.assign({kind:OpKind.TRANSACTION},a)),this}withTransferTicket(a){const $=validateAddress(a.destination);if($!==ValidationResult.VALID)throw new InvalidAddressError(a.destination,invalidDetail($));return this.operations.push(Object.assign({kind:OpKind.TRANSFER_TICKET},a)),this}withContractCall(a,$={}){return this.withTransfer(a.toTransferParams($))}withDelegation(a){var $;const j=validateAddress(a.source);if(a.source&&j!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(j));const et=validateAddress(($=a.delegate)!==null&&$!==void 0?$:"");if(a.delegate&&et!==ValidationResult.VALID)throw new InvalidAddressError(a.delegate,invalidDetail(et));return this.operations.push(Object.assign({kind:OpKind.DELEGATION},a)),this}withActivation({pkh:a,secret:$}){const j=validateKeyHash(a);if(j!==ValidationResult.VALID)throw new InvalidKeyHashError(a,invalidDetail(j));return this.operations.push({kind:OpKind.ACTIVATION,pkh:a,secret:$}),this}withOrigination(a){return this.operations.push(Object.assign({kind:OpKind.ORIGINATION},a)),this}withRegisterGlobalConstant(a){return this.operations.push(Object.assign({kind:OpKind.REGISTER_GLOBAL_CONSTANT},a)),this}withIncreasePaidStorage(a){return this.operations.push(Object.assign({kind:OpKind.INCREASE_PAID_STORAGE},a)),this}withSmartRollupAddMessages(a){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_ADD_MESSAGES},a)),this}withSmartRollupOriginate(a){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_ORIGINATE},a)),this}withSmartRollupExecuteOutboxMessage(a){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE},a)),this}getRPCOp(a){return __awaiter(this,void 0,void 0,function*(){switch(a.kind){case OpKind.TRANSACTION:return createTransferOperation(Object.assign({},a));case OpKind.ORIGINATION:return createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},a)));case OpKind.DELEGATION:return createSetDelegateOperation(Object.assign({},a));case OpKind.REGISTER_GLOBAL_CONSTANT:return createRegisterGlobalConstantOperation(Object.assign({},a));case OpKind.INCREASE_PAID_STORAGE:return createIncreasePaidStorageOperation(Object.assign({},a));case OpKind.TRANSFER_TICKET:return createTransferTicketOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ADD_MESSAGES:return createSmartRollupAddMessagesOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_ORIGINATE:return createSmartRollupOriginateOperation(Object.assign({},a));case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return createSmartRollupExecuteOutboxMessageOperation(Object.assign({},a));default:throw new InvalidOperationKindError(JSON.stringify(a.kind))}})}with(a){for(const $ of a)switch($.kind){case OpKind.TRANSACTION:this.withTransfer($);break;case OpKind.ORIGINATION:this.withOrigination($);break;case OpKind.DELEGATION:this.withDelegation($);break;case OpKind.ACTIVATION:this.withActivation($);break;case OpKind.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant($);break;case OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage($);break;case OpKind.TRANSFER_TICKET:this.withTransferTicket($);break;case OpKind.SMART_ROLLUP_ADD_MESSAGES:this.withSmartRollupAddMessages($);break;case OpKind.SMART_ROLLUP_ORIGINATE:this.withSmartRollupOriginate($);break;case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:this.withSmartRollupExecuteOutboxMessage($);break;default:throw new InvalidOperationKindError(JSON.stringify($.kind))}return this}send(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=a&&a.source||$,et=yield this.estimator.batch(this.operations);et.length!==this.operations.length&&et.shift();const tt=yield this.prepare.batch(this.operations,et),rt=yield this.forge(tt),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new BatchOperation(nt,tt.opOb.contents,j,at,st,it)})}}class RPCBatchProvider{constructor(a,$){this.context=a,this.estimator=$}batch(a){const $=new OperationBatch(this.context,this.estimator);return Array.isArray(a)&&$.with(a),$}}class BatchWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$,this.getOriginatedContractAddresses=()=>__awaiter(this,void 0,void 0,function*(){const et=yield this.operationResults();if(et){const tt=et.filter(nt=>nt.kind==="origination");let rt=[];for(const nt of tt)nt.metadata.operation_result.originated_contracts&&(rt=[...rt,...nt.metadata.operation_result.originated_contracts]);return rt}else throw new ObservableError("Unable to fetch operation results")})}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation results")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.operationResults();if(a)return a.filter($=>BATCH_KINDS.indexOf($.kind)!==-1).map($=>hasMetadataWithResult($)?$.metadata.operation_result.status:"unknown")[0]||"unknown";throw new ObservableError("Unable to fetch operation results")})}}class IncreasePaidStorageWalletOperation extends WalletOperation{constructor(a,$,j){super(a,$,j),this.opHash=a,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}increasePaidStorageOperation(){return __awaiter(this,void 0,void 0,function*(){const a=yield this.operationResults();if(a)return a.find($=>$.kind===OpKind.INCREASE_PAID_STORAGE);throw new ObservableError("Unable to fetch operation result")})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const a=yield this.increasePaidStorageOperation();return a?a.metadata.operation_result.status:"unknown"})}}function timeoutAfter(_){return function($){return new BehaviorSubject(null).pipe(timeout({each:_,with:()=>throwError(()=>new ConfirmationTimeoutError("Confirmation polling timed out"))}),mergeMap(()=>$))}}const createNewPollingBasedHeadObservable=(_,a,$)=>_.pipe(timeoutAfter(a.config.confirmationPollingTimeoutSecond*1e3),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1}));class OperationFactory{constructor(a){this.context=a,this.sharedHeadObs=defer(()=>createObservableFromSubscription(this.context.stream.subscribeBlock("head")))}createNewHeadObservable(){return __awaiter(this,void 0,void 0,function*(){return createNewPollingBasedHeadObservable(this.sharedHeadObs,this.context)})}createPastBlockWalker(a,$=1){return from(this.context.readProvider.getBlock(a)).pipe(switchMap(j=>$===1?of(j):range(j.header.level,$-1).pipe(startWith(j),concatMap(et=>__awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getBlock(typeof et=="number"?et:et.header.level)})))))}createHeadObservableFromConfig({blockIdentifier:a}){return __awaiter(this,void 0,void 0,function*(){const $=[];return a&&$.push(this.createPastBlockWalker(a)),$.push(yield this.createNewHeadObservable()),concat(...$)})}createOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new WalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createBatchOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new BatchWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createTransactionOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new TransactionWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createDelegationOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new DelegationWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createOriginationOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new OriginationWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createIncreasePaidStorageOperation(a,$={}){return __awaiter(this,void 0,void 0,function*(){return new IncreasePaidStorageWalletOperation(a,this.context.clone(),yield this.createHeadObservableFromConfig($))})}}class RpcTzProvider extends Provider{constructor(a){super(a),this.prepare=new PrepareProvider(this.context)}getBalance(a){return __awaiter(this,void 0,void 0,function*(){const $=validateAddress(a);if($!==ValidationResult.VALID)throw new InvalidAddressError(a,invalidDetail($));return this.context.readProvider.getBalance(a,"head")})}getDelegate(a){return __awaiter(this,void 0,void 0,function*(){const $=validateAddress(a);if($!==ValidationResult.VALID)throw new InvalidAddressError(a,invalidDetail($));return this.context.readProvider.getDelegate(a,"head")})}activate(a,$){return __awaiter(this,void 0,void 0,function*(){const j=validateKeyHash(a);if(j!==ValidationResult.VALID)throw new InvalidKeyHashError(a,invalidDetail(j));const et=yield this.prepare.activate({pkh:a,secret:$}),tt=yield this.forge(et),rt=`${tt.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new Operation(yield this.rpc.injectOperation(rt),Object.assign(Object.assign({},tt),{opbytes:rt}),[],this.context.clone())})}}const MINIMAL_FEE_MUTEZ=100,MINIMAL_FEE_PER_BYTE_MUTEZ=1,MINIMAL_FEE_PER_GAS_MUTEZ=.1;class Estimate{constructor(a,$,j,et,tt=MINIMAL_FEE_MUTEZ){this._milligasLimit=a,this._storageLimit=$,this.opSize=j,this.minimalFeePerStorageByteMutez=et,this.baseFeeMutez=tt}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){return Math.max(Number(this._storageLimit),0)}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3)}get operationFeeMutez(){return this.gasLimit*MINIMAL_FEE_PER_GAS_MUTEZ+Number(this.opSize)*MINIMAL_FEE_PER_BYTE_MUTEZ}roundUp(a){return Math.ceil(Number(a))}get minimalFeeMutez(){return this.roundUp(this.operationFeeMutez+MINIMAL_FEE_MUTEZ)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+MINIMAL_FEE_MUTEZ*1.2)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),MINIMAL_FEE_MUTEZ)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(a){let $=0,j=0,et=0,tt=0,rt;return a.forEach(nt=>{$+=nt.milligasLimit,j+=nt.storageLimit,et+=nt.opSize,tt=Math.max(nt.minimalFeePerStorageByteMutez,tt),nt.baseFeeMutez&&(rt=rt?rt+nt.baseFeeMutez:nt.baseFeeMutez)}),new Estimate($,j,et,tt,rt)}static createArrayEstimateInstancesFromProperties(a){return a.map($=>new Estimate($.milligasLimit,$.storageLimit,$.opSize,$.minimalFeePerStorageByteMutez,$.baseFeeMutez))}}class RevealEstimateError extends TaquitoError{constructor(){super(),this.name="RevealEstimateError",this.message="Public key is unknown, unable to estimate the reveal operation in Wallet API."}}const STUB_SIGNATURE="edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg";class RPCEstimateProvider extends Provider{constructor(){super(...arguments),this.OP_SIZE_REVEAL=324,this.MILLIGAS_BUFFER=100*1e3,this.STORAGE_BUFFER=20,this.prepare=new PrepareProvider(this.context)}getKeys(){return __awaiter(this,void 0,void 0,function*(){const a=this.context.isAnySignerConfigured();return{publicKeyHash:a?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:a?yield this.signer.publicKey():void 0}})}getEstimationPropertiesFromOperationContent(a,$,j,et){const tt=flattenOperationResult({contents:[a]});let rt=0,nt=0;return tt.forEach(it=>{rt+=Number(it.consumed_milligas)||0,nt+="allocated_destination_contract"in it?et:0,nt+="originated_contracts"in it&&Array.isArray(it.originated_contracts)?it.originated_contracts.length*et:0,nt+="storage_size"in it&&"global_address"in it&&Number(it.storage_size)||0,nt+="paid_storage_size_diff"in it&&Number(it.paid_storage_size_diff)||0,nt+="genesis_commitment_hash"in it&&Number(it.size)||0}),isOpWithFee(a)?{milligasLimit:isOpWithGasBuffer(a)?rt+Number(this.MILLIGAS_BUFFER):rt,storageLimit:nt>0?nt+this.STORAGE_BUFFER:0,opSize:$,minimalFeePerStorageByteMutez:j.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:$,minimalFeePerStorageByteMutez:j.toNumber(),baseFeeMutez:0}}calculateEstimates(a,$){return __awaiter(this,void 0,void 0,function*(){const{opbytes:j,opOb:{branch:et,contents:tt}}=yield this.forge(a),rt={operation:{branch:et,contents:tt,signature:STUB_SIGNATURE},chain_id:yield this.context.readProvider.getChainId()},{opResponse:nt}=yield this.simulate(rt),{cost_per_byte:it,origination_size:at}=$,st=[...flattenErrors(nt,"backtracked"),...flattenErrors(nt)];if(st.length)throw new TezosOperationError(st,"Error occurred during estimation",nt.contents);let ot=1;return Array.isArray(a.opOb.contents)&&a.opOb.contents.length>1&&(ot=nt.contents[0].kind==="reveal"?a.opOb.contents.length-1:a.opOb.contents.length),nt.contents.map(ut=>this.getEstimationPropertiesFromOperationContent(ut,ut.kind==="reveal"?this.OP_SIZE_REVEAL/2:(j.length+130)/2/ot,it,at??257))})}originate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.prepare.originate(a),j=yield this.context.readProvider.getProtocolConstants("head"),et=yield this.calculateEstimates($,j);return $.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}transfer(a){var $,{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=validateAddress(rt.to);if(nt!==ValidationResult.VALID)throw new InvalidAddressError(rt.to,invalidDetail(nt));const it=validateAddress(($=rt.source)!==null&&$!==void 0?$:"");if(rt.source&&it!==ValidationResult.VALID)throw new InvalidAddressError(rt.source,invalidDetail(it));if(rt.amount<0)throw new InvalidAmountError(rt.amount.toString());const at=yield this.prepare.transaction(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt)),st=yield this.context.readProvider.getProtocolConstants("head"),ot=yield this.calculateEstimates(at,st);return at.opOb.contents[0].kind==="reveal"&&(ot.shift(),ot[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(ot)})}transferTicket(a){var $,{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=validateAddress(rt.destination);if(nt!==ValidationResult.VALID)throw new InvalidAddressError(rt.destination,invalidDetail(nt));const it=validateAddress(($=rt.source)!==null&&$!==void 0?$:"");if(rt.source&&it!==ValidationResult.VALID)throw new InvalidAddressError(rt.source,invalidDetail(it));const at=yield this.context.readProvider.getProtocolConstants("head"),st=yield this.prepare.transferTicket(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt)),ot=yield this.calculateEstimates(st,at);return st.opOb.contents[0].kind==="reveal"&&(ot.shift(),ot[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(ot)})}setDelegate(a){var $,{fee:j,gasLimit:et,storageLimit:tt}=a,rt=__rest(a,["fee","gasLimit","storageLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=validateAddress(rt.source);if(rt.source&&nt!==ValidationResult.VALID)throw new InvalidAddressError(rt.source,invalidDetail(nt));const it=validateAddress(($=rt.delegate)!==null&&$!==void 0?$:"");if(rt.delegate&&it!==ValidationResult.VALID)throw new InvalidAddressError(rt.delegate,invalidDetail(it));const at=yield this.prepare.delegation(Object.assign({fee:j,storageLimit:tt,gasLimit:et},rt)),st=yield this.context.readProvider.getProtocolConstants("head"),ot=yield this.calculateEstimates(at,st);return at.opOb.contents[0].kind==="reveal"&&(ot.shift(),ot[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(ot)})}batch(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.batch(a),et=yield this.calculateEstimates(j,$);return Estimate.createArrayEstimateInstancesFromProperties(et)})}registerDelegate(a,$){var{fee:j,storageLimit:et,gasLimit:tt}=a,rt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=(yield this.getKeys()).publicKeyHash,it=yield this.context.readProvider.getProtocolConstants("head"),at=$||nt,st=yield this.prepare.registerDelegate(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt),at),ot=yield this.calculateEstimates(st,it);return st.opOb.contents[0].kind==="reveal"&&(ot.shift(),ot[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(ot)})}reveal(a){return __awaiter(this,void 0,void 0,function*(){const{publicKeyHash:$,publicKey:j}=yield this.getKeys();if(!j)throw new RevealEstimateError;if(yield this.isAccountRevealRequired($)){const et=yield this.context.readProvider.getProtocolConstants("head"),tt=a?yield this.prepare.reveal(a):yield this.prepare.reveal({}),rt=yield this.calculateEstimates(tt,et);return Estimate.createEstimateInstanceFromProperties(rt)}})}registerGlobalConstant(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const rt=yield this.prepare.registerGlobalConstant(Object.assign({fee:$,storageLimit:j,gasLimit:et},tt)),nt=yield this.context.readProvider.getProtocolConstants("head"),it=yield this.calculateEstimates(rt,nt);return rt.opOb.contents[0].kind==="reveal"&&(it.shift(),it[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(it)})}increasePaidStorage(a){var{fee:$,storageLimit:j,gasLimit:et}=a,tt=__rest(a,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){if(tt.amount<0)throw new InvalidAmountError(tt.amount.toString());const rt=yield this.context.readProvider.getProtocolConstants("head"),nt=yield this.prepare.increasePaidStorage(Object.assign({fee:$,storageLimit:j,gasLimit:et},tt)),it=yield this.calculateEstimates(nt,rt);return nt.opOb.contents[0].kind==="reveal"&&(it.shift(),it[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(it)})}updateConsensusKey(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.updateConsensusKey(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}smartRollupAddMessages(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupAddMessages(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}smartRollupOriginate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupOriginate(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}smartRollupExecuteOutboxMessage(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupExecuteOutboxMessage(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&et.shift(),Estimate.createEstimateInstanceFromProperties(et)})}contractCall(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.contractCall(a),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&(et.shift(),et[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(et)})}}class DelegateOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="delegation"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get delegate(){return this.params.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class OriginationOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,j,et,tt),this.params=$,this.contractProvider=rt;const nt=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(nt)&&(this.contractAddress=nt[0])}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="origination"),$=a&&hasMetadataWithResult(a)&&a.metadata.operation_result;return $||void 0}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get storageDiff(){const a=this.operationResults&&this.operationResults.paid_storage_size_diff;return a||void 0}get storageSize(){const a=this.operationResults&&this.operationResults.storage_size;return a||void 0}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}contract(a,$){return __awaiter(this,void 0,void 0,function*(){if(!this.contractAddress)throw new OriginationOperationError("No contract was originated in this operation");return yield this.confirmation(a,$),this.contractProvider.at(this.contractAddress)})}}class RegisterGlobalConstantOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="register_global_constant"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get registeredExpression(){return this.params.value}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}}class RevealOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find($=>$.kind==="reveal");return a?[a]:[]}get status(){const $=this.operationResults[0];return $?$.metadata.operation_result.status:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get publicKey(){return this.params.public_key}sumProp(a,$){return a.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"storage_size"))}get errors(){return flattenErrors({contents:this.operationResults})}}class TransactionOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find($=>$.kind==="transaction");return a?[a]:[]}get status(){const $=this.operationResults[0];return $?$.metadata.operation_result.status:"unknown"}get amount(){return new BigNumber(this.params.amount)}get destination(){return this.params.destination}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}sumProp(a,$){return a.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(flattenOperationResult({contents:this.operationResults}),"storage_size"))}get errors(){return flattenErrors({contents:this.operationResults})}}class IncreasePaidStorageOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="increase_paid_storage"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}class UpdateConsensusKeyOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="update_consensus_key"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class SmartRollupAddMessagesOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="smart_rollup_add_messages"),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get message(){return this.params.message}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class SmartRollupOriginateOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.SMART_ROLLUP_ORIGINATE),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class BallotOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const $=Array.isArray(this.results)&&this.results.find(j=>j.kind==="ballot");return $||void 0}get period(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}class DrainDelegateOperation extends Operation{constructor(a,$,j,et,tt){super(a,j,et,tt),this.params=$}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind==="drain_delegate"),$=a&&a.metadata&&a.metadata.balance_updates;return $||void 0}get consensusKey(){return this.params.consensus_key}get delegate(){return this.params.delegate}get destination(){return this.params.destination}}class ProposalsOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const $=Array.isArray(this.results)&&this.results.find(j=>j.kind==="proposals");return $||void 0}get proposals(){return this.params.proposals}get period(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.period}}class TransferTicketOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.TRANSFER_TICKET),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP}),this.consumedMilliGas?new BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}}class SmartRollupExecuteOutboxMessageOperation extends Operation{constructor(a,$,j,et,tt,rt){super(a,et,tt,rt),this.params=$,this.source=j}get operationResults(){const a=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),$=a&&a.metadata&&a.metadata.operation_result;return $||void 0}get status(){var a,$;return($=(a=this.operationResults)===null||a===void 0?void 0:a.status)!==null&&$!==void 0?$:"unknown"}get rollup(){return this.params.rollup}get cementedCommitment(){return this.params.cemented_commitment}get outputProof(){return this.params.output_proof}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.consumed_milligas}get errors(){var a;return(a=this.operationResults)===null||a===void 0?void 0:a.errors}}class RpcContractProvider extends Provider{constructor(a,$){super(a),this.estimator=$,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new PrepareProvider(this.context)}getStorage(a,$){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(a);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(j));const et=yield this.context.readProvider.getScript(a,"head");$||($=et);let tt;return Schema.isSchema($)?tt=$:tt=Schema.fromRPCResponse({script:$}),tt.Execute(et.storage,smartContractAbstractionSemantic(this))})}getBigMapKey(a,$,j){return __awaiter(this,void 0,void 0,function*(){const et=validateContractAddress(a);if(et!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(et));j||(j=(yield this.rpc.getContract(a)).script);let tt;Schema.isSchema(j)?tt=j:tt=Schema.fromRPCResponse({script:j});const rt=tt.EncodeBigMapKey($),nt=yield this.rpc.getBigMapKey(a,rt);return tt.ExecuteOnBigMapValue(nt)})}getBigMapKeyByID(a,$,j,et){return __awaiter(this,void 0,void 0,function*(){const{key:tt,type:rt}=j.EncodeBigMapKey($),{packed:nt}=yield this.context.packer.packData({data:tt,type:rt}),it=encodeExpr(nt),at=et?yield this.context.readProvider.getBigMapValue({id:a.toString(),expr:it},et):yield this.context.readProvider.getBigMapValue({id:a.toString(),expr:it},"head");return j.ExecuteOnBigMapValue(at,smartContractAbstractionSemantic(this))})}getBigMapKeysByID(a,$,j,et,tt=5){return __awaiter(this,void 0,void 0,function*(){const rt=yield this.getBlockForRequest($,et),nt=new MichelsonMap;let it=0,at=[];for(;it<$.length;){const ot=$.slice(it,it+tt).map(ut=>this.getBigMapValueOrUndefined(ut,a,j,rt));at=[...at,...yield Promise.all(ot)],it+=tt}for(let st=0;stst.kind===OpKind.ORIGINATION),tt=yield this.forge(j),{hash:rt,context:nt,forgedBytes:it,opResponse:at}=yield this.signAndInject(tt);return new OriginationOperation(rt,et,it,at,nt,this)})}setDelegate(a){var $;return __awaiter(this,void 0,void 0,function*(){const j=validateAddress(a.source);if(a.source&&j!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(j));const et=validateAddress(($=a.delegate)!==null&&$!==void 0?$:"");if(a.delegate&&et!==ValidationResult.VALID)throw new InvalidAddressError(a.delegate,invalidDetail(et));if(/kt1/i.test(a.source))throw new InvalidDelegationSource(a.source);const tt=yield this.signer.publicKeyHash(),rt=a.source||tt,nt=yield this.estimate(a,this.estimator.setDelegate.bind(this.estimator)),it=yield this.prepare.delegation(Object.assign(Object.assign({},a),nt)),at=it.opOb.contents.find(xt=>xt.kind===OpKind.DELEGATION),st=yield this.forge(it),{hash:ot,context:ut,forgedBytes:dt,opResponse:mt}=yield this.signAndInject(st);return new DelegateOperation(ot,at,rt,dt,mt,ut)})}registerDelegate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.estimate(a,this.estimator.registerDelegate.bind(this.estimator)),j=yield this.signer.publicKeyHash(),et=yield this.prepare.registerDelegate(Object.assign(Object.assign({},a),$)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.DELEGATION),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new DelegateOperation(nt,tt,j,at,st,it)})}transfer(a){var $;return __awaiter(this,void 0,void 0,function*(){const j=validateAddress(a.to);if(j!==ValidationResult.VALID)throw new InvalidAddressError(a.to,invalidDetail(j));const et=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&et!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(et));if(a.amount<0)throw new InvalidAmountError(a.amount.toString());const tt=yield this.signer.publicKeyHash(),rt=yield this.estimate(a,this.estimator.transfer.bind(this.estimator)),nt=a.source||tt,it=yield this.prepare.transaction(Object.assign(Object.assign({},a),rt)),at=it.opOb.contents.find(xt=>xt.kind===OpKind.TRANSACTION),st=yield this.forge(it),{hash:ot,context:ut,forgedBytes:dt,opResponse:mt}=yield this.signAndInject(st);return new TransactionOperation(ot,at,nt,dt,mt,ut)})}transferTicket(a){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=validateAddress(a.destination);if(et!==ValidationResult.VALID)throw new InvalidAddressError(a.destination,invalidDetail(et));const tt=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(tt));const rt=yield this.signer.publicKeyHash(),nt=(j=a.source)!==null&&j!==void 0?j:rt,it=yield this.estimate(a,this.estimator.transferTicket.bind(this.estimator)),at=yield this.prepare.transferTicket(Object.assign(Object.assign({},a),it)),st=at.opOb.contents.find(Ct=>Ct.kind===OpKind.TRANSFER_TICKET),ot=yield this.forge(at),{hash:ut,context:dt,forgedBytes:mt,opResponse:xt}=yield this.signAndInject(ot);return new TransferTicketOperation(ut,st,nt,mt,xt,dt)})}reveal(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimator.reveal(a);if(j){const et=yield this.estimate(a,()=>__awaiter(this,void 0,void 0,function*(){return j})),tt=yield this.prepare.reveal(Object.assign(Object.assign({},a),et)),rt=tt.opOb.contents.find(ut=>ut.kind===OpKind.REVEAL),nt=yield this.forge(tt),{hash:it,context:at,forgedBytes:st,opResponse:ot}=yield this.signAndInject(nt);return new RevealOperation(it,rt,$,st,ot,at)}else throw new RevealOperationError(`The publicKeyHash '${$}' has already been revealed.`)})}registerGlobalConstant(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.registerGlobalConstant.bind(this.estimator)),et=yield this.prepare.registerGlobalConstant(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.REGISTER_GLOBAL_CONSTANT),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new RegisterGlobalConstantOperation(nt,tt,$,at,st,it)})}increasePaidStorage(a){return __awaiter(this,void 0,void 0,function*(){if(a.amount<0)throw new InvalidAmountError(a.amount.toString());const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.increasePaidStorage.bind(this.estimator)),et=yield this.prepare.increasePaidStorage(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.INCREASE_PAID_STORAGE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new IncreasePaidStorageOperation(nt,tt,$,at,st,it)})}drainDelegate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.prepare.drainDelegate(a),j=$.opOb.contents.find(at=>at.kind===OpKind.DRAIN_DELEGATE),et=yield this.forge($),{hash:tt,context:rt,forgedBytes:nt,opResponse:it}=yield this.signAndInject(et);return new DrainDelegateOperation(tt,j,nt,it,rt)})}ballot(a){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=yield this.signer.publicKeyHash(),tt=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(tt));const rt=(j=a.source)!==null&&j!==void 0?j:et,nt=yield this.prepare.ballot(Object.assign(Object.assign({},a),{source:rt})),it=nt.opOb.contents.find(mt=>mt.kind===OpKind.BALLOT),at=yield this.forge(nt),{hash:st,context:ot,forgedBytes:ut,opResponse:dt}=yield this.signAndInject(at);return new BallotOperation(st,it,et,ut,dt,ot)})}proposals(a){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=yield this.signer.publicKeyHash(),tt=validateAddress(($=a.source)!==null&&$!==void 0?$:"");if(a.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(a.source,invalidDetail(tt));const rt=(j=a.source)!==null&&j!==void 0?j:et,nt=yield this.prepare.proposals(Object.assign(Object.assign({},a),{source:rt})),it=nt.opOb.contents.find(mt=>mt.kind===OpKind.PROPOSALS),at=yield this.forge(nt),{hash:st,context:ot,forgedBytes:ut,opResponse:dt}=yield this.signAndInject(at);return new ProposalsOperation(st,it,et,ut,dt,ot)})}updateConsensusKey(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.updateConsensusKey.bind(this.estimator)),et=yield this.prepare.updateConsensusKey(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.UPDATE_CONSENSUS_KEY),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new UpdateConsensusKeyOperation(nt,tt,$,at,st,it)})}smartRollupAddMessages(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.smartRollupAddMessages.bind(this.estimator)),et=yield this.prepare.smartRollupAddMessages(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.SMART_ROLLUP_ADD_MESSAGES),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new SmartRollupAddMessagesOperation(nt,tt,$,at,st,it)})}smartRollupOriginate(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.smartRollupOriginate.bind(this.estimator)),et=yield this.prepare.smartRollupOriginate(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.SMART_ROLLUP_ORIGINATE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new SmartRollupOriginateOperation(nt,tt,$,at,st,it)})}smartRollupExecuteOutboxMessage(a){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(a,this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)),et=yield this.prepare.smartRollupExecuteOutboxMessage(Object.assign(Object.assign({},a),j)),tt=et.opOb.contents.find(ot=>ot.kind===OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:at,opResponse:st}=yield this.signAndInject(rt);return new SmartRollupExecuteOutboxMessageOperation(nt,tt,$,at,st,it)})}failingNoop(a){return __awaiter(this,void 0,void 0,function*(){const $={kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary},j=yield this.context.readProvider.getBlockHash(a.basedOnBlock),et=yield this.context.forger.forge({branch:j,contents:[$]}),{prefixSig:tt}=yield this.signer.sign(et,new Uint8Array([3]));return{signature:tt,bytes:et,signedContent:{branch:j,contents:[{kind:OpKind.FAILING_NOOP,arbitrary:a.arbitrary}]}}})}at(a,$=j=>j){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(a);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(a,invalidDetail(j));const et=this.context.withExtensions().rpc,tt=this.context.withExtensions().readProvider,rt=yield tt.getScript(a,"head"),nt=yield tt.getEntrypoints(a),it=new ContractAbstraction(a,rt,this,this,nt,et,tt);return $(it,this.context)})}batch(a){const $=new OperationBatch(this.context,this.estimator);return Array.isArray(a)&&$.with(a),$}}class MichelCodecParser{constructor(a){this.context=a}getNextProto(){return __awaiter(this,void 0,void 0,function*(){if(!this.context.proto){const a=yield this.context.readProvider.getNextProtocol("head");this.context.proto=a}return this.context.proto})}parseScript(a){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseScript(a)})}parseMichelineExpression(a){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseMichelineExpression(a)})}parseJSON(a){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseJSON(a)})}prepareCodeOrigination(a){return __awaiter(this,void 0,void 0,function*(){const $=a;if($.code=yield this.formatCodeParam(a.code),a.init)$.init=yield this.formatInitParam(a.init);else if(a.storage){const j=$.code.find(rt=>"prim"in rt&&rt.prim==="storage");if(!(j!=null&&j.args))throw new InvalidCodeParameter("The storage section is missing from the script",a.code);const et=new Schema(j.args[0]),tt=yield this.findGlobalConstantsHashAndValue(et);if(Object.keys(tt).length!==0){const nt=new Parser$1({expandGlobalConstant:tt}).parseJSON(j.args[0]),it=new Schema(nt);$.init=it.Encode(a.storage)}else $.init=et.Encode(a.storage);delete $.storage}return $})}formatCodeParam(a){return __awaiter(this,void 0,void 0,function*(){let $;if(typeof a=="string"){const j=yield this.parseScript(a);if(j===null)throw new InvalidCodeParameter("Unable to parse",a);$=j}else{const j=yield this.parseJSON(a),et=["parameter","storage","code"];$=j.sort((tt,rt)=>et.indexOf(tt.prim)-et.indexOf(rt.prim))}return $})}formatInitParam(a){return __awaiter(this,void 0,void 0,function*(){let $;if(typeof a=="string"){const j=yield this.parseMichelineExpression(a);if(j===null)throw new InvalidInitParameter("Invalid init parameter",a);$=j}else $=yield this.parseJSON(a);return $})}findGlobalConstantsHashAndValue(a){return __awaiter(this,void 0,void 0,function*(){const $=a.findToken("constant"),j={};if($.length!==0)for(const et of $){const tt=et.tokenVal.args;if(tt){const rt=tt[0];if(rt.string){const nt=rt.string,it=yield this.context.globalConstantsProvider.getGlobalConstantByHash(nt);Object.assign(j,{[nt]:it})}}}return j})}}class RpcPacker{constructor(a){this.context=a}packData(a){return __awaiter(this,void 0,void 0,function*(){return this.context.rpc.packData(a)})}}class UnconfiguredGlobalConstantsProviderError extends TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredGlobalConstantsProviderError",this.message="No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."}}class NoopGlobalConstantsProvider{getGlobalConstantByHash(a){return __awaiter(this,void 0,void 0,function*(){throw new UnconfiguredGlobalConstantsProviderError})}}class RpcReadAdapter{constructor(a){this.rpc=a}getBalance(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBalance(a,{block:String($)})})}getDelegate(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getDelegate(a,{block:String($)})})}getNextProtocol(a){return __awaiter(this,void 0,void 0,function*(){return(yield this.rpc.getProtocols({block:String(a)})).next_protocol})}getProtocolConstants(a){return __awaiter(this,void 0,void 0,function*(){const{time_between_blocks:$,minimal_block_delay:j,hard_gas_limit_per_operation:et,hard_gas_limit_per_block:tt,hard_storage_limit_per_operation:rt,cost_per_byte:nt,smart_rollup_origination_size:it}=yield this.rpc.getConstants({block:String(a)});return{time_between_blocks:$,minimal_block_delay:j,hard_gas_limit_per_operation:et,hard_gas_limit_per_block:tt,hard_storage_limit_per_operation:rt,cost_per_byte:nt,smart_rollup_origination_size:it}})}getScript(a,$){return __awaiter(this,void 0,void 0,function*(){const{script:j}=yield this.rpc.getContract(a,{block:String($)});return j})}getStorage(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getStorage(a,{block:String($)})})}getBlockHash(a){return __awaiter(this,void 0,void 0,function*(){const{hash:$}=yield this.rpc.getBlockHeader({block:String(a)});return $})}getBlockLevel(a){return __awaiter(this,void 0,void 0,function*(){const{level:$}=yield this.rpc.getBlockHeader({block:String(a)});return $})}getCounter(a,$){return __awaiter(this,void 0,void 0,function*(){const{counter:j}=yield this.rpc.getContract(a,{block:String($)});return j||"0"})}getBlockTimestamp(a){return __awaiter(this,void 0,void 0,function*(){const{timestamp:$}=yield this.rpc.getBlockHeader({block:String(a)});return $})}getBigMapValue(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBigMapExpr(a.id,a.expr,{block:String($)})})}getSaplingDiffById(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getSaplingDiffById(a.id,{block:String($)})})}getSaplingDiffByContract(a,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getSaplingDiffByContract(a,{block:String($)})})}getEntrypoints(a){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getEntrypoints(a)})}getChainId(){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getChainId()})}isAccountRevealed(a,$){return __awaiter(this,void 0,void 0,function*(){const j=yield this.rpc.getManagerKey(a,{block:String($)});return j&&typeof j=="object"?!!j.key:!!j})}getBlock(a){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBlock({block:String(a)})})}getLiveBlocks(a){return this.rpc.getLiveBlocks({block:String(a)})}}class UnsupportedEventError extends ParameterValidationError{constructor(a){super(),this.type=a,this.name="UnsupportedEventError",this.message=`Unsupported event type "${a}" expecting one of the "data", "error", or "close".`}}class InvalidFilterExpressionError extends ParameterValidationError{constructor(a){super(),this.invalidExpression=a,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}const opHashFilter=(_,a)=>_.hash===a.opHash,sourceFilter=(_,a)=>{switch(_.kind){case"attestation":return"metadata"in _&&_.metadata.delegate===a.source;case"endorsement":return"metadata"in _&&_.metadata.delegate===a.source;case"activate_account":return"metadata"in _&&_.pkh===a.source;default:return"source"in _&&_.source===a.source}},kindFilter=(_,a)=>"kind"in _&&_.kind===a.kind,destinationFilter=(_,a)=>{switch(_.kind){case"delegation":return _.delegate===a.destination;case"origination":if("metadata"in _&&"operation_result"in _.metadata&&"originated_contracts"in _.metadata.operation_result&&Array.isArray(_.metadata.operation_result.originated_contracts))return _.metadata.operation_result.originated_contracts.some($=>$===a.destination);break;case"transaction":return _.destination===a.destination;default:return!1}},eventFilter=(_,a,$,j)=>!(_.kind!=="event"||$&&_.tag!==$||a&&_.source!==a||j&&_.result.status!=="applied"),evaluateOpFilter=(_,a)=>"opHash"in a?opHashFilter(_,a):"source"in a?sourceFilter(_,a):"kind"in a?kindFilter(_,a):"destination"in a?destinationFilter(_,a):!1,evaluateExpression=(_,a)=>{if(Array.isArray(a.and))return a.and.every($=>evaluateFilter(_,$));if(Array.isArray(a.or))return a.or.some($=>evaluateFilter(_,$));throw new InvalidFilterExpressionError(a)},evaluateFilter=(_,a)=>{const $=[];return Array.isArray(a)?$.push(...a):$.push(a),$.every(j=>"and"in j||"or"in j?evaluateExpression(_,j):evaluateOpFilter(_,j))};class ObservableSubscription{constructor(a,$=!1,j=retry()){this.shouldRetry=$,this.operatorFunction=j,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new Subject,a.pipe(takeUntil(this.completed$),tap(et=>{this.call(this.messageListeners,et)},et=>{this.call(this.errorListeners,et)},()=>{this.call(this.closeListeners)}),this.shouldRetry?j:tap(),catchError(()=>NEVER)).subscribe()}call(a,$){for(const j of a)try{j($)}catch(et){console.error(et)}}remove(a,$){const j=a.indexOf($);j!==-1&&a.splice(j,1)}on(a,$){switch(a){case"data":this.messageListeners.push($);break;case"error":this.errorListeners.push($);break;case"close":this.closeListeners.push($);break;default:throw new UnsupportedEventError(a)}}off(a,$){switch(a){case"data":this.remove(this.messageListeners,$);break;case"error":this.remove(this.errorListeners,$);break;case"close":this.remove(this.closeListeners,$);break;default:throw new UnsupportedEventError(a)}}close(){this.completed$.next()}}const defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:retry()},getLastBlock=_=>from(_.rpc.getBlock()).pipe(first()),applyFilter=_=>concatMap(a=>new Observable($=>{for(const j of a.operations)for(const et of j)for(const tt of et.contents)evaluateFilter(Object.assign({hash:et.hash},tt),_)&&$.next(Object.assign({hash:et.hash},tt));$.complete()})),applyEventFilter=_=>concatMap(a=>new Observable($=>{for(const j of a.operations)for(const et of j)for(const tt of et.contents){const nt=tt.metadata.internal_operation_results;if(nt)for(const it of nt)eventFilter(it,_==null?void 0:_.address,_==null?void 0:_.tag,_==null?void 0:_.excludeFailedOperations)&&$.next(Object.assign({opHash:et.hash,blockHash:a.hash,level:a.header.level},it))}$.complete()}));class PollingSubscribeProvider{constructor(a,$={}){this.context=a,this._config$=new BehaviorSubject(Object.assign(Object.assign({},defaultConfigStreamer),$)),this.timer$=this._config$.pipe(pluck("pollingIntervalMilliseconds"),switchMap(j=>j?timer(0,j):from(this.getConfirmationPollingInterval()).pipe(switchMap(et=>timer(0,et))))),this.newBlock$=this.timer$.pipe(switchMap(()=>getLastBlock(this.context)),distinctUntilKeyChanged("hash"),publish(),refCount())}get config(){return this._config$.getValue()}getConfirmationPollingInterval(){return __awaiter(this,void 0,void 0,function*(){if(!this.config.pollingIntervalMilliseconds)try{const j=yield this.context.readProvider.getProtocolConstants("head"),tt=(j.minimal_block_delay?j.minimal_block_delay.multipliedBy(1e3):j.time_between_blocks?j.time_between_blocks[0].multipliedBy(1e3):new BigNumber(5e3)).dividedBy(3);this.config.pollingIntervalMilliseconds=tt.toNumber()===0?1e3:tt.toNumber()}catch{return 5e3}return this.config.pollingIntervalMilliseconds})}subscribeBlock(a){return new ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(a){return new ObservableSubscription(this.newBlock$.pipe(pluck("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(a){return new ObservableSubscription(this.newBlock$.pipe(applyFilter(a)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(a){return new ObservableSubscription(this.newBlock$.pipe(applyEventFilter(a)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}}class TaquitoLocalForger{constructor(a){this.context=a}getNextProto(){return __awaiter(this,void 0,void 0,function*(){if(!this.context.proto){const a=yield this.context.readProvider.getNextProtocol("head");this.context.proto=a}return this.context.proto})}forge({branch:a,contents:$}){return __awaiter(this,void 0,void 0,function*(){return new LocalForger(yield this.getNextProto()).forge({branch:a,contents:$})})}}const defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class Context{constructor(a,$=new NoopSigner,j,et=new BehaviorSubject(Object.assign({},defaultConfigConfirmation)),tt,rt,nt,it,at,st,ot,ut){this._rpc=a,this._signer=$,this._proto=j,this._config=et,this.providerDecorator=[],this.tz=new RpcTzProvider(this),this.estimate=new RPCEstimateProvider(this),this.contract=new RpcContractProvider(this,this.estimate),this.prepare=new PrepareProvider(this),this.batch=new RPCBatchProvider(this,this.estimate),this.wallet=new Wallet(this),this.withExtensions=()=>{let dt=this.clone();return this.providerDecorator.forEach(mt=>{dt=mt(dt)}),dt},typeof this._rpc=="string"?this._rpcClient=new RpcClient(this._rpc):this._rpcClient=this._rpc,this._forger=tt||new TaquitoLocalForger(this),this._injector=rt||new RpcInjector(this),this.operationFactory=new OperationFactory(this),this._walletProvider=it||new LegacyWalletProvider(this),this._parser=at||new MichelCodecParser(this),this._packer=nt||new RpcPacker(this),this._globalConstantsProvider=st||new NoopGlobalConstantsProvider,this._readProvider=ot||new RpcReadAdapter(this._rpcClient),this._stream=ut||new PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(a){this._config.next(Object.assign({},a))}setPartialConfig(a){this._config.next(Object.assign(Object.assign({},this._config.getValue()),a))}get rpc(){return this._rpcClient}set rpc(a){this._rpcClient=a}get injector(){return this._injector}set injector(a){this._injector=a}get forger(){return this._forger}set forger(a){this._forger=a}get signer(){return this._signer}set signer(a){this._signer=a}get walletProvider(){return this._walletProvider}set walletProvider(a){this._walletProvider=a}set proto(a){this._proto=a}get proto(){return this._proto}get parser(){return this._parser}set parser(a){this._parser=a}get packer(){return this._packer}set packer(a){this._packer=a}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(a){this._globalConstantsProvider=a}get readProvider(){return this._readProvider}set readProvider(a){this._readProvider=a}get stream(){return this._stream}set stream(a){this._stream=a}isAnyProtocolActive(a=[]){return __awaiter(this,void 0,void 0,function*(){if(this._proto)return a.includes(this._proto);{const $=yield this.readProvider.getNextProtocol("head");return a.includes($)}})}isAnySignerConfigured(){return!(this.signer instanceof NoopSigner)}clone(){return new Context(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(a){this.providerDecorator.push(a)}}const VERSION={commitHash:"2e05f6f865be17a1b367b284542b24ffa9823271",version:"19.2.1"};class TezosToolkit{constructor(a){this._rpc=a,this._options={},this.format=format$1,typeof this._rpc=="string"?this._rpcClient=new RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new Context(a),this._wallet=new Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:a,stream:$,signer:j,protocol:et,config:tt,forger:rt,wallet:nt,packer:it,globalConstantsProvider:at,readProvider:st,parserProvider:ot,injectorProvider:ut}){this.setRpcProvider(a),this.setStreamProvider($),this.setSignerProvider(j),this.setForgerProvider(rt),this.setWalletProvider(nt),this.setPackerProvider(it),this.setGlobalConstantsProvider(at),this.setReadProvider(st),this.setParserProvider(ot),this.setInjectorProvider(ut),this._context.proto=et,tt&&this._context.setPartialConfig(tt)}setSignerProvider(a){!this._options.signer&&typeof a>"u"?(this._context.signer=new NoopSigner,this._options.signer=a):typeof a<"u"&&(this._context.signer=a,this._options.signer=a)}setRpcProvider(a){typeof a=="string"?this._rpcClient=new RpcClient(a):a===void 0||(this._rpcClient=a),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(a){if(typeof a<"u")this._options.forger=a,this._context.forger=a;else if(this._options.forger===void 0){const $=this.getFactory(TaquitoLocalForger)();this._options.forger=$,this._context.forger=$}}setStreamProvider(a){if(typeof a=="string"){const $=new PollingSubscribeProvider(new Context(new RpcClient(a)));this._options.stream=$,this._context.stream=$}else if(typeof a<"u")this._options.stream=a,this._context.stream=a;else if(this._options.stream===void 0){const $=this.getFactory(PollingSubscribeProvider)();this._options.stream=$,this._context.stream=$}}setWalletProvider(a){if(!this._options.wallet&&typeof a>"u"){const $=this.getFactory(LegacyWalletProvider)();this._options.wallet=$,this._context.walletProvider=$}else typeof a<"u"&&(this._options.wallet=a,this._context.walletProvider=a)}setPackerProvider(a){if(!this._options.packer&&typeof a>"u"){const $=this.getFactory(RpcPacker)();this._context.packer=$,this._options.packer=$}else typeof a<"u"&&(this._context.packer=a,this._options.packer=a)}setGlobalConstantsProvider(a){if(!this._options.globalConstantsProvider&&typeof a>"u"){const $=new NoopGlobalConstantsProvider;this._context.globalConstantsProvider=$,this._options.globalConstantsProvider=$}else typeof a<"u"&&(this._context.globalConstantsProvider=a,this._options.globalConstantsProvider=a)}setReadProvider(a){const $=a||new RpcReadAdapter(this._context.rpc);this._options.readProvider=$,this._context.readProvider=$}setParserProvider(a){if(!this._options.parserProvider&&typeof a>"u"){const $=new MichelCodecParser(this._context);this._context.parser=$,this._options.parserProvider=$}else typeof a<"u"&&(this._context.parser=a,this._options.parserProvider=a)}setInjectorProvider(a){if(!this._options.injectorProvider&&typeof a>"u"){const $=new RpcInjector(this._context);this._context.injector=$,this._options.injectorProvider=$}else typeof a<"u"&&(this._context.injector=a,this._options.injectorProvider=a)}get tz(){return this._context.tz}get contract(){return this._context.contract}get prepare(){return this._context.prepare}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}get globalConstants(){return this._context.globalConstantsProvider}addExtension(a){Array.isArray(a)?a.forEach($=>$.configureContext(this._context)):a.configureContext(this._context)}getFactory(a){return(...$)=>new a(this._context,...$)}getVersionInfo(){return VERSION}}class FakeSigner{constructor(a,$){this.pk=a,this.pkh=$}async publicKey(){return Promise.resolve(this.pk)}async publicKeyHash(){return Promise.resolve(this.pkh)}async sign(){return Promise.reject(new Error("`sign` method not available"))}async secretKey(){return Promise.reject(new Error("empty secret key"))}}const LAMBDA_HEADER=[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]}],makeMultisigApproveOrExecuteOperation=(_,a,$)=>makeContractCallOperation(_,a,{int:$}),makeMultisigProposeOperation=(_,a)=>{const $=toBatchLambda(a);return makeContractCallOperation(_,"propose",$)},makeContractCallOperation=(_,a,$,j="0")=>({type:"contract_call",contract:_,entrypoint:a,args:$,amount:j}),headlessLambda=_=>lodashExports.isEqual(_.slice(0,2),LAMBDA_HEADER)?_.slice(2):_,toLambda=_=>{switch(_.type){case"tez":switch(_.recipient.type){case"implicit":return MANAGER_LAMBDA.transferImplicit(_.recipient.pkh,Number(_.amount));case"contract":return MANAGER_LAMBDA.transferToContract(_.recipient.pkh,Number(_.amount))}case"fa1.2":return contractLambda(_,FA12_TRANSFER_ARG_TYPES,makeFA12TransactionParameter(_));case"fa2":return contractLambda(_,FA2_TRANSFER_ARG_TYPES,makeFA2TransactionParameter(_));case"delegation":return MANAGER_LAMBDA.setDelegate(_.recipient.pkh);case"undelegation":return MANAGER_LAMBDA.removeDelegate();case"contract_origination":case"contract_call":throw new Error(`${_.type} is not supported yet`)}},toBatchLambda=_=>{const a=_.map($=>toLambda($)).flatMap(headlessLambda);return[...LAMBDA_HEADER,...a]},FA2_TRANSFER_ARG_TYPES={args:[{args:[{annots:["%from_"],prim:"address"},{annots:["%txs"],args:[{args:[{annots:["%to_"],prim:"address"},{args:[{annots:["%token_id"],prim:"nat"},{annots:["%amount"],prim:"nat"}],prim:"pair"}],prim:"pair"}],prim:"list"}],prim:"pair"}],prim:"list"},FA12_TRANSFER_ARG_TYPES={args:[{annots:[":from"],prim:"address"},{args:[{annots:[":to"],prim:"address"},{annots:[":value"],prim:"nat"}],prim:"pair"}],prim:"pair"},contractLambda=(_,a,$)=>[...LAMBDA_HEADER,{prim:"PUSH",args:[{prim:"address"},{string:_.contract.pkh+"%"+$.entrypoint}]},{prim:"CONTRACT",args:[a]},[{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]}],{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"PUSH",args:[a,$.value]},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],makeFA12TransactionParameter=({sender:_,recipient:a,amount:$})=>({entrypoint:"transfer",value:{prim:"Pair",args:[{string:_.pkh},{prim:"Pair",args:[{string:a.pkh},{int:$}]}]}}),makeFA2TransactionParameter=({sender:_,recipient:a,tokenId:$,amount:j})=>({entrypoint:"transfer",value:[{prim:"Pair",args:[{string:_.pkh},[{prim:"Pair",args:[{string:a.pkh},{prim:"Pair",args:[{int:$},{int:j}]}]}]]}]}),addressExists=async(_,a)=>{try{const $=`${a.tzktApiUrl}/v1/accounts/${_}`,{data:{type:j}}=await axios.get($);return j!=="empty"}catch($){throw new Error(`Error fetching account from tzkt ${$.message}`)}},getFingerPrint=async _=>{const a=new TextEncoder().encode(_),$=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array($)).map(tt=>tt.toString(16).padStart(2,"0")).join("").slice(0,8)},curvesToDerivationPath=_=>{switch(_){case"ed25519":return DerivationType.ED25519;case"secp256k1":return DerivationType.SECP256K1;case"p256":return DerivationType.P256;case"bip25519":throw new Error("bip25519 is not supported in Tezos")}},makeSigner=async _=>{switch(_.type){case"social":case"mnemonic":case"secret_key":return new InMemorySigner(_.secretKey);case"ledger":{const a=await TransportWebUSB.list();for(let et=0;et{const a=new TezosToolkit(_.network.rpcUrl),$=await makeSigner(_);return a.setSignerProvider($),a},getPublicKeyPairFromSk=async _=>{const a=new InMemorySigner(_);return{pk:await a.publicKey(),pkh:await a.publicKeyHash()}},derivePublicKeyPair=async(_,a,$="ed25519")=>deriveSecretKey(_,a,$).then(getPublicKeyPairFromSk),deriveSecretKey=(_,a,$)=>InMemorySigner.fromMnemonic({mnemonic:_,derivationPath:a,curve:$}).secretKey(),selectRandomElements=(_,a)=>lodashExports.shuffle(_.map(($,j)=>({value:$,index:j}))).slice(0,a).sort(($,j)=>$.index-j.index),sumTez=_=>_.reduce((a,$)=>a.plus($),new BigNumber(0)),operationToTaquitoOperation=_=>{switch(_.type){case"tez":return{kind:OpKind.TRANSACTION,to:_.recipient.pkh,amount:parseInt(_.amount),mutez:!0};case"contract_call":return{kind:OpKind.TRANSACTION,to:_.contract.pkh,amount:parseInt(_.amount),mutez:!0,parameter:{entrypoint:_.entrypoint,value:_.args}};case"delegation":return{kind:OpKind.DELEGATION,source:_.sender.pkh,delegate:_.recipient.pkh};case"undelegation":return{kind:OpKind.DELEGATION,source:_.sender.pkh,delegate:void 0};case"fa1.2":return{kind:OpKind.TRANSACTION,amount:0,to:_.contract.pkh,parameter:makeFA12TransactionParameter(_)};case"fa2":return{kind:OpKind.TRANSACTION,amount:0,to:_.contract.pkh,parameter:makeFA2TransactionParameter(_)};case"contract_origination":return{kind:OpKind.ORIGINATION,..._}}},operationsToBatchParams=({type:_,operations:a,sender:$})=>(_==="implicit"?a:[makeMultisigProposeOperation($.address,a)]).map(operationToTaquitoOperation),operationsToWalletParams=operationsToBatchParams,estimate=async(_,a)=>{const $=await makeToolkit({type:"fake",signer:_.signer,network:a});try{const j=await $.estimate.batch(operationsToBatchParams(_));return sumTez(j.map(et=>Math.max(et.suggestedFeeMutez,et.totalCost).toString()))}catch(j){throw await addressExists(_.signer.address.pkh,a)?(j instanceof Error&&(j.message=handleTezError(j)),j):new Error(`Signer address is not revealed on the ${a.name}.`)}},handleTezError=_=>_.message.includes("subtraction_underflow")?"Insufficient balance, please make sure you have enough funds.":_.message.includes("contract.non_existing_contract")?"Contract does not exist, please check if the correct network is selected.":_.message,getAccounts=async(_,a)=>withRateLimit(()=>accountsGet({address:{in:[_.join(",")]},select:{fields:["address,balance,delegationLevel"]}},{baseUrl:a.tzktApiUrl})),getTokenBalances=async(_,a)=>withRateLimit(()=>tokensGetTokenBalances({account:{in:[_.join(",")]},balance:{gt:"0"},limit:1e4},{baseUrl:a.tzktApiUrl})),getDelegations=async(_,a,$)=>withRateLimit(()=>operationsGetDelegations({sender:{in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})),getTransactions=async(_,a,$)=>withRateLimit(()=>operationsGetTransactions({anyof:{fields:["sender","target","initiator"],in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})),getOriginations=async(_,a,$)=>withRateLimit(()=>operationsGetOriginations({sender:{in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})),getCombinedOperations=async(_,a,$)=>{const j=($==null?void 0:$.limit)||100,et=($==null?void 0:$.sort)??"desc",tt={limit:j,offset:$!=null&&$.lastId?{cr:$.lastId}:void 0,sort:{[et]:"id"}},rt=await Promise.all([getTransactions(_,a,tt),getDelegations(_,a,tt),getOriginations(_,a,tt),getTokenTransfers(_,a,tt)]);return lodashExports.sortBy(rt.flat(),nt=>et==="asc"?nt.id:-nt.id).slice(0,j)},getRelatedTokenTransfers=async(_,a)=>_.length===0?[]:withRateLimit(()=>tokensGetTokenTransfers({transactionId:{in:[_.join(",")]}},{baseUrl:a.tzktApiUrl})),getTokenTransfers=async(_,a,$)=>withRateLimit(async()=>(await tokensGetTokenTransfers({anyof:{fields:["from","to"],in:[_.join(",")]},...$},{baseUrl:a.tzktApiUrl})).map(et=>({...et,type:"token_transfer"}))),getLastDelegation=(_,a)=>getDelegations([_],a,{limit:1,sort:{desc:"id"}}).then(lodashExports.first),getTezosPriceInUSD=()=>withRateLimit(()=>quotesGetLast().then(_=>_.usd)),getLatestBlockLevel=async _=>withRateLimit(async()=>await blocksGetCount({baseUrl:_.tzktApiUrl})),getBakers=async _=>withRateLimit(()=>delegatesGet({sort:{desc:"stakingBalance"},active:{eq:!0},limit:1e4,select:{fields:["address,alias,stakingBalance"]}},{baseUrl:_.tzktApiUrl}).then(a=>a.map($=>({name:$.alias||"Unknown baker",address:$.address,stakingBalance:$.stakingBalance})))),executeOperations=async(_,a)=>{const $=operationsToWalletParams(_);return a.wallet.batch($).send()},TEZ="ꜩ",TEZ_DECIMALS=6,truncate=(_,a)=>_.length>a?_.slice(0,a-3)+"...":_,tezToMutez=_=>format$1("tz","mutez",_),mutezToTez=_=>format$1("mutez","tz",_),prettyTezAmount=_=>{const a=BigNumber(mutezToTez(_)).toNumber();return`${new Intl.NumberFormat("en-US",{minimumFractionDigits:TEZ_DECIMALS,maximumFractionDigits:TEZ_DECIMALS}).format(a)} ${TEZ}`},formatPkh=_=>`${_.slice(0,5)}...${_.slice(-5)}`,useBlockLevel=()=>useAppSelector(_=>_.assets.blockLevel),useIsBlockFinalised=_=>{const a=useBlockLevel();return a!==null?a-_>=2:null},useAllNfts=()=>{const _=useGetAccountNFTs(),a=useAppSelector(j=>j.assets.balances.tokens),$=Object.keys(a);return lodashExports.fromPairs($.map(j=>[j,_(j)]))},useGetAccountAssets=()=>{const _=useGetToken(),a=useAppSelector($=>$.assets.balances.tokens);return $=>{const j=a[$]||[];return lodashExports.compact(j.map(({contract:et,tokenId:tt,...rt})=>{const nt=_(et,tt);return nt&&{...nt,...rt}}))}},useGetAccountFA2Tokens=()=>{const _=useGetAccountAssets();return a=>keepFA2s(_(a))},useGetAccountFA1Tokens=()=>{const _=useGetAccountAssets();return a=>keepFA1s(_(a))},useGetAccountAllTokens=()=>{const _=useGetAccountFA1Tokens(),a=useGetAccountFA2Tokens();return $=>[..._($),...a($)]},useGetAccountNFTs=()=>{const _=useGetAccountAssets();return a=>keepNFTs(_(a))},useGetTokenTransfer=()=>{const _=useAppSelector(a=>a.assets.transfers.tokens);return a=>{const $=_[a];return $&&{...$,type:"token_transfer"}}},useConversionRate=()=>useAppSelector(_=>_.assets.conversionRate),useTezToDollar=()=>{const _=useConversionRate();return _?a=>BigNumber(a).multipliedBy(_).decimalPlaces(2,BigNumber.ROUND_UP):()=>{}},useGetDollarBalance=()=>{const _=useTezToDollar(),a=useGetAccountBalance();return $=>{const j=a($);return j===void 0?void 0:_(mutezToTez(j))}},useTotalBalance=()=>{const _=useAppSelector(tt=>tt.assets.balances.mutez),a=useTezToDollar(),$=Object.values(_);if($.length===0)return null;const j=$.reduce((tt,rt)=>tt.plus(rt),BigNumber(0)),et=a(mutezToTez(j));return{mutez:j.toFixed(),usd:et}},useGetAccountBalance=()=>{const _=useAppSelector(a=>a.assets.balances.mutez);return a=>_[a]},useBakerList=()=>useAppSelector(_=>_.assets.bakers),useGetBaker=()=>{const _=useBakerList();return a=>_.find($=>$.address===a)},useRefetchTrigger=()=>useAppSelector(_=>_.assets.refetchTrigger),useIsLoading=()=>useAppSelector(_=>_.assets.isLoading),useLastTimeUpdated=()=>useAppSelector(_=>_.assets.lastTimeUpdated),useMultisigAccounts=()=>useAppSelector(_=>_.multisigs.items),useGetPendingMultisigOperations=()=>{const _=useAppSelector(a=>a.multisigs.pendingOperations);return a=>[..._[a.pendingOperationsBigmapId]??[]].sort((j,et)=>Number(et.id)-Number(j.id))},useSeedPhrases=()=>useAppSelector(_=>_.accounts.seedPhrases),useSecretKeys=()=>useAppSelector(_=>_.accounts.secretKeys),useImplicitAccounts=()=>useAppSelector(_=>_.accounts.items),useGetImplicitAccountSafe=()=>{const _=useImplicitAccounts();return a=>_.find($=>$.address.pkh===a)},useGetImplicitAccount=()=>{const _=useGetImplicitAccountSafe();return a=>{const $=_(a);if(!$)throw new Error(`Unknown account: ${a}`);return $}},useGetAccountsByType=()=>{const _=useImplicitAccounts();return a=>_.filter($=>$.type===a)},useGetAccountsByFingerPrint=()=>{const _=useGetAccountsByType();return a=>_("mnemonic").filter($=>$.seedFingerPrint===a)},useAllAccounts=()=>{const _=useImplicitAccounts(),a=useMultisigAccounts();return[..._,...a]},useGetOwnedAccountSafe=()=>{const _=useAllAccounts();return a=>_.find($=>$.address.pkh===a)},useGetOwnedAccount=()=>{const _=useGetOwnedAccountSafe();return a=>{const $=_(a);if(!$)throw new Error(`Unknown account: ${a}`);return $}},useValidateMasterPassword=()=>{const _=useSeedPhrases(),a=useSecretKeys(),$=Object.values({...a,..._})[0];return $?async j=>{await decrypt$1($,j)}:null},useIsOwnedAddress=()=>{const _=useAllAccounts(),a=new Set(_.map($=>$.address.pkh));return $=>!!$&&a.has($)},useGetMultisigSigners=()=>{const _=useImplicitAccounts();return a=>{const $=_.filter(j=>a.signers.some(et=>et.pkh===j.address.pkh));return $.length===0&&console.warn("Wallet doesn't own any signers for multisig contract "+a.address.pkh),$}},useGetOwnedSignersForAccount=()=>{const _=useGetMultisigSigners();return a=>{switch(a.type){case"ledger":case"mnemonic":case"social":case"secret_key":return[a];case"multisig":return _(a)}}},useGetBestSignerForAccount=()=>{const _=useGetOwnedSignersForAccount(),a=useGetMostFundedImplicitAccount();return $=>a(_($))},useGetMostFundedImplicitAccount=()=>{const _=useGetAccountBalance();return a=>lodashExports.maxBy(a,$=>Number(_($.address.pkh)||"0"))},useGetSecretKey=()=>{const _=useSeedPhrases(),a=useSecretKeys();return async($,j)=>{if($.type==="secret_key"){const et=a[$.address.pkh];if(!et)throw new Error(`Missing secret key for account ${$.address.pkh}`);return decrypt$1(et,j)}else{const et=_[$.seedFingerPrint];if(!et)throw new Error(`Missing seedphrase for account ${$.address.pkh}`);const tt=await decrypt$1(et,j);return deriveSecretKey(tt,$.derivationPath,$.curve)}}},useAllContacts=()=>useAppSelector(_=>_.contacts),useContactsForSelectedNetwork=()=>{const _=useSelectedNetwork(),a=useAllContacts();return Object.values(a).filter($=>isValidImplicitPkh($.pkh)||$.network===_.name).map($=>$)},useSortedContacts=()=>useContactsForSelectedNetwork().sort((a,$)=>a.name.localeCompare($.name)).map(a=>a),useAddressExistsInContacts=()=>{const _=useAllContacts();return a=>a in _},useGetContactName=()=>{const _=useAllContacts();return a=>a in _?_[a].name:void 0},useValidateNewContactPkh=()=>{const _=useAddressExistsInContacts(),a=useGetOwnedAccountSafe();return $=>isAddressValid($)?a($)?"Address is already used in accounts":!_($)||"Address is already registered":"Invalid address"},useValidateName=_=>{const a=useIsUniqueLabel();return $=>{const j=$.trim();return j.length===0?"Name should not be empty":_!==void 0&&j===_?"Name was not changed":a(j)?!0:"Name must be unique across all accounts and contacts"}},useGetNextAvailableAccountLabels=()=>{const _=useIsUniqueLabel();return(a,$=1)=>{const j=[];for(let et=1;j.length<$;et++){const tt=et===1?a:`${a} ${et}`;_(tt)&&j.push(tt)}return j}},useIsUniqueLabel=()=>{const _=useAllAccounts().map($=>$.label),a=Object.values(useAllContacts()).map($=>$.name);return $=>![..._,...a].includes($)};var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(_){return this.listeners.add(_),this.onSubscribe(),()=>{this.listeners.delete(_),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$2(){}function functionalUpdate(_,a){return typeof _=="function"?_(a):_}function isValidTimeout(_){return typeof _=="number"&&_>=0&&_!==1/0}function timeUntilStale(_,a){return Math.max(_+(a||0)-Date.now(),0)}function matchQuery(_,a){const{type:$="all",exact:j,fetchStatus:et,predicate:tt,queryKey:rt,stale:nt}=_;if(rt){if(j){if(a.queryHash!==hashQueryKeyByOptions(rt,a.options))return!1}else if(!partialMatchKey(a.queryKey,rt))return!1}if($!=="all"){const it=a.isActive();if($==="active"&&!it||$==="inactive"&&it)return!1}return!(typeof nt=="boolean"&&a.isStale()!==nt||et&&et!==a.state.fetchStatus||tt&&!tt(a))}function matchMutation(_,a){const{exact:$,status:j,predicate:et,mutationKey:tt}=_;if(tt){if(!a.options.mutationKey)return!1;if($){if(hashKey(a.options.mutationKey)!==hashKey(tt))return!1}else if(!partialMatchKey(a.options.mutationKey,tt))return!1}return!(j&&a.state.status!==j||et&&!et(a))}function hashQueryKeyByOptions(_,a){return((a==null?void 0:a.queryKeyHashFn)||hashKey)(_)}function hashKey(_){return JSON.stringify(_,(a,$)=>isPlainObject($)?Object.keys($).sort().reduce((j,et)=>(j[et]=$[et],j),{}):$)}function partialMatchKey(_,a){return _===a?!0:typeof _!=typeof a?!1:_&&a&&typeof _=="object"&&typeof a=="object"?!Object.keys(a).some($=>!partialMatchKey(_[$],a[$])):!1}function replaceEqualDeep(_,a){if(_===a)return _;const $=isPlainArray(_)&&isPlainArray(a);if($||isPlainObject(_)&&isPlainObject(a)){const j=$?_:Object.keys(_),et=j.length,tt=$?a:Object.keys(a),rt=tt.length,nt=$?[]:{};let it=0;for(let at=0;at{setTimeout(a,_)})}function replaceData(_,a,$){return typeof $.structuralSharing=="function"?$.structuralSharing(_,a):$.structuralSharing!==!1?replaceEqualDeep(_,a):a}function addToEnd(_,a,$=0){const j=[..._,a];return $&&j.length>$?j.slice(1):j}function addToStart(_,a,$=0){const j=[a,..._];return $&&j.length>$?j.slice(0,-1):j}var skipToken=Symbol(),ou,Hl,Tu,bv,FocusManager=(bv=class extends Subscribable{constructor(){super();Mn(this,ou,void 0);Mn(this,Hl,void 0);Mn(this,Tu,void 0);In(this,Tu,a=>{if(!isServer&&window.addEventListener){const $=()=>a();return window.addEventListener("visibilitychange",$,!1),()=>{window.removeEventListener("visibilitychange",$)}}})}onSubscribe(){Nr(this,Hl)||this.setEventListener(Nr(this,Tu))}onUnsubscribe(){var a;this.hasListeners()||((a=Nr(this,Hl))==null||a.call(this),In(this,Hl,void 0))}setEventListener(a){var $;In(this,Tu,a),($=Nr(this,Hl))==null||$.call(this),In(this,Hl,a(j=>{typeof j=="boolean"?this.setFocused(j):this.onFocus()}))}setFocused(a){Nr(this,ou)!==a&&(In(this,ou,a),this.onFocus())}onFocus(){const a=this.isFocused();this.listeners.forEach($=>{$(a)})}isFocused(){var a;return typeof Nr(this,ou)=="boolean"?Nr(this,ou):((a=globalThis.document)==null?void 0:a.visibilityState)!=="hidden"}},ou=new WeakMap,Hl=new WeakMap,Tu=new WeakMap,bv),focusManager=new FocusManager,Cu,Vl,Iu,vv,OnlineManager=(vv=class extends Subscribable{constructor(){super();Mn(this,Cu,!0);Mn(this,Vl,void 0);Mn(this,Iu,void 0);In(this,Iu,a=>{if(!isServer&&window.addEventListener){const $=()=>a(!0),j=()=>a(!1);return window.addEventListener("online",$,!1),window.addEventListener("offline",j,!1),()=>{window.removeEventListener("online",$),window.removeEventListener("offline",j)}}})}onSubscribe(){Nr(this,Vl)||this.setEventListener(Nr(this,Iu))}onUnsubscribe(){var a;this.hasListeners()||((a=Nr(this,Vl))==null||a.call(this),In(this,Vl,void 0))}setEventListener(a){var $;In(this,Iu,a),($=Nr(this,Vl))==null||$.call(this),In(this,Vl,a(this.setOnline.bind(this)))}setOnline(a){Nr(this,Cu)!==a&&(In(this,Cu,a),this.listeners.forEach(j=>{j(a)}))}isOnline(){return Nr(this,Cu)}},Cu=new WeakMap,Vl=new WeakMap,Iu=new WeakMap,vv),onlineManager=new OnlineManager;function defaultRetryDelay(_){return Math.min(1e3*2**_,3e4)}function canFetch(_){return(_??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class{constructor(_){this.revert=_==null?void 0:_.revert,this.silent=_==null?void 0:_.silent}};function isCancelledError(_){return _ instanceof CancelledError}function createRetryer(_){let a=!1,$=0,j=!1,et,tt,rt;const nt=new Promise((Pt,Tt)=>{tt=Pt,rt=Tt}),it=Pt=>{var Tt;j||(mt(new CancelledError(Pt)),(Tt=_.abort)==null||Tt.call(_))},at=()=>{a=!0},st=()=>{a=!1},ot=()=>focusManager.isFocused()&&(_.networkMode==="always"||onlineManager.isOnline())&&_.canRun(),ut=()=>canFetch(_.networkMode)&&_.canRun(),dt=Pt=>{var Tt;j||(j=!0,(Tt=_.onSuccess)==null||Tt.call(_,Pt),et==null||et(),tt(Pt))},mt=Pt=>{var Tt;j||(j=!0,(Tt=_.onError)==null||Tt.call(_,Pt),et==null||et(),rt(Pt))},xt=()=>new Promise(Pt=>{var Tt;et=kt=>{(j||ot())&&Pt(kt)},(Tt=_.onPause)==null||Tt.call(_)}).then(()=>{var Pt;et=void 0,j||(Pt=_.onContinue)==null||Pt.call(_)}),Ct=()=>{if(j)return;let Pt;try{Pt=_.fn()}catch(Tt){Pt=Promise.reject(Tt)}Promise.resolve(Pt).then(dt).catch(Tt=>{var jt;if(j)return;const kt=_.retry??(isServer?0:3),Lt=_.retryDelay??defaultRetryDelay,Nt=typeof Lt=="function"?Lt($,Tt):Lt,zt=kt===!0||typeof kt=="number"&&$ot()?void 0:xt()).then(()=>{a?mt(Tt):Ct()})})};return{promise:nt,cancel:it,continue:()=>(et==null||et(),nt),cancelRetry:at,continueRetry:st,canStart:ut,start:()=>(ut()?Ct():xt().then(Ct),nt)}}function createNotifyManager(){let _=[],a=0,$=ut=>{ut()},j=ut=>{ut()},et=ut=>setTimeout(ut,0);const tt=ut=>{et=ut},rt=ut=>{let dt;a++;try{dt=ut()}finally{a--,a||at()}return dt},nt=ut=>{a?_.push(ut):et(()=>{$(ut)})},it=ut=>(...dt)=>{nt(()=>{ut(...dt)})},at=()=>{const ut=_;_=[],ut.length&&et(()=>{j(()=>{ut.forEach(dt=>{$(dt)})})})};return{batch:rt,batchCalls:it,schedule:nt,setNotifyFunction:ut=>{$=ut},setBatchNotifyFunction:ut=>{j=ut},setScheduler:tt}}var notifyManager=createNotifyManager(),cu,yv,Removable=(yv=class{constructor(){Mn(this,cu,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&In(this,cu,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(_){this.gcTime=Math.max(this.gcTime||0,_??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Nr(this,cu)&&(clearTimeout(Nr(this,cu)),In(this,cu,void 0))}},cu=new WeakMap,yv),ku,Mu,go,Ks,ap,lu,To,Qo,xv,Query=(xv=class extends Removable{constructor(a){super();Mn(this,To);Mn(this,ku,void 0);Mn(this,Mu,void 0);Mn(this,go,void 0);Mn(this,Ks,void 0);Mn(this,ap,void 0);Mn(this,lu,void 0);In(this,lu,!1),In(this,ap,a.defaultOptions),this.setOptions(a.options),this.observers=[],In(this,go,a.cache),this.queryKey=a.queryKey,this.queryHash=a.queryHash,In(this,ku,a.state||getDefaultState$1(this.options)),this.state=Nr(this,ku),this.scheduleGc()}get meta(){return this.options.meta}setOptions(a){this.options={...Nr(this,ap),...a},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Nr(this,go).remove(this)}setData(a,$){const j=replaceData(this.state.data,a,this.options);return Zn(this,To,Qo).call(this,{data:j,type:"success",dataUpdatedAt:$==null?void 0:$.updatedAt,manual:$==null?void 0:$.manual}),j}setState(a,$){Zn(this,To,Qo).call(this,{type:"setState",state:a,setStateOptions:$})}cancel(a){var j,et;const $=(j=Nr(this,Ks))==null?void 0:j.promise;return(et=Nr(this,Ks))==null||et.cancel(a),$?$.then(noop$2).catch(noop$2):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Nr(this,ku))}isActive(){return this.observers.some(a=>a.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(a=>a.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(a=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,a)}onFocus(){var $;const a=this.observers.find(j=>j.shouldFetchOnWindowFocus());a==null||a.refetch({cancelRefetch:!1}),($=Nr(this,Ks))==null||$.continue()}onOnline(){var $;const a=this.observers.find(j=>j.shouldFetchOnReconnect());a==null||a.refetch({cancelRefetch:!1}),($=Nr(this,Ks))==null||$.continue()}addObserver(a){this.observers.includes(a)||(this.observers.push(a),this.clearGcTimeout(),Nr(this,go).notify({type:"observerAdded",query:this,observer:a}))}removeObserver(a){this.observers.includes(a)&&(this.observers=this.observers.filter($=>$!==a),this.observers.length||(Nr(this,Ks)&&(Nr(this,lu)?Nr(this,Ks).cancel({revert:!0}):Nr(this,Ks).cancelRetry()),this.scheduleGc()),Nr(this,go).notify({type:"observerRemoved",query:this,observer:a}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Zn(this,To,Qo).call(this,{type:"invalidate"})}fetch(a,$){var at,st,ot;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&($!=null&&$.cancelRefetch))this.cancel({silent:!0});else if(Nr(this,Ks))return Nr(this,Ks).continueRetry(),Nr(this,Ks).promise}if(a&&this.setOptions(a),!this.options.queryFn){const ut=this.observers.find(dt=>dt.options.queryFn);ut&&this.setOptions(ut.options)}const j=new AbortController,et={queryKey:this.queryKey,meta:this.meta},tt=ut=>{Object.defineProperty(ut,"signal",{enumerable:!0,get:()=>(In(this,lu,!0),j.signal)})};tt(et);const rt=()=>!this.options.queryFn||this.options.queryFn===skipToken?Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)):(In(this,lu,!1),this.options.persister?this.options.persister(this.options.queryFn,et,this):this.options.queryFn(et)),nt={fetchOptions:$,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:rt};tt(nt),(at=this.options.behavior)==null||at.onFetch(nt,this),In(this,Mu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((st=nt.fetchOptions)==null?void 0:st.meta))&&Zn(this,To,Qo).call(this,{type:"fetch",meta:(ot=nt.fetchOptions)==null?void 0:ot.meta});const it=ut=>{var dt,mt,xt,Ct;isCancelledError(ut)&&ut.silent||Zn(this,To,Qo).call(this,{type:"error",error:ut}),isCancelledError(ut)||((mt=(dt=Nr(this,go).config).onError)==null||mt.call(dt,ut,this),(Ct=(xt=Nr(this,go).config).onSettled)==null||Ct.call(xt,this.state.data,ut,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return In(this,Ks,createRetryer({fn:nt.fetchFn,abort:j.abort.bind(j),onSuccess:ut=>{var dt,mt,xt,Ct;if(ut===void 0){it(new Error(`${this.queryHash} data is undefined`));return}this.setData(ut),(mt=(dt=Nr(this,go).config).onSuccess)==null||mt.call(dt,ut,this),(Ct=(xt=Nr(this,go).config).onSettled)==null||Ct.call(xt,ut,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:it,onFail:(ut,dt)=>{Zn(this,To,Qo).call(this,{type:"failed",failureCount:ut,error:dt})},onPause:()=>{Zn(this,To,Qo).call(this,{type:"pause"})},onContinue:()=>{Zn(this,To,Qo).call(this,{type:"continue"})},retry:nt.options.retry,retryDelay:nt.options.retryDelay,networkMode:nt.options.networkMode,canRun:()=>!0})),Nr(this,Ks).start()}},ku=new WeakMap,Mu=new WeakMap,go=new WeakMap,Ks=new WeakMap,ap=new WeakMap,lu=new WeakMap,To=new WeakSet,Qo=function(a){const $=j=>{switch(a.type){case"failed":return{...j,fetchFailureCount:a.failureCount,fetchFailureReason:a.error};case"pause":return{...j,fetchStatus:"paused"};case"continue":return{...j,fetchStatus:"fetching"};case"fetch":return{...j,...fetchState(j.data,this.options),fetchMeta:a.meta??null};case"success":return{...j,data:a.data,dataUpdateCount:j.dataUpdateCount+1,dataUpdatedAt:a.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!a.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const et=a.error;return isCancelledError(et)&&et.revert&&Nr(this,Mu)?{...Nr(this,Mu),fetchStatus:"idle"}:{...j,error:et,errorUpdateCount:j.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:j.fetchFailureCount+1,fetchFailureReason:et,fetchStatus:"idle",status:"error"};case"invalidate":return{...j,isInvalidated:!0};case"setState":return{...j,...a.state}}};this.state=$(this.state),notifyManager.batch(()=>{this.observers.forEach(j=>{j.onQueryUpdate()}),Nr(this,go).notify({query:this,type:"updated",action:a})})},xv);function fetchState(_,a){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(a.networkMode)?"fetching":"paused",..._===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(_){const a=typeof _.initialData=="function"?_.initialData():_.initialData,$=a!==void 0,j=$?typeof _.initialDataUpdatedAt=="function"?_.initialDataUpdatedAt():_.initialDataUpdatedAt:0;return{data:a,dataUpdateCount:0,dataUpdatedAt:$?j??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:$?"success":"pending",fetchStatus:"idle"}}var Lo,Ev,QueryCache=(Ev=class extends Subscribable{constructor(a={}){super();Mn(this,Lo,void 0);this.config=a,In(this,Lo,new Map)}build(a,$,j){const et=$.queryKey,tt=$.queryHash??hashQueryKeyByOptions(et,$);let rt=this.get(tt);return rt||(rt=new Query({cache:this,queryKey:et,queryHash:tt,options:a.defaultQueryOptions($),state:j,defaultOptions:a.getQueryDefaults(et)}),this.add(rt)),rt}add(a){Nr(this,Lo).has(a.queryHash)||(Nr(this,Lo).set(a.queryHash,a),this.notify({type:"added",query:a}))}remove(a){const $=Nr(this,Lo).get(a.queryHash);$&&(a.destroy(),$===a&&Nr(this,Lo).delete(a.queryHash),this.notify({type:"removed",query:a}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(a=>{this.remove(a)})})}get(a){return Nr(this,Lo).get(a)}getAll(){return[...Nr(this,Lo).values()]}find(a){const $={exact:!0,...a};return this.getAll().find(j=>matchQuery($,j))}findAll(a={}){const $=this.getAll();return Object.keys(a).length>0?$.filter(j=>matchQuery(a,j)):$}notify(a){notifyManager.batch(()=>{this.listeners.forEach($=>{$(a)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(a=>{a.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(a=>{a.onOnline()})})}},Lo=new WeakMap,Ev),Do,Ws,uu,Fo,Ul,wv,Mutation=(wv=class extends Removable{constructor(a){super();Mn(this,Fo);Mn(this,Do,void 0);Mn(this,Ws,void 0);Mn(this,uu,void 0);this.mutationId=a.mutationId,In(this,Ws,a.mutationCache),In(this,Do,[]),this.state=a.state||getDefaultState(),this.setOptions(a.options),this.scheduleGc()}setOptions(a){this.options=a,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(a){Nr(this,Do).includes(a)||(Nr(this,Do).push(a),this.clearGcTimeout(),Nr(this,Ws).notify({type:"observerAdded",mutation:this,observer:a}))}removeObserver(a){In(this,Do,Nr(this,Do).filter($=>$!==a)),this.scheduleGc(),Nr(this,Ws).notify({type:"observerRemoved",mutation:this,observer:a})}optionalRemove(){Nr(this,Do).length||(this.state.status==="pending"?this.scheduleGc():Nr(this,Ws).remove(this))}continue(){var a;return((a=Nr(this,uu))==null?void 0:a.continue())??this.execute(this.state.variables)}async execute(a){var et,tt,rt,nt,it,at,st,ot,ut,dt,mt,xt,Ct,Pt,Tt,kt,Lt,Nt,zt,jt;In(this,uu,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(a):Promise.reject(new Error("No mutationFn found")),onFail:(Mt,Dt)=>{Zn(this,Fo,Ul).call(this,{type:"failed",failureCount:Mt,error:Dt})},onPause:()=>{Zn(this,Fo,Ul).call(this,{type:"pause"})},onContinue:()=>{Zn(this,Fo,Ul).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Nr(this,Ws).canRun(this)}));const $=this.state.status==="pending",j=!Nr(this,uu).canStart();try{if(!$){Zn(this,Fo,Ul).call(this,{type:"pending",variables:a,isPaused:j}),await((tt=(et=Nr(this,Ws).config).onMutate)==null?void 0:tt.call(et,a,this));const Dt=await((nt=(rt=this.options).onMutate)==null?void 0:nt.call(rt,a));Dt!==this.state.context&&Zn(this,Fo,Ul).call(this,{type:"pending",context:Dt,variables:a,isPaused:j})}const Mt=await Nr(this,uu).start();return await((at=(it=Nr(this,Ws).config).onSuccess)==null?void 0:at.call(it,Mt,a,this.state.context,this)),await((ot=(st=this.options).onSuccess)==null?void 0:ot.call(st,Mt,a,this.state.context)),await((dt=(ut=Nr(this,Ws).config).onSettled)==null?void 0:dt.call(ut,Mt,null,this.state.variables,this.state.context,this)),await((xt=(mt=this.options).onSettled)==null?void 0:xt.call(mt,Mt,null,a,this.state.context)),Zn(this,Fo,Ul).call(this,{type:"success",data:Mt}),Mt}catch(Mt){try{throw await((Pt=(Ct=Nr(this,Ws).config).onError)==null?void 0:Pt.call(Ct,Mt,a,this.state.context,this)),await((kt=(Tt=this.options).onError)==null?void 0:kt.call(Tt,Mt,a,this.state.context)),await((Nt=(Lt=Nr(this,Ws).config).onSettled)==null?void 0:Nt.call(Lt,void 0,Mt,this.state.variables,this.state.context,this)),await((jt=(zt=this.options).onSettled)==null?void 0:jt.call(zt,void 0,Mt,a,this.state.context)),Mt}finally{Zn(this,Fo,Ul).call(this,{type:"error",error:Mt})}}finally{Nr(this,Ws).runNext(this)}}},Do=new WeakMap,Ws=new WeakMap,uu=new WeakMap,Fo=new WeakSet,Ul=function(a){const $=j=>{switch(a.type){case"failed":return{...j,failureCount:a.failureCount,failureReason:a.error};case"pause":return{...j,isPaused:!0};case"continue":return{...j,isPaused:!1};case"pending":return{...j,context:a.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:a.isPaused,status:"pending",variables:a.variables,submittedAt:Date.now()};case"success":return{...j,data:a.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...j,data:void 0,error:a.error,failureCount:j.failureCount+1,failureReason:a.error,isPaused:!1,status:"error"}}};this.state=$(this.state),notifyManager.batch(()=>{Nr(this,Do).forEach(j=>{j.onMutationUpdate(a)}),Nr(this,Ws).notify({mutation:this,type:"updated",action:a})})},wv);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var no,op,_v,MutationCache=(_v=class extends Subscribable{constructor(a={}){super();Mn(this,no,void 0);Mn(this,op,void 0);this.config=a,In(this,no,new Map),In(this,op,Date.now())}build(a,$,j){const et=new Mutation({mutationCache:this,mutationId:++r0(this,op)._,options:a.defaultMutationOptions($),state:j});return this.add(et),et}add(a){const $=scopeFor(a),j=Nr(this,no).get($)??[];j.push(a),Nr(this,no).set($,j),this.notify({type:"added",mutation:a})}remove(a){var j;const $=scopeFor(a);if(Nr(this,no).has($)){const et=(j=Nr(this,no).get($))==null?void 0:j.filter(tt=>tt!==a);et&&(et.length===0?Nr(this,no).delete($):Nr(this,no).set($,et))}this.notify({type:"removed",mutation:a})}canRun(a){var j;const $=(j=Nr(this,no).get(scopeFor(a)))==null?void 0:j.find(et=>et.state.status==="pending");return!$||$===a}runNext(a){var j;const $=(j=Nr(this,no).get(scopeFor(a)))==null?void 0:j.find(et=>et!==a&&et.state.isPaused);return($==null?void 0:$.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(a=>{this.remove(a)})})}getAll(){return[...Nr(this,no).values()].flat()}find(a){const $={exact:!0,...a};return this.getAll().find(j=>matchMutation($,j))}findAll(a={}){return this.getAll().filter($=>matchMutation(a,$))}notify(a){notifyManager.batch(()=>{this.listeners.forEach($=>{$(a)})})}resumePausedMutations(){const a=this.getAll().filter($=>$.state.isPaused);return notifyManager.batch(()=>Promise.all(a.map($=>$.continue().catch(noop$2))))}},no=new WeakMap,op=new WeakMap,_v);function scopeFor(_){var a;return((a=_.options.scope)==null?void 0:a.id)??String(_.mutationId)}function infiniteQueryBehavior(_){return{onFetch:(a,$)=>{const j=async()=>{var mt,xt,Ct,Pt,Tt;const et=a.options,tt=(Ct=(xt=(mt=a.fetchOptions)==null?void 0:mt.meta)==null?void 0:xt.fetchMore)==null?void 0:Ct.direction,rt=((Pt=a.state.data)==null?void 0:Pt.pages)||[],nt=((Tt=a.state.data)==null?void 0:Tt.pageParams)||[],it={pages:[],pageParams:[]};let at=!1;const st=kt=>{Object.defineProperty(kt,"signal",{enumerable:!0,get:()=>(a.signal.aborted?at=!0:a.signal.addEventListener("abort",()=>{at=!0}),a.signal)})},ot=a.options.queryFn&&a.options.queryFn!==skipToken?a.options.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${a.options.queryHash}'`)),ut=async(kt,Lt,Nt)=>{if(at)return Promise.reject();if(Lt==null&&kt.pages.length)return Promise.resolve(kt);const zt={queryKey:a.queryKey,pageParam:Lt,direction:Nt?"backward":"forward",meta:a.options.meta};st(zt);const jt=await ot(zt),{maxPages:Mt}=a.options,Dt=Nt?addToStart:addToEnd;return{pages:Dt(kt.pages,jt,Mt),pageParams:Dt(kt.pageParams,Lt,Mt)}};let dt;if(tt&&rt.length){const kt=tt==="backward",Lt=kt?getPreviousPageParam:getNextPageParam,Nt={pages:rt,pageParams:nt},zt=Lt(et,Nt);dt=await ut(Nt,zt,kt)}else{dt=await ut(it,nt[0]??et.initialPageParam);const kt=_??rt.length;for(let Lt=1;Lt{var et,tt;return(tt=(et=a.options).persister)==null?void 0:tt.call(et,j,{queryKey:a.queryKey,meta:a.options.meta,signal:a.signal},$)}:a.fetchFn=j}}}function getNextPageParam(_,{pages:a,pageParams:$}){const j=a.length-1;return _.getNextPageParam(a[j],a,$[j],$)}function getPreviousPageParam(_,{pages:a,pageParams:$}){var j;return(j=_.getPreviousPageParam)==null?void 0:j.call(_,a[0],a,$[0],$)}function hasNextPage(_,a){return a?getNextPageParam(_,a)!=null:!1}function hasPreviousPage(_,a){return!a||!_.getPreviousPageParam?!1:getPreviousPageParam(_,a)!=null}var Ss,Kl,Wl,Ou,ju,Gl,Bu,Nu,Sv,QueryClient=(Sv=class{constructor(_={}){Mn(this,Ss,void 0);Mn(this,Kl,void 0);Mn(this,Wl,void 0);Mn(this,Ou,void 0);Mn(this,ju,void 0);Mn(this,Gl,void 0);Mn(this,Bu,void 0);Mn(this,Nu,void 0);In(this,Ss,_.queryCache||new QueryCache),In(this,Kl,_.mutationCache||new MutationCache),In(this,Wl,_.defaultOptions||{}),In(this,Ou,new Map),In(this,ju,new Map),In(this,Gl,0)}mount(){r0(this,Gl)._++,Nr(this,Gl)===1&&(In(this,Bu,focusManager.subscribe(async _=>{_&&(await this.resumePausedMutations(),Nr(this,Ss).onFocus())})),In(this,Nu,onlineManager.subscribe(async _=>{_&&(await this.resumePausedMutations(),Nr(this,Ss).onOnline())})))}unmount(){var _,a;r0(this,Gl)._--,Nr(this,Gl)===0&&((_=Nr(this,Bu))==null||_.call(this),In(this,Bu,void 0),(a=Nr(this,Nu))==null||a.call(this),In(this,Nu,void 0))}isFetching(_){return Nr(this,Ss).findAll({..._,fetchStatus:"fetching"}).length}isMutating(_){return Nr(this,Kl).findAll({..._,status:"pending"}).length}getQueryData(_){var $;const a=this.defaultQueryOptions({queryKey:_});return($=Nr(this,Ss).get(a.queryHash))==null?void 0:$.state.data}ensureQueryData(_){const a=this.getQueryData(_.queryKey);if(a===void 0)return this.fetchQuery(_);{const $=this.defaultQueryOptions(_),j=Nr(this,Ss).build(this,$);return _.revalidateIfStale&&j.isStaleByTime($.staleTime)&&this.prefetchQuery($),Promise.resolve(a)}}getQueriesData(_){return Nr(this,Ss).findAll(_).map(({queryKey:a,state:$})=>{const j=$.data;return[a,j]})}setQueryData(_,a,$){const j=this.defaultQueryOptions({queryKey:_}),et=Nr(this,Ss).get(j.queryHash),tt=et==null?void 0:et.state.data,rt=functionalUpdate(a,tt);if(rt!==void 0)return Nr(this,Ss).build(this,j).setData(rt,{...$,manual:!0})}setQueriesData(_,a,$){return notifyManager.batch(()=>Nr(this,Ss).findAll(_).map(({queryKey:j})=>[j,this.setQueryData(j,a,$)]))}getQueryState(_){var $;const a=this.defaultQueryOptions({queryKey:_});return($=Nr(this,Ss).get(a.queryHash))==null?void 0:$.state}removeQueries(_){const a=Nr(this,Ss);notifyManager.batch(()=>{a.findAll(_).forEach($=>{a.remove($)})})}resetQueries(_,a){const $=Nr(this,Ss),j={type:"active",..._};return notifyManager.batch(()=>($.findAll(_).forEach(et=>{et.reset()}),this.refetchQueries(j,a)))}cancelQueries(_={},a={}){const $={revert:!0,...a},j=notifyManager.batch(()=>Nr(this,Ss).findAll(_).map(et=>et.cancel($)));return Promise.all(j).then(noop$2).catch(noop$2)}invalidateQueries(_={},a={}){return notifyManager.batch(()=>{if(Nr(this,Ss).findAll(_).forEach(j=>{j.invalidate()}),_.refetchType==="none")return Promise.resolve();const $={..._,type:_.refetchType??_.type??"active"};return this.refetchQueries($,a)})}refetchQueries(_={},a){const $={...a,cancelRefetch:(a==null?void 0:a.cancelRefetch)??!0},j=notifyManager.batch(()=>Nr(this,Ss).findAll(_).filter(et=>!et.isDisabled()).map(et=>{let tt=et.fetch(void 0,$);return $.throwOnError||(tt=tt.catch(noop$2)),et.state.fetchStatus==="paused"?Promise.resolve():tt}));return Promise.all(j).then(noop$2)}fetchQuery(_){const a=this.defaultQueryOptions(_);a.retry===void 0&&(a.retry=!1);const $=Nr(this,Ss).build(this,a);return $.isStaleByTime(a.staleTime)?$.fetch(a):Promise.resolve($.state.data)}prefetchQuery(_){return this.fetchQuery(_).then(noop$2).catch(noop$2)}fetchInfiniteQuery(_){return _.behavior=infiniteQueryBehavior(_.pages),this.fetchQuery(_)}prefetchInfiniteQuery(_){return this.fetchInfiniteQuery(_).then(noop$2).catch(noop$2)}resumePausedMutations(){return onlineManager.isOnline()?Nr(this,Kl).resumePausedMutations():Promise.resolve()}getQueryCache(){return Nr(this,Ss)}getMutationCache(){return Nr(this,Kl)}getDefaultOptions(){return Nr(this,Wl)}setDefaultOptions(_){In(this,Wl,_)}setQueryDefaults(_,a){Nr(this,Ou).set(hashKey(_),{queryKey:_,defaultOptions:a})}getQueryDefaults(_){const a=[...Nr(this,Ou).values()];let $={};return a.forEach(j=>{partialMatchKey(_,j.queryKey)&&($={...$,...j.defaultOptions})}),$}setMutationDefaults(_,a){Nr(this,ju).set(hashKey(_),{mutationKey:_,defaultOptions:a})}getMutationDefaults(_){const a=[...Nr(this,ju).values()];let $={};return a.forEach(j=>{partialMatchKey(_,j.mutationKey)&&($={...$,...j.defaultOptions})}),$}defaultQueryOptions(_){if(_._defaulted)return _;const a={...Nr(this,Wl).queries,...this.getQueryDefaults(_.queryKey),..._,_defaulted:!0};return a.queryHash||(a.queryHash=hashQueryKeyByOptions(a.queryKey,a)),a.refetchOnReconnect===void 0&&(a.refetchOnReconnect=a.networkMode!=="always"),a.throwOnError===void 0&&(a.throwOnError=!!a.suspense),!a.networkMode&&a.persister&&(a.networkMode="offlineFirst"),a.enabled!==!0&&a.queryFn===skipToken&&(a.enabled=!1),a}defaultMutationOptions(_){return _!=null&&_._defaulted?_:{...Nr(this,Wl).mutations,...(_==null?void 0:_.mutationKey)&&this.getMutationDefaults(_.mutationKey),..._,_defaulted:!0}}clear(){Nr(this,Ss).clear(),Nr(this,Kl).clear()}},Ss=new WeakMap,Kl=new WeakMap,Wl=new WeakMap,Ou=new WeakMap,ju=new WeakMap,Gl=new WeakMap,Bu=new WeakMap,Nu=new WeakMap,Sv),ba,ys,cp,Gs,du,Lu,zo,lp,Du,Fu,fu,hu,Zl,zu,pu,sp,up,um,dp,dm,fp,fm,hp,hm,pp,pm,mp,mm,gp,gm,i0,Av,$v,QueryObserver=($v=class extends Subscribable{constructor(a,$){super();Mn(this,pu);Mn(this,up);Mn(this,dp);Mn(this,fp);Mn(this,hp);Mn(this,pp);Mn(this,mp);Mn(this,gp);Mn(this,i0);Mn(this,ba,void 0);Mn(this,ys,void 0);Mn(this,cp,void 0);Mn(this,Gs,void 0);Mn(this,du,void 0);Mn(this,Lu,void 0);Mn(this,zo,void 0);Mn(this,lp,void 0);Mn(this,Du,void 0);Mn(this,Fu,void 0);Mn(this,fu,void 0);Mn(this,hu,void 0);Mn(this,Zl,void 0);Mn(this,zu,new Set);this.options=$,In(this,ba,a),In(this,zo,null),this.bindMethods(),this.setOptions($)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Nr(this,ys).addObserver(this),shouldFetchOnMount(Nr(this,ys),this.options)?Zn(this,pu,sp).call(this):this.updateResult(),Zn(this,hp,hm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Nr(this,ys),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Nr(this,ys),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Zn(this,pp,pm).call(this),Zn(this,mp,mm).call(this),Nr(this,ys).removeObserver(this)}setOptions(a,$){const j=this.options,et=Nr(this,ys);if(this.options=Nr(this,ba).defaultQueryOptions(a),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");Zn(this,gp,gm).call(this),Nr(this,ys).setOptions(this.options),j._defaulted&&!shallowEqualObjects(this.options,j)&&Nr(this,ba).getQueryCache().notify({type:"observerOptionsUpdated",query:Nr(this,ys),observer:this});const tt=this.hasListeners();tt&&shouldFetchOptionally(Nr(this,ys),et,this.options,j)&&Zn(this,pu,sp).call(this),this.updateResult($),tt&&(Nr(this,ys)!==et||this.options.enabled!==j.enabled||this.options.staleTime!==j.staleTime)&&Zn(this,up,um).call(this);const rt=Zn(this,dp,dm).call(this);tt&&(Nr(this,ys)!==et||this.options.enabled!==j.enabled||rt!==Nr(this,Zl))&&Zn(this,fp,fm).call(this,rt)}getOptimisticResult(a){const $=Nr(this,ba).getQueryCache().build(Nr(this,ba),a),j=this.createResult($,a);return shouldAssignObserverCurrentProperties(this,j)&&(In(this,Gs,j),In(this,Lu,this.options),In(this,du,Nr(this,ys).state)),j}getCurrentResult(){return Nr(this,Gs)}trackResult(a,$){const j={};return Object.keys(a).forEach(et=>{Object.defineProperty(j,et,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(et),$==null||$(et),a[et])})}),j}trackProp(a){Nr(this,zu).add(a)}getCurrentQuery(){return Nr(this,ys)}refetch({...a}={}){return this.fetch({...a})}fetchOptimistic(a){const $=Nr(this,ba).defaultQueryOptions(a),j=Nr(this,ba).getQueryCache().build(Nr(this,ba),$);return j.isFetchingOptimistic=!0,j.fetch().then(()=>this.createResult(j,$))}fetch(a){return Zn(this,pu,sp).call(this,{...a,cancelRefetch:a.cancelRefetch??!0}).then(()=>(this.updateResult(),Nr(this,Gs)))}createResult(a,$){var jt;const j=Nr(this,ys),et=this.options,tt=Nr(this,Gs),rt=Nr(this,du),nt=Nr(this,Lu),at=a!==j?a.state:Nr(this,cp),{state:st}=a;let ot={...st},ut=!1,dt;if($._optimisticResults){const Mt=this.hasListeners(),Dt=!Mt&&shouldFetchOnMount(a,$),Ft=Mt&&shouldFetchOptionally(a,j,$,et);(Dt||Ft)&&(ot={...ot,...fetchState(st.data,a.options)}),$._optimisticResults==="isRestoring"&&(ot.fetchStatus="idle")}let{error:mt,errorUpdatedAt:xt,status:Ct}=ot;if($.select&&ot.data!==void 0)if(tt&&ot.data===(rt==null?void 0:rt.data)&&$.select===Nr(this,lp))dt=Nr(this,Du);else try{In(this,lp,$.select),dt=$.select(ot.data),dt=replaceData(tt==null?void 0:tt.data,dt,$),In(this,Du,dt),In(this,zo,null)}catch(Mt){In(this,zo,Mt)}else dt=ot.data;if($.placeholderData!==void 0&&dt===void 0&&Ct==="pending"){let Mt;if(tt!=null&&tt.isPlaceholderData&&$.placeholderData===(nt==null?void 0:nt.placeholderData))Mt=tt.data;else if(Mt=typeof $.placeholderData=="function"?$.placeholderData((jt=Nr(this,Fu))==null?void 0:jt.state.data,Nr(this,Fu)):$.placeholderData,$.select&&Mt!==void 0)try{Mt=$.select(Mt),In(this,zo,null)}catch(Dt){In(this,zo,Dt)}Mt!==void 0&&(Ct="success",dt=replaceData(tt==null?void 0:tt.data,Mt,$),ut=!0)}Nr(this,zo)&&(mt=Nr(this,zo),dt=Nr(this,Du),xt=Date.now(),Ct="error");const Pt=ot.fetchStatus==="fetching",Tt=Ct==="pending",kt=Ct==="error",Lt=Tt&&Pt,Nt=dt!==void 0;return{status:Ct,fetchStatus:ot.fetchStatus,isPending:Tt,isSuccess:Ct==="success",isError:kt,isInitialLoading:Lt,isLoading:Lt,data:dt,dataUpdatedAt:ot.dataUpdatedAt,error:mt,errorUpdatedAt:xt,failureCount:ot.fetchFailureCount,failureReason:ot.fetchFailureReason,errorUpdateCount:ot.errorUpdateCount,isFetched:ot.dataUpdateCount>0||ot.errorUpdateCount>0,isFetchedAfterMount:ot.dataUpdateCount>at.dataUpdateCount||ot.errorUpdateCount>at.errorUpdateCount,isFetching:Pt,isRefetching:Pt&&!Tt,isLoadingError:kt&&!Nt,isPaused:ot.fetchStatus==="paused",isPlaceholderData:ut,isRefetchError:kt&&Nt,isStale:isStale(a,$),refetch:this.refetch}}updateResult(a){const $=Nr(this,Gs),j=this.createResult(Nr(this,ys),this.options);if(In(this,du,Nr(this,ys).state),In(this,Lu,this.options),Nr(this,du).data!==void 0&&In(this,Fu,Nr(this,ys)),shallowEqualObjects(j,$))return;In(this,Gs,j);const et={},tt=()=>{if(!$)return!0;const{notifyOnChangeProps:rt}=this.options,nt=typeof rt=="function"?rt():rt;if(nt==="all"||!nt&&!Nr(this,zu).size)return!0;const it=new Set(nt??Nr(this,zu));return this.options.throwOnError&&it.add("error"),Object.keys(Nr(this,Gs)).some(at=>{const st=at;return Nr(this,Gs)[st]!==$[st]&&it.has(st)})};(a==null?void 0:a.listeners)!==!1&&tt()&&(et.listeners=!0),Zn(this,i0,Av).call(this,{...et,...a})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Zn(this,hp,hm).call(this)}},ba=new WeakMap,ys=new WeakMap,cp=new WeakMap,Gs=new WeakMap,du=new WeakMap,Lu=new WeakMap,zo=new WeakMap,lp=new WeakMap,Du=new WeakMap,Fu=new WeakMap,fu=new WeakMap,hu=new WeakMap,Zl=new WeakMap,zu=new WeakMap,pu=new WeakSet,sp=function(a){Zn(this,gp,gm).call(this);let $=Nr(this,ys).fetch(this.options,a);return a!=null&&a.throwOnError||($=$.catch(noop$2)),$},up=new WeakSet,um=function(){if(Zn(this,pp,pm).call(this),isServer||Nr(this,Gs).isStale||!isValidTimeout(this.options.staleTime))return;const $=timeUntilStale(Nr(this,Gs).dataUpdatedAt,this.options.staleTime)+1;In(this,fu,setTimeout(()=>{Nr(this,Gs).isStale||this.updateResult()},$))},dp=new WeakSet,dm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Nr(this,ys)):this.options.refetchInterval)??!1},fp=new WeakSet,fm=function(a){Zn(this,mp,mm).call(this),In(this,Zl,a),!(isServer||this.options.enabled===!1||!isValidTimeout(Nr(this,Zl))||Nr(this,Zl)===0)&&In(this,hu,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&Zn(this,pu,sp).call(this)},Nr(this,Zl)))},hp=new WeakSet,hm=function(){Zn(this,up,um).call(this),Zn(this,fp,fm).call(this,Zn(this,dp,dm).call(this))},pp=new WeakSet,pm=function(){Nr(this,fu)&&(clearTimeout(Nr(this,fu)),In(this,fu,void 0))},mp=new WeakSet,mm=function(){Nr(this,hu)&&(clearInterval(Nr(this,hu)),In(this,hu,void 0))},gp=new WeakSet,gm=function(){const a=Nr(this,ba).getQueryCache().build(Nr(this,ba),this.options);if(a===Nr(this,ys))return;const $=Nr(this,ys);In(this,ys,a),In(this,cp,a.state),this.hasListeners()&&($==null||$.removeObserver(this),a.addObserver(this))},i0=new WeakSet,Av=function(a){notifyManager.batch(()=>{a.listeners&&this.listeners.forEach($=>{$(Nr(this,Gs))}),Nr(this,ba).getQueryCache().notify({query:Nr(this,ys),type:"observerResultsUpdated"})})},$v);function shouldLoadOnMount(_,a){return a.enabled!==!1&&_.state.data===void 0&&!(_.state.status==="error"&&a.retryOnMount===!1)}function shouldFetchOnMount(_,a){return shouldLoadOnMount(_,a)||_.state.data!==void 0&&shouldFetchOn(_,a,a.refetchOnMount)}function shouldFetchOn(_,a,$){if(a.enabled!==!1){const j=typeof $=="function"?$(_):$;return j==="always"||j!==!1&&isStale(_,a)}return!1}function shouldFetchOptionally(_,a,$,j){return(_!==a||j.enabled===!1)&&(!$.suspense||_.state.status!=="error")&&isStale(_,$)}function isStale(_,a){return a.enabled!==!1&&_.isStaleByTime(a.staleTime)}function shouldAssignObserverCurrentProperties(_,a){return!shallowEqualObjects(_.getCurrentResult(),a)}var InfiniteQueryObserver=class extends QueryObserver{constructor(_,a){super(_,a)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(_,a){super.setOptions({..._,behavior:infiniteQueryBehavior()},a)}getOptimisticResult(_){return _.behavior=infiniteQueryBehavior(),super.getOptimisticResult(_)}fetchNextPage(_){return this.fetch({..._,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(_){return this.fetch({..._,meta:{fetchMore:{direction:"backward"}}})}createResult(_,a){var mt,xt;const{state:$}=_,j=super.createResult(_,a),{isFetching:et,isRefetching:tt,isError:rt,isRefetchError:nt}=j,it=(xt=(mt=$.fetchMeta)==null?void 0:mt.fetchMore)==null?void 0:xt.direction,at=rt&&it==="forward",st=et&&it==="forward",ot=rt&&it==="backward",ut=et&&it==="backward";return{...j,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hasNextPage(a,$.data),hasPreviousPage:hasPreviousPage(a,$.data),isFetchNextPageError:at,isFetchingNextPage:st,isFetchPreviousPageError:ot,isFetchingPreviousPage:ut,isRefetchError:nt&&!at&&!ot,isRefetching:tt&&!st&&!ut}}},QueryClientContext=reactExports.createContext(void 0),useQueryClient=_=>{const a=reactExports.useContext(QueryClientContext);if(!a)throw new Error("No QueryClient set, use QueryClientProvider to set one");return a},QueryClientProvider=({client:_,children:a})=>(reactExports.useEffect(()=>(_.mount(),()=>{_.unmount()}),[_]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:_,children:a})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let _=!1;return{clearReset:()=>{_=!1},reset:()=>{_=!0},isReset:()=>_}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(_,a){return typeof _=="function"?_(...a):!!_}var ensurePreventErrorBoundaryRetry=(_,a)=>{(_.suspense||_.throwOnError)&&(a.isReset()||(_.retryOnMount=!1))},useClearResetErrorBoundary=_=>{reactExports.useEffect(()=>{_.clearReset()},[_])},getHasError=({result:_,errorResetBoundary:a,throwOnError:$,query:j})=>_.isError&&!a.isReset()&&!_.isFetching&&j&&shouldThrowError($,[_.error,j]),ensureStaleTime=_=>{_.suspense&&typeof _.staleTime!="number"&&(_.staleTime=1e3)},shouldSuspend=(_,a)=>(_==null?void 0:_.suspense)&&a.isPending,fetchOptimistic=(_,a,$)=>a.fetchOptimistic(_).catch(()=>{$.clearReset()});function useBaseQuery(_,a,$){const j=useQueryClient(),et=useIsRestoring(),tt=useQueryErrorResetBoundary(),rt=j.defaultQueryOptions(_);rt._optimisticResults=et?"isRestoring":"optimistic",ensureStaleTime(rt),ensurePreventErrorBoundaryRetry(rt,tt),useClearResetErrorBoundary(tt);const[nt]=reactExports.useState(()=>new a(j,rt)),it=nt.getOptimisticResult(rt);if(reactExports.useSyncExternalStore(reactExports.useCallback(at=>{const st=et?()=>{}:nt.subscribe(notifyManager.batchCalls(at));return nt.updateResult(),st},[nt,et]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),reactExports.useEffect(()=>{nt.setOptions(rt,{listeners:!1})},[rt,nt]),shouldSuspend(rt,it))throw fetchOptimistic(rt,nt,tt);if(getHasError({result:it,errorResetBoundary:tt,throwOnError:rt.throwOnError,query:j.getQueryCache().get(rt.queryHash)}))throw it.error;return rt.notifyOnChangeProps?it:nt.trackResult(it)}function useQuery(_,a){return useBaseQuery(_,QueryObserver)}function useInfiniteQuery(_,a){return useBaseQuery(_,InfiniteQueryObserver)}const peerInfoSchema=z.object({id:z.string(),type:z.string(),name:z.string(),publicKey:z.string(),version:z.string(),icon:z.string().optional(),relayServer:z.string().optional()}),makePeerInfo=peerInfoSchema.parse,useGetConnectionInfo=_=>useAppSelector($=>$.beacon)[_],useGetPeersForAccounts=()=>{const _=useAppSelector(a=>a.beacon);return a=>lodashExports.uniq(Object.entries(_).filter(([$,j])=>a.includes(j.accountPkh)).map(([$,j])=>$))},useResetConnections=()=>{const _=useDispatch();return()=>_(beaconSlice.actions.reset())},useAddConnection=()=>{const _=useDispatch();return(a,$,j)=>_(beaconSlice.actions.addConnection({dAppId:a,accountPkh:$,networkType:j}))},useRemoveConnection=()=>{const _=useDispatch();return a=>_(beaconSlice.actions.removeConnection(a))},PEERS_QUERY_KEY="beaconPeers",useRefreshPeers=()=>{const _=useQueryClient();return()=>_.refetchQueries({queryKey:[PEERS_QUERY_KEY]})},usePeers=()=>useQuery({queryKey:[PEERS_QUERY_KEY],queryFn:()=>WalletClient.getPeers(),initialData:[]}).data,useRemovePeer=()=>{const _=useRefreshPeers(),a=useRemoveConnection();return $=>WalletClient.removePeer($,!0).then(()=>a($.senderId)).finally(()=>void _())},useRemovePeerBySenderId=()=>{const _=usePeers(),a=useRemovePeer();return $=>Promise.all(_.filter(j=>$===j.senderId).map(a))},useRemovePeersByAccounts=()=>{const _=useGetPeersForAccounts(),a=useRemovePeerBySenderId();return $=>Promise.all(_($).map(a))},useAddPeer=()=>{const _=useRefreshPeers(),a=useToast();return $=>new Serializer().deserialize($).then(makePeerInfo).then(j=>WalletClient.addPeer(j)).then(_).catch(j=>{a({description:"Beacon sync code in the clipboard is invalid. Please copy a beacon sync code from the dApp",status:"error"}),console.error(j)})},useRemoveDependenciesAndMultisigs=()=>{const _=useAppDispatch(),a=useGetMultisigsToRemove(),$=useRemoveAccountsDependencies();return j=>{const et=a(j);$([...j,...et]),_(multisigsSlice.actions.removeMultisigsData(et.map(tt=>tt.address.pkh)))}},useRemoveAccountsDependencies=()=>{const _=useAppDispatch(),a=useRemovePeersByAccounts();return $=>{const j=$.map(et=>et.address.pkh);_(batchesSlice.actions.removeByAccounts(j)),a(j),_(beaconSlice.actions.removeConnections(j)),_(assetsSlice.actions.removeAccountsData(j))}},useGetMultisigsToRemove=()=>{const _=useImplicitAccounts(),a=useMultisigAccounts();return $=>{const j=$.map(tt=>tt.address.pkh),et=_.map(tt=>tt.address.pkh).filter(tt=>!j.includes(tt));return a.filter(tt=>!tt.signers.some(rt=>et.includes(rt.pkh)))}},defaultDerivationPathTemplate="44'/1729'/?'/0'",DEFAULT_DERIVATION_PATH_TEMPLATE={label:"Default - m/44'/1729'/?'/0'",value:defaultDerivationPathTemplate},AVAILABLE_DERIVATION_PATH_TEMPLATES=[DEFAULT_DERIVATION_PATH_TEMPLATE,{label:"m/44'/1729'/0'/?'",value:"44'/1729'/0'/?'"},{label:"m/44'/1729'/?'/0'/0'",value:"44'/1729'/?'/0'/0'"},{label:"m/44'/1729'/0'/0'/?'",value:"44'/1729'/0'/0'/?'"}],getDefaultDerivationPath=_=>makeDerivationPath(defaultDerivationPathTemplate,_),makeDerivationPath=(_,a)=>_.replace("?",a.toString()),makeMnemonicAccount=(_,a,$,j,et,tt)=>({curve:"ed25519",derivationPath:$,derivationPathTemplate:j,pk:_,address:parseImplicitPkh(a),seedFingerPrint:et,label:tt,type:"mnemonic"}),generate24WordMnemonic=()=>generateMnemonic_1(256),restoreRevealedPublicKeyPairs=async(_,a,$)=>{const j=[];let et=0,tt=await derivePublicKeyPair(_,makeDerivationPath(a,et));do j.push(tt),et+=1,tt=await derivePublicKeyPair(_,makeDerivationPath(a,et));while(await addressExists(tt.pkh,$));return j},useRestoreRevealedMnemonicAccounts=()=>{const _=useGetNextAvailableAccountLabels();return async(a,$,j,et)=>{const tt=await restoreRevealedPublicKeyPairs(a,j,$),rt=await getFingerPrint(a),nt=_(et,tt.length);return tt.map(({pk:it,pkh:at},st)=>makeMnemonicAccount(it,at,makeDerivationPath(j,st),j,rt,nt[st]))}},getCurve=_=>{if(_.startsWith(Prefix.EDESK)||_.startsWith(Prefix.EDSK))return"ed25519";if(_.startsWith(Prefix.SPESK)||_.startsWith(Prefix.SPSK))return"secp256k1";if(_.startsWith(Prefix.P2ESK)||_.startsWith(Prefix.P2SK))return"p256";throw new Error("Invalid secret key")},isEncryptedSecretKeyPrefix=_=>_.substring(2,3)==="e",makeSecretKeyAccount=async({secretKey:_,label:a,password:$})=>{const{pk:j,pkh:et}=await getPublicKeyPairFromSk(_),tt=await encrypt$1(_,$);return{account:{type:"secret_key",pk:j,label:a,curve:getCurve(_),address:parseImplicitPkh(et)},encryptedSecretKey:tt}},restore=({secretKey:_,label:a,password:$})=>async j=>{const{account:et,encryptedSecretKey:tt}=await makeSecretKeyAccount({secretKey:_,label:a,password:$});j(accountsSlice.actions.addAccount(et)),j(accountsSlice.actions.addSecretKey({pkh:et.address.pkh,encryptedSecretKey:tt}))},{removeMnemonicAndAccounts,removeNonMnemonicAccounts}=accountsSlice.actions,{addAccount}=accountsSlice.actions,useRestoreFromMnemonic=()=>{const _=useSelectedNetwork(),a=useRestoreRevealedMnemonicAccounts(),$=useDispatch();return async({mnemonic:j,password:et,derivationPathTemplate:tt,label:rt})=>{const nt=await getFingerPrint(j),it=await a(j,_,tt,rt),at=await encrypt$1(j,et);$(accountsSlice.actions.addMnemonicAccounts({seedFingerprint:nt,accounts:it,encryptedMnemonic:at}))}},useDeriveMnemonicAccount=()=>{const _=useSeedPhrases(),a=useImplicitAccounts(),$=useGetNextAvailableAccountLabels(),j=useDispatch();return async({fingerPrint:et,password:tt,label:rt})=>{const nt=_[et];if(!nt)throw new Error(`No seedphrase found with fingerprint: ${et}`);const it=await decrypt$1(nt,tt),at=a.filter(Pt=>Pt.type==="mnemonic"&&Pt.seedFingerPrint===et),st=at.length,ot=at[0].derivationPathTemplate,ut=makeDerivationPath(ot,st),{pk:dt,pkh:mt}=await derivePublicKeyPair(it,ut),xt=$(rt,1)[0],Ct=makeMnemonicAccount(dt,mt,ut,ot,et,xt);j(accountsSlice.actions.addAccount(Ct))}},useRestoreFromSecretKey=()=>{const _=useAppDispatch();return(a,$,j)=>_(restore({secretKey:a,password:$,label:j}))},useRestoreLedger=()=>{const _=useAppDispatch();return(a,$,j,et,tt)=>{_(addAccount({derivationPathTemplate:a,derivationPath:$,curve:"ed25519",type:"ledger",pk:j,address:{type:"implicit",pkh:et},label:tt}))}},useRestoreSocial=()=>{const _=useAppDispatch();return reactExports.useCallback(($,j,et,tt)=>{_(addAccount({type:"social",pk:$,address:{type:"implicit",pkh:j},idp:tt,label:et}))},[_])},useRemoveMnemonic=()=>{const _=useAppDispatch(),a=useGetAccountsByFingerPrint(),$=useRemoveDependenciesAndMultisigs();return j=>{$(a(j)),_(removeMnemonicAndAccounts({fingerPrint:j}))}},useRemoveNonMnemonic=()=>{const _=useAppDispatch(),a=useGetAccountsByType(),$=useRemoveDependenciesAndMultisigs();return j=>{$(a(j)),_(removeNonMnemonicAccounts({accountType:j}))}},useRemoveAccount=()=>{const _=useAppDispatch(),a=useRemoveDependenciesAndMultisigs();return $=>{a([$]),_(accountsSlice.actions.removeAccount($))}},DEFAULT_TITLE="Name Your Account",NameAccountDisplay=({onSubmit:_,title:a=DEFAULT_TITLE,subtitle:$})=>{const{register:j,handleSubmit:et}=useForm({mode:"onChange"});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(EditAccountIcon,{}),subtitle:$,title:a,children:jsxRuntimeExports.jsxs("form",{onSubmit:et(_),style:{width:"100%"},children:[jsxRuntimeExports.jsxs(FormControl,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"Account name"}),jsxRuntimeExports.jsx(Input,{"data-testid":"name",type:"text",...j("accountName",{required:!1}),placeholder:"Optional"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"32px",size:"lg",type:"submit",children:"Continue"})]})})},DEFAULT_ACCOUNT_LABEL="Account",NameAccount=({goToStep:_,account:a})=>{const $=useGetNextAvailableAccountLabels(),j=et=>{const tt=et.accountName.trim()||DEFAULT_ACCOUNT_LABEL,rt=$(tt)[0];switch(a.type){case"secret_key":return _({type:"masterPassword",account:{...a,label:rt}});case"ledger":return _({type:"derivationPath",account:{...a,label:rt}});case"mnemonic":return _({type:"derivationPath",account:{...a,label:tt}})}};return jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:j,subtitle:"Please choose a name for your first account. You can edit your account name later."})},reload=()=>window.location.reload(),useRestoreV1BackupFile=()=>{const _=useRestoreFromMnemonic();return async(a,$)=>{const j=a.recoveryPhrases,et=a.derivationPaths.map(rt=>rt.slice(0,2)==="m/"?rt.slice(2):rt),tt=[];try{for(const rt of j)tt.push(await decrypt$1(rt,$,"V1"))}catch{throw new Error("Invalid password.")}for(const[rt,nt]of tt.entries())await _({mnemonic:nt,password:$,label:DEFAULT_ACCOUNT_LABEL,derivationPathTemplate:et[rt]})}},restoreV2BackupFile=async(_,a)=>{const $=_["persist:accounts"];if(!$)throw new Error("Invalid backup file.");const j=JSON.parse($),et=JSON.parse(j.seedPhrases);try{for(const tt of Object.values(et))await decrypt$1(tt,a,"V2")}catch{throw new Error("Invalid password.")}persistor.pause(),localStorage.clear(),localStorage.setItem("persist:accounts",$),localStorage.setItem("persist:root",_["persist:root"])},downloadBackupFile=()=>{const _={version:packageInfo.version,"persist:accounts":localStorage.getItem("persist:accounts"),"persist:root":localStorage.getItem("persist:root")},a=`data:text/json;chatset=utf-8,${encodeURIComponent(JSON.stringify(_))}`,$=document.createElement("a");$.href=a,$.download="UmamiV2Backup.json",$.click()},BackgroundImage=""+new URL("background_image-BS5h8JYK.png",import.meta.url).href,feedbackEmailBodyTemplate="What is it about? (if a bug report please consider including your account address) %0A PLEASE FILL %0A%0A What is the feedback? %0A PLEASE FILL",refresh=()=>{window.location.href="/"},ErrorPage=()=>{const{modalElement:_,onOpen:a}=useOffboardingModal();return jsxRuntimeExports.jsxs(Center,{height:"100vh",padding:"60px",backgroundImage:BackgroundImage,backgroundSize:"cover",children:[jsxRuntimeExports.jsx(Box,{width:"480px",padding:"40px",background:colors.gray[900],border:"1px",borderColor:colors.gray[700],borderRadius:"8px",boxShadow:"0px 0px 30px rgba(0, 0, 0, 0.30)",children:jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(NoticeIcon,{}),subtitle:"Please refresh the app or use one of the following options:",title:"Oops! Something went wrong!",children:jsxRuntimeExports.jsxs(VStack,{width:"100%",spacing:"16px",children:[jsxRuntimeExports.jsx(Button,{width:"100%",borderRadius:"4px",onClick:downloadBackupFile,size:"lg",children:"Save Backup"}),jsxRuntimeExports.jsx(Button,{width:"100%",borderRadius:"4px",onClick:a,size:"lg",variant:"warning",children:"Off-board Wallet"}),jsxRuntimeExports.jsx(Button,{width:"100%",borderColor:colors.gray[600],borderRadius:"4px",size:"lg",variant:"tertiary",children:jsxRuntimeExports.jsx(Link$1,{width:"100%",_hover:{textDecoration:"none"},href:`mailto:umami-support@trili.tech?subject=Umami V2 feedback&body=${feedbackEmailBodyTemplate}`,rel:"noopener noreferrer",target:"_blank",children:"Report Error"})}),jsxRuntimeExports.jsx(Link$1,{display:"block",marginTop:"14px",color:colors.blue,fill:colors.blue,_hover:{color:colors.blueL,fill:colors.blueL},onClick:refresh,children:jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(ReloadIcon,{marginRight:"7px"}),jsxRuntimeExports.jsx(Heading,{display:"inline",lineHeight:"22px",size:"md",children:"Refresh"})]})})]})})}),_]})},queryClient=new QueryClient,ReactQueryProvider=({children:_})=>jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:_}),ReduxStore=_=>jsxRuntimeExports.jsx(Provider_default,{store,children:_.children}),baseCircle={borderRadius:"full",bg:colors.gray[600],_disabled:{bg:colors.gray[700],color:colors.gray[450]},_hover:{color:colors.green,bg:colors.gray[500],_disabled:{bg:colors.gray[700],color:colors.gray[450]}}},buttonTheme={sizes:{md:{height:"38px",fontSize:"14px",minWidth:"38px"},lg:{height:"48px",fontSize:"16px",minWidth:"48px"}},variants:{primary:{bg:colors.blue,_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1},_hover:{_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1},bg:colors.blueL}},secondary:{border:"1px solid",borderColor:colors.green,_disabled:{color:colors.gray[450],borderColor:colors.gray[500],opacity:1},_hover:{bg:colors.green,_disabled:{color:colors.gray[450],borderColor:colors.gray[500],opacity:1}}},tertiary:{bg:"transparent",border:"1px solid",borderColor:colors.gray[500],_disabled:{color:colors.gray[450],opacity:1},_hover:{border:"1px solid",borderColor:colors.gray[600],bg:colors.gray[600],_disabled:{borderColor:colors.gray[500],color:colors.gray[450],opacity:1}}},warning:{bg:colors.orange,_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1},_hover:{bg:colors.orangeL,_disabled:{bg:colors.gray[500],color:colors.gray[450],opacity:1}}},circle_without_hover_color:{...baseCircle,_hover:{color:colors.green,_disabled:{bg:colors.gray[700],color:colors.gray[450]}}},circle_without_color:baseCircle,circle:{...baseCircle,color:colors.gray[300]},specialCTA:{color:colors.greenL,_hover:{color:colors.green}},CTAWithIcon:{padding:"8px 7px",color:colors.gray[300],_hover:{color:colors.green},_disabled:{color:colors.gray[450]}},popover:{color:colors.gray[300],stroke:colors.gray[450],width:"100%",padding:0,height:"24px",justifyContent:"end",_hover:{color:colors.green,stroke:colors.green}},socialLogin:{width:"48px",height:"48px",background:"white",borderWidth:"0",borderRadius:"full",_hover:{background:colors.gray[600]}}},defaultProps:{variant:"primary",size:"md"}},{definePartsStyle:definePartsStyle$6,defineMultiStyleConfig:defineMultiStyleConfig$6}=createMultiStyleConfigHelpers(checkboxAnatomy.keys),baseStyle$3=definePartsStyle$6({icon:{color:"white"},control:{marginTop:"-20px",width:"20px",height:"20px",borderWidth:"2px",borderColor:colors.gray[400],borderRadius:"2px",_checked:{borderColor:colors.green,bg:colors.green,color:colors.white,_hover:{bg:colors.green,borderColor:colors.green}}}}),checkboxTheme=defineMultiStyleConfig$6({baseStyle:baseStyle$3}),{definePartsStyle:definePartsStyle$5,defineMultiStyleConfig:defineMultiStyleConfig$5}=createMultiStyleConfigHelpers(drawerAnatomy.keys),baseStyle$2=definePartsStyle$5(_=>({body:{padding:"18px 30px 30px 30px",borderLeft:`1px solid ${colors.gray[800]}`},dialog:{bg:colors.gray[900]}})),drawerTheme=defineMultiStyleConfig$5({baseStyle:baseStyle$2,sizes:{md:{dialog:{maxW:"594px"}}},defaultProps:{size:"md"}}),{definePartsStyle:definePartsStyle$4,defineMultiStyleConfig:defineMultiStyleConfig$4}=createMultiStyleConfigHelpers(listAnatomy.keys),onboardingNoticeStyle=definePartsStyle$4({item:{"&::marker":{color:colors.gray[400]}}}),suggestionsStyle=definePartsStyle$4({item:{_hover:{background:colors.gray[500]},background:colors.gray[700],borderRadius:"4px",cursor:"pointer",height:"28px",listStyleType:"none"},container:{background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px",listStyleType:"none",marginLeft:"0 !important",overflowX:"hidden",padding:"10px",position:"absolute",width:"100%",zIndex:2,maxHeight:"130px"}}),listTheme=defineMultiStyleConfig$4({variants:{onboardingNotice:onboardingNoticeStyle,suggestions:suggestionsStyle}}),{definePartsStyle:definePartsStyle$3,defineMultiStyleConfig:defineMultiStyleConfig$3}=createMultiStyleConfigHelpers(modalAnatomy.keys),modalButtonBaseStyle={top:"10px",position:"absolute",color:colors.gray[400],borderRadius:"18px"},closeButtonStyle={...modalButtonBaseStyle,insetEnd:"10px"},backButtonStyle={...modalButtonBaseStyle,insetStart:"10px"},baseStyle$1=definePartsStyle$3({dialog:{padding:"40px",_dark:{bg:colors.gray[900],border:"1px solid",borderColor:colors.gray[700],borderRadius:"8px"}},overlay:{_dark:{bg:"rgba(0, 0, 0, 0.85)"}},closeButton:closeButtonStyle,body:{padding:0},footer:{padding:"32px 0 0 0"},header:{padding:0}}),modalTheme=defineMultiStyleConfig$3({baseStyle:baseStyle$1,sizes:{md:{dialog:{maxW:"482px"}}}}),{definePartsStyle:definePartsStyle$2,defineMultiStyleConfig:defineMultiStyleConfig$2}=createMultiStyleConfigHelpers(radioAnatomy.keys),primary=definePartsStyle$2({control:{height:"16px",width:"16px",_dark:{borderColor:colors.gray[400]},_checked:{backgroundColor:colors.green,borderColor:colors.green,border:"none",color:"white"}}}),radioTheme=defineMultiStyleConfig$2({variants:{primary}}),{definePartsStyle:definePartsStyle$1,defineMultiStyleConfig:defineMultiStyleConfig$1}=createMultiStyleConfigHelpers(switchAnatomy.keys),danger=definePartsStyle$1({track:{backgroundColor:colors.gray[450],_checked:{backgroundColor:colors.orange}},thumb:{backgroundColor:"black"}}),switchTheme=defineMultiStyleConfig$1({variants:{danger}}),{definePartsStyle,defineMultiStyleConfig}=createMultiStyleConfigHelpers(tabsAnatomy.keys),baseStyle=definePartsStyle({tab:{_selected:{fontWeight:600,color:colors.white,borderColor:colors.orange,borderBottom:`2px solid ${colors.orange}`}}}),tabsTheme=defineMultiStyleConfig({baseStyle}),config$1={initialColorMode:"dark",useSystemColorMode:!1},sizes={xs:{fontSize:"12px"},sm:{fontSize:"14px"},md:{fontSize:"16px"},lg:{fontSize:"18px"},xl:{fontSize:"20px"},"2xl":{fontSize:"24px"},"3xl":{fontSize:"30px"},"4xl":{fontSize:"36px"},"5xl":{fontSize:"48px"},"6xl":{fontSize:"69px"}},theme=extendTheme({components:{Tabs:tabsTheme,Text:{baseStyle:{fontWeight:"400",fontFamily:"Inter"},sizes},Heading:{baseStyle:{fontWeight:"600",fontFamily:"Inter"},sizes},Checkbox:checkboxTheme,Input:{sizes:{md:{field:{height:"48px"}}},defaultProps:{variant:"filled"},variants:{filled:{field:{bg:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],_invalid:{borderColor:colors.orange},_hover:{bg:colors.gray[800]},_focusVisible:{bg:colors.gray[800],borderColor:colors.gray[450]}}}}},Button:buttonTheme,FormLabel:{baseStyle:{fontWeight:"600",marginBottom:"12px",size:"md"},sizes},Modal:modalTheme,Drawer:drawerTheme,Radio:radioTheme,List:listTheme,Switch:switchTheme},config:config$1,colors:{umami:colors,text:{dark:colors.gray[400]}},styles:{global:{body:{bg:colors.black,color:colors.white,fontFamily:"Inter"}}}}),UmamiTheme=_=>jsxRuntimeExports.jsxs(ChakraProvider,{theme,children:[jsxRuntimeExports.jsx(ColorModeScript,{initialColorMode:theme.config.initialColorMode}),_.children]});/** * @remix-run/router v1.16.1 * * Copyright (c) Remix Software Inc. @@ -475,7 +475,7 @@ Please pass a 2048 word array explicitly.`;function normalize(_){return(_||"").n * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(_){for(var a=1;a"u")throw new Error(a)}function warning(_,a){if(!_){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(_,a){return{usr:_.state,key:_.key,idx:a}}function createLocation(_,a,$,j){return $===void 0&&($=null),_extends$4({pathname:typeof _=="string"?_:_.pathname,search:"",hash:""},typeof a=="string"?parsePath(a):a,{state:$,key:a&&a.key||j||createKey()})}function createPath(_){let{pathname:a="/",search:$="",hash:j=""}=_;return $&&$!=="?"&&(a+=$.charAt(0)==="?"?$:"?"+$),j&&j!=="#"&&(a+=j.charAt(0)==="#"?j:"#"+j),a}function parsePath(_){let a={};if(_){let $=_.indexOf("#");$>=0&&(a.hash=_.substr($),_=_.substr(0,$));let j=_.indexOf("?");j>=0&&(a.search=_.substr(j),_=_.substr(0,j)),_&&(a.pathname=_)}return a}function getUrlBasedHistory(_,a,$,j){j===void 0&&(j={});let{window:et=document.defaultView,v5Compat:tt=!1}=j,rt=et.history,nt=Action.Pop,it=null,ot=st();ot==null&&(ot=0,rt.replaceState(_extends$4({},rt.state,{idx:ot}),""));function st(){return(rt.state||{idx:null}).idx}function at(){nt=Action.Pop;let Ct=st(),Pt=Ct==null?null:Ct-ot;ot=Ct,it&&it({action:nt,location:Et.location,delta:Pt})}function ut(Ct,Pt){nt=Action.Push;let Tt=createLocation(Et.location,Ct,Pt);$&&$(Tt,Ct),ot=st()+1;let It=getHistoryState(Tt,ot),Lt=Et.createHref(Tt);try{rt.pushState(It,"",Lt)}catch(Nt){if(Nt instanceof DOMException&&Nt.name==="DataCloneError")throw Nt;et.location.assign(Lt)}tt&&it&&it({action:nt,location:Et.location,delta:1})}function ht(Ct,Pt){nt=Action.Replace;let Tt=createLocation(Et.location,Ct,Pt);$&&$(Tt,Ct),ot=st();let It=getHistoryState(Tt,ot),Lt=Et.createHref(Tt);rt.replaceState(It,"",Lt),tt&&it&&it({action:nt,location:Et.location,delta:0})}function bt(Ct){let Pt=et.location.origin!=="null"?et.location.origin:et.location.href,Tt=typeof Ct=="string"?Ct:createPath(Ct);return Tt=Tt.replace(/ $/,"%20"),invariant(Pt,"No window.location.(origin|href) available to create URL for href: "+Tt),new URL(Tt,Pt)}let Et={get action(){return nt},get location(){return _(et,rt)},listen(Ct){if(it)throw new Error("A history only accepts one active listener");return et.addEventListener(PopStateEventType,at),it=Ct,()=>{et.removeEventListener(PopStateEventType,at),it=null}},createHref(Ct){return a(et,Ct)},createURL:bt,encodeLocation(Ct){let Pt=bt(Ct);return{pathname:Pt.pathname,search:Pt.search,hash:Pt.hash}},push:ut,replace:ht,go(Ct){return rt.go(Ct)}};return Et}var ResultType;(function(_){_.data="data",_.deferred="deferred",_.redirect="redirect",_.error="error"})(ResultType||(ResultType={}));function matchRoutes(_,a,$){$===void 0&&($="/");let j=typeof a=="string"?parsePath(a):a,et=stripBasename(j.pathname||"/",$);if(et==null)return null;let tt=flattenRoutes(_);rankRouteBranches(tt);let rt=null;for(let nt=0;rt==null&&nt{let it={relativePath:nt===void 0?tt.path||"":nt,caseSensitive:tt.caseSensitive===!0,childrenIndex:rt,route:tt};it.relativePath.startsWith("/")&&(invariant(it.relativePath.startsWith(j),'Absolute route path "'+it.relativePath+'" nested under path '+('"'+j+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),it.relativePath=it.relativePath.slice(j.length));let ot=joinPaths([j,it.relativePath]),st=$.concat(it);tt.children&&tt.children.length>0&&(invariant(tt.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+ot+'".')),flattenRoutes(tt.children,a,st,ot)),!(tt.path==null&&!tt.index)&&a.push({path:ot,score:computeScore(ot,tt.index),routesMeta:st})};return _.forEach((tt,rt)=>{var nt;if(tt.path===""||!((nt=tt.path)!=null&&nt.includes("?")))et(tt,rt);else for(let it of explodeOptionalSegments(tt.path))et(tt,rt,it)}),a}function explodeOptionalSegments(_){let a=_.split("/");if(a.length===0)return[];let[$,...j]=a,et=$.endsWith("?"),tt=$.replace(/\?$/,"");if(j.length===0)return et?[tt,""]:[tt];let rt=explodeOptionalSegments(j.join("/")),nt=[];return nt.push(...rt.map(it=>it===""?tt:[tt,it].join("/"))),et&&nt.push(...rt),nt.map(it=>_.startsWith("/")&&it===""?"/":it)}function rankRouteBranches(_){_.sort((a,$)=>a.score!==$.score?$.score-a.score:compareIndexes(a.routesMeta.map(j=>j.childrenIndex),$.routesMeta.map(j=>j.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=_=>_==="*";function computeScore(_,a){let $=_.split("/"),j=$.length;return $.some(isSplat)&&(j+=splatPenalty),a&&(j+=indexRouteValue),$.filter(et=>!isSplat(et)).reduce((et,tt)=>et+(paramRe.test(tt)?dynamicSegmentValue:tt===""?emptySegmentValue:staticSegmentValue),j)}function compareIndexes(_,a){return _.length===a.length&&_.slice(0,-1).every((j,et)=>j===a[et])?_[_.length-1]-a[a.length-1]:0}function matchRouteBranch(_,a){let{routesMeta:$}=_,j={},et="/",tt=[];for(let rt=0;rt<$.length;++rt){let nt=$[rt],it=rt===$.length-1,ot=et==="/"?a:a.slice(et.length)||"/",st=matchPath({path:nt.relativePath,caseSensitive:nt.caseSensitive,end:it},ot);if(!st)return null;Object.assign(j,st.params);let at=nt.route;tt.push({params:j,pathname:joinPaths([et,st.pathname]),pathnameBase:normalizePathname(joinPaths([et,st.pathnameBase])),route:at}),st.pathnameBase!=="/"&&(et=joinPaths([et,st.pathnameBase]))}return tt}function matchPath(_,a){typeof _=="string"&&(_={path:_,caseSensitive:!1,end:!0});let[$,j]=compilePath(_.path,_.caseSensitive,_.end),et=a.match($);if(!et)return null;let tt=et[0],rt=tt.replace(/(.)\/+$/,"$1"),nt=et.slice(1);return{params:j.reduce((ot,st,at)=>{let{paramName:ut,isOptional:ht}=st;if(ut==="*"){let Et=nt[at]||"";rt=tt.slice(0,tt.length-Et.length).replace(/(.)\/+$/,"$1")}const bt=nt[at];return ht&&!bt?ot[ut]=void 0:ot[ut]=(bt||"").replace(/%2F/g,"/"),ot},{}),pathname:tt,pathnameBase:rt,pattern:_}}function compilePath(_,a,$){a===void 0&&(a=!1),$===void 0&&($=!0),warning(_==="*"||!_.endsWith("*")||_.endsWith("/*"),'Route path "'+_+'" will be treated as if it were '+('"'+_.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+_.replace(/\*$/,"/*")+'".'));let j=[],et="^"+_.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(rt,nt,it)=>(j.push({paramName:nt,isOptional:it!=null}),it?"/?([^\\/]+)?":"/([^\\/]+)"));return _.endsWith("*")?(j.push({paramName:"*"}),et+=_==="*"||_==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):$?et+="\\/*$":_!==""&&_!=="/"&&(et+="(?:(?=\\/|$))"),[new RegExp(et,a?void 0:"i"),j]}function decodePath(_){try{return _.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return warning(!1,'The URL path "'+_+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),_}}function stripBasename(_,a){if(a==="/")return _;if(!_.toLowerCase().startsWith(a.toLowerCase()))return null;let $=a.endsWith("/")?a.length-1:a.length,j=_.charAt($);return j&&j!=="/"?null:_.slice($)||"/"}function resolvePath(_,a){a===void 0&&(a="/");let{pathname:$,search:j="",hash:et=""}=typeof _=="string"?parsePath(_):_;return{pathname:$?$.startsWith("/")?$:resolvePathname($,a):a,search:normalizeSearch(j),hash:normalizeHash(et)}}function resolvePathname(_,a){let $=a.replace(/\/+$/,"").split("/");return _.split("/").forEach(et=>{et===".."?$.length>1&&$.pop():et!=="."&&$.push(et)}),$.length>1?$.join("/"):"/"}function getInvalidPathError(_,a,$,j){return"Cannot include a '"+_+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(j)+"]. Please separate it out to the ")+("`to."+$+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(_){return _.filter((a,$)=>$===0||a.route.path&&a.route.path.length>0)}function getResolveToMatches(_,a){let $=getPathContributingMatches(_);return a?$.map((j,et)=>et===_.length-1?j.pathname:j.pathnameBase):$.map(j=>j.pathnameBase)}function resolveTo(_,a,$,j){j===void 0&&(j=!1);let et;typeof _=="string"?et=parsePath(_):(et=_extends$4({},_),invariant(!et.pathname||!et.pathname.includes("?"),getInvalidPathError("?","pathname","search",et)),invariant(!et.pathname||!et.pathname.includes("#"),getInvalidPathError("#","pathname","hash",et)),invariant(!et.search||!et.search.includes("#"),getInvalidPathError("#","search","hash",et)));let tt=_===""||et.pathname==="",rt=tt?"/":et.pathname,nt;if(rt==null)nt=$;else{let at=a.length-1;if(!j&&rt.startsWith("..")){let ut=rt.split("/");for(;ut[0]==="..";)ut.shift(),at-=1;et.pathname=ut.join("/")}nt=at>=0?a[at]:"/"}let it=resolvePath(et,nt),ot=rt&&rt!=="/"&&rt.endsWith("/"),st=(tt||rt===".")&&$.endsWith("/");return!it.pathname.endsWith("/")&&(ot||st)&&(it.pathname+="/"),it}const joinPaths=_=>_.join("/").replace(/\/\/+/g,"/"),normalizePathname=_=>_.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=_=>!_||_==="?"?"":_.startsWith("?")?_:"?"+_,normalizeHash=_=>!_||_==="#"?"":_.startsWith("#")?_:"#"+_;function isRouteErrorResponse(_){return _!=null&&typeof _.status=="number"&&typeof _.statusText=="string"&&typeof _.internal=="boolean"&&"data"in _}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** + */function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(_){for(var a=1;a"u")throw new Error(a)}function warning(_,a){if(!_){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(_,a){return{usr:_.state,key:_.key,idx:a}}function createLocation(_,a,$,j){return $===void 0&&($=null),_extends$4({pathname:typeof _=="string"?_:_.pathname,search:"",hash:""},typeof a=="string"?parsePath(a):a,{state:$,key:a&&a.key||j||createKey()})}function createPath(_){let{pathname:a="/",search:$="",hash:j=""}=_;return $&&$!=="?"&&(a+=$.charAt(0)==="?"?$:"?"+$),j&&j!=="#"&&(a+=j.charAt(0)==="#"?j:"#"+j),a}function parsePath(_){let a={};if(_){let $=_.indexOf("#");$>=0&&(a.hash=_.substr($),_=_.substr(0,$));let j=_.indexOf("?");j>=0&&(a.search=_.substr(j),_=_.substr(0,j)),_&&(a.pathname=_)}return a}function getUrlBasedHistory(_,a,$,j){j===void 0&&(j={});let{window:et=document.defaultView,v5Compat:tt=!1}=j,rt=et.history,nt=Action.Pop,it=null,at=st();at==null&&(at=0,rt.replaceState(_extends$4({},rt.state,{idx:at}),""));function st(){return(rt.state||{idx:null}).idx}function ot(){nt=Action.Pop;let Ct=st(),Pt=Ct==null?null:Ct-at;at=Ct,it&&it({action:nt,location:xt.location,delta:Pt})}function ut(Ct,Pt){nt=Action.Push;let Tt=createLocation(xt.location,Ct,Pt);$&&$(Tt,Ct),at=st()+1;let kt=getHistoryState(Tt,at),Lt=xt.createHref(Tt);try{rt.pushState(kt,"",Lt)}catch(Nt){if(Nt instanceof DOMException&&Nt.name==="DataCloneError")throw Nt;et.location.assign(Lt)}tt&&it&&it({action:nt,location:xt.location,delta:1})}function dt(Ct,Pt){nt=Action.Replace;let Tt=createLocation(xt.location,Ct,Pt);$&&$(Tt,Ct),at=st();let kt=getHistoryState(Tt,at),Lt=xt.createHref(Tt);rt.replaceState(kt,"",Lt),tt&&it&&it({action:nt,location:xt.location,delta:0})}function mt(Ct){let Pt=et.location.origin!=="null"?et.location.origin:et.location.href,Tt=typeof Ct=="string"?Ct:createPath(Ct);return Tt=Tt.replace(/ $/,"%20"),invariant(Pt,"No window.location.(origin|href) available to create URL for href: "+Tt),new URL(Tt,Pt)}let xt={get action(){return nt},get location(){return _(et,rt)},listen(Ct){if(it)throw new Error("A history only accepts one active listener");return et.addEventListener(PopStateEventType,ot),it=Ct,()=>{et.removeEventListener(PopStateEventType,ot),it=null}},createHref(Ct){return a(et,Ct)},createURL:mt,encodeLocation(Ct){let Pt=mt(Ct);return{pathname:Pt.pathname,search:Pt.search,hash:Pt.hash}},push:ut,replace:dt,go(Ct){return rt.go(Ct)}};return xt}var ResultType;(function(_){_.data="data",_.deferred="deferred",_.redirect="redirect",_.error="error"})(ResultType||(ResultType={}));function matchRoutes(_,a,$){$===void 0&&($="/");let j=typeof a=="string"?parsePath(a):a,et=stripBasename(j.pathname||"/",$);if(et==null)return null;let tt=flattenRoutes(_);rankRouteBranches(tt);let rt=null;for(let nt=0;rt==null&&nt{let it={relativePath:nt===void 0?tt.path||"":nt,caseSensitive:tt.caseSensitive===!0,childrenIndex:rt,route:tt};it.relativePath.startsWith("/")&&(invariant(it.relativePath.startsWith(j),'Absolute route path "'+it.relativePath+'" nested under path '+('"'+j+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),it.relativePath=it.relativePath.slice(j.length));let at=joinPaths([j,it.relativePath]),st=$.concat(it);tt.children&&tt.children.length>0&&(invariant(tt.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+at+'".')),flattenRoutes(tt.children,a,st,at)),!(tt.path==null&&!tt.index)&&a.push({path:at,score:computeScore(at,tt.index),routesMeta:st})};return _.forEach((tt,rt)=>{var nt;if(tt.path===""||!((nt=tt.path)!=null&&nt.includes("?")))et(tt,rt);else for(let it of explodeOptionalSegments(tt.path))et(tt,rt,it)}),a}function explodeOptionalSegments(_){let a=_.split("/");if(a.length===0)return[];let[$,...j]=a,et=$.endsWith("?"),tt=$.replace(/\?$/,"");if(j.length===0)return et?[tt,""]:[tt];let rt=explodeOptionalSegments(j.join("/")),nt=[];return nt.push(...rt.map(it=>it===""?tt:[tt,it].join("/"))),et&&nt.push(...rt),nt.map(it=>_.startsWith("/")&&it===""?"/":it)}function rankRouteBranches(_){_.sort((a,$)=>a.score!==$.score?$.score-a.score:compareIndexes(a.routesMeta.map(j=>j.childrenIndex),$.routesMeta.map(j=>j.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=_=>_==="*";function computeScore(_,a){let $=_.split("/"),j=$.length;return $.some(isSplat)&&(j+=splatPenalty),a&&(j+=indexRouteValue),$.filter(et=>!isSplat(et)).reduce((et,tt)=>et+(paramRe.test(tt)?dynamicSegmentValue:tt===""?emptySegmentValue:staticSegmentValue),j)}function compareIndexes(_,a){return _.length===a.length&&_.slice(0,-1).every((j,et)=>j===a[et])?_[_.length-1]-a[a.length-1]:0}function matchRouteBranch(_,a){let{routesMeta:$}=_,j={},et="/",tt=[];for(let rt=0;rt<$.length;++rt){let nt=$[rt],it=rt===$.length-1,at=et==="/"?a:a.slice(et.length)||"/",st=matchPath({path:nt.relativePath,caseSensitive:nt.caseSensitive,end:it},at);if(!st)return null;Object.assign(j,st.params);let ot=nt.route;tt.push({params:j,pathname:joinPaths([et,st.pathname]),pathnameBase:normalizePathname(joinPaths([et,st.pathnameBase])),route:ot}),st.pathnameBase!=="/"&&(et=joinPaths([et,st.pathnameBase]))}return tt}function matchPath(_,a){typeof _=="string"&&(_={path:_,caseSensitive:!1,end:!0});let[$,j]=compilePath(_.path,_.caseSensitive,_.end),et=a.match($);if(!et)return null;let tt=et[0],rt=tt.replace(/(.)\/+$/,"$1"),nt=et.slice(1);return{params:j.reduce((at,st,ot)=>{let{paramName:ut,isOptional:dt}=st;if(ut==="*"){let xt=nt[ot]||"";rt=tt.slice(0,tt.length-xt.length).replace(/(.)\/+$/,"$1")}const mt=nt[ot];return dt&&!mt?at[ut]=void 0:at[ut]=(mt||"").replace(/%2F/g,"/"),at},{}),pathname:tt,pathnameBase:rt,pattern:_}}function compilePath(_,a,$){a===void 0&&(a=!1),$===void 0&&($=!0),warning(_==="*"||!_.endsWith("*")||_.endsWith("/*"),'Route path "'+_+'" will be treated as if it were '+('"'+_.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+_.replace(/\*$/,"/*")+'".'));let j=[],et="^"+_.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(rt,nt,it)=>(j.push({paramName:nt,isOptional:it!=null}),it?"/?([^\\/]+)?":"/([^\\/]+)"));return _.endsWith("*")?(j.push({paramName:"*"}),et+=_==="*"||_==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):$?et+="\\/*$":_!==""&&_!=="/"&&(et+="(?:(?=\\/|$))"),[new RegExp(et,a?void 0:"i"),j]}function decodePath(_){try{return _.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return warning(!1,'The URL path "'+_+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),_}}function stripBasename(_,a){if(a==="/")return _;if(!_.toLowerCase().startsWith(a.toLowerCase()))return null;let $=a.endsWith("/")?a.length-1:a.length,j=_.charAt($);return j&&j!=="/"?null:_.slice($)||"/"}function resolvePath(_,a){a===void 0&&(a="/");let{pathname:$,search:j="",hash:et=""}=typeof _=="string"?parsePath(_):_;return{pathname:$?$.startsWith("/")?$:resolvePathname($,a):a,search:normalizeSearch(j),hash:normalizeHash(et)}}function resolvePathname(_,a){let $=a.replace(/\/+$/,"").split("/");return _.split("/").forEach(et=>{et===".."?$.length>1&&$.pop():et!=="."&&$.push(et)}),$.length>1?$.join("/"):"/"}function getInvalidPathError(_,a,$,j){return"Cannot include a '"+_+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(j)+"]. Please separate it out to the ")+("`to."+$+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(_){return _.filter((a,$)=>$===0||a.route.path&&a.route.path.length>0)}function getResolveToMatches(_,a){let $=getPathContributingMatches(_);return a?$.map((j,et)=>et===_.length-1?j.pathname:j.pathnameBase):$.map(j=>j.pathnameBase)}function resolveTo(_,a,$,j){j===void 0&&(j=!1);let et;typeof _=="string"?et=parsePath(_):(et=_extends$4({},_),invariant(!et.pathname||!et.pathname.includes("?"),getInvalidPathError("?","pathname","search",et)),invariant(!et.pathname||!et.pathname.includes("#"),getInvalidPathError("#","pathname","hash",et)),invariant(!et.search||!et.search.includes("#"),getInvalidPathError("#","search","hash",et)));let tt=_===""||et.pathname==="",rt=tt?"/":et.pathname,nt;if(rt==null)nt=$;else{let ot=a.length-1;if(!j&&rt.startsWith("..")){let ut=rt.split("/");for(;ut[0]==="..";)ut.shift(),ot-=1;et.pathname=ut.join("/")}nt=ot>=0?a[ot]:"/"}let it=resolvePath(et,nt),at=rt&&rt!=="/"&&rt.endsWith("/"),st=(tt||rt===".")&&$.endsWith("/");return!it.pathname.endsWith("/")&&(at||st)&&(it.pathname+="/"),it}const joinPaths=_=>_.join("/").replace(/\/\/+/g,"/"),normalizePathname=_=>_.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=_=>!_||_==="?"?"":_.startsWith("?")?_:"?"+_,normalizeHash=_=>!_||_==="#"?"":_.startsWith("#")?_:"#"+_;function isRouteErrorResponse(_){return _!=null&&typeof _.status=="number"&&typeof _.statusText=="string"&&typeof _.internal=="boolean"&&"data"in _}const validMutationMethodsArr=["post","put","patch","delete"];new Set(validMutationMethodsArr);const validRequestMethodsArr=["get",...validMutationMethodsArr];new Set(validRequestMethodsArr);/** * React Router v6.23.1 * * Copyright (c) Remix Software Inc. @@ -484,7 +484,7 @@ Please pass a 2048 word array explicitly.`;function normalize(_){return(_||"").n * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(_){for(var a=1;a{nt.current=!0}),reactExports.useCallback(function(ot,st){if(st===void 0&&(st={}),!nt.current)return;if(typeof ot=="number"){j.go(ot);return}let at=resolveTo(ot,JSON.parse(rt),tt,st.relative==="path");_==null&&a!=="/"&&(at.pathname=at.pathname==="/"?a:joinPaths([a,at.pathname])),(st.replace?j.replace:j.push)(at,st.state,st)},[a,j,rt,tt,_])}function useParams(){let{matches:_}=reactExports.useContext(RouteContext),a=_[_.length-1];return a?a.params:{}}function useResolvedPath(_,a){let{relative:$}=a===void 0?{}:a,{future:j}=reactExports.useContext(NavigationContext),{matches:et}=reactExports.useContext(RouteContext),{pathname:tt}=useLocation(),rt=JSON.stringify(getResolveToMatches(et,j.v7_relativeSplatPath));return reactExports.useMemo(()=>resolveTo(_,JSON.parse(rt),tt,$==="path"),[_,rt,tt,$])}function useRoutes(_,a){return useRoutesImpl(_,a)}function useRoutesImpl(_,a,$,j){useInRouterContext()||invariant(!1);let{navigator:et}=reactExports.useContext(NavigationContext),{matches:tt}=reactExports.useContext(RouteContext),rt=tt[tt.length-1],nt=rt?rt.params:{};rt&&rt.pathname;let it=rt?rt.pathnameBase:"/";rt&&rt.route;let ot=useLocation(),st;if(a){var at;let Ct=typeof a=="string"?parsePath(a):a;it==="/"||(at=Ct.pathname)!=null&&at.startsWith(it)||invariant(!1),st=Ct}else st=ot;let ut=st.pathname||"/",ht=ut;if(it!=="/"){let Ct=it.replace(/^\//,"").split("/");ht="/"+ut.replace(/^\//,"").split("/").slice(Ct.length).join("/")}let bt=matchRoutes(_,{pathname:ht}),Et=_renderMatches(bt&&bt.map(Ct=>Object.assign({},Ct,{params:Object.assign({},nt,Ct.params),pathname:joinPaths([it,et.encodeLocation?et.encodeLocation(Ct.pathname).pathname:Ct.pathname]),pathnameBase:Ct.pathnameBase==="/"?it:joinPaths([it,et.encodeLocation?et.encodeLocation(Ct.pathnameBase).pathname:Ct.pathnameBase])})),tt,$,j);return a&&Et?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$3({pathname:"/",search:"",hash:"",state:null,key:"default"},st),navigationType:Action.Pop}},Et):Et}function DefaultErrorComponent(){let _=useRouteError(),a=isRouteErrorResponse(_)?_.status+" "+_.statusText:_ instanceof Error?_.message:JSON.stringify(_),$=_ instanceof Error?_.stack:null,et={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},a),$?reactExports.createElement("pre",{style:et},$):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,$){return $.location!==a.location||$.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:$.error,location:$.location,revalidation:a.revalidation||$.revalidation}}componentDidCatch(a,$){console.error("React Router caught the following error during render",a,$)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(_){let{routeContext:a,match:$,children:j}=_,et=reactExports.useContext(DataRouterContext);return et&&et.static&&et.staticContext&&($.route.errorElement||$.route.ErrorBoundary)&&(et.staticContext._deepestRenderedBoundaryId=$.route.id),reactExports.createElement(RouteContext.Provider,{value:a},j)}function _renderMatches(_,a,$,j){var et;if(a===void 0&&(a=[]),$===void 0&&($=null),j===void 0&&(j=null),_==null){var tt;if((tt=$)!=null&&tt.errors)_=$.matches;else return null}let rt=_,nt=(et=$)==null?void 0:et.errors;if(nt!=null){let st=rt.findIndex(at=>at.route.id&&(nt==null?void 0:nt[at.route.id])!==void 0);st>=0||invariant(!1),rt=rt.slice(0,Math.min(rt.length,st+1))}let it=!1,ot=-1;if($&&j&&j.v7_partialHydration)for(let st=0;st=0?rt=rt.slice(0,ot+1):rt=[rt[0]];break}}}return rt.reduceRight((st,at,ut)=>{let ht,bt=!1,Et=null,Ct=null;$&&(ht=nt&&at.route.id?nt[at.route.id]:void 0,Et=at.route.errorElement||defaultErrorElement,it&&(ot<0&&ut===0?(bt=!0,Ct=null):ot===ut&&(bt=!0,Ct=at.route.hydrateFallbackElement||null)));let Pt=a.concat(rt.slice(0,ut+1)),Tt=()=>{let It;return ht?It=Et:bt?It=Ct:at.route.Component?It=reactExports.createElement(at.route.Component,null):at.route.element?It=at.route.element:It=st,reactExports.createElement(RenderedRoute,{match:at,routeContext:{outlet:st,matches:Pt,isDataRoute:$!=null},children:It})};return $&&(at.route.ErrorBoundary||at.route.errorElement||ut===0)?reactExports.createElement(RenderErrorBoundary,{location:$.location,revalidation:$.revalidation,component:Et,error:ht,children:Tt(),routeContext:{outlet:null,matches:Pt,isDataRoute:!0}}):Tt()},null)}var DataRouterHook$1=function(_){return _.UseBlocker="useBlocker",_.UseRevalidator="useRevalidator",_.UseNavigateStable="useNavigate",_}(DataRouterHook$1||{}),DataRouterStateHook$1=function(_){return _.UseBlocker="useBlocker",_.UseLoaderData="useLoaderData",_.UseActionData="useActionData",_.UseRouteError="useRouteError",_.UseNavigation="useNavigation",_.UseRouteLoaderData="useRouteLoaderData",_.UseMatches="useMatches",_.UseRevalidator="useRevalidator",_.UseNavigateStable="useNavigate",_.UseRouteId="useRouteId",_}(DataRouterStateHook$1||{});function useDataRouterContext(_){let a=reactExports.useContext(DataRouterContext);return a||invariant(!1),a}function useDataRouterState(_){let a=reactExports.useContext(DataRouterStateContext);return a||invariant(!1),a}function useRouteContext(_){let a=reactExports.useContext(RouteContext);return a||invariant(!1),a}function useCurrentRouteId(_){let a=useRouteContext(),$=a.matches[a.matches.length-1];return $.route.id||invariant(!1),$.route.id}function useRouteError(){var _;let a=reactExports.useContext(RouteErrorContext),$=useDataRouterState(DataRouterStateHook$1.UseRouteError),j=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return a!==void 0?a:(_=$.errors)==null?void 0:_[j]}function useNavigateStable(){let{router:_}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),a=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),$=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{$.current=!0}),reactExports.useCallback(function(et,tt){tt===void 0&&(tt={}),$.current&&(typeof et=="number"?_.navigate(et):_.navigate(et,_extends$3({fromRouteId:a},tt)))},[_,a])}function Navigate(_){let{to:a,replace:$,state:j,relative:et}=_;useInRouterContext()||invariant(!1);let{future:tt,static:rt}=reactExports.useContext(NavigationContext),{matches:nt}=reactExports.useContext(RouteContext),{pathname:it}=useLocation(),ot=useNavigate(),st=resolveTo(a,getResolveToMatches(nt,tt.v7_relativeSplatPath),it,et==="path"),at=JSON.stringify(st);return reactExports.useEffect(()=>ot(JSON.parse(at),{replace:$,state:j,relative:et}),[ot,at,et,$,j]),null}function Route(_){invariant(!1)}function Router$1(_){let{basename:a="/",children:$=null,location:j,navigationType:et=Action.Pop,navigator:tt,static:rt=!1,future:nt}=_;useInRouterContext()&&invariant(!1);let it=a.replace(/^\/*/,"/"),ot=reactExports.useMemo(()=>({basename:it,navigator:tt,static:rt,future:_extends$3({v7_relativeSplatPath:!1},nt)}),[it,nt,tt,rt]);typeof j=="string"&&(j=parsePath(j));let{pathname:st="/",search:at="",hash:ut="",state:ht=null,key:bt="default"}=j,Et=reactExports.useMemo(()=>{let Ct=stripBasename(st,it);return Ct==null?null:{location:{pathname:Ct,search:at,hash:ut,state:ht,key:bt},navigationType:et}},[it,st,at,ut,ht,bt,et]);return Et==null?null:reactExports.createElement(NavigationContext.Provider,{value:ot},reactExports.createElement(LocationContext.Provider,{children:$,value:Et}))}function Routes(_){let{children:a,location:$}=_;return useRoutes(createRoutesFromChildren(a),$)}new Promise(()=>{});function createRoutesFromChildren(_,a){a===void 0&&(a=[]);let $=[];return reactExports.Children.forEach(_,(j,et)=>{if(!reactExports.isValidElement(j))return;let tt=[...a,et];if(j.type===reactExports.Fragment){$.push.apply($,createRoutesFromChildren(j.props.children,tt));return}j.type!==Route&&invariant(!1),!j.props.index||!j.props.children||invariant(!1);let rt={id:j.props.id||tt.join("-"),caseSensitive:j.props.caseSensitive,element:j.props.element,Component:j.props.Component,index:j.props.index,path:j.props.path,loader:j.props.loader,action:j.props.action,errorElement:j.props.errorElement,ErrorBoundary:j.props.ErrorBoundary,hasErrorBoundary:j.props.ErrorBoundary!=null||j.props.errorElement!=null,shouldRevalidate:j.props.shouldRevalidate,handle:j.props.handle,lazy:j.props.lazy};j.props.children&&(rt.children=createRoutesFromChildren(j.props.children,tt)),$.push(rt)}),$}/** + */function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(_){for(var a=1;a{nt.current=!0}),reactExports.useCallback(function(at,st){if(st===void 0&&(st={}),!nt.current)return;if(typeof at=="number"){j.go(at);return}let ot=resolveTo(at,JSON.parse(rt),tt,st.relative==="path");_==null&&a!=="/"&&(ot.pathname=ot.pathname==="/"?a:joinPaths([a,ot.pathname])),(st.replace?j.replace:j.push)(ot,st.state,st)},[a,j,rt,tt,_])}function useParams(){let{matches:_}=reactExports.useContext(RouteContext),a=_[_.length-1];return a?a.params:{}}function useResolvedPath(_,a){let{relative:$}=a===void 0?{}:a,{future:j}=reactExports.useContext(NavigationContext),{matches:et}=reactExports.useContext(RouteContext),{pathname:tt}=useLocation(),rt=JSON.stringify(getResolveToMatches(et,j.v7_relativeSplatPath));return reactExports.useMemo(()=>resolveTo(_,JSON.parse(rt),tt,$==="path"),[_,rt,tt,$])}function useRoutes(_,a){return useRoutesImpl(_,a)}function useRoutesImpl(_,a,$,j){useInRouterContext()||invariant(!1);let{navigator:et}=reactExports.useContext(NavigationContext),{matches:tt}=reactExports.useContext(RouteContext),rt=tt[tt.length-1],nt=rt?rt.params:{};rt&&rt.pathname;let it=rt?rt.pathnameBase:"/";rt&&rt.route;let at=useLocation(),st;if(a){var ot;let Ct=typeof a=="string"?parsePath(a):a;it==="/"||(ot=Ct.pathname)!=null&&ot.startsWith(it)||invariant(!1),st=Ct}else st=at;let ut=st.pathname||"/",dt=ut;if(it!=="/"){let Ct=it.replace(/^\//,"").split("/");dt="/"+ut.replace(/^\//,"").split("/").slice(Ct.length).join("/")}let mt=matchRoutes(_,{pathname:dt}),xt=_renderMatches(mt&&mt.map(Ct=>Object.assign({},Ct,{params:Object.assign({},nt,Ct.params),pathname:joinPaths([it,et.encodeLocation?et.encodeLocation(Ct.pathname).pathname:Ct.pathname]),pathnameBase:Ct.pathnameBase==="/"?it:joinPaths([it,et.encodeLocation?et.encodeLocation(Ct.pathnameBase).pathname:Ct.pathnameBase])})),tt,$,j);return a&&xt?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$3({pathname:"/",search:"",hash:"",state:null,key:"default"},st),navigationType:Action.Pop}},xt):xt}function DefaultErrorComponent(){let _=useRouteError(),a=isRouteErrorResponse(_)?_.status+" "+_.statusText:_ instanceof Error?_.message:JSON.stringify(_),$=_ instanceof Error?_.stack:null,et={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},a),$?reactExports.createElement("pre",{style:et},$):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,$){return $.location!==a.location||$.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:$.error,location:$.location,revalidation:a.revalidation||$.revalidation}}componentDidCatch(a,$){console.error("React Router caught the following error during render",a,$)}render(){return this.state.error!==void 0?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(_){let{routeContext:a,match:$,children:j}=_,et=reactExports.useContext(DataRouterContext);return et&&et.static&&et.staticContext&&($.route.errorElement||$.route.ErrorBoundary)&&(et.staticContext._deepestRenderedBoundaryId=$.route.id),reactExports.createElement(RouteContext.Provider,{value:a},j)}function _renderMatches(_,a,$,j){var et;if(a===void 0&&(a=[]),$===void 0&&($=null),j===void 0&&(j=null),_==null){var tt;if((tt=$)!=null&&tt.errors)_=$.matches;else return null}let rt=_,nt=(et=$)==null?void 0:et.errors;if(nt!=null){let st=rt.findIndex(ot=>ot.route.id&&(nt==null?void 0:nt[ot.route.id])!==void 0);st>=0||invariant(!1),rt=rt.slice(0,Math.min(rt.length,st+1))}let it=!1,at=-1;if($&&j&&j.v7_partialHydration)for(let st=0;st=0?rt=rt.slice(0,at+1):rt=[rt[0]];break}}}return rt.reduceRight((st,ot,ut)=>{let dt,mt=!1,xt=null,Ct=null;$&&(dt=nt&&ot.route.id?nt[ot.route.id]:void 0,xt=ot.route.errorElement||defaultErrorElement,it&&(at<0&&ut===0?(mt=!0,Ct=null):at===ut&&(mt=!0,Ct=ot.route.hydrateFallbackElement||null)));let Pt=a.concat(rt.slice(0,ut+1)),Tt=()=>{let kt;return dt?kt=xt:mt?kt=Ct:ot.route.Component?kt=reactExports.createElement(ot.route.Component,null):ot.route.element?kt=ot.route.element:kt=st,reactExports.createElement(RenderedRoute,{match:ot,routeContext:{outlet:st,matches:Pt,isDataRoute:$!=null},children:kt})};return $&&(ot.route.ErrorBoundary||ot.route.errorElement||ut===0)?reactExports.createElement(RenderErrorBoundary,{location:$.location,revalidation:$.revalidation,component:xt,error:dt,children:Tt(),routeContext:{outlet:null,matches:Pt,isDataRoute:!0}}):Tt()},null)}var DataRouterHook$1=function(_){return _.UseBlocker="useBlocker",_.UseRevalidator="useRevalidator",_.UseNavigateStable="useNavigate",_}(DataRouterHook$1||{}),DataRouterStateHook$1=function(_){return _.UseBlocker="useBlocker",_.UseLoaderData="useLoaderData",_.UseActionData="useActionData",_.UseRouteError="useRouteError",_.UseNavigation="useNavigation",_.UseRouteLoaderData="useRouteLoaderData",_.UseMatches="useMatches",_.UseRevalidator="useRevalidator",_.UseNavigateStable="useNavigate",_.UseRouteId="useRouteId",_}(DataRouterStateHook$1||{});function useDataRouterContext(_){let a=reactExports.useContext(DataRouterContext);return a||invariant(!1),a}function useDataRouterState(_){let a=reactExports.useContext(DataRouterStateContext);return a||invariant(!1),a}function useRouteContext(_){let a=reactExports.useContext(RouteContext);return a||invariant(!1),a}function useCurrentRouteId(_){let a=useRouteContext(),$=a.matches[a.matches.length-1];return $.route.id||invariant(!1),$.route.id}function useRouteError(){var _;let a=reactExports.useContext(RouteErrorContext),$=useDataRouterState(DataRouterStateHook$1.UseRouteError),j=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return a!==void 0?a:(_=$.errors)==null?void 0:_[j]}function useNavigateStable(){let{router:_}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),a=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),$=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{$.current=!0}),reactExports.useCallback(function(et,tt){tt===void 0&&(tt={}),$.current&&(typeof et=="number"?_.navigate(et):_.navigate(et,_extends$3({fromRouteId:a},tt)))},[_,a])}function Navigate(_){let{to:a,replace:$,state:j,relative:et}=_;useInRouterContext()||invariant(!1);let{future:tt,static:rt}=reactExports.useContext(NavigationContext),{matches:nt}=reactExports.useContext(RouteContext),{pathname:it}=useLocation(),at=useNavigate(),st=resolveTo(a,getResolveToMatches(nt,tt.v7_relativeSplatPath),it,et==="path"),ot=JSON.stringify(st);return reactExports.useEffect(()=>at(JSON.parse(ot),{replace:$,state:j,relative:et}),[at,ot,et,$,j]),null}function Route(_){invariant(!1)}function Router$1(_){let{basename:a="/",children:$=null,location:j,navigationType:et=Action.Pop,navigator:tt,static:rt=!1,future:nt}=_;useInRouterContext()&&invariant(!1);let it=a.replace(/^\/*/,"/"),at=reactExports.useMemo(()=>({basename:it,navigator:tt,static:rt,future:_extends$3({v7_relativeSplatPath:!1},nt)}),[it,nt,tt,rt]);typeof j=="string"&&(j=parsePath(j));let{pathname:st="/",search:ot="",hash:ut="",state:dt=null,key:mt="default"}=j,xt=reactExports.useMemo(()=>{let Ct=stripBasename(st,it);return Ct==null?null:{location:{pathname:Ct,search:ot,hash:ut,state:dt,key:mt},navigationType:et}},[it,st,ot,ut,dt,mt,et]);return xt==null?null:reactExports.createElement(NavigationContext.Provider,{value:at},reactExports.createElement(LocationContext.Provider,{children:$,value:xt}))}function Routes(_){let{children:a,location:$}=_;return useRoutes(createRoutesFromChildren(a),$)}new Promise(()=>{});function createRoutesFromChildren(_,a){a===void 0&&(a=[]);let $=[];return reactExports.Children.forEach(_,(j,et)=>{if(!reactExports.isValidElement(j))return;let tt=[...a,et];if(j.type===reactExports.Fragment){$.push.apply($,createRoutesFromChildren(j.props.children,tt));return}j.type!==Route&&invariant(!1),!j.props.index||!j.props.children||invariant(!1);let rt={id:j.props.id||tt.join("-"),caseSensitive:j.props.caseSensitive,element:j.props.element,Component:j.props.Component,index:j.props.index,path:j.props.path,loader:j.props.loader,action:j.props.action,errorElement:j.props.errorElement,ErrorBoundary:j.props.ErrorBoundary,hasErrorBoundary:j.props.ErrorBoundary!=null||j.props.errorElement!=null,shouldRevalidate:j.props.shouldRevalidate,handle:j.props.handle,lazy:j.props.lazy};j.props.children&&(rt.children=createRoutesFromChildren(j.props.children,tt)),$.push(rt)}),$}/** * React Router DOM v6.23.1 * * Copyright (c) Remix Software Inc. @@ -493,7 +493,7 @@ Please pass a 2048 word array explicitly.`;function normalize(_){return(_||"").n * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(_){for(var a=1;a=0)&&($[et]=_[et]);return $}function isModifiedEvent(_){return!!(_.metaKey||_.altKey||_.ctrlKey||_.shiftKey)}function shouldProcessLinkClick(_,a){return _.button===0&&(!a||a==="_self")&&!isModifiedEvent(_)}function createSearchParams(_){return _===void 0&&(_=""),new URLSearchParams(typeof _=="string"||Array.isArray(_)||_ instanceof URLSearchParams?_:Object.keys(_).reduce((a,$)=>{let j=_[$];return a.concat(Array.isArray(j)?j.map(et=>[$,et]):[[$,j]])},[]))}function getSearchParamsForLocation(_,a){let $=createSearchParams(_);return a&&a.forEach((j,et)=>{$.has(et)||a.getAll(et).forEach(tt=>{$.append(et,tt)})}),$}const _excluded$3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch(_){}const START_TRANSITION="startTransition",startTransitionImpl=React$3[START_TRANSITION];function HashRouter(_){let{basename:a,children:$,future:j,window:et}=_,tt=reactExports.useRef();tt.current==null&&(tt.current=createHashHistory({window:et,v5Compat:!0}));let rt=tt.current,[nt,it]=reactExports.useState({action:rt.action,location:rt.location}),{v7_startTransition:ot}=j||{},st=reactExports.useCallback(at=>{ot&&startTransitionImpl?startTransitionImpl(()=>it(at)):it(at)},[it,ot]);return reactExports.useLayoutEffect(()=>rt.listen(st),[rt,st]),reactExports.createElement(Router$1,{basename:a,children:$,location:nt.location,navigationType:nt.action,navigator:rt,future:j})}const isBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function _(a,$){let{onClick:j,relative:et,reloadDocument:tt,replace:rt,state:nt,target:it,to:ot,preventScrollReset:st,unstable_viewTransition:at}=a,ut=_objectWithoutPropertiesLoose$1(a,_excluded$3),{basename:ht}=reactExports.useContext(NavigationContext),bt,Et=!1;if(typeof ot=="string"&&ABSOLUTE_URL_REGEX.test(ot)&&(bt=ot,isBrowser))try{let It=new URL(window.location.href),Lt=ot.startsWith("//")?new URL(It.protocol+ot):new URL(ot),Nt=stripBasename(Lt.pathname,ht);Lt.origin===It.origin&&Nt!=null?ot=Nt+Lt.search+Lt.hash:Et=!0}catch{}let Ct=useHref(ot,{relative:et}),Pt=useLinkClickHandler(ot,{replace:rt,state:nt,target:it,preventScrollReset:st,relative:et,unstable_viewTransition:at});function Tt(It){j&&j(It),It.defaultPrevented||Pt(It)}return reactExports.createElement("a",_extends$2({},ut,{href:bt||Ct,onClick:Et||tt?j:Tt,ref:$,target:it}))});var DataRouterHook;(function(_){_.UseScrollRestoration="useScrollRestoration",_.UseSubmit="useSubmit",_.UseSubmitFetcher="useSubmitFetcher",_.UseFetcher="useFetcher",_.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(_){_.UseFetcher="useFetcher",_.UseFetchers="useFetchers",_.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(_,a){let{target:$,replace:j,state:et,preventScrollReset:tt,relative:rt,unstable_viewTransition:nt}=a===void 0?{}:a,it=useNavigate(),ot=useLocation(),st=useResolvedPath(_,{relative:rt});return reactExports.useCallback(at=>{if(shouldProcessLinkClick(at,$)){at.preventDefault();let ut=j!==void 0?j:createPath(ot)===createPath(st);it(_,{replace:ut,state:et,preventScrollReset:tt,relative:rt,unstable_viewTransition:nt})}},[ot,it,st,j,et,$,_,tt,rt,nt])}function useSearchParams(_){let a=reactExports.useRef(createSearchParams(_)),$=reactExports.useRef(!1),j=useLocation(),et=reactExports.useMemo(()=>getSearchParamsForLocation(j.search,$.current?null:a.current),[j.search]),tt=useNavigate(),rt=reactExports.useCallback((nt,it)=>{const ot=createSearchParams(typeof nt=="function"?nt(et):nt);$.current=!0,tt("?"+ot,it)},[tt,et]);return[et,rt]}const ANNOUNCEMENT_REFRESH_INTERVAL=60*60*1e3,ANNOUNCEMENT_FILE_URL="https://storage.googleapis.com/umami-artifacts/announcement.html",AnnouncementBanner=()=>{const{html:_,seen:a}=useAppSelector(j=>j.announcement),$=useAppDispatch();return reactExports.useEffect(()=>{const j=()=>{axios.get(ANNOUNCEMENT_FILE_URL).then(tt=>{$(announcementSlice.actions.setCurrent(tt.data))}).catch(tt=>{})};j();const et=setInterval(j,ANNOUNCEMENT_REFRESH_INTERVAL);return()=>clearInterval(et)},[$]),a||!_?null:jsxRuntimeExports.jsx(Alert,{className:"announcement-banner",color:"black",background:colors.orangeL,"data-testid":"announcement",paddingX:"30px",children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",width:"100%",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(MaintenanceIcon,{marginRight:"4px"}),jsxRuntimeExports.jsx(AlertDescription,{fontSize:"14px",dangerouslySetInnerHTML:{__html:_}})]}),jsxRuntimeExports.jsx(CloseButton,{"data-testid":"close",onClick:()=>$(announcementSlice.actions.setSeen())})]})})};var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size",effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(_,a){var $=reactExports.useRef(null),j=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),et=j[0],tt=j[1],rt=_.forwardProps,nt=_.children,it=_.className,ot=_.removeScrollBar,st=_.enabled,at=_.shards,ut=_.sideCar,ht=_.noIsolation,bt=_.inert,Et=_.allowPinchZoom,Ct=_.as,Pt=Ct===void 0?"div":Ct,Tt=_.gapMode,It=__rest$3(_,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Lt=ut,Nt=useMergeRefs([$,a]),Ut=__assign(__assign({},It),et);return reactExports.createElement(reactExports.Fragment,null,st&&reactExports.createElement(Lt,{sideCar:effectCar,removeScrollBar:ot,shards:at,noIsolation:ht,inert:bt,setCallbacks:tt,allowPinchZoom:!!Et,lockRef:$,gapMode:Tt}),rt?reactExports.cloneElement(reactExports.Children.only(nt),__assign(__assign({},Ut),{ref:Nt})):reactExports.createElement(Pt,__assign({},Ut,{className:it,ref:Nt}),nt))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var zeroGap={left:0,top:0,right:0,gap:0},parse$3=function(_){return parseInt(_||"",10)||0},getOffset=function(_){var a=window.getComputedStyle(document.body),$=a[_==="padding"?"paddingLeft":"marginLeft"],j=a[_==="padding"?"paddingTop":"marginTop"],et=a[_==="padding"?"paddingRight":"marginRight"];return[parse$3($),parse$3(j),parse$3(et)]},getGapWidth=function(_){if(_===void 0&&(_="margin"),typeof window>"u")return zeroGap;var a=getOffset(_),$=document.documentElement.clientWidth,j=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,j-$+a[2]-a[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(_,a,$,j){var et=_.left,tt=_.top,rt=_.right,nt=_.gap;return $===void 0&&($="margin"),` + */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(_){for(var a=1;a=0)&&($[et]=_[et]);return $}function isModifiedEvent(_){return!!(_.metaKey||_.altKey||_.ctrlKey||_.shiftKey)}function shouldProcessLinkClick(_,a){return _.button===0&&(!a||a==="_self")&&!isModifiedEvent(_)}function createSearchParams(_){return _===void 0&&(_=""),new URLSearchParams(typeof _=="string"||Array.isArray(_)||_ instanceof URLSearchParams?_:Object.keys(_).reduce((a,$)=>{let j=_[$];return a.concat(Array.isArray(j)?j.map(et=>[$,et]):[[$,j]])},[]))}function getSearchParamsForLocation(_,a){let $=createSearchParams(_);return a&&a.forEach((j,et)=>{$.has(et)||a.getAll(et).forEach(tt=>{$.append(et,tt)})}),$}const _excluded$3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch(_){}const START_TRANSITION="startTransition",startTransitionImpl=React$3[START_TRANSITION];function HashRouter(_){let{basename:a,children:$,future:j,window:et}=_,tt=reactExports.useRef();tt.current==null&&(tt.current=createHashHistory({window:et,v5Compat:!0}));let rt=tt.current,[nt,it]=reactExports.useState({action:rt.action,location:rt.location}),{v7_startTransition:at}=j||{},st=reactExports.useCallback(ot=>{at&&startTransitionImpl?startTransitionImpl(()=>it(ot)):it(ot)},[it,at]);return reactExports.useLayoutEffect(()=>rt.listen(st),[rt,st]),reactExports.createElement(Router$1,{basename:a,children:$,location:nt.location,navigationType:nt.action,navigator:rt,future:j})}const isBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function _(a,$){let{onClick:j,relative:et,reloadDocument:tt,replace:rt,state:nt,target:it,to:at,preventScrollReset:st,unstable_viewTransition:ot}=a,ut=_objectWithoutPropertiesLoose$1(a,_excluded$3),{basename:dt}=reactExports.useContext(NavigationContext),mt,xt=!1;if(typeof at=="string"&&ABSOLUTE_URL_REGEX.test(at)&&(mt=at,isBrowser))try{let kt=new URL(window.location.href),Lt=at.startsWith("//")?new URL(kt.protocol+at):new URL(at),Nt=stripBasename(Lt.pathname,dt);Lt.origin===kt.origin&&Nt!=null?at=Nt+Lt.search+Lt.hash:xt=!0}catch{}let Ct=useHref(at,{relative:et}),Pt=useLinkClickHandler(at,{replace:rt,state:nt,target:it,preventScrollReset:st,relative:et,unstable_viewTransition:ot});function Tt(kt){j&&j(kt),kt.defaultPrevented||Pt(kt)}return reactExports.createElement("a",_extends$2({},ut,{href:mt||Ct,onClick:xt||tt?j:Tt,ref:$,target:it}))});var DataRouterHook;(function(_){_.UseScrollRestoration="useScrollRestoration",_.UseSubmit="useSubmit",_.UseSubmitFetcher="useSubmitFetcher",_.UseFetcher="useFetcher",_.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(_){_.UseFetcher="useFetcher",_.UseFetchers="useFetchers",_.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(_,a){let{target:$,replace:j,state:et,preventScrollReset:tt,relative:rt,unstable_viewTransition:nt}=a===void 0?{}:a,it=useNavigate(),at=useLocation(),st=useResolvedPath(_,{relative:rt});return reactExports.useCallback(ot=>{if(shouldProcessLinkClick(ot,$)){ot.preventDefault();let ut=j!==void 0?j:createPath(at)===createPath(st);it(_,{replace:ut,state:et,preventScrollReset:tt,relative:rt,unstable_viewTransition:nt})}},[at,it,st,j,et,$,_,tt,rt,nt])}function useSearchParams(_){let a=reactExports.useRef(createSearchParams(_)),$=reactExports.useRef(!1),j=useLocation(),et=reactExports.useMemo(()=>getSearchParamsForLocation(j.search,$.current?null:a.current),[j.search]),tt=useNavigate(),rt=reactExports.useCallback((nt,it)=>{const at=createSearchParams(typeof nt=="function"?nt(et):nt);$.current=!0,tt("?"+at,it)},[tt,et]);return[et,rt]}const ANNOUNCEMENT_REFRESH_INTERVAL=60*60*1e3,ANNOUNCEMENT_FILE_URL="https://storage.googleapis.com/umami-artifacts/announcement.html",AnnouncementBanner=()=>{const{html:_,seen:a}=useAppSelector(j=>j.announcement),$=useAppDispatch();return reactExports.useEffect(()=>{const j=()=>{axios.get(ANNOUNCEMENT_FILE_URL).then(tt=>{$(announcementSlice.actions.setCurrent(tt.data))}).catch(tt=>{})};j();const et=setInterval(j,ANNOUNCEMENT_REFRESH_INTERVAL);return()=>clearInterval(et)},[$]),a||!_?null:jsxRuntimeExports.jsx(Alert,{className:"announcement-banner",color:"black",background:colors.orangeL,"data-testid":"announcement",paddingX:"30px",children:jsxRuntimeExports.jsxs(Flex,{justifyContent:"space-between",width:"100%",children:[jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(MaintenanceIcon,{marginRight:"4px"}),jsxRuntimeExports.jsx(AlertDescription,{fontSize:"14px",dangerouslySetInnerHTML:{__html:_}})]}),jsxRuntimeExports.jsx(CloseButton,{"data-testid":"close",onClick:()=>$(announcementSlice.actions.setSeen())})]})})};var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size",effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(_,a){var $=reactExports.useRef(null),j=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),et=j[0],tt=j[1],rt=_.forwardProps,nt=_.children,it=_.className,at=_.removeScrollBar,st=_.enabled,ot=_.shards,ut=_.sideCar,dt=_.noIsolation,mt=_.inert,xt=_.allowPinchZoom,Ct=_.as,Pt=Ct===void 0?"div":Ct,Tt=_.gapMode,kt=__rest$3(_,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Lt=ut,Nt=useMergeRefs([$,a]),zt=__assign(__assign({},kt),et);return reactExports.createElement(reactExports.Fragment,null,st&&reactExports.createElement(Lt,{sideCar:effectCar,removeScrollBar:at,shards:ot,noIsolation:dt,inert:mt,setCallbacks:tt,allowPinchZoom:!!xt,lockRef:$,gapMode:Tt}),rt?reactExports.cloneElement(reactExports.Children.only(nt),__assign(__assign({},zt),{ref:Nt})):reactExports.createElement(Pt,__assign({},zt,{className:it,ref:Nt}),nt))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var zeroGap={left:0,top:0,right:0,gap:0},parse$3=function(_){return parseInt(_||"",10)||0},getOffset=function(_){var a=window.getComputedStyle(document.body),$=a[_==="padding"?"paddingLeft":"marginLeft"],j=a[_==="padding"?"paddingTop":"marginTop"],et=a[_==="padding"?"paddingRight":"marginRight"];return[parse$3($),parse$3(j),parse$3(et)]},getGapWidth=function(_){if(_===void 0&&(_="margin"),typeof window>"u")return zeroGap;var a=getOffset(_),$=document.documentElement.clientWidth,j=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,j-$+a[2]-a[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(_,a,$,j){var et=_.left,tt=_.top,rt=_.right,nt=_.gap;return $===void 0&&($="margin"),` .`.concat(noScrollbarsClassName,` { overflow: hidden `).concat(j,`; padding-right: `).concat(nt,"px ").concat(j,`; @@ -530,64 +530,64 @@ Please pass a 2048 word array explicitly.`;function normalize(_){return(_||"").n body[`).concat(lockAttribute,`] { `).concat(removedBarSizeVariable,": ").concat(nt,`px; } -`)},getCurrentUseCounter=function(){var _=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(_)?_:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var _=getCurrentUseCounter()-1;_<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,_.toString())}},[])},RemoveScrollBar=function(_){var a=_.noRelative,$=_.noImportant,j=_.gapMode,et=j===void 0?"margin":j;useLockAttribute();var tt=reactExports.useMemo(function(){return getGapWidth(et)},[et]);return reactExports.createElement(Style,{styles:getStyles(tt,!a,et,$?"":"!important")})},passiveSupported=!1;if(typeof window<"u")try{var options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",options,options),window.removeEventListener("test",options,options)}catch{passiveSupported=!1}var nonPassive=passiveSupported?{passive:!1}:!1,alwaysContainsScroll=function(_){return _.tagName==="TEXTAREA"},elementCanBeScrolled=function(_,a){if(!(_ instanceof Element))return!1;var $=window.getComputedStyle(_);return $[a]!=="hidden"&&!($.overflowY===$.overflowX&&!alwaysContainsScroll(_)&&$[a]==="visible")},elementCouldBeVScrolled=function(_){return elementCanBeScrolled(_,"overflowY")},elementCouldBeHScrolled=function(_){return elementCanBeScrolled(_,"overflowX")},locationCouldBeScrolled=function(_,a){var $=a.ownerDocument,j=a;do{typeof ShadowRoot<"u"&&j instanceof ShadowRoot&&(j=j.host);var et=elementCouldBeScrolled(_,j);if(et){var tt=getScrollVariables(_,j),rt=tt[1],nt=tt[2];if(rt>nt)return!0}j=j.parentNode}while(j&&j!==$.body);return!1},getVScrollVariables=function(_){var a=_.scrollTop,$=_.scrollHeight,j=_.clientHeight;return[a,$,j]},getHScrollVariables=function(_){var a=_.scrollLeft,$=_.scrollWidth,j=_.clientWidth;return[a,$,j]},elementCouldBeScrolled=function(_,a){return _==="v"?elementCouldBeVScrolled(a):elementCouldBeHScrolled(a)},getScrollVariables=function(_,a){return _==="v"?getVScrollVariables(a):getHScrollVariables(a)},getDirectionFactor=function(_,a){return _==="h"&&a==="rtl"?-1:1},handleScroll=function(_,a,$,j,et){var tt=getDirectionFactor(_,window.getComputedStyle(a).direction),rt=tt*j,nt=$.target,it=a.contains(nt),ot=!1,st=rt>0,at=0,ut=0;do{var ht=getScrollVariables(_,nt),bt=ht[0],Et=ht[1],Ct=ht[2],Pt=Et-Ct-tt*bt;(bt||Pt)&&elementCouldBeScrolled(_,nt)&&(at+=Pt,ut+=bt),nt instanceof ShadowRoot?nt=nt.host:nt=nt.parentNode}while(!it&&nt!==document.body||it&&(a.contains(nt)||a===nt));return(st&&(Math.abs(at)<1||!et)||!st&&(Math.abs(ut)<1||!et))&&(ot=!0),ot},getTouchXY=function(_){return"changedTouches"in _?[_.changedTouches[0].clientX,_.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(_){return[_.deltaX,_.deltaY]},extractRef=function(_){return _&&"current"in _?_.current:_},deltaCompare=function(_,a){return _[0]===a[0]&&_[1]===a[1]},generateStyle=function(_){return` +`)},getCurrentUseCounter=function(){var _=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(_)?_:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var _=getCurrentUseCounter()-1;_<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,_.toString())}},[])},RemoveScrollBar=function(_){var a=_.noRelative,$=_.noImportant,j=_.gapMode,et=j===void 0?"margin":j;useLockAttribute();var tt=reactExports.useMemo(function(){return getGapWidth(et)},[et]);return reactExports.createElement(Style,{styles:getStyles(tt,!a,et,$?"":"!important")})},passiveSupported=!1;if(typeof window<"u")try{var options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",options,options),window.removeEventListener("test",options,options)}catch{passiveSupported=!1}var nonPassive=passiveSupported?{passive:!1}:!1,alwaysContainsScroll=function(_){return _.tagName==="TEXTAREA"},elementCanBeScrolled=function(_,a){if(!(_ instanceof Element))return!1;var $=window.getComputedStyle(_);return $[a]!=="hidden"&&!($.overflowY===$.overflowX&&!alwaysContainsScroll(_)&&$[a]==="visible")},elementCouldBeVScrolled=function(_){return elementCanBeScrolled(_,"overflowY")},elementCouldBeHScrolled=function(_){return elementCanBeScrolled(_,"overflowX")},locationCouldBeScrolled=function(_,a){var $=a.ownerDocument,j=a;do{typeof ShadowRoot<"u"&&j instanceof ShadowRoot&&(j=j.host);var et=elementCouldBeScrolled(_,j);if(et){var tt=getScrollVariables(_,j),rt=tt[1],nt=tt[2];if(rt>nt)return!0}j=j.parentNode}while(j&&j!==$.body);return!1},getVScrollVariables=function(_){var a=_.scrollTop,$=_.scrollHeight,j=_.clientHeight;return[a,$,j]},getHScrollVariables=function(_){var a=_.scrollLeft,$=_.scrollWidth,j=_.clientWidth;return[a,$,j]},elementCouldBeScrolled=function(_,a){return _==="v"?elementCouldBeVScrolled(a):elementCouldBeHScrolled(a)},getScrollVariables=function(_,a){return _==="v"?getVScrollVariables(a):getHScrollVariables(a)},getDirectionFactor=function(_,a){return _==="h"&&a==="rtl"?-1:1},handleScroll=function(_,a,$,j,et){var tt=getDirectionFactor(_,window.getComputedStyle(a).direction),rt=tt*j,nt=$.target,it=a.contains(nt),at=!1,st=rt>0,ot=0,ut=0;do{var dt=getScrollVariables(_,nt),mt=dt[0],xt=dt[1],Ct=dt[2],Pt=xt-Ct-tt*mt;(mt||Pt)&&elementCouldBeScrolled(_,nt)&&(ot+=Pt,ut+=mt),nt instanceof ShadowRoot?nt=nt.host:nt=nt.parentNode}while(!it&&nt!==document.body||it&&(a.contains(nt)||a===nt));return(st&&(Math.abs(ot)<1||!et)||!st&&(Math.abs(ut)<1||!et))&&(at=!0),at},getTouchXY=function(_){return"changedTouches"in _?[_.changedTouches[0].clientX,_.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(_){return[_.deltaX,_.deltaY]},extractRef=function(_){return _&&"current"in _?_.current:_},deltaCompare=function(_,a){return _[0]===a[0]&&_[1]===a[1]},generateStyle=function(_){return` .block-interactivity-`.concat(_,` {pointer-events: none;} .allow-interactivity-`).concat(_,` {pointer-events: all;} -`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(_){var a=reactExports.useRef([]),$=reactExports.useRef([0,0]),j=reactExports.useRef(),et=reactExports.useState(idCounter++)[0],tt=reactExports.useState(styleSingleton)[0],rt=reactExports.useRef(_);reactExports.useEffect(function(){rt.current=_},[_]),reactExports.useEffect(function(){if(_.inert){document.body.classList.add("block-interactivity-".concat(et));var Et=__spreadArray([_.lockRef.current],(_.shards||[]).map(extractRef),!0).filter(Boolean);return Et.forEach(function(Ct){return Ct.classList.add("allow-interactivity-".concat(et))}),function(){document.body.classList.remove("block-interactivity-".concat(et)),Et.forEach(function(Ct){return Ct.classList.remove("allow-interactivity-".concat(et))})}}},[_.inert,_.lockRef.current,_.shards]);var nt=reactExports.useCallback(function(Et,Ct){if("touches"in Et&&Et.touches.length===2)return!rt.current.allowPinchZoom;var Pt=getTouchXY(Et),Tt=$.current,It="deltaX"in Et?Et.deltaX:Tt[0]-Pt[0],Lt="deltaY"in Et?Et.deltaY:Tt[1]-Pt[1],Nt,Ut=Et.target,jt=Math.abs(It)>Math.abs(Lt)?"h":"v";if("touches"in Et&&jt==="h"&&Ut.type==="range")return!1;var Mt=locationCouldBeScrolled(jt,Ut);if(!Mt)return!0;if(Mt?Nt=jt:(Nt=jt==="v"?"h":"v",Mt=locationCouldBeScrolled(jt,Ut)),!Mt)return!1;if(!j.current&&"changedTouches"in Et&&(It||Lt)&&(j.current=Nt),!Nt)return!0;var Dt=j.current||Nt;return handleScroll(Dt,Ct,Et,Dt==="h"?It:Lt,!0)},[]),it=reactExports.useCallback(function(Et){var Ct=Et;if(!(!lockStack.length||lockStack[lockStack.length-1]!==tt)){var Pt="deltaY"in Ct?getDeltaXY(Ct):getTouchXY(Ct),Tt=a.current.filter(function(Nt){return Nt.name===Ct.type&&(Nt.target===Ct.target||Ct.target===Nt.shadowParent)&&deltaCompare(Nt.delta,Pt)})[0];if(Tt&&Tt.should){Ct.cancelable&&Ct.preventDefault();return}if(!Tt){var It=(rt.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Nt){return Nt.contains(Ct.target)}),Lt=It.length>0?nt(Ct,It[0]):!rt.current.noIsolation;Lt&&Ct.cancelable&&Ct.preventDefault()}}},[]),ot=reactExports.useCallback(function(Et,Ct,Pt,Tt){var It={name:Et,delta:Ct,target:Pt,should:Tt,shadowParent:getOutermostShadowParent(Pt)};a.current.push(It),setTimeout(function(){a.current=a.current.filter(function(Lt){return Lt!==It})},1)},[]),st=reactExports.useCallback(function(Et){$.current=getTouchXY(Et),j.current=void 0},[]),at=reactExports.useCallback(function(Et){ot(Et.type,getDeltaXY(Et),Et.target,nt(Et,_.lockRef.current))},[]),ut=reactExports.useCallback(function(Et){ot(Et.type,getTouchXY(Et),Et.target,nt(Et,_.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(tt),_.setCallbacks({onScrollCapture:at,onWheelCapture:at,onTouchMoveCapture:ut}),document.addEventListener("wheel",it,nonPassive),document.addEventListener("touchmove",it,nonPassive),document.addEventListener("touchstart",st,nonPassive),function(){lockStack=lockStack.filter(function(Et){return Et!==tt}),document.removeEventListener("wheel",it,nonPassive),document.removeEventListener("touchmove",it,nonPassive),document.removeEventListener("touchstart",st,nonPassive)}},[]);var ht=_.removeScrollBar,bt=_.inert;return reactExports.createElement(reactExports.Fragment,null,bt?reactExports.createElement(tt,{styles:generateStyle(et)}):null,ht?reactExports.createElement(RemoveScrollBar,{gapMode:_.gapMode}):null)}function getOutermostShadowParent(_){for(var a=null;_!==null;)_ instanceof ShadowRoot&&(a=_.host,_=_.host),_=_.parentNode;return a}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(_,a){return reactExports.createElement(RemoveScroll,__assign({},_,{ref:a,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;const DynamicModalContext=reactExports.createContext({openWith:_=>Promise.resolve(),onClose:()=>{},isOpen:!1}),useDynamicModal=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1(),[j,et]=reactExports.useState(null),[tt,rt]=reactExports.useState("md");return{isOpen:_,onClose:a,openWith:async(it,ot="md")=>(rt(ot),et(it),$(),Promise.resolve()),content:jsxRuntimeExports.jsxs(Modal,{autoFocus:!1,blockScrollOnMount:!1,closeOnOverlayClick:!1,isCentered:!0,isOpen:_,motionPreset:localStorage.getItem("chakra-modal-motion-preset")||void 0,onClose:a,size:tt,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ReactRemoveScroll,{enabled:_,children:j})]})}},JsValueWrap=({value:_,space:a=2,...$})=>jsxRuntimeExports.jsx(Card,{background:colors.gray[700],borderRadius:"5px",...$,children:jsxRuntimeExports.jsx(CardBody,{children:jsxRuntimeExports.jsx("pre",{style:{whiteSpace:"pre-wrap",fontSize:"12px",lineHeight:"18px"},children:JSON.stringify(_,null,a)})})});var md5$1={exports:{}},crypt={exports:{}};(function(){var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a={rotl:function($,j){return $<>>32-j},rotr:function($,j){return $<<32-j|$>>>j},endian:function($){if($.constructor==Number)return a.rotl($,8)&16711935|a.rotl($,24)&4278255360;for(var j=0;j<$.length;j++)$[j]=a.endian($[j]);return $},randomBytes:function($){for(var j=[];$>0;$--)j.push(Math.floor(Math.random()*256));return j},bytesToWords:function($){for(var j=[],et=0,tt=0;et<$.length;et++,tt+=8)j[tt>>>5]|=$[et]<<24-tt%32;return j},wordsToBytes:function($){for(var j=[],et=0;et<$.length*32;et+=8)j.push($[et>>>5]>>>24-et%32&255);return j},bytesToHex:function($){for(var j=[],et=0;et<$.length;et++)j.push(($[et]>>>4).toString(16)),j.push(($[et]&15).toString(16));return j.join("")},hexToBytes:function($){for(var j=[],et=0;et<$.length;et+=2)j.push(parseInt($.substr(et,2),16));return j},bytesToBase64:function($){for(var j=[],et=0;et<$.length;et+=3)for(var tt=$[et]<<16|$[et+1]<<8|$[et+2],rt=0;rt<4;rt++)et*8+rt*6<=$.length*8?j.push(_.charAt(tt>>>6*(3-rt)&63)):j.push("=");return j.join("")},base64ToBytes:function($){$=$.replace(/[^A-Z0-9+\/]/ig,"");for(var j=[],et=0,tt=0;et<$.length;tt=++et%4)tt!=0&&j.push((_.indexOf($.charAt(et-1))&Math.pow(2,-2*tt+8)-1)<>>6-tt*2);return j}};crypt.exports=a})();var cryptExports=crypt.exports,charenc={utf8:{stringToBytes:function(_){return charenc.bin.stringToBytes(unescape(encodeURIComponent(_)))},bytesToString:function(_){return decodeURIComponent(escape(charenc.bin.bytesToString(_)))}},bin:{stringToBytes:function(_){for(var a=[],$=0;$<_.length;$++)a.push(_.charCodeAt($)&255);return a},bytesToString:function(_){for(var a=[],$=0;$<_.length;$++)a.push(String.fromCharCode(_[$]));return a.join("")}}},charenc_1=charenc;/*! +`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(_){var a=reactExports.useRef([]),$=reactExports.useRef([0,0]),j=reactExports.useRef(),et=reactExports.useState(idCounter++)[0],tt=reactExports.useState(styleSingleton)[0],rt=reactExports.useRef(_);reactExports.useEffect(function(){rt.current=_},[_]),reactExports.useEffect(function(){if(_.inert){document.body.classList.add("block-interactivity-".concat(et));var xt=__spreadArray([_.lockRef.current],(_.shards||[]).map(extractRef),!0).filter(Boolean);return xt.forEach(function(Ct){return Ct.classList.add("allow-interactivity-".concat(et))}),function(){document.body.classList.remove("block-interactivity-".concat(et)),xt.forEach(function(Ct){return Ct.classList.remove("allow-interactivity-".concat(et))})}}},[_.inert,_.lockRef.current,_.shards]);var nt=reactExports.useCallback(function(xt,Ct){if("touches"in xt&&xt.touches.length===2)return!rt.current.allowPinchZoom;var Pt=getTouchXY(xt),Tt=$.current,kt="deltaX"in xt?xt.deltaX:Tt[0]-Pt[0],Lt="deltaY"in xt?xt.deltaY:Tt[1]-Pt[1],Nt,zt=xt.target,jt=Math.abs(kt)>Math.abs(Lt)?"h":"v";if("touches"in xt&&jt==="h"&&zt.type==="range")return!1;var Mt=locationCouldBeScrolled(jt,zt);if(!Mt)return!0;if(Mt?Nt=jt:(Nt=jt==="v"?"h":"v",Mt=locationCouldBeScrolled(jt,zt)),!Mt)return!1;if(!j.current&&"changedTouches"in xt&&(kt||Lt)&&(j.current=Nt),!Nt)return!0;var Dt=j.current||Nt;return handleScroll(Dt,Ct,xt,Dt==="h"?kt:Lt,!0)},[]),it=reactExports.useCallback(function(xt){var Ct=xt;if(!(!lockStack.length||lockStack[lockStack.length-1]!==tt)){var Pt="deltaY"in Ct?getDeltaXY(Ct):getTouchXY(Ct),Tt=a.current.filter(function(Nt){return Nt.name===Ct.type&&(Nt.target===Ct.target||Ct.target===Nt.shadowParent)&&deltaCompare(Nt.delta,Pt)})[0];if(Tt&&Tt.should){Ct.cancelable&&Ct.preventDefault();return}if(!Tt){var kt=(rt.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Nt){return Nt.contains(Ct.target)}),Lt=kt.length>0?nt(Ct,kt[0]):!rt.current.noIsolation;Lt&&Ct.cancelable&&Ct.preventDefault()}}},[]),at=reactExports.useCallback(function(xt,Ct,Pt,Tt){var kt={name:xt,delta:Ct,target:Pt,should:Tt,shadowParent:getOutermostShadowParent(Pt)};a.current.push(kt),setTimeout(function(){a.current=a.current.filter(function(Lt){return Lt!==kt})},1)},[]),st=reactExports.useCallback(function(xt){$.current=getTouchXY(xt),j.current=void 0},[]),ot=reactExports.useCallback(function(xt){at(xt.type,getDeltaXY(xt),xt.target,nt(xt,_.lockRef.current))},[]),ut=reactExports.useCallback(function(xt){at(xt.type,getTouchXY(xt),xt.target,nt(xt,_.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(tt),_.setCallbacks({onScrollCapture:ot,onWheelCapture:ot,onTouchMoveCapture:ut}),document.addEventListener("wheel",it,nonPassive),document.addEventListener("touchmove",it,nonPassive),document.addEventListener("touchstart",st,nonPassive),function(){lockStack=lockStack.filter(function(xt){return xt!==tt}),document.removeEventListener("wheel",it,nonPassive),document.removeEventListener("touchmove",it,nonPassive),document.removeEventListener("touchstart",st,nonPassive)}},[]);var dt=_.removeScrollBar,mt=_.inert;return reactExports.createElement(reactExports.Fragment,null,mt?reactExports.createElement(tt,{styles:generateStyle(et)}):null,dt?reactExports.createElement(RemoveScrollBar,{gapMode:_.gapMode}):null)}function getOutermostShadowParent(_){for(var a=null;_!==null;)_ instanceof ShadowRoot&&(a=_.host,_=_.host),_=_.parentNode;return a}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(_,a){return reactExports.createElement(RemoveScroll,__assign({},_,{ref:a,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;const DynamicModalContext=reactExports.createContext({openWith:_=>Promise.resolve(),onClose:()=>{},isOpen:!1}),useDynamicModal=()=>{const{isOpen:_,onClose:a,onOpen:$}=useDisclosure$1(),[j,et]=reactExports.useState(null),[tt,rt]=reactExports.useState("md");return{isOpen:_,onClose:a,openWith:async(it,at="md")=>(rt(at),et(it),$(),Promise.resolve()),content:jsxRuntimeExports.jsxs(Modal,{autoFocus:!1,blockScrollOnMount:!1,closeOnOverlayClick:!1,isCentered:!0,isOpen:_,motionPreset:localStorage.getItem("chakra-modal-motion-preset")||void 0,onClose:a,size:tt,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ReactRemoveScroll,{enabled:_,children:j})]})}},JsValueWrap=({value:_,space:a=2,...$})=>jsxRuntimeExports.jsx(Card,{background:colors.gray[700],borderRadius:"5px",...$,children:jsxRuntimeExports.jsx(CardBody,{children:jsxRuntimeExports.jsx("pre",{style:{whiteSpace:"pre-wrap",fontSize:"12px",lineHeight:"18px"},children:JSON.stringify(_,null,a)})})});var md5$1={exports:{}},crypt={exports:{}};(function(){var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a={rotl:function($,j){return $<>>32-j},rotr:function($,j){return $<<32-j|$>>>j},endian:function($){if($.constructor==Number)return a.rotl($,8)&16711935|a.rotl($,24)&4278255360;for(var j=0;j<$.length;j++)$[j]=a.endian($[j]);return $},randomBytes:function($){for(var j=[];$>0;$--)j.push(Math.floor(Math.random()*256));return j},bytesToWords:function($){for(var j=[],et=0,tt=0;et<$.length;et++,tt+=8)j[tt>>>5]|=$[et]<<24-tt%32;return j},wordsToBytes:function($){for(var j=[],et=0;et<$.length*32;et+=8)j.push($[et>>>5]>>>24-et%32&255);return j},bytesToHex:function($){for(var j=[],et=0;et<$.length;et++)j.push(($[et]>>>4).toString(16)),j.push(($[et]&15).toString(16));return j.join("")},hexToBytes:function($){for(var j=[],et=0;et<$.length;et+=2)j.push(parseInt($.substr(et,2),16));return j},bytesToBase64:function($){for(var j=[],et=0;et<$.length;et+=3)for(var tt=$[et]<<16|$[et+1]<<8|$[et+2],rt=0;rt<4;rt++)et*8+rt*6<=$.length*8?j.push(_.charAt(tt>>>6*(3-rt)&63)):j.push("=");return j.join("")},base64ToBytes:function($){$=$.replace(/[^A-Z0-9+\/]/ig,"");for(var j=[],et=0,tt=0;et<$.length;tt=++et%4)tt!=0&&j.push((_.indexOf($.charAt(et-1))&Math.pow(2,-2*tt+8)-1)<>>6-tt*2);return j}};crypt.exports=a})();var cryptExports=crypt.exports,charenc={utf8:{stringToBytes:function(_){return charenc.bin.stringToBytes(unescape(encodeURIComponent(_)))},bytesToString:function(_){return decodeURIComponent(escape(charenc.bin.bytesToString(_)))}},bin:{stringToBytes:function(_){for(var a=[],$=0;$<_.length;$++)a.push(_.charCodeAt($)&255);return a},bytesToString:function(_){for(var a=[],$=0;$<_.length;$++)a.push(String.fromCharCode(_[$]));return a.join("")}}},charenc_1=charenc;/*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT - */var isBuffer_1=function(_){return _!=null&&(isBuffer(_)||isSlowBuffer(_)||!!_._isBuffer)};function isBuffer(_){return!!_.constructor&&typeof _.constructor.isBuffer=="function"&&_.constructor.isBuffer(_)}function isSlowBuffer(_){return typeof _.readFloatLE=="function"&&typeof _.slice=="function"&&isBuffer(_.slice(0,0))}(function(){var _=cryptExports,a=charenc_1.utf8,$=isBuffer_1,j=charenc_1.bin,et=function(tt,rt){tt.constructor==String?rt&&rt.encoding==="binary"?tt=j.stringToBytes(tt):tt=a.stringToBytes(tt):$(tt)?tt=Array.prototype.slice.call(tt,0):!Array.isArray(tt)&&tt.constructor!==Uint8Array&&(tt=tt.toString());for(var nt=_.bytesToWords(tt),it=tt.length*8,ot=1732584193,st=-271733879,at=-1732584194,ut=271733878,ht=0;ht>>24)&16711935|(nt[ht]<<24|nt[ht]>>>8)&4278255360;nt[it>>>5]|=128<>>9<<4)+14]=it;for(var bt=et._ff,Et=et._gg,Ct=et._hh,Pt=et._ii,ht=0;ht>>0,st=st+It>>>0,at=at+Lt>>>0,ut=ut+Nt>>>0}return _.endian([ot,st,at,ut])};et._ff=function(tt,rt,nt,it,ot,st,at){var ut=tt+(rt&nt|~rt&it)+(ot>>>0)+at;return(ut<>>32-st)+rt},et._gg=function(tt,rt,nt,it,ot,st,at){var ut=tt+(rt&it|nt&~it)+(ot>>>0)+at;return(ut<>>32-st)+rt},et._hh=function(tt,rt,nt,it,ot,st,at){var ut=tt+(rt^nt^it)+(ot>>>0)+at;return(ut<>>32-st)+rt},et._ii=function(tt,rt,nt,it,ot,st,at){var ut=tt+(nt^(rt|~it))+(ot>>>0)+at;return(ut<>>32-st)+rt},et._blocksize=16,et._digestsize=16,md5$1.exports=function(tt,rt){if(tt==null)throw new Error("Illegal argument "+tt);var nt=_.wordsToBytes(et(tt,rt));return rt&&rt.asBytes?nt:rt&&rt.asString?j.bytesToString(nt):_.bytesToHex(nt)}})();var md5Exports=md5$1.exports;const md5=getDefaultExportFromCjs$1(md5Exports),ReactIdenticon=React$2.memo(({count:_=5,background:a,string:$,size:j})=>{const et=reactExports.useRef(null);reactExports.useEffect(()=>{tt()});const tt=()=>{const rt=md5($),nt=Math.floor(j/_),it=rt.slice(0,6),ot=et.current;ot.width=nt*_,ot.height=nt*_;const st=rt.split("").map(ht=>parseInt(ht,16)).map(ht=>ht<8?0:1),at=[];at[0]=at[4]=st.slice(0,5),at[1]=at[3]=st.slice(5,10),at[2]=st.slice(10,15);const ut=ot.getContext("2d");ut.imageSmoothingEnabled=!1,ut.clearRect(0,0,ot.width,ot.height),at.forEach((ht,bt)=>{ht.forEach((Et,Ct)=>{Et?(ut.fillStyle="#"+it,ut.fillRect(nt*bt,nt*Ct,nt,nt)):(ut.fillStyle=a,ut.fillRect(nt*bt,nt*Ct,nt,nt))})})};return jsxRuntimeExports.jsx("canvas",{ref:et,style:{width:j,height:j}})}),color=_=>`#${md5(_).slice(0,6)}`,Identicon=({address:_,identiconSize:a,...$})=>jsxRuntimeExports.jsx(Box,{sx:{canvas:{borderRadius:"4px"}},zIndex:3,background:"white",borderRadius:"4px","data-testid":"identicon",...$,children:jsxRuntimeExports.jsx(ReactIdenticon,{background:"white",size:a,string:_.pkh,style:{borderRadius:4}})}),SIZES$1={lg:{defaults:{width:"48px",height:"48px",borderRadius:"4px"},mnemonic:{padding:"8px",identiconSize:32},ledger:{padding:"10px"},secret_key:{padding:"8px",identiconSize:32},multisig:{padding:"10px"},social:{google:{paddingX:"10.28px",paddingY:"10px"},facebook:{padding:"9px"},twitter:{paddingX:"12.78px",paddingY:"13.5px"},reddit:{padding:"10px"},email:{padding:"10px"}}},sm:{defaults:{width:"30px",height:"30px",borderRadius:"4px"},mnemonic:{padding:"5px",identiconSize:20},ledger:{padding:"5px"},secret_key:{padding:"5px",identiconSize:20},multisig:{padding:"5px"},social:{google:{paddingX:"6.425px",paddingY:"6.25px"},facebook:{padding:"6px"},twitter:{paddingX:"7.5px",paddingY:"8px"},reddit:{padding:"6px"},email:{padding:"6px"}}}},AccountTileIcon=reactExports.memo(({account:_,size:a})=>{const $=SIZES$1[a],j=$.defaults;switch(_.type){case"secret_key":return jsxRuntimeExports.jsx(Identicon,{address:_.address,...j,...$.secret_key});case"mnemonic":return jsxRuntimeExports.jsx(Identicon,{address:_.address,...j,...$.mnemonic});case"ledger":return jsxRuntimeExports.jsx(LedgerIcon,{...j,...$.ledger,background:colors.gray[500]});case"multisig":return jsxRuntimeExports.jsx(KeyIcon,{...j,...$.multisig,stroke:colors.gray[400],background:colors.gray[500]});case"social":switch(_.idp){case"google":return jsxRuntimeExports.jsx(GoogleIcon,{...j,...$.social.google,background:"white"});case"facebook":return jsxRuntimeExports.jsx(FacebookIcon,{...j,...$.social.facebook,background:"white"});case"twitter":return jsxRuntimeExports.jsx(TwitterIcon,{...j,...$.social.twitter,background:"white"});case"reddit":return jsxRuntimeExports.jsx(RedditIcon,{...j,...$.social.reddit,background:"white"});case"email":return jsxRuntimeExports.jsx(EmailIcon,{...j,...$.social.email,color:"black",background:"white"})}}}),baseIconProps={stroke:colors.gray[400],borderRadius:"4px",background:colors.gray[500]},AddressTileIcon=reactExports.memo(({addressKind:_,size:a})=>{const j=useGetOwnedAccountSafe()(_.pkh);if(j)return jsxRuntimeExports.jsx(AccountTileIcon,{account:j,size:a});let et,tt;switch(a){case"sm":et="30px",tt="5px";break;case"lg":et="48px",tt="10px"}switch(_.type){case"contact":return jsxRuntimeExports.jsx(ContactIcon,{width:et,height:et,padding:tt,...baseIconProps});case"unknown":return jsxRuntimeExports.jsx(UnknownContactIcon,{width:et,height:et,padding:tt,...baseIconProps});case"baker":return jsxRuntimeExports.jsx(Image$1,{height:et,"data-testid":"baker-icon",src:`https://services.tzkt.io/v1/avatars/${_.pkh}`});case"secret_key":case"mnemonic":case"social":case"ledger":case"multisig":return null}}),useAddressKind$1=_=>{const a=useOwnedAccountAddressKind$1(_),$=useBakerAddressKind(_),j=useContactAddressKind(_);return a||$||j||{pkh:_.pkh,type:"unknown",label:null}},useOwnedAccountAddressKind$1=({pkh:_})=>{const $=useGetOwnedAccountSafe()(_);return $?{type:$.type,pkh:_,label:$.label}:null},useBakerAddressKind=({pkh:_})=>{const $=useGetBaker()(_);return $?{pkh:_,type:"baker",label:$.name}:null},useContactAddressKind=({pkh:_})=>{const $=useGetContactName()(_);return $?{pkh:_,type:"contact",label:$}:null},splitNumber=_=>{const[a,$]=_.split(".");return{integer:a,decimal:$}},PrettyNumber=({number:_,size:a="md",...$})=>{const j=a==="md"?"md":"lg",et=a==="md"?"sm":"md",{integer:tt,decimal:rt}=splitNumber(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"end","data-testid":"pretty-number",...$,children:[jsxRuntimeExports.jsx(Heading,{size:j,children:tt}),rt&&jsxRuntimeExports.jsxs(Heading,{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",size:et,children:[".",rt]})]})},AccountBalance=({address:_,size:a,numberProps:$,...j})=>{const tt=useGetAccountBalance()(_);if(!tt)return null;const rt=prettyTezAmount(tt);return jsxRuntimeExports.jsx(Box,{overflow:"hidden",textAlign:"right","data-testid":"account-balance",...j,children:jsxRuntimeExports.jsx(PrettyNumber,{number:rt,size:a,...$})})},AddressTile=({address:_,hideBalance:a=!1,...$})=>{const j=useAddressKind$1(_);return jsxRuntimeExports.jsx(Tooltip,{background:colors.white,hasArrow:!0,label:j.label,placement:"left",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",width:"100%",padding:"9px 10px",background:colors.gray[800],borderRadius:"4px","data-testid":"address-tile",...$,children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",width:a?"100%":"calc(100% - 95px)",children:[jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:j,size:"sm"}),j.type==="unknown"?jsxRuntimeExports.jsx(Text,{marginLeft:"10px",color:colors.gray[300],size:"sm",children:_.pkh}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{overflow:"hidden",width:"100%",marginLeft:"10px",whiteSpace:"nowrap",children:jsxRuntimeExports.jsx(Heading,{overflow:"hidden",textOverflow:"ellipsis",size:"sm",children:j.label})}),jsxRuntimeExports.jsx(Text,{width:"89px",marginLeft:"10px",color:colors.gray[300],size:"xs",children:formatPkh(j.pkh)})]})]}),!a&&jsxRuntimeExports.jsx(AccountBalance,{overflow:"hidden",marginLeft:"10px",textAlign:"right",address:_.pkh,numberProps:{maxWidth:"85px"}})]})})},Suggestions=({contacts:_,hideBalance:a,onChange:$})=>_.length===0?null:jsxRuntimeExports.jsx(UnorderedList,{position:"absolute",zIndex:2,overflowY:"auto",width:"100%",maxHeight:"300px",marginTop:"8px",marginLeft:0,background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"suggestions-list",listStyleType:"none",children:_.map((j,et)=>jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(ListItem,{marginBottom:et===_.length-1?"5px":0,padding:"5px 15px 0 5px",onMouseDown:()=>{$(j.name)},children:jsxRuntimeExports.jsx(AddressTile,{height:"40px",padding:"10px 8px 10px 5px",background:colors.gray[700],borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",address:parsePkh(j.pkh),hideBalance:a})})},j.pkh))}),getSuggestions=(_,a)=>a.filter($=>!_.trim()||$.name.toLowerCase().includes(_.trim().toLowerCase())),AddressAutocomplete=({contacts:_,isDisabled:a,isLoading:$=!1,allowUnknown:j,inputName:et,onUpdate:tt,validate:rt,label:nt,keepValid:it,style:ot,size:st,hideBalance:at=!1})=>{const{register:ut,setValue:ht,formState:{defaultValues:bt},getValues:Et}=useFormContext(),Ct=ht,Pt=reactExports.useId(),[Tt,It]=reactExports.useState(()=>{var mt;if(it||!bt)return"";const yt=lodashExports.get(bt,et);return yt?((mt=_.find(ct=>ct.pkh===yt))==null?void 0:mt.name)||yt:""}),[Lt,Nt]=reactExports.useState(!0),[Ut,jt]=reactExports.useState(getSuggestions("",_)),Mt=Et(et),Dt=yt=>{It(yt),jt(getSuggestions(yt,_));const mt=_.find(dt=>dt.name===yt||dt.pkh===yt);let ct;if(mt!==void 0)ct=mt.pkh,Nt(!0);else if(j&&isAddressValid(yt))ct=yt;else{if(it)return;ct=""}Ct(et,ct,{shouldValidate:!0}),tt&&tt(ct)};let Ft="raw_input";$?Ft="selected_tile":a?Ft="disabled_tile":Mt&&(Ft="selected_tile");const Bt=()=>{Dt(""),Nt(!1)};return jsxRuntimeExports.jsxs(Box,{"data-testid":`address-autocomplete-${et}`,children:[jsxRuntimeExports.jsx(FormLabel,{htmlFor:Pt,children:nt}),Ft==="disabled_tile"&&jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Mt)}),Ft==="selected_tile"&&jsxRuntimeExports.jsx(Box,{height:"48px",background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px","data-testid":`selected-address-tile-${Mt}`,onClick:Bt,paddingY:0,children:jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",cursor:"pointer","data-testid":"clear-selected-button",children:[jsxRuntimeExports.jsx(AddressTile,{width:st==="short"?"338px":"365px",paddingTop:"8px",background:"transparent",address:parsePkh(Mt)}),it?jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginRight:"12px","data-testid":"chevron-icon"}):jsxRuntimeExports.jsx(CrossButton,{marginRight:"14px"})]})}),Ft==="raw_input"&&jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{...ot,"aria-label":et,autoComplete:"off",id:Pt,onBlur:yt=>{if(yt.preventDefault(),Nt(!0),it&&Mt!==yt.target.value)return Dt(Mt);Dt(yt.target.value)},onChange:yt=>Dt(yt.target.value),onFocus:()=>Nt(!1),placeholder:"Enter address or contact name",value:Tt}),jsxRuntimeExports.jsx(InputRightElement,{children:Tt?jsxRuntimeExports.jsx(CrossButton,{marginRight:"0px",onClick:Bt}):jsxRuntimeExports.jsx(ChevronDownIcon$1,{"data-testid":"chevron-icon"})})]}),jsxRuntimeExports.jsx(Input,{...ut(et,{required:"Invalid address or contact name",validate:rt}),marginBottom:0,"data-testid":`real-address-input-${et}`,name:et,type:"hidden"}),!Lt&&jsxRuntimeExports.jsx(Suggestions,{contacts:Ut,hideBalance:at,onChange:Dt})]})},CrossButton=_=>jsxRuntimeExports.jsx(XMark,{marginRight:"16px",stroke:colors.gray[450],cursor:"pointer","data-testid":"clear-input-button",..._}),KnownAccountsAutocomplete=_=>{const a=useContactsForSelectedNetwork(),$=useAllAccounts().map(j=>({name:j.label,pkh:j.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a.concat($)})},OwnedImplicitAccountsAutocomplete=_=>{const a=useImplicitAccounts().map($=>({name:$.label,pkh:$.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a})},OwnedAccountsAutocomplete=_=>{const a=useAllAccounts().map($=>({name:$.label,pkh:$.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a})},BakersAutocomplete=_=>{const a=useBakerList().map($=>({name:$.name,pkh:$.address}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a,hideBalance:!0})},AvailableSignersAutocomplete=_=>{const $=useGetOwnedSignersForAccount()(_.account).map(j=>({name:j.label,pkh:j.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{allowUnknown:!1,contacts:$,isDisabled:$.length===1,..._})},getErrorContext=_=>{let a="Something went wrong";typeof _=="object"&&"message"in _?a=_.message:typeof _=="string"&&(a=_);let $="";return typeof _=="object"&&"stack"in _&&($=_.stack),{timestamp:new Date().toISOString(),description:a,stacktrace:$}},useAsyncActionHandler=()=>{const[_,a]=reactExports.useState(!1),$=reactExports.useRef(_),j=useToast(),et=useAppDispatch(),tt=reactExports.useCallback(async(nt,it)=>{if(!$.current){$.current=!0,a(!0);try{return await nt()}catch(ot){const st=getErrorContext(ot);throw j({description:st.description,status:"error",...typeof it=="function"?it(ot):it}),et(errorsSlice.actions.add(st)),ot}finally{$.current=!1,a(!1)}}},[et,j]),rt=reactExports.useCallback(async(nt,it)=>tt(nt,it).catch(()=>{}),[tt]);return{isLoading:_,handleAsyncAction:rt,handleAsyncActionUnsafe:tt}},PermissionRequestModal=({request:_})=>{const a=useAddConnection(),$=useGetImplicitAccount(),{onClose:j}=reactExports.useContext(DynamicModalContext),{handleAsyncAction:et}=useAsyncActionHandler(),tt=useForm({mode:"onBlur"}),{getValues:rt,formState:{errors:nt,isValid:it}}=tt,ot=useRemovePeerBySenderId(),st=()=>{ot(_.senderId),WalletClient.respond({id:_.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.NOT_GRANTED_ERROR})},at=()=>et(async()=>{const ut=$(rt().address),ht={type:BeaconMessageType.PermissionResponse,network:_.network,scopes:_.scopes,id:_.id,publicKey:ut.pk,walletType:"implicit"};await WalletClient.respond(ht),a(_.senderId,ut.address.pkh,_.network.type)}).finally(j);return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"24px",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",children:"Permission Request"}),jsxRuntimeExports.jsxs(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:[_.appMetadata.name," is requesting permission to sign this operation."]}),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(_.network.type)})]})]}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:st}),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:_.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:_.appMetadata.name})]}),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:"Request"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{overflow:"auto",maxHeight:"250px",value:_})})]})}),jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!nt.address,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"address",label:"Select Account"}),nt.address&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.address.message})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!it,onClick:at,size:"lg",children:"Allow"})})]})},PAYLOAD_PADDING="0501",getPayloadHexBytes=_=>{let a=0;if(_.startsWith(PAYLOAD_PADDING)){for(a=4;a<_.length&&_[a]==="0";)a+=1;let $="",j=0;const et=a;for(;a<_.length&&_[a]!=="0";){$+=_[a],j=parseInt($,16);const tt=_.length-$.length-et;if(j*2===tt){a+=1;break}if(j*2>tt)throw new Error("Invalid payload length");a+=1}}return _.slice(a)},decodePayload$1=_=>{try{return new TextDecoder("utf-8").decode(hex2buf(getPayloadHexBytes(_)))||_}catch{return _}};function _typeof$3(_){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof$3(_)}function toPrimitive(_,a){if(_typeof$3(_)!="object"||!_)return _;var $=_[Symbol.toPrimitive];if($!==void 0){var j=$.call(_,a||"default");if(_typeof$3(j)!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(_)}function toPropertyKey(_){var a=toPrimitive(_,"string");return _typeof$3(a)=="symbol"?a:a+""}function _defineProperty$4(_,a,$){return a=toPropertyKey(a),a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}function ownKeys$2(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread2(_){for(var a=1;a-1}function Gr(Xt,cr){var gr=this.__data__,Dr=Jn(gr,Xt);return Dr<0?(++this.size,gr.push([Xt,cr])):gr[Dr][1]=cr,this}hn.prototype.clear=fn,hn.prototype.delete=Kr,hn.prototype.get=$n,hn.prototype.has=dn,hn.prototype.set=Gr;function gn(Xt){var cr=-1,gr=Xt==null?0:Xt.length;for(this.clear();++cr1?gr[rn-1]:void 0,Pn=rn>2?gr[2]:void 0;for(xn=Xt.length>3&&typeof xn=="function"?(rn--,xn):void 0,Pn&&Yl(gr[0],gr[1],Pn)&&(xn=rn<3?void 0:xn,rn=1),cr=Object(cr);++Dr-1&&Xt%1==0&&Xt0){if(++cr>=et)return arguments[0]}else cr=0;return Xt.apply(void 0,arguments)}}function Al(Xt){if(Xt!=null){try{return Pr.call(Xt)}catch{}try{return Xt+""}catch{}}return""}function Xs(Xt,cr){return Xt===cr||Xt!==Xt&&cr!==cr}var Ro=es(function(){return arguments}())?es:function(Xt){return Ms(Xt)&&Rr.call(Xt,"callee")&&!ar.call(Xt,"callee")},Ls=Array.isArray;function uo(Xt){return Xt!=null&&Po(Xt.length)&&!Ao(Xt)}function Pl(Xt){return Ms(Xt)&&uo(Xt)}var fo=Wr||_r;function Ao(Xt){if(!Ts(Xt))return!1;var cr=Qn(Xt);return cr==ht||cr==bt||cr==ot||cr==It}function Po(Xt){return typeof Xt=="number"&&Xt>-1&&Xt%1==0&&Xt<=rt}function Ts(Xt){var cr=typeof Xt;return Xt!=null&&(cr=="object"||cr=="function")}function Ms(Xt){return Xt!=null&&typeof Xt=="object"}function Tl(Xt){if(!Ms(Xt)||Qn(Xt)!=Tt)return!1;var cr=Vt(Xt);if(cr===null)return!0;var gr=Rr.call(cr,"constructor")&&cr.constructor;return typeof gr=="function"&&gr instanceof gr&&Pr.call(gr)==Lr}var Bo=Qt?pr(Qt):us;function To(Xt){return _o(Xt,No(Xt))}function No(Xt){return uo(Xt)?ps(Xt):Wn(Xt)}var Xl=Go(function(Xt,cr,gr){as(Xt,cr,gr)});function rs(Xt){return function(){return Xt}}function Xn(Xt){return Xt}function _r(){return!1}_.exports=Xl})(lodash_merge,lodash_merge.exports);var lodash_mergeExports=lodash_merge.exports;const deepmerge$1=getDefaultExportFromCjs$1(lodash_mergeExports);var loglevel={exports:{}};(function(_){(function(a,$){_.exports?_.exports=$():a.log=$()})(commonjsGlobal,function(){var a=function(){},$="undefined",j=typeof window!==$&&typeof window.navigator!==$&&/Trident\/|MSIE /.test(window.navigator.userAgent),et=["trace","debug","info","warn","error"],tt={},rt=null;function nt(Et,Ct){var Pt=Et[Ct];if(typeof Pt.bind=="function")return Pt.bind(Et);try{return Function.prototype.bind.call(Pt,Et)}catch{return function(){return Function.prototype.apply.apply(Pt,[Et,arguments])}}}function it(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function ot(Et){return Et==="debug"&&(Et="log"),typeof console===$?!1:Et==="trace"&&j?it:console[Et]!==void 0?nt(console,Et):console.log!==void 0?nt(console,"log"):a}function st(){for(var Et=this.getLevel(),Ct=0;Ct=0&&yt<=Pt.levels.SILENT)return yt;throw new TypeError("log.setLevel() called with invalid level: "+Bt)}Pt.name=Et,Pt.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Pt.methodFactory=Ct||ut,Pt.getLevel=function(){return Lt??It??Tt},Pt.setLevel=function(Bt,yt){return Lt=Dt(Bt),yt!==!1&&Ut(Lt),st.call(Pt)},Pt.setDefaultLevel=function(Bt){It=Dt(Bt),jt()||Pt.setLevel(Bt,!1)},Pt.resetLevel=function(){Lt=null,Mt(),st.call(Pt)},Pt.enableAll=function(Bt){Pt.setLevel(Pt.levels.TRACE,Bt)},Pt.disableAll=function(Bt){Pt.setLevel(Pt.levels.SILENT,Bt)},Pt.rebuild=function(){if(rt!==Pt&&(Tt=Dt(rt.getLevel())),st.call(Pt),rt===Pt)for(var Bt in tt)tt[Bt].rebuild()},Tt=Dt(rt?rt.getLevel():"WARN");var Ft=jt();Ft!=null&&(Lt=Dt(Ft)),st.call(Pt)}rt=new ht,rt.getLogger=function(Ct){if(typeof Ct!="symbol"&&typeof Ct!="string"||Ct==="")throw new TypeError("You must supply a name when creating a logger.");var Pt=tt[Ct];return Pt||(Pt=tt[Ct]=new ht(Ct,rt.methodFactory)),Pt};var bt=typeof window!==$?window.log:void 0;return rt.noConflict=function(){return typeof window!==$&&window.log===rt&&(window.log=bt),rt},rt.getLoggers=function(){return tt},rt.default=rt,rt})})(loglevel);var loglevelExports=loglevel.exports;const log$1$1=getDefaultExportFromCjs$1(loglevelExports),log$6=log$1$1.getLogger("http-helpers");log$6.setLevel(loglevelExports.levels.INFO);let apiKey$2="torus-default";const gatewayAuthHeader$2="x-api-key";async function fetchAndTrace$2(_,a){let $=null;try{$=new URL(_)}catch{}return fetch(_,a)}function getApiKeyHeaders$2(){const _={};return _[gatewayAuthHeader$2]=apiKey$2,_}function debugLogResponse$2(_){log$6.info(`Response: ${_.status} ${_.statusText}`),log$6.info(`Url: ${_.url}`)}function logTracingHeader$1(_){log$6.info(`Request tracing with traceID=${_.headers.get("x-web3-correlation-id")}`)}const promiseTimeout$1=(_,a)=>{const $=new Promise((j,et)=>{const tt=setTimeout(()=>{clearTimeout(tt),et(new Error(`Timed out in ${_}ms`))},_)});return Promise.race([a,$])},get$2=async function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j={mode:"cors",headers:{}};$.useAPIKey&&(j.headers=_objectSpread2(_objectSpread2({},j.headers),getApiKeyHeaders$2()));const et=deepmerge$1(j,a,{method:"GET"}),tt=await fetchAndTrace$2(_,et);if(tt.ok){const rt=tt.headers.get("content-type");return rt!=null&&rt.includes("application/json")?tt.json():tt.text()}throw debugLogResponse$2(tt),tt},post$1=function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const et={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};j.useAPIKey&&(et.headers=_objectSpread2(_objectSpread2({},et.headers),getApiKeyHeaders$2()));const tt=deepmerge$1(et,$,{method:"POST"});return j.isUrlEncodedData?(tt.body=a,tt.headers["Content-Type"]==="application/json; charset=utf-8"&&delete tt.headers["Content-Type"]):tt.body=JSON.stringify(a),promiseTimeout$1(j.timeout||6e4,fetchAndTrace$2(_,tt).then(rt=>{if(j.logTracingHeader&&logTracingHeader$1(rt),rt.ok){const nt=rt.headers.get("content-type");return nt!=null&&nt.includes("application/json")?rt.json():rt.text()}throw debugLogResponse$2(rt),rt}))};function _objectWithoutPropertiesLoose(_,a){if(_==null)return{};var $={};for(var j in _)if(Object.prototype.hasOwnProperty.call(_,j)){if(a.indexOf(j)>=0)continue;$[j]=_[j]}return $}function _objectWithoutProperties(_,a){if(_==null)return{};var $=_objectWithoutPropertiesLoose(_,a),j,et;if(Object.getOwnPropertySymbols){var tt=Object.getOwnPropertySymbols(_);for(et=0;et=0)&&Object.prototype.propertyIsEnumerable.call(_,j)&&($[j]=_[j])}return $}const BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(a,$){const j=$.match(a);return j&&j.length>0&&j[1]||""}static getSecondMatch(a,$){const j=$.match(a);return j&&j.length>1&&j[2]||""}static matchAndReturnConst(a,$,j){if(a.test($))return j}static getWindowsVersionName(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(a){const $=a.split(".").splice(0,2).map(j=>parseInt(j,10)||0);if($.push(0),$[0]===10)switch($[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(a){const $=a.split(".").splice(0,2).map(j=>parseInt(j,10)||0);if($.push(0),!($[0]===1&&$[1]<5)){if($[0]===1&&$[1]<6)return"Cupcake";if($[0]===1&&$[1]>=6)return"Donut";if($[0]===2&&$[1]<2)return"Eclair";if($[0]===2&&$[1]===2)return"Froyo";if($[0]===2&&$[1]>2)return"Gingerbread";if($[0]===3)return"Honeycomb";if($[0]===4&&$[1]<1)return"Ice Cream Sandwich";if($[0]===4&&$[1]<4)return"Jelly Bean";if($[0]===4&&$[1]>=4)return"KitKat";if($[0]===5)return"Lollipop";if($[0]===6)return"Marshmallow";if($[0]===7)return"Nougat";if($[0]===8)return"Oreo";if($[0]===9)return"Pie"}}static getVersionPrecision(a){return a.split(".").length}static compareVersions(a,$,j=!1){const et=Utils.getVersionPrecision(a),tt=Utils.getVersionPrecision($);let rt=Math.max(et,tt),nt=0;const it=Utils.map([a,$],ot=>{const st=rt-Utils.getVersionPrecision(ot),at=ot+new Array(st+1).join(".0");return Utils.map(at.split("."),ut=>new Array(20-ut.length).join("0")+ut).reverse()});for(j&&(nt=rt-Math.min(et,tt)),rt-=1;rt>=nt;){if(it[0][rt]>it[1][rt])return 1;if(it[0][rt]===it[1][rt]){if(rt===nt)return 0;rt-=1}else if(it[0][rt]{j[it]=rt[it]})}return a}static getBrowserAlias(a){return BROWSER_ALIASES_MAP[a]}static getBrowserTypeByAlias(a){return BROWSER_MAP[a]||""}}const commonVersionIdentifier=/version\/(\d+(\.?_?\d+)+)/i,browsersList=[{test:[/googlebot/i],describe(_){const a={name:"Googlebot"},$=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/opera/i],describe(_){const a={name:"Opera"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/opr\/|opios/i],describe(_){const a={name:"Opera"},$=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/SamsungBrowser/i],describe(_){const a={name:"Samsung Internet for Android"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/Whale/i],describe(_){const a={name:"NAVER Whale Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/MZBrowser/i],describe(_){const a={name:"MZ Browser"},$=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/focus/i],describe(_){const a={name:"Focus"},$=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/swing/i],describe(_){const a={name:"Swing"},$=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/coast/i],describe(_){const a={name:"Opera Coast"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(_){const a={name:"Opera Touch"},$=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/yabrowser/i],describe(_){const a={name:"Yandex Browser"},$=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/ucbrowser/i],describe(_){const a={name:"UC Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/Maxthon|mxios/i],describe(_){const a={name:"Maxthon"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/epiphany/i],describe(_){const a={name:"Epiphany"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/puffin/i],describe(_){const a={name:"Puffin"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/sleipnir/i],describe(_){const a={name:"Sleipnir"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/k-meleon/i],describe(_){const a={name:"K-Meleon"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/micromessenger/i],describe(_){const a={name:"WeChat"},$=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/qqbrowser/i],describe(_){const a={name:/qqbrowserlite/i.test(_)?"QQ Browser Lite":"QQ Browser"},$=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/msie|trident/i],describe(_){const a={name:"Internet Explorer"},$=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/\sedg\//i],describe(_){const a={name:"Microsoft Edge"},$=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/edg([ea]|ios)/i],describe(_){const a={name:"Microsoft Edge"},$=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/vivaldi/i],describe(_){const a={name:"Vivaldi"},$=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/seamonkey/i],describe(_){const a={name:"SeaMonkey"},$=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/sailfish/i],describe(_){const a={name:"Sailfish"},$=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,_);return $&&(a.version=$),a}},{test:[/silk/i],describe(_){const a={name:"Amazon Silk"},$=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/phantom/i],describe(_){const a={name:"PhantomJS"},$=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/slimerjs/i],describe(_){const a={name:"SlimerJS"},$=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(_){const a={name:"BlackBerry"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/(web|hpw)[o0]s/i],describe(_){const a={name:"WebOS Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/bada/i],describe(_){const a={name:"Bada"},$=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/tizen/i],describe(_){const a={name:"Tizen"},$=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/qupzilla/i],describe(_){const a={name:"QupZilla"},$=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/firefox|iceweasel|fxios/i],describe(_){const a={name:"Firefox"},$=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/electron/i],describe(_){const a={name:"Electron"},$=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/MiuiBrowser/i],describe(_){const a={name:"Miui"},$=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/chromium/i],describe(_){const a={name:"Chromium"},$=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/chrome|crios|crmo/i],describe(_){const a={name:"Chrome"},$=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/GSA/i],describe(_){const a={name:"Google Search"},$=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test(_){const a=!_.test(/like android/i),$=_.test(/android/i);return a&&$},describe(_){const a={name:"Android Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/playstation 4/i],describe(_){const a={name:"PlayStation 4"},$=Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/safari|applewebkit/i],describe(_){const a={name:"Safari"},$=Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/.*/i],describe(_){const a=/^(.*)\/(.*) /,$=/^(.*)\/(.*)[ \t]\((.*)/,et=_.search("\\(")!==-1?$:a;return{name:Utils.getFirstMatch(et,_),version:Utils.getSecondMatch(et,_)}}}],osParsersList=[{test:[/Roku\/DVP/],describe(_){const a=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,_);return{name:OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe(_){const a=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,_);return{name:OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe(_){const a=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,_),$=Utils.getWindowsVersionName(a);return{name:OS_MAP.Windows,version:a,versionName:$}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(_){const a={name:OS_MAP.iOS},$=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,_);return $&&(a.version=$),a}},{test:[/macintosh/i],describe(_){const a=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,_).replace(/[_\s]/g,"."),$=Utils.getMacOSVersionName(a),j={name:OS_MAP.MacOS,version:a};return $&&(j.versionName=$),j}},{test:[/(ipod|iphone|ipad)/i],describe(_){const a=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,_).replace(/[_\s]/g,".");return{name:OS_MAP.iOS,version:a}}},{test(_){const a=!_.test(/like android/i),$=_.test(/android/i);return a&&$},describe(_){const a=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,_),$=Utils.getAndroidVersionName(a),j={name:OS_MAP.Android,version:a};return $&&(j.versionName=$),j}},{test:[/(web|hpw)[o0]s/i],describe(_){const a=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,_),$={name:OS_MAP.WebOS};return a&&a.length&&($.version=a),$}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(_){const a=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,_)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,_)||Utils.getFirstMatch(/\bbb(\d+)/i,_);return{name:OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe(_){const a=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,_);return{name:OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe(_){const a=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,_);return{name:OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe(){return{name:OS_MAP.Linux}}},{test:[/CrOS/],describe(){return{name:OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe(_){const a=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,_);return{name:OS_MAP.PlayStation4,version:a}}}],platformParsersList=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(_){const a=Utils.getFirstMatch(/(can-l01)/i,_)&&"Nova",$={type:PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&($.model=a),$}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:PLATFORMS_MAP.tablet}}},{test(_){const a=_.test(/ipod|iphone/i),$=_.test(/like (ipod|iphone)/i);return a&&!$},describe(_){const a=Utils.getFirstMatch(/(ipod|iphone)/i,_);return{type:PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:PLATFORMS_MAP.mobile}}},{test(_){return _.getBrowserName(!0)==="blackberry"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test(_){return _.getBrowserName(!0)==="bada"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(_){return _.getBrowserName()==="windows phone"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test(_){const a=Number(String(_.getOSVersion()).split(".")[0]);return _.getOSName(!0)==="android"&&a>=3},describe(){return{type:PLATFORMS_MAP.tablet}}},{test(_){return _.getOSName(!0)==="android"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(_){return _.getOSName(!0)==="macos"},describe(){return{type:PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test(_){return _.getOSName(!0)==="windows"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(_){return _.getOSName(!0)==="linux"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(_){return _.getOSName(!0)==="playstation 4"},describe(){return{type:PLATFORMS_MAP.tv}}},{test(_){return _.getOSName(!0)==="roku"},describe(){return{type:PLATFORMS_MAP.tv}}}],enginesParsersList=[{test(_){return _.getBrowserName(!0)==="microsoft edge"},describe(_){if(/\sedg\//i.test(_))return{name:ENGINE_MAP.Blink};const $=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,_);return{name:ENGINE_MAP.EdgeHTML,version:$}}},{test:[/trident/i],describe(_){const a={name:ENGINE_MAP.Trident},$=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test(_){return _.test(/presto/i)},describe(_){const a={name:ENGINE_MAP.Presto},$=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test(_){const a=_.test(/gecko/i),$=_.test(/like gecko/i);return a&&!$},describe(_){const a={name:ENGINE_MAP.Gecko},$=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe(_){const a={name:ENGINE_MAP.WebKit},$=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}}];class Parser{constructor(a,$=!1){if(a==null||a==="")throw new Error("UserAgent parameter can't be empty");this._ua=a,this.parsedResult={},$!==!0&&this.parse()}getUA(){return this._ua}test(a){return a.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const a=Utils.find(browsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.browser=a.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(a){return a?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const a=Utils.find(osParsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.os=a.describe(this.getUA())),this.parsedResult.os}getOSName(a){const{name:$}=this.getOS();return a?String($).toLowerCase()||"":$||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(a=!1){const{type:$}=this.getPlatform();return a?String($).toLowerCase()||"":$||""}parsePlatform(){this.parsedResult.platform={};const a=Utils.find(platformParsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.platform=a.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(a){return a?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const a=Utils.find(enginesParsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.engine=a.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(a){const $={};let j=0;const et={};let tt=0;if(Object.keys(a).forEach(nt=>{const it=a[nt];typeof it=="string"?(et[nt]=it,tt+=1):typeof it=="object"&&($[nt]=it,j+=1)}),j>0){const nt=Object.keys($),it=Utils.find(nt,st=>this.isOS(st));if(it){const st=this.satisfies($[it]);if(st!==void 0)return st}const ot=Utils.find(nt,st=>this.isPlatform(st));if(ot){const st=this.satisfies($[ot]);if(st!==void 0)return st}}if(tt>0){const nt=Object.keys(et),it=Utils.find(nt,ot=>this.isBrowser(ot,!0));if(it!==void 0)return this.compareVersion(et[it])}}isBrowser(a,$=!1){const j=this.getBrowserName().toLowerCase();let et=a.toLowerCase();const tt=Utils.getBrowserTypeByAlias(et);return $&&tt&&(et=tt.toLowerCase()),et===j}compareVersion(a){let $=[0],j=a,et=!1;const tt=this.getBrowserVersion();if(typeof tt=="string")return a[0]===">"||a[0]==="<"?(j=a.substr(1),a[1]==="="?(et=!0,j=a.substr(2)):$=[],a[0]===">"?$.push(1):$.push(-1)):a[0]==="="?j=a.substr(1):a[0]==="~"&&(et=!0,j=a.substr(1)),$.indexOf(Utils.compareVersions(tt,j,et))>-1}isOS(a){return this.getOSName(!0)===String(a).toLowerCase()}isPlatform(a){return this.getPlatformType(!0)===String(a).toLowerCase()}isEngine(a){return this.getEngineName(!0)===String(a).toLowerCase()}is(a,$=!1){return this.isBrowser(a,$)||this.isOS(a)||this.isPlatform(a)}some(a=[]){return a.some($=>this.is($))}}/*! + */var isBuffer_1=function(_){return _!=null&&(isBuffer(_)||isSlowBuffer(_)||!!_._isBuffer)};function isBuffer(_){return!!_.constructor&&typeof _.constructor.isBuffer=="function"&&_.constructor.isBuffer(_)}function isSlowBuffer(_){return typeof _.readFloatLE=="function"&&typeof _.slice=="function"&&isBuffer(_.slice(0,0))}(function(){var _=cryptExports,a=charenc_1.utf8,$=isBuffer_1,j=charenc_1.bin,et=function(tt,rt){tt.constructor==String?rt&&rt.encoding==="binary"?tt=j.stringToBytes(tt):tt=a.stringToBytes(tt):$(tt)?tt=Array.prototype.slice.call(tt,0):!Array.isArray(tt)&&tt.constructor!==Uint8Array&&(tt=tt.toString());for(var nt=_.bytesToWords(tt),it=tt.length*8,at=1732584193,st=-271733879,ot=-1732584194,ut=271733878,dt=0;dt>>24)&16711935|(nt[dt]<<24|nt[dt]>>>8)&4278255360;nt[it>>>5]|=128<>>9<<4)+14]=it;for(var mt=et._ff,xt=et._gg,Ct=et._hh,Pt=et._ii,dt=0;dt>>0,st=st+kt>>>0,ot=ot+Lt>>>0,ut=ut+Nt>>>0}return _.endian([at,st,ot,ut])};et._ff=function(tt,rt,nt,it,at,st,ot){var ut=tt+(rt&nt|~rt&it)+(at>>>0)+ot;return(ut<>>32-st)+rt},et._gg=function(tt,rt,nt,it,at,st,ot){var ut=tt+(rt&it|nt&~it)+(at>>>0)+ot;return(ut<>>32-st)+rt},et._hh=function(tt,rt,nt,it,at,st,ot){var ut=tt+(rt^nt^it)+(at>>>0)+ot;return(ut<>>32-st)+rt},et._ii=function(tt,rt,nt,it,at,st,ot){var ut=tt+(nt^(rt|~it))+(at>>>0)+ot;return(ut<>>32-st)+rt},et._blocksize=16,et._digestsize=16,md5$1.exports=function(tt,rt){if(tt==null)throw new Error("Illegal argument "+tt);var nt=_.wordsToBytes(et(tt,rt));return rt&&rt.asBytes?nt:rt&&rt.asString?j.bytesToString(nt):_.bytesToHex(nt)}})();var md5Exports=md5$1.exports;const md5=getDefaultExportFromCjs$1(md5Exports),ReactIdenticon=React$2.memo(({count:_=5,background:a,string:$,size:j})=>{const et=reactExports.useRef(null);reactExports.useEffect(()=>{tt()});const tt=()=>{const rt=md5($),nt=Math.floor(j/_),it=rt.slice(0,6),at=et.current;at.width=nt*_,at.height=nt*_;const st=rt.split("").map(dt=>parseInt(dt,16)).map(dt=>dt<8?0:1),ot=[];ot[0]=ot[4]=st.slice(0,5),ot[1]=ot[3]=st.slice(5,10),ot[2]=st.slice(10,15);const ut=at.getContext("2d");ut.imageSmoothingEnabled=!1,ut.clearRect(0,0,at.width,at.height),ot.forEach((dt,mt)=>{dt.forEach((xt,Ct)=>{xt?(ut.fillStyle="#"+it,ut.fillRect(nt*mt,nt*Ct,nt,nt)):(ut.fillStyle=a,ut.fillRect(nt*mt,nt*Ct,nt,nt))})})};return jsxRuntimeExports.jsx("canvas",{ref:et,style:{width:j,height:j}})}),color=_=>`#${md5(_).slice(0,6)}`,Identicon=({address:_,identiconSize:a,...$})=>jsxRuntimeExports.jsx(Box,{sx:{canvas:{borderRadius:"4px"}},zIndex:3,background:"white",borderRadius:"4px","data-testid":"identicon",...$,children:jsxRuntimeExports.jsx(ReactIdenticon,{background:"white",size:a,string:_.pkh,style:{borderRadius:4}})}),SIZES$1={lg:{defaults:{width:"48px",height:"48px",borderRadius:"4px"},mnemonic:{padding:"8px",identiconSize:32},ledger:{padding:"10px"},secret_key:{padding:"8px",identiconSize:32},multisig:{padding:"10px"},social:{google:{paddingX:"10.28px",paddingY:"10px"},facebook:{padding:"9px"},twitter:{paddingX:"12.78px",paddingY:"13.5px"},reddit:{padding:"10px"},email:{padding:"10px"}}},sm:{defaults:{width:"30px",height:"30px",borderRadius:"4px"},mnemonic:{padding:"5px",identiconSize:20},ledger:{padding:"5px"},secret_key:{padding:"5px",identiconSize:20},multisig:{padding:"5px"},social:{google:{paddingX:"6.425px",paddingY:"6.25px"},facebook:{padding:"6px"},twitter:{paddingX:"7.5px",paddingY:"8px"},reddit:{padding:"6px"},email:{padding:"6px"}}}},AccountTileIcon=reactExports.memo(({account:_,size:a})=>{const $=SIZES$1[a],j=$.defaults;switch(_.type){case"secret_key":return jsxRuntimeExports.jsx(Identicon,{address:_.address,...j,...$.secret_key});case"mnemonic":return jsxRuntimeExports.jsx(Identicon,{address:_.address,...j,...$.mnemonic});case"ledger":return jsxRuntimeExports.jsx(LedgerIcon,{...j,...$.ledger,background:colors.gray[500]});case"multisig":return jsxRuntimeExports.jsx(KeyIcon,{...j,...$.multisig,stroke:colors.gray[400],background:colors.gray[500]});case"social":switch(_.idp){case"google":return jsxRuntimeExports.jsx(GoogleIcon,{...j,...$.social.google,background:"white"});case"facebook":return jsxRuntimeExports.jsx(FacebookIcon,{...j,...$.social.facebook,background:"white"});case"twitter":return jsxRuntimeExports.jsx(TwitterIcon,{...j,...$.social.twitter,background:"white"});case"reddit":return jsxRuntimeExports.jsx(RedditIcon,{...j,...$.social.reddit,background:"white"});case"email":return jsxRuntimeExports.jsx(EmailIcon,{...j,...$.social.email,color:"black",background:"white"})}}}),baseIconProps={stroke:colors.gray[400],borderRadius:"4px",background:colors.gray[500]},AddressTileIcon=reactExports.memo(({addressKind:_,size:a})=>{const j=useGetOwnedAccountSafe()(_.pkh);if(j)return jsxRuntimeExports.jsx(AccountTileIcon,{account:j,size:a});let et,tt;switch(a){case"sm":et="30px",tt="5px";break;case"lg":et="48px",tt="10px"}switch(_.type){case"contact":return jsxRuntimeExports.jsx(ContactIcon,{width:et,height:et,padding:tt,...baseIconProps});case"unknown":return jsxRuntimeExports.jsx(UnknownContactIcon,{width:et,height:et,padding:tt,...baseIconProps});case"baker":return jsxRuntimeExports.jsx(Image$1,{height:et,"data-testid":"baker-icon",src:`https://services.tzkt.io/v1/avatars/${_.pkh}`});case"secret_key":case"mnemonic":case"social":case"ledger":case"multisig":return null}}),useAddressKind$1=_=>{const a=useOwnedAccountAddressKind$1(_),$=useBakerAddressKind(_),j=useContactAddressKind(_);return a||$||j||{pkh:_.pkh,type:"unknown",label:null}},useOwnedAccountAddressKind$1=({pkh:_})=>{const $=useGetOwnedAccountSafe()(_);return $?{type:$.type,pkh:_,label:$.label}:null},useBakerAddressKind=({pkh:_})=>{const $=useGetBaker()(_);return $?{pkh:_,type:"baker",label:$.name}:null},useContactAddressKind=({pkh:_})=>{const $=useGetContactName()(_);return $?{pkh:_,type:"contact",label:$}:null},splitNumber=_=>{const[a,$]=_.split(".");return{integer:a,decimal:$}},PrettyNumber=({number:_,size:a="md",...$})=>{const j=a==="md"?"md":"lg",et=a==="md"?"sm":"md",{integer:tt,decimal:rt}=splitNumber(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"end","data-testid":"pretty-number",...$,children:[jsxRuntimeExports.jsx(Heading,{size:j,children:tt}),rt&&jsxRuntimeExports.jsxs(Heading,{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",size:et,children:[".",rt]})]})},AccountBalance=({address:_,size:a,numberProps:$,...j})=>{const tt=useGetAccountBalance()(_);if(!tt)return null;const rt=prettyTezAmount(tt);return jsxRuntimeExports.jsx(Box,{overflow:"hidden",textAlign:"right","data-testid":"account-balance",...j,children:jsxRuntimeExports.jsx(PrettyNumber,{number:rt,size:a,...$})})},AddressTile=({address:_,hideBalance:a=!1,...$})=>{const j=useAddressKind$1(_);return jsxRuntimeExports.jsx(Tooltip,{background:colors.white,hasArrow:!0,label:j.label,placement:"left",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",width:"100%",padding:"9px 10px",background:colors.gray[800],borderRadius:"4px","data-testid":"address-tile",...$,children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",width:a?"100%":"calc(100% - 95px)",children:[jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:j,size:"sm"}),j.type==="unknown"?jsxRuntimeExports.jsx(Text,{marginLeft:"10px",color:colors.gray[300],size:"sm",children:_.pkh}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{overflow:"hidden",width:"100%",marginLeft:"10px",whiteSpace:"nowrap",children:jsxRuntimeExports.jsx(Heading,{overflow:"hidden",textOverflow:"ellipsis",size:"sm",children:j.label})}),jsxRuntimeExports.jsx(Text,{width:"89px",marginLeft:"10px",color:colors.gray[300],size:"xs",children:formatPkh(j.pkh)})]})]}),!a&&jsxRuntimeExports.jsx(AccountBalance,{overflow:"hidden",marginLeft:"10px",textAlign:"right",address:_.pkh,numberProps:{maxWidth:"85px"}})]})})},Suggestions=({contacts:_,hideBalance:a,onChange:$})=>_.length===0?null:jsxRuntimeExports.jsx(UnorderedList,{position:"absolute",zIndex:2,overflowY:"auto",width:"100%",maxHeight:"300px",marginTop:"8px",marginLeft:0,background:colors.gray[700],border:"1px solid",borderColor:colors.gray[500],borderRadius:"8px","data-testid":"suggestions-list",listStyleType:"none",children:_.map((j,et)=>jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(ListItem,{marginBottom:et===_.length-1?"5px":0,padding:"5px 15px 0 5px",onMouseDown:()=>{$(j.name)},children:jsxRuntimeExports.jsx(AddressTile,{height:"40px",padding:"10px 8px 10px 5px",background:colors.gray[700],borderRadius:"4px",_hover:{background:colors.gray[500]},cursor:"pointer",address:parsePkh(j.pkh),hideBalance:a})})},j.pkh))}),getSuggestions=(_,a)=>a.filter($=>!_.trim()||$.name.toLowerCase().includes(_.trim().toLowerCase())),AddressAutocomplete=({contacts:_,isDisabled:a,isLoading:$=!1,allowUnknown:j,inputName:et,onUpdate:tt,validate:rt,label:nt,keepValid:it,style:at,size:st,hideBalance:ot=!1})=>{const{register:ut,setValue:dt,formState:{defaultValues:mt},getValues:xt}=useFormContext(),Ct=dt,Pt=reactExports.useId(),[Tt,kt]=reactExports.useState(()=>{var bt;if(it||!mt)return"";const yt=lodashExports.get(mt,et);return yt?((bt=_.find(ct=>ct.pkh===yt))==null?void 0:bt.name)||yt:""}),[Lt,Nt]=reactExports.useState(!0),[zt,jt]=reactExports.useState(getSuggestions("",_)),Mt=xt(et),Dt=yt=>{kt(yt),jt(getSuggestions(yt,_));const bt=_.find(ht=>ht.name===yt||ht.pkh===yt);let ct;if(bt!==void 0)ct=bt.pkh,Nt(!0);else if(j&&isAddressValid(yt))ct=yt;else{if(it)return;ct=""}Ct(et,ct,{shouldValidate:!0}),tt&&tt(ct)};let Ft="raw_input";$?Ft="selected_tile":a?Ft="disabled_tile":Mt&&(Ft="selected_tile");const Bt=()=>{Dt(""),Nt(!1)};return jsxRuntimeExports.jsxs(Box,{"data-testid":`address-autocomplete-${et}`,children:[jsxRuntimeExports.jsx(FormLabel,{htmlFor:Pt,children:nt}),Ft==="disabled_tile"&&jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Mt)}),Ft==="selected_tile"&&jsxRuntimeExports.jsx(Box,{height:"48px",background:colors.gray[800],border:"1px solid",borderColor:colors.gray[500],borderRadius:"4px","data-testid":`selected-address-tile-${Mt}`,onClick:Bt,paddingY:0,children:jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",cursor:"pointer","data-testid":"clear-selected-button",children:[jsxRuntimeExports.jsx(AddressTile,{width:st==="short"?"338px":"365px",paddingTop:"8px",background:"transparent",address:parsePkh(Mt)}),it?jsxRuntimeExports.jsx(ChevronDownIcon$1,{marginRight:"12px","data-testid":"chevron-icon"}):jsxRuntimeExports.jsx(CrossButton,{marginRight:"14px"})]})}),Ft==="raw_input"&&jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{...at,"aria-label":et,autoComplete:"off",id:Pt,onBlur:yt=>{if(yt.preventDefault(),Nt(!0),it&&Mt!==yt.target.value)return Dt(Mt);Dt(yt.target.value)},onChange:yt=>Dt(yt.target.value),onFocus:()=>Nt(!1),placeholder:"Enter address or contact name",value:Tt}),jsxRuntimeExports.jsx(InputRightElement,{children:Tt?jsxRuntimeExports.jsx(CrossButton,{marginRight:"0px",onClick:Bt}):jsxRuntimeExports.jsx(ChevronDownIcon$1,{"data-testid":"chevron-icon"})})]}),jsxRuntimeExports.jsx(Input,{...ut(et,{required:"Invalid address or contact name",validate:rt}),marginBottom:0,"data-testid":`real-address-input-${et}`,name:et,type:"hidden"}),!Lt&&jsxRuntimeExports.jsx(Suggestions,{contacts:zt,hideBalance:ot,onChange:Dt})]})},CrossButton=_=>jsxRuntimeExports.jsx(XMark,{marginRight:"16px",stroke:colors.gray[450],cursor:"pointer","data-testid":"clear-input-button",..._}),KnownAccountsAutocomplete=_=>{const a=useContactsForSelectedNetwork(),$=useAllAccounts().map(j=>({name:j.label,pkh:j.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a.concat($)})},OwnedImplicitAccountsAutocomplete=_=>{const a=useImplicitAccounts().map($=>({name:$.label,pkh:$.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a})},OwnedAccountsAutocomplete=_=>{const a=useAllAccounts().map($=>({name:$.label,pkh:$.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a})},BakersAutocomplete=_=>{const a=useBakerList().map($=>({name:$.name,pkh:$.address}));return jsxRuntimeExports.jsx(AddressAutocomplete,{..._,contacts:a,hideBalance:!0})},AvailableSignersAutocomplete=_=>{const $=useGetOwnedSignersForAccount()(_.account).map(j=>({name:j.label,pkh:j.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{allowUnknown:!1,contacts:$,isDisabled:$.length===1,..._})},getErrorContext=_=>{let a="Something went wrong";typeof _=="object"&&"message"in _?a=_.message:typeof _=="string"&&(a=_);let $="";return typeof _=="object"&&"stack"in _&&($=_.stack),{timestamp:new Date().toISOString(),description:a,stacktrace:$}},useAsyncActionHandler=()=>{const[_,a]=reactExports.useState(!1),$=reactExports.useRef(_),j=useToast(),et=useAppDispatch(),tt=reactExports.useCallback(async(nt,it)=>{if(!$.current){$.current=!0,a(!0);try{return await nt()}catch(at){const st=getErrorContext(at);throw j({description:st.description,status:"error",...typeof it=="function"?it(at):it}),et(errorsSlice.actions.add(st)),at}finally{$.current=!1,a(!1)}}},[et,j]),rt=reactExports.useCallback(async(nt,it)=>tt(nt,it).catch(()=>{}),[tt]);return{isLoading:_,handleAsyncAction:rt,handleAsyncActionUnsafe:tt}},PermissionRequestModal=({request:_})=>{const a=useAddConnection(),$=useGetImplicitAccount(),{onClose:j}=reactExports.useContext(DynamicModalContext),{handleAsyncAction:et}=useAsyncActionHandler(),tt=useForm({mode:"onBlur"}),{getValues:rt,formState:{errors:nt,isValid:it}}=tt,at=useRemovePeerBySenderId(),st=()=>{at(_.senderId),WalletClient.respond({id:_.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.NOT_GRANTED_ERROR})},ot=()=>et(async()=>{const ut=$(rt().address),dt={type:BeaconMessageType.PermissionResponse,network:_.network,scopes:_.scopes,id:_.id,publicKey:ut.pk,walletType:"implicit"};await WalletClient.respond(dt),a(_.senderId,ut.address.pkh,_.network.type)}).finally(j);return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"24px",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",children:"Permission Request"}),jsxRuntimeExports.jsxs(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:[_.appMetadata.name," is requesting permission to sign this operation."]}),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(_.network.type)})]})]}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:st}),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:_.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:_.appMetadata.name})]}),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:"Request"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{children:jsxRuntimeExports.jsx(JsValueWrap,{overflow:"auto",maxHeight:"250px",value:_})})]})}),jsxRuntimeExports.jsx(FormProvider,{...tt,children:jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!nt.address,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"address",label:"Select Account"}),nt.address&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.address.message})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!it,onClick:ot,size:"lg",children:"Allow"})})]})},PAYLOAD_PADDING="0501",getPayloadHexBytes=_=>{let a=0;if(_.startsWith(PAYLOAD_PADDING)){for(a=4;a<_.length&&_[a]==="0";)a+=1;let $="",j=0;const et=a;for(;a<_.length&&_[a]!=="0";){$+=_[a],j=parseInt($,16);const tt=_.length-$.length-et;if(j*2===tt){a+=1;break}if(j*2>tt)throw new Error("Invalid payload length");a+=1}}return _.slice(a)},decodePayload$1=_=>{try{return new TextDecoder("utf-8").decode(hex2buf(getPayloadHexBytes(_)))||_}catch{return _}};function _typeof$3(_){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof$3(_)}function toPrimitive(_,a){if(_typeof$3(_)!="object"||!_)return _;var $=_[Symbol.toPrimitive];if($!==void 0){var j=$.call(_,a||"default");if(_typeof$3(j)!="object")return j;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(_)}function toPropertyKey(_){var a=toPrimitive(_,"string");return _typeof$3(a)=="symbol"?a:a+""}function _defineProperty$4(_,a,$){return(a=toPropertyKey(a))in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}function ownKeys$2(_,a){var $=Object.keys(_);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(_);a&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(_,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread2(_){for(var a=1;a-1}function Gr(Xt,cr){var gr=this.__data__,Dr=Jn(gr,Xt);return Dr<0?(++this.size,gr.push([Xt,cr])):gr[Dr][1]=cr,this}hn.prototype.clear=fn,hn.prototype.delete=Kr,hn.prototype.get=$n,hn.prototype.has=dn,hn.prototype.set=Gr;function gn(Xt){var cr=-1,gr=Xt==null?0:Xt.length;for(this.clear();++cr1?gr[rn-1]:void 0,Pn=rn>2?gr[2]:void 0;for(xn=Xt.length>3&&typeof xn=="function"?(rn--,xn):void 0,Pn&&Yl(gr[0],gr[1],Pn)&&(xn=rn<3?void 0:xn,rn=1),cr=Object(cr);++Dr-1&&Xt%1==0&&Xt0){if(++cr>=et)return arguments[0]}else cr=0;return Xt.apply(void 0,arguments)}}function Al(Xt){if(Xt!=null){try{return Pr.call(Xt)}catch{}try{return Xt+""}catch{}}return""}function Xs(Xt,cr){return Xt===cr||Xt!==Xt&&cr!==cr}var Eo=es(function(){return arguments}())?es:function(Xt){return Ms(Xt)&&Rr.call(Xt,"callee")&&!or.call(Xt,"callee")},Ls=Array.isArray;function so(Xt){return Xt!=null&&_o(Xt.length)&&!wo(Xt)}function Pl(Xt){return Ms(Xt)&&so(Xt)}var ao=Wr||_r;function wo(Xt){if(!Ts(Xt))return!1;var cr=Qn(Xt);return cr==dt||cr==mt||cr==at||cr==kt}function _o(Xt){return typeof Xt=="number"&&Xt>-1&&Xt%1==0&&Xt<=rt}function Ts(Xt){var cr=typeof Xt;return Xt!=null&&(cr=="object"||cr=="function")}function Ms(Xt){return Xt!=null&&typeof Xt=="object"}function Tl(Xt){if(!Ms(Xt)||Qn(Xt)!=Tt)return!1;var cr=qt(Xt);if(cr===null)return!0;var gr=Rr.call(cr,"constructor")&&cr.constructor;return typeof gr=="function"&&gr instanceof gr&&Pr.call(gr)==Lr}var Io=Qt?pr(Qt):us;function So(Xt){return vo(Xt,ko(Xt))}function ko(Xt){return so(Xt)?ps(Xt):Wn(Xt)}var Xl=Ho(function(Xt,cr,gr){os(Xt,cr,gr)});function rs(Xt){return function(){return Xt}}function Xn(Xt){return Xt}function _r(){return!1}_.exports=Xl})(lodash_merge,lodash_merge.exports);var lodash_mergeExports=lodash_merge.exports;const deepmerge$1=getDefaultExportFromCjs$1(lodash_mergeExports);var loglevel={exports:{}};(function(_){(function(a,$){_.exports?_.exports=$():a.log=$()})(commonjsGlobal,function(){var a=function(){},$="undefined",j=typeof window!==$&&typeof window.navigator!==$&&/Trident\/|MSIE /.test(window.navigator.userAgent),et=["trace","debug","info","warn","error"],tt={},rt=null;function nt(xt,Ct){var Pt=xt[Ct];if(typeof Pt.bind=="function")return Pt.bind(xt);try{return Function.prototype.bind.call(Pt,xt)}catch{return function(){return Function.prototype.apply.apply(Pt,[xt,arguments])}}}function it(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function at(xt){return xt==="debug"&&(xt="log"),typeof console===$?!1:xt==="trace"&&j?it:console[xt]!==void 0?nt(console,xt):console.log!==void 0?nt(console,"log"):a}function st(){for(var xt=this.getLevel(),Ct=0;Ct=0&&yt<=Pt.levels.SILENT)return yt;throw new TypeError("log.setLevel() called with invalid level: "+Bt)}Pt.name=xt,Pt.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Pt.methodFactory=Ct||ut,Pt.getLevel=function(){return Lt??kt??Tt},Pt.setLevel=function(Bt,yt){return Lt=Dt(Bt),yt!==!1&&zt(Lt),st.call(Pt)},Pt.setDefaultLevel=function(Bt){kt=Dt(Bt),jt()||Pt.setLevel(Bt,!1)},Pt.resetLevel=function(){Lt=null,Mt(),st.call(Pt)},Pt.enableAll=function(Bt){Pt.setLevel(Pt.levels.TRACE,Bt)},Pt.disableAll=function(Bt){Pt.setLevel(Pt.levels.SILENT,Bt)},Pt.rebuild=function(){if(rt!==Pt&&(Tt=Dt(rt.getLevel())),st.call(Pt),rt===Pt)for(var Bt in tt)tt[Bt].rebuild()},Tt=Dt(rt?rt.getLevel():"WARN");var Ft=jt();Ft!=null&&(Lt=Dt(Ft)),st.call(Pt)}rt=new dt,rt.getLogger=function(Ct){if(typeof Ct!="symbol"&&typeof Ct!="string"||Ct==="")throw new TypeError("You must supply a name when creating a logger.");var Pt=tt[Ct];return Pt||(Pt=tt[Ct]=new dt(Ct,rt.methodFactory)),Pt};var mt=typeof window!==$?window.log:void 0;return rt.noConflict=function(){return typeof window!==$&&window.log===rt&&(window.log=mt),rt},rt.getLoggers=function(){return tt},rt.default=rt,rt})})(loglevel);var loglevelExports=loglevel.exports;const log$1$1=getDefaultExportFromCjs$1(loglevelExports),log$7=log$1$1.getLogger("http-helpers");log$7.setLevel(loglevelExports.levels.INFO);let apiKey$2="torus-default";const gatewayAuthHeader$2="x-api-key";async function fetchAndTrace$2(_,a){let $=null;try{$=new URL(_)}catch{}return fetch(_,a)}function getApiKeyHeaders$2(){const _={};return _[gatewayAuthHeader$2]=apiKey$2,_}function debugLogResponse$2(_){log$7.info(`Response: ${_.status} ${_.statusText}`),log$7.info(`Url: ${_.url}`)}function logTracingHeader$1(_){log$7.info(`Request tracing with traceID=${_.headers.get("x-web3-correlation-id")}`)}const promiseTimeout$1=(_,a)=>{const $=new Promise((j,et)=>{const tt=setTimeout(()=>{clearTimeout(tt),et(new Error(`Timed out in ${_}ms`))},_)});return Promise.race([a,$])},get$2=async function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j={mode:"cors",headers:{}};$.useAPIKey&&(j.headers=_objectSpread2(_objectSpread2({},j.headers),getApiKeyHeaders$2()));const et=deepmerge$1(j,a,{method:"GET"}),tt=await fetchAndTrace$2(_,et);if(tt.ok){const rt=tt.headers.get("content-type");return rt!=null&&rt.includes("application/json")?tt.json():tt.text()}throw debugLogResponse$2(tt),tt},post$1=function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const et={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};j.useAPIKey&&(et.headers=_objectSpread2(_objectSpread2({},et.headers),getApiKeyHeaders$2()));const tt=deepmerge$1(et,$,{method:"POST"});return j.isUrlEncodedData?(tt.body=a,tt.headers["Content-Type"]==="application/json; charset=utf-8"&&delete tt.headers["Content-Type"]):tt.body=JSON.stringify(a),promiseTimeout$1(j.timeout||6e4,fetchAndTrace$2(_,tt).then(rt=>{if(j.logTracingHeader&&logTracingHeader$1(rt),rt.ok){const nt=rt.headers.get("content-type");return nt!=null&&nt.includes("application/json")?rt.json():rt.text()}throw debugLogResponse$2(rt),rt}))};function _objectWithoutPropertiesLoose(_,a){if(_==null)return{};var $={};for(var j in _)if({}.hasOwnProperty.call(_,j)){if(a.indexOf(j)>=0)continue;$[j]=_[j]}return $}function _objectWithoutProperties(_,a){if(_==null)return{};var $,j,et=_objectWithoutPropertiesLoose(_,a);if(Object.getOwnPropertySymbols){var tt=Object.getOwnPropertySymbols(_);for(j=0;j=0||{}.propertyIsEnumerable.call(_,$)&&(et[$]=_[$])}return et}const BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(a,$){const j=$.match(a);return j&&j.length>0&&j[1]||""}static getSecondMatch(a,$){const j=$.match(a);return j&&j.length>1&&j[2]||""}static matchAndReturnConst(a,$,j){if(a.test($))return j}static getWindowsVersionName(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(a){const $=a.split(".").splice(0,2).map(j=>parseInt(j,10)||0);if($.push(0),$[0]===10)switch($[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(a){const $=a.split(".").splice(0,2).map(j=>parseInt(j,10)||0);if($.push(0),!($[0]===1&&$[1]<5)){if($[0]===1&&$[1]<6)return"Cupcake";if($[0]===1&&$[1]>=6)return"Donut";if($[0]===2&&$[1]<2)return"Eclair";if($[0]===2&&$[1]===2)return"Froyo";if($[0]===2&&$[1]>2)return"Gingerbread";if($[0]===3)return"Honeycomb";if($[0]===4&&$[1]<1)return"Ice Cream Sandwich";if($[0]===4&&$[1]<4)return"Jelly Bean";if($[0]===4&&$[1]>=4)return"KitKat";if($[0]===5)return"Lollipop";if($[0]===6)return"Marshmallow";if($[0]===7)return"Nougat";if($[0]===8)return"Oreo";if($[0]===9)return"Pie"}}static getVersionPrecision(a){return a.split(".").length}static compareVersions(a,$,j=!1){const et=Utils.getVersionPrecision(a),tt=Utils.getVersionPrecision($);let rt=Math.max(et,tt),nt=0;const it=Utils.map([a,$],at=>{const st=rt-Utils.getVersionPrecision(at),ot=at+new Array(st+1).join(".0");return Utils.map(ot.split("."),ut=>new Array(20-ut.length).join("0")+ut).reverse()});for(j&&(nt=rt-Math.min(et,tt)),rt-=1;rt>=nt;){if(it[0][rt]>it[1][rt])return 1;if(it[0][rt]===it[1][rt]){if(rt===nt)return 0;rt-=1}else if(it[0][rt]{j[it]=rt[it]})}return a}static getBrowserAlias(a){return BROWSER_ALIASES_MAP[a]}static getBrowserTypeByAlias(a){return BROWSER_MAP[a]||""}}const commonVersionIdentifier=/version\/(\d+(\.?_?\d+)+)/i,browsersList=[{test:[/googlebot/i],describe(_){const a={name:"Googlebot"},$=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/opera/i],describe(_){const a={name:"Opera"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/opr\/|opios/i],describe(_){const a={name:"Opera"},$=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/SamsungBrowser/i],describe(_){const a={name:"Samsung Internet for Android"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/Whale/i],describe(_){const a={name:"NAVER Whale Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/MZBrowser/i],describe(_){const a={name:"MZ Browser"},$=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/focus/i],describe(_){const a={name:"Focus"},$=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/swing/i],describe(_){const a={name:"Swing"},$=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/coast/i],describe(_){const a={name:"Opera Coast"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(_){const a={name:"Opera Touch"},$=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/yabrowser/i],describe(_){const a={name:"Yandex Browser"},$=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/ucbrowser/i],describe(_){const a={name:"UC Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/Maxthon|mxios/i],describe(_){const a={name:"Maxthon"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/epiphany/i],describe(_){const a={name:"Epiphany"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/puffin/i],describe(_){const a={name:"Puffin"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/sleipnir/i],describe(_){const a={name:"Sleipnir"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/k-meleon/i],describe(_){const a={name:"K-Meleon"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/micromessenger/i],describe(_){const a={name:"WeChat"},$=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/qqbrowser/i],describe(_){const a={name:/qqbrowserlite/i.test(_)?"QQ Browser Lite":"QQ Browser"},$=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/msie|trident/i],describe(_){const a={name:"Internet Explorer"},$=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/\sedg\//i],describe(_){const a={name:"Microsoft Edge"},$=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/edg([ea]|ios)/i],describe(_){const a={name:"Microsoft Edge"},$=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/vivaldi/i],describe(_){const a={name:"Vivaldi"},$=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/seamonkey/i],describe(_){const a={name:"SeaMonkey"},$=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/sailfish/i],describe(_){const a={name:"Sailfish"},$=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,_);return $&&(a.version=$),a}},{test:[/silk/i],describe(_){const a={name:"Amazon Silk"},$=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/phantom/i],describe(_){const a={name:"PhantomJS"},$=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/slimerjs/i],describe(_){const a={name:"SlimerJS"},$=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(_){const a={name:"BlackBerry"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/(web|hpw)[o0]s/i],describe(_){const a={name:"WebOS Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/bada/i],describe(_){const a={name:"Bada"},$=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/tizen/i],describe(_){const a={name:"Tizen"},$=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/qupzilla/i],describe(_){const a={name:"QupZilla"},$=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/firefox|iceweasel|fxios/i],describe(_){const a={name:"Firefox"},$=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/electron/i],describe(_){const a={name:"Electron"},$=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/MiuiBrowser/i],describe(_){const a={name:"Miui"},$=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/chromium/i],describe(_){const a={name:"Chromium"},$=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,_)||Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/chrome|crios|crmo/i],describe(_){const a={name:"Chrome"},$=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/GSA/i],describe(_){const a={name:"Google Search"},$=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test(_){const a=!_.test(/like android/i),$=_.test(/android/i);return a&&$},describe(_){const a={name:"Android Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/playstation 4/i],describe(_){const a={name:"PlayStation 4"},$=Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/safari|applewebkit/i],describe(_){const a={name:"Safari"},$=Utils.getFirstMatch(commonVersionIdentifier,_);return $&&(a.version=$),a}},{test:[/.*/i],describe(_){const a=/^(.*)\/(.*) /,$=/^(.*)\/(.*)[ \t]\((.*)/,et=_.search("\\(")!==-1?$:a;return{name:Utils.getFirstMatch(et,_),version:Utils.getSecondMatch(et,_)}}}],osParsersList=[{test:[/Roku\/DVP/],describe(_){const a=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,_);return{name:OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe(_){const a=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,_);return{name:OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe(_){const a=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,_),$=Utils.getWindowsVersionName(a);return{name:OS_MAP.Windows,version:a,versionName:$}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(_){const a={name:OS_MAP.iOS},$=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,_);return $&&(a.version=$),a}},{test:[/macintosh/i],describe(_){const a=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,_).replace(/[_\s]/g,"."),$=Utils.getMacOSVersionName(a),j={name:OS_MAP.MacOS,version:a};return $&&(j.versionName=$),j}},{test:[/(ipod|iphone|ipad)/i],describe(_){const a=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,_).replace(/[_\s]/g,".");return{name:OS_MAP.iOS,version:a}}},{test(_){const a=!_.test(/like android/i),$=_.test(/android/i);return a&&$},describe(_){const a=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,_),$=Utils.getAndroidVersionName(a),j={name:OS_MAP.Android,version:a};return $&&(j.versionName=$),j}},{test:[/(web|hpw)[o0]s/i],describe(_){const a=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,_),$={name:OS_MAP.WebOS};return a&&a.length&&($.version=a),$}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(_){const a=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,_)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,_)||Utils.getFirstMatch(/\bbb(\d+)/i,_);return{name:OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe(_){const a=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,_);return{name:OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe(_){const a=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,_);return{name:OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe(){return{name:OS_MAP.Linux}}},{test:[/CrOS/],describe(){return{name:OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe(_){const a=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,_);return{name:OS_MAP.PlayStation4,version:a}}}],platformParsersList=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(_){const a=Utils.getFirstMatch(/(can-l01)/i,_)&&"Nova",$={type:PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&($.model=a),$}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:PLATFORMS_MAP.tablet}}},{test(_){const a=_.test(/ipod|iphone/i),$=_.test(/like (ipod|iphone)/i);return a&&!$},describe(_){const a=Utils.getFirstMatch(/(ipod|iphone)/i,_);return{type:PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:PLATFORMS_MAP.mobile}}},{test(_){return _.getBrowserName(!0)==="blackberry"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test(_){return _.getBrowserName(!0)==="bada"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(_){return _.getBrowserName()==="windows phone"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test(_){const a=Number(String(_.getOSVersion()).split(".")[0]);return _.getOSName(!0)==="android"&&a>=3},describe(){return{type:PLATFORMS_MAP.tablet}}},{test(_){return _.getOSName(!0)==="android"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(_){return _.getOSName(!0)==="macos"},describe(){return{type:PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test(_){return _.getOSName(!0)==="windows"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(_){return _.getOSName(!0)==="linux"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(_){return _.getOSName(!0)==="playstation 4"},describe(){return{type:PLATFORMS_MAP.tv}}},{test(_){return _.getOSName(!0)==="roku"},describe(){return{type:PLATFORMS_MAP.tv}}}],enginesParsersList=[{test(_){return _.getBrowserName(!0)==="microsoft edge"},describe(_){if(/\sedg\//i.test(_))return{name:ENGINE_MAP.Blink};const $=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,_);return{name:ENGINE_MAP.EdgeHTML,version:$}}},{test:[/trident/i],describe(_){const a={name:ENGINE_MAP.Trident},$=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test(_){return _.test(/presto/i)},describe(_){const a={name:ENGINE_MAP.Presto},$=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test(_){const a=_.test(/gecko/i),$=_.test(/like gecko/i);return a&&!$},describe(_){const a={name:ENGINE_MAP.Gecko},$=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe(_){const a={name:ENGINE_MAP.WebKit},$=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,_);return $&&(a.version=$),a}}];class Parser{constructor(a,$=!1){if(a==null||a==="")throw new Error("UserAgent parameter can't be empty");this._ua=a,this.parsedResult={},$!==!0&&this.parse()}getUA(){return this._ua}test(a){return a.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const a=Utils.find(browsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.browser=a.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(a){return a?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const a=Utils.find(osParsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.os=a.describe(this.getUA())),this.parsedResult.os}getOSName(a){const{name:$}=this.getOS();return a?String($).toLowerCase()||"":$||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(a=!1){const{type:$}=this.getPlatform();return a?String($).toLowerCase()||"":$||""}parsePlatform(){this.parsedResult.platform={};const a=Utils.find(platformParsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.platform=a.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(a){return a?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const a=Utils.find(enginesParsersList,$=>{if(typeof $.test=="function")return $.test(this);if($.test instanceof Array)return $.test.some(j=>this.test(j));throw new Error("Browser's test function is not valid")});return a&&(this.parsedResult.engine=a.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(a){const $={};let j=0;const et={};let tt=0;if(Object.keys(a).forEach(nt=>{const it=a[nt];typeof it=="string"?(et[nt]=it,tt+=1):typeof it=="object"&&($[nt]=it,j+=1)}),j>0){const nt=Object.keys($),it=Utils.find(nt,st=>this.isOS(st));if(it){const st=this.satisfies($[it]);if(st!==void 0)return st}const at=Utils.find(nt,st=>this.isPlatform(st));if(at){const st=this.satisfies($[at]);if(st!==void 0)return st}}if(tt>0){const nt=Object.keys(et),it=Utils.find(nt,at=>this.isBrowser(at,!0));if(it!==void 0)return this.compareVersion(et[it])}}isBrowser(a,$=!1){const j=this.getBrowserName().toLowerCase();let et=a.toLowerCase();const tt=Utils.getBrowserTypeByAlias(et);return $&&tt&&(et=tt.toLowerCase()),et===j}compareVersion(a){let $=[0],j=a,et=!1;const tt=this.getBrowserVersion();if(typeof tt=="string")return a[0]===">"||a[0]==="<"?(j=a.substr(1),a[1]==="="?(et=!0,j=a.substr(2)):$=[],a[0]===">"?$.push(1):$.push(-1)):a[0]==="="?j=a.substr(1):a[0]==="~"&&(et=!0,j=a.substr(1)),$.indexOf(Utils.compareVersions(tt,j,et))>-1}isOS(a){return this.getOSName(!0)===String(a).toLowerCase()}isPlatform(a){return this.getPlatformType(!0)===String(a).toLowerCase()}isEngine(a){return this.getEngineName(!0)===String(a).toLowerCase()}is(a,$=!1){return this.isBrowser(a,$)||this.isOS(a)||this.isPlatform(a)}some(a=[]){return a.some($=>this.is($))}}/*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 - */class Bowser{static getParser(a,$=!1){if(typeof a!="string")throw new Error("UserAgent should be a string");return new Parser(a,$)}static parse(a){return new Parser(a).getResult()}static get BROWSER_MAP(){return BROWSER_MAP}static get ENGINE_MAP(){return ENGINE_MAP}static get OS_MAP(){return OS_MAP}static get PLATFORMS_MAP(){return PLATFORMS_MAP}}function isPromise(_){return!!(_&&typeof _.then=="function")}Promise.resolve(!1);Promise.resolve(!0);var PROMISE_RESOLVED_VOID=Promise.resolve();function sleep(_,a){return _||(_=0),new Promise(function($){return setTimeout(function(){return $(a)},_)})}function randomInt(_,a){return Math.floor(Math.random()*(a-_+1)+_)}function randomToken(){return Math.random().toString(36).substring(2)}var lastMs=0,additional=0;function microSeconds$5(){var _=new Date().getTime();return _===lastMs?(additional++,_*1e3+additional):(lastMs=_,additional=0,_*1e3)}function are3PCSupported$1(){if(typeof navigator>"u")return!1;var _=Bowser.parse(navigator.userAgent);log$5.info(JSON.stringify(_),"current browser info");var a=!0;return navigator.brave&&(a=!1),(_.engine.name===Bowser.ENGINE_MAP.WebKit||_.engine.name===Bowser.ENGINE_MAP.Gecko)&&(a=!1),a}var log$5=log$1$1.getLogger("broadcast-channel");log$5.setLevel("error");var microSeconds$4=microSeconds$5,type$4="native";function create$4(_){var a={messagesCallback:null,bc:new BroadcastChannel(_),subFns:[]};return a.bc.onmessage=function($){a.messagesCallback&&a.messagesCallback($.data)},a}function close$4(_){_.bc.close(),_.subFns=[]}function postMessage$4(_,a){try{return _.bc.postMessage(a,!1),PROMISE_RESOLVED_VOID}catch($){return Promise.reject($)}}function onMessage$4(_,a){_.messagesCallback=a}function canBeUsed$4(_){if(typeof window>"u"||!_.support3PC)return!1;if(typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}function averageResponseTime$4(){return 150}const NativeMethod={create:create$4,close:close$4,onMessage:onMessage$4,postMessage:postMessage$4,canBeUsed:canBeUsed$4,type:type$4,averageResponseTime:averageResponseTime$4,microSeconds:microSeconds$4};var ObliviousSet=function(){function _(a){this.ttl=a,this.map=new Map,this._to=!1}return _.prototype.has=function(a){return this.map.has(a)},_.prototype.add=function(a){var $=this;this.map.set(a,now()),this._to||(this._to=!0,setTimeout(function(){$._to=!1,removeTooOldValues($)},0))},_.prototype.clear=function(){this.map.clear()},_}();function removeTooOldValues(_){for(var a=now()-_.ttl,$=_.map[Symbol.iterator]();;){var j=$.next().value;if(!j)return;var et=j[0],tt=j[1];if(tt0&&arguments[0]!==void 0?arguments[0]:{},a=JSON.parse(JSON.stringify(_));return typeof a.support3PC>"u"&&(a.support3PC=are3PCSupported$1()),typeof a.webWorkerSupport>"u"&&(a.webWorkerSupport=!0),a.idb||(a.idb={}),a.idb.ttl||(a.idb.ttl=1e3*45),a.idb.fallbackInterval||(a.idb.fallbackInterval=150),_.idb&&typeof _.idb.onclose=="function"&&(a.idb.onclose=_.idb.onclose),a.localstorage||(a.localstorage={}),a.localstorage.removeTimeout||(a.localstorage.removeTimeout=1e3*60),a.server||(a.server={}),a.server.url||(a.server.url="https://broadcast-server.tor.us"),a.server.removeTimeout||(a.server.removeTimeout=1e3*60*5),_.methods&&(a.methods=_.methods),a}var microSeconds$3=microSeconds$5,DB_PREFIX="pubkey.broadcast-channel-0-",OBJECT_STORE_ID="messages",TRANSACTION_SETTINGS={durability:"relaxed"},type$3="idb";function getIdb(){if(typeof indexedDB<"u")return indexedDB;if(typeof window<"u"){if(typeof window.mozIndexedDB<"u")return window.mozIndexedDB;if(typeof window.webkitIndexedDB<"u")return window.webkitIndexedDB;if(typeof window.msIndexedDB<"u")return window.msIndexedDB}return!1}function commitIndexedDBTransaction(_){_.commit&&_.commit()}function createDatabase(_){var a=getIdb(),$=DB_PREFIX+_,j=a.open($);j.onupgradeneeded=function(tt){var rt=tt.target.result;rt.createObjectStore(OBJECT_STORE_ID,{keyPath:"id",autoIncrement:!0})};var et=new Promise(function(tt,rt){j.onerror=function(nt){return rt(nt)},j.onsuccess=function(){tt(j.result)}});return et}function writeMessage(_,a,$){var j=new Date().getTime(),et={uuid:a,time:j,data:$},tt=_.transaction([OBJECT_STORE_ID],"readwrite",TRANSACTION_SETTINGS);return new Promise(function(rt,nt){tt.oncomplete=function(){return rt()},tt.onerror=function(ot){return nt(ot)};var it=tt.objectStore(OBJECT_STORE_ID);it.add(et),commitIndexedDBTransaction(tt)})}function getMessagesHigherThan(_,a){var $=_.transaction(OBJECT_STORE_ID,"readonly",TRANSACTION_SETTINGS),j=$.objectStore(OBJECT_STORE_ID),et=[],tt=IDBKeyRange.bound(a+1,1/0);if(j.getAll){var rt=j.getAll(tt);return new Promise(function(it,ot){rt.onerror=function(st){return ot(st)},rt.onsuccess=function(st){it(st.target.result)}})}function nt(){try{return tt=IDBKeyRange.bound(a+1,1/0),j.openCursor(tt)}catch{return j.openCursor()}}return new Promise(function(it,ot){var st=nt();st.onerror=function(at){return ot(at)},st.onsuccess=function(at){var ut=at.target.result;ut?ut.value.id_.lastCursorId&&(_.lastCursorId=j.id),j}).filter(function(j){return _filterMessage(j,_)}).sort(function(j,et){return j.time-et.time});return $.forEach(function(j){_.messagesCallback&&(_.eMIs.add(j.id),_.messagesCallback(j.data))}),PROMISE_RESOLVED_VOID})}function close$3(_){_.closed=!0,_.db.close()}function postMessage$3(_,a){return _.writeBlockPromise=_.writeBlockPromise.then(function(){return writeMessage(_.db,_.uuid,a)}).then(function(){randomInt(0,10)===0&&cleanOldMessages(_.db,_.options.idb.ttl)}),_.writeBlockPromise}function onMessage$3(_,a,$){_.messagesCallbackTime=$,_.messagesCallback=a,readNewMessages(_)}function canBeUsed$3(_){if(!_.support3PC)return!1;var a=getIdb();return!!a}function averageResponseTime$3(_){return _.idb.fallbackInterval*2}const IndexeDbMethod={create:create$3,close:close$3,onMessage:onMessage$3,postMessage:postMessage$3,canBeUsed:canBeUsed$3,type:type$3,averageResponseTime:averageResponseTime$3,microSeconds:microSeconds$3};var microSeconds$2=microSeconds$5,KEY_PREFIX$1="pubkey.broadcastChannel-",type$2="localstorage";function getLocalStorage(){var _;if(typeof window>"u")return null;try{_=window.localStorage,_=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return _}function storageKey$1(_){return KEY_PREFIX$1+_}function postMessage$2(_,a){return new Promise(function($){sleep().then(function(){var j=storageKey$1(_.channelName),et={token:randomToken(),time:new Date().getTime(),data:a,uuid:_.uuid},tt=JSON.stringify(et);getLocalStorage().setItem(j,tt);var rt=document.createEvent("Event");rt.initEvent("storage",!0,!0),rt.key=j,rt.newValue=tt,window.dispatchEvent(rt),$()})})}function addStorageEventListener(_,a){var $=storageKey$1(_),j=function(tt){tt.key===$&&a(JSON.parse(tt.newValue))};return window.addEventListener("storage",j),j}function removeStorageEventListener(_){window.removeEventListener("storage",_)}function create$2(_,a){if(a=fillOptionsWithDefaults(a),!canBeUsed$2(a))throw new Error("BroadcastChannel: localstorage cannot be used");var $=randomToken(),j=new ObliviousSet(a.localstorage.removeTimeout),et={channelName:_,uuid:$,eMIs:j};return et.listener=addStorageEventListener(_,function(tt){et.messagesCallback&&tt.uuid!==$&&(!tt.token||j.has(tt.token)||tt.data.time&&tt.data.time=0;--Ot){var tr=this.tryEntries[Ot],nr=tr.completion;if(tr.tryLoc==="root")return wt("end");if(tr.tryLoc<=this.prev){var ir=rt.call(tr,"catchLoc"),Wt=rt.call(tr,"finallyLoc");if(ir&&Wt){if(this.prev=0;--wt){var Ot=this.tryEntries[wt];if(Ot.tryLoc<=this.prev&&rt.call(Ot,"finallyLoc")&&this.prev=0;--At){var wt=this.tryEntries[At];if(wt.finallyLoc===xt)return this.complete(wt.completion,wt.afterLoc),vt(wt),It}},catch:function(xt){for(var At=this.tryEntries.length-1;At>=0;--At){var wt=this.tryEntries[At];if(wt.tryLoc===xt){var Ot=wt.completion;if(Ot.type==="throw"){var tr=Ot.arg;vt(wt)}return tr}}throw Error("illegal catch attempt")},delegateYield:function(xt,At,wt){return this.delegate={iterator:Rt(xt),resultName:At,nextLoc:wt},this.method==="next"&&(this.arg=j),It}},et}_.exports=$,_.exports.__esModule=!0,_.exports.default=_.exports})(regeneratorRuntime$1);var regeneratorRuntimeExports=regeneratorRuntime$1.exports,runtime=regeneratorRuntimeExports(),regenerator=runtime;try{regeneratorRuntime=runtime}catch(_){typeof globalThis=="object"?globalThis.regeneratorRuntime=runtime:Function("r","regeneratorRuntime = r")(runtime)}const _regeneratorRuntime=getDefaultExportFromCjs$1(regenerator),PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(_=>{PACKET_TYPES_REVERSE[PACKET_TYPES[_]]=_});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=_=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(_):_&&_.buffer instanceof ArrayBuffer,encodePacket=({type:_,data:a},$,j)=>withNativeBlob$1&&a instanceof Blob?$?j(a):encodeBlobAsBase64(a,j):withNativeArrayBuffer$2&&(a instanceof ArrayBuffer||isView$1(a))?$?j(a):encodeBlobAsBase64(new Blob([a]),j):j(PACKET_TYPES[_]+(a||"")),encodeBlobAsBase64=(_,a)=>{const $=new FileReader;return $.onload=function(){const j=$.result.split(",")[1];a("b"+(j||""))},$.readAsDataURL(_)};function toArray(_){return _ instanceof Uint8Array?_:_ instanceof ArrayBuffer?new Uint8Array(_):new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(_,a){if(withNativeBlob$1&&_.data instanceof Blob)return _.data.arrayBuffer().then(toArray).then(a);if(withNativeArrayBuffer$2&&(_.data instanceof ArrayBuffer||isView$1(_.data)))return a(toArray(_.data));encodePacket(_,!1,$=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),a(TEXT_ENCODER.encode($))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let _=0;_{let a=_.length*.75,$=_.length,j,et=0,tt,rt,nt,it;_[_.length-1]==="="&&(a--,_[_.length-2]==="="&&a--);const ot=new ArrayBuffer(a),st=new Uint8Array(ot);for(j=0;j<$;j+=4)tt=lookup$1[_.charCodeAt(j)],rt=lookup$1[_.charCodeAt(j+1)],nt=lookup$1[_.charCodeAt(j+2)],it=lookup$1[_.charCodeAt(j+3)],st[et++]=tt<<2|rt>>4,st[et++]=(rt&15)<<4|nt>>2,st[et++]=(nt&3)<<6|it&63;return ot},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(_,a)=>{if(typeof _!="string")return{type:"message",data:mapBinary(_,a)};const $=_.charAt(0);return $==="b"?{type:"message",data:decodeBase64Packet(_.substring(1),a)}:PACKET_TYPES_REVERSE[$]?_.length>1?{type:PACKET_TYPES_REVERSE[$],data:_.substring(1)}:{type:PACKET_TYPES_REVERSE[$]}:ERROR_PACKET},decodeBase64Packet=(_,a)=>{if(withNativeArrayBuffer$1){const $=decode$3(_);return mapBinary($,a)}else return{base64:!0,data:_}},mapBinary=(_,a)=>{switch(a){case"blob":return _ instanceof Blob?_:new Blob([_]);case"arraybuffer":default:return _ instanceof ArrayBuffer?_:_.buffer}},SEPARATOR="",encodePayload=(_,a)=>{const $=_.length,j=new Array($);let et=0;_.forEach((tt,rt)=>{encodePacket(tt,!1,nt=>{j[rt]=nt,++et===$&&a(j.join(SEPARATOR))})})},decodePayload=(_,a)=>{const $=_.split(SEPARATOR),j=[];for(let et=0;et<$.length;et++){const tt=decodePacket($[et],a);if(j.push(tt),tt.type==="error")break}return j};function createPacketEncoderStream(){return new TransformStream({transform(_,a){encodePacketToBinary(_,$=>{const j=$.length;let et;if(j<126)et=new Uint8Array(1),new DataView(et.buffer).setUint8(0,j);else if(j<65536){et=new Uint8Array(3);const tt=new DataView(et.buffer);tt.setUint8(0,126),tt.setUint16(1,j)}else{et=new Uint8Array(9);const tt=new DataView(et.buffer);tt.setUint8(0,127),tt.setBigUint64(1,BigInt(j))}_.data&&typeof _.data!="string"&&(et[0]|=128),a.enqueue(et),a.enqueue($)})}})}let TEXT_DECODER;function totalLength(_){return _.reduce((a,$)=>a+$.length,0)}function concatChunks(_,a){if(_[0].length===a)return _.shift();const $=new Uint8Array(a);let j=0;for(let et=0;etMath.pow(2,21)-1){nt.enqueue(ERROR_PACKET);break}et=st*Math.pow(2,32)+ot.getUint32(4),j=3}else{if(totalLength($)_){nt.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(_){if(_)return mixin(_)}function mixin(_){for(var a in Emitter.prototype)_[a]=Emitter.prototype[a];return _}Emitter.prototype.on=Emitter.prototype.addEventListener=function(_,a){return this._callbacks=this._callbacks||{},(this._callbacks["$"+_]=this._callbacks["$"+_]||[]).push(a),this};Emitter.prototype.once=function(_,a){function $(){this.off(_,$),a.apply(this,arguments)}return $.fn=a,this.on(_,$),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(_,a){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var $=this._callbacks["$"+_];if(!$)return this;if(arguments.length==1)return delete this._callbacks["$"+_],this;for(var j,et=0;et<$.length;et++)if(j=$[et],j===a||j.fn===a){$.splice(et,1);break}return $.length===0&&delete this._callbacks["$"+_],this};Emitter.prototype.emit=function(_){this._callbacks=this._callbacks||{};for(var a=new Array(arguments.length-1),$=this._callbacks["$"+_],j=1;j(_.hasOwnProperty(j)&&($[j]=_[j]),$),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(_,a){a.useNativeTimers?(_.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),_.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(_.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),_.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(_){return typeof _=="string"?utf8Length(_):Math.ceil((_.byteLength||_.size)*BASE64_OVERHEAD)}function utf8Length(_){let a=0,$=0;for(let j=0,et=_.length;j=57344?$+=3:(j++,$+=4);return $}function encode$2(_){let a="";for(let $ in _)_.hasOwnProperty($)&&(a.length&&(a+="&"),a+=encodeURIComponent($)+"="+encodeURIComponent(_[$]));return a}function decode$2(_){let a={},$=_.split("&");for(let j=0,et=$.length;j0);return a}function yeast(){const _=encode$1(+new Date);return _!==prev?(seed=0,prev=_):_+"."+encode$1(seed++)}for(;i{this.readyState="paused",a()};if(this.polling||!this.writable){let j=0;this.polling&&(j++,this.once("pollComplete",function(){--j||$()})),this.writable||(j++,this.once("drain",function(){--j||$()}))}else $()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(a){const $=j=>{if(this.readyState==="opening"&&j.type==="open"&&this.onOpen(),j.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(j)};decodePayload(a,this.socket.binaryType).forEach($),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const a=()=>{this.write([{type:"close"}])};this.readyState==="open"?a():this.once("open",a)}write(a){this.writable=!1,encodePayload(a,$=>{this.doWrite($,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const a=this.opts.secure?"https":"http",$=this.query||{};return this.opts.timestampRequests!==!1&&($[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!$.sid&&($.b64=1),this.createUri(a,$)}request(a={}){return Object.assign(a,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),a)}doWrite(a,$){const j=this.request({method:"POST",data:a});j.on("success",$),j.on("error",(et,tt)=>{this.onError("xhr post error",et,tt)})}doPoll(){const a=this.request();a.on("data",this.onData.bind(this)),a.on("error",($,j)=>{this.onError("xhr poll error",$,j)}),this.pollXhr=a}}let Request$1=class n0 extends Emitter{constructor(a,$){super(),installTimerFunctions(this,$),this.opts=$,this.method=$.method||"GET",this.uri=a,this.data=$.data!==void 0?$.data:null,this.create()}create(){var a;const $=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");$.xdomain=!!this.opts.xd;const j=this.xhr=new XHR($);try{j.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){j.setDisableHeaderCheck&&j.setDisableHeaderCheck(!0);for(let et in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(et)&&j.setRequestHeader(et,this.opts.extraHeaders[et])}}catch{}if(this.method==="POST")try{j.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{j.setRequestHeader("Accept","*/*")}catch{}(a=this.opts.cookieJar)===null||a===void 0||a.addCookies(j),"withCredentials"in j&&(j.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(j.timeout=this.opts.requestTimeout),j.onreadystatechange=()=>{var et;j.readyState===3&&((et=this.opts.cookieJar)===null||et===void 0||et.parseCookies(j)),j.readyState===4&&(j.status===200||j.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof j.status=="number"?j.status:0)},0))},j.send(this.data)}catch(et){this.setTimeoutFn(()=>{this.onError(et)},0);return}typeof document<"u"&&(this.index=n0.requestsCount++,n0.requests[this.index]=this)}onError(a){this.emitReserved("error",a,this.xhr),this.cleanup(!0)}cleanup(a){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,a)try{this.xhr.abort()}catch{}typeof document<"u"&&delete n0.requests[this.index],this.xhr=null}}onLoad(){const a=this.xhr.responseText;a!==null&&(this.emitReserved("data",a),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const _="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(_,unloadHandler,!1)}}function unloadHandler(){for(let _ in Request$1.requests)Request$1.requests.hasOwnProperty(_)&&Request$1.requests[_].abort()}const nextTick=typeof Promise=="function"&&typeof Promise.resolve=="function"?a=>Promise.resolve().then(a):(a,$)=>$(a,0),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(a){super(a),this.supportsBinary=!a.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const a=this.uri(),$=this.opts.protocols,j=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(j.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?$?new WebSocket(a,$):new WebSocket(a):new WebSocket(a,$,j)}catch(et){return this.emitReserved("error",et)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=a=>this.onClose({description:"websocket connection closed",context:a}),this.ws.onmessage=a=>this.onData(a.data),this.ws.onerror=a=>this.onError("websocket error",a)}write(a){this.writable=!1;for(let $=0;${const rt={};try{usingBrowserWebSocket&&this.ws.send(tt)}catch{}et&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const a=this.opts.secure?"wss":"ws",$=this.query||{};return this.opts.timestampRequests&&($[this.opts.timestampParam]=yeast()),this.supportsBinary||($.b64=1),this.createUri(a,$)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(a=>{this.onError("webtransport error",a)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(a=>{const $=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),j=a.readable.pipeThrough($).getReader(),et=createPacketEncoderStream();et.readable.pipeTo(a.writable),this.writer=et.writable.getWriter();const tt=()=>{j.read().then(({done:nt,value:it})=>{nt||(this.onPacket(it),tt())}).catch(nt=>{})};tt();const rt={type:"open"};this.query.sid&&(rt.data=`{"sid":"${this.query.sid}"}`),this.writer.write(rt).then(()=>this.onOpen())})}))}write(a){this.writable=!1;for(let $=0;${et&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var a;(a=this.transport)===null||a===void 0||a.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$2(_){if(_.length>2e3)throw"URI too long";const a=_,$=_.indexOf("["),j=_.indexOf("]");$!=-1&&j!=-1&&(_=_.substring(0,$)+_.substring($,j).replace(/:/g,";")+_.substring(j,_.length));let et=re.exec(_||""),tt={},rt=14;for(;rt--;)tt[parts[rt]]=et[rt]||"";return $!=-1&&j!=-1&&(tt.source=a,tt.host=tt.host.substring(1,tt.host.length-1).replace(/;/g,":"),tt.authority=tt.authority.replace("[","").replace("]","").replace(/;/g,":"),tt.ipv6uri=!0),tt.pathNames=pathNames(tt,tt.path),tt.queryKey=queryKey(tt,tt.query),tt}function pathNames(_,a){const $=/\/{2,9}/g,j=a.replace($,"/").split("/");return(a.slice(0,1)=="/"||a.length===0)&&j.splice(0,1),a.slice(-1)=="/"&&j.splice(j.length-1,1),j}function queryKey(_,a){const $={};return a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(j,et,tt){et&&($[et]=tt)}),$}let Socket$1=class Pu extends Emitter{constructor(a,$={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],a&&typeof a=="object"&&($=a,a=null),a?(a=parse$2(a),$.hostname=a.host,$.secure=a.protocol==="https"||a.protocol==="wss",$.port=a.port,a.query&&($.query=a.query)):$.host&&($.hostname=parse$2($.host).host),installTimerFunctions(this,$),this.secure=$.secure!=null?$.secure:typeof location<"u"&&location.protocol==="https:",$.hostname&&!$.port&&($.port=this.secure?"443":"80"),this.hostname=$.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=$.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=$.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},$),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(a){const $=Object.assign({},this.opts.query);$.EIO=protocol$1,$.transport=a,this.id&&($.sid=this.id);const j=Object.assign({},this.opts,{query:$,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[a]);return new transports[a](j)}open(){let a;if(this.opts.rememberUpgrade&&Pu.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)a="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else a=this.transports[0];this.readyState="opening";try{a=this.createTransport(a)}catch{this.transports.shift(),this.open();return}a.open(),this.setTransport(a)}setTransport(a){this.transport&&this.transport.removeAllListeners(),this.transport=a,a.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",$=>this.onClose("transport close",$))}probe(a){let $=this.createTransport(a),j=!1;Pu.priorWebsocketSuccess=!1;const et=()=>{j||($.send([{type:"ping",data:"probe"}]),$.once("packet",at=>{if(!j)if(at.type==="pong"&&at.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",$),!$)return;Pu.priorWebsocketSuccess=$.name==="websocket",this.transport.pause(()=>{j||this.readyState!=="closed"&&(st(),this.setTransport($),$.send([{type:"upgrade"}]),this.emitReserved("upgrade",$),$=null,this.upgrading=!1,this.flush())})}else{const ut=new Error("probe error");ut.transport=$.name,this.emitReserved("upgradeError",ut)}}))};function tt(){j||(j=!0,st(),$.close(),$=null)}const rt=at=>{const ut=new Error("probe error: "+at);ut.transport=$.name,tt(),this.emitReserved("upgradeError",ut)};function nt(){rt("transport closed")}function it(){rt("socket closed")}function ot(at){$&&at.name!==$.name&&tt()}const st=()=>{$.removeListener("open",et),$.removeListener("error",rt),$.removeListener("close",nt),this.off("close",it),this.off("upgrading",ot)};$.once("open",et),$.once("error",rt),$.once("close",nt),this.once("close",it),this.once("upgrading",ot),this.upgrades.indexOf("webtransport")!==-1&&a!=="webtransport"?this.setTimeoutFn(()=>{j||$.open()},200):$.open()}onOpen(){if(this.readyState="open",Pu.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let a=0;const $=this.upgrades.length;for(;a<$;a++)this.probe(this.upgrades[a])}}onPacket(a){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",a),this.emitReserved("heartbeat"),this.resetPingTimeout(),a.type){case"open":this.onHandshake(JSON.parse(a.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const $=new Error("server error");$.code=a.data,this.onError($);break;case"message":this.emitReserved("data",a.data),this.emitReserved("message",a.data);break}}onHandshake(a){this.emitReserved("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.maxPayload=a.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const a=this.getWritablePackets();this.transport.send(a),this.prevBufferLen=a.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let $=1;for(let j=0;j0&&$>this.maxPayload)return this.writeBuffer.slice(0,j);$+=2}return this.writeBuffer}write(a,$,j){return this.sendPacket("message",a,$,j),this}send(a,$,j){return this.sendPacket("message",a,$,j),this}sendPacket(a,$,j,et){if(typeof $=="function"&&(et=$,$=void 0),typeof j=="function"&&(et=j,j=null),this.readyState==="closing"||this.readyState==="closed")return;j=j||{},j.compress=j.compress!==!1;const tt={type:a,data:$,options:j};this.emitReserved("packetCreate",tt),this.writeBuffer.push(tt),et&&this.once("flush",et),this.flush()}close(){const a=()=>{this.onClose("forced close"),this.transport.close()},$=()=>{this.off("upgrade",$),this.off("upgradeError",$),a()},j=()=>{this.once("upgrade",$),this.once("upgradeError",$)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?j():a()}):this.upgrading?j():a()),this}onError(a){Pu.priorWebsocketSuccess=!1,this.emitReserved("error",a),this.onClose("transport error",a)}onClose(a,$){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",a,$),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(a){const $=[];let j=0;const et=a.length;for(;jtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(_):_.buffer instanceof ArrayBuffer,toString$1=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$1.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$1.call(File)==="[object FileConstructor]";function isBinary(_){return withNativeArrayBuffer&&(_ instanceof ArrayBuffer||isView(_))||withNativeBlob&&_ instanceof Blob||withNativeFile&&_ instanceof File}function hasBinary(_,a){if(!_||typeof _!="object")return!1;if(Array.isArray(_)){for(let $=0,j=_.length;$=0&&_.num{delete this.acks[a];for(let nt=0;nt{this.io.clearTimeoutFn(tt),$.apply(this,nt)};rt.withError=!0,this.acks[a]=rt}emitWithAck(a,...$){return new Promise((j,et)=>{const tt=(rt,nt)=>rt?et(rt):j(nt);tt.withError=!0,$.push(tt),this.emit(a,...$)})}_addToQueue(a){let $;typeof a[a.length-1]=="function"&&($=a.pop());const j={id:this._queueSeq++,tryCount:0,pending:!1,args:a,flags:Object.assign({fromQueue:!0},this.flags)};a.push((et,...tt)=>j!==this._queue[0]?void 0:(et!==null?j.tryCount>this._opts.retries&&(this._queue.shift(),$&&$(et)):(this._queue.shift(),$&&$(null,...tt)),j.pending=!1,this._drainQueue())),this._queue.push(j),this._drainQueue()}_drainQueue(a=!1){if(!this.connected||this._queue.length===0)return;const $=this._queue[0];$.pending&&!a||($.pending=!0,$.tryCount++,this.flags=$.flags,this.emit.apply(this,$.args))}packet(a){a.nsp=this.nsp,this.io._packet(a)}onopen(){typeof this.auth=="function"?this.auth(a=>{this._sendConnectPacket(a)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(a){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},a):a})}onerror(a){this.connected||this.emitReserved("connect_error",a)}onclose(a,$){this.connected=!1,delete this.id,this.emitReserved("disconnect",a,$),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(a=>{if(!this.sendBuffer.some(j=>String(j.id)===a)){const j=this.acks[a];delete this.acks[a],j.withError&&j.call(this,new Error("socket has been disconnected"))}})}onpacket(a){if(a.nsp===this.nsp)switch(a.type){case PacketType.CONNECT:a.data&&a.data.sid?this.onconnect(a.data.sid,a.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(a);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(a);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const j=new Error(a.data.message);j.data=a.data.data,this.emitReserved("connect_error",j);break}}onevent(a){const $=a.data||[];a.id!=null&&$.push(this.ack(a.id)),this.connected?this.emitEvent($):this.receiveBuffer.push(Object.freeze($))}emitEvent(a){if(this._anyListeners&&this._anyListeners.length){const $=this._anyListeners.slice();for(const j of $)j.apply(this,a)}super.emit.apply(this,a),this._pid&&a.length&&typeof a[a.length-1]=="string"&&(this._lastOffset=a[a.length-1])}ack(a){const $=this;let j=!1;return function(...et){j||(j=!0,$.packet({type:PacketType.ACK,id:a,data:et}))}}onack(a){const $=this.acks[a.id];typeof $=="function"&&(delete this.acks[a.id],$.withError&&a.data.unshift(null),$.apply(this,a.data))}onconnect(a,$){this.id=a,this.recovered=$&&this._pid===$,this._pid=$,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(a=>this.emitEvent(a)),this.receiveBuffer=[],this.sendBuffer.forEach(a=>{this.notifyOutgoingListeners(a),this.packet(a)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(a=>a()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(a){return this.flags.compress=a,this}get volatile(){return this.flags.volatile=!0,this}timeout(a){return this.flags.timeout=a,this}onAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(a),this}prependAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(a),this}offAny(a){if(!this._anyListeners)return this;if(a){const $=this._anyListeners;for(let j=0;j<$.length;j++)if(a===$[j])return $.splice(j,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(a),this}prependAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(a),this}offAnyOutgoing(a){if(!this._anyOutgoingListeners)return this;if(a){const $=this._anyOutgoingListeners;for(let j=0;j<$.length;j++)if(a===$[j])return $.splice(j,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(a){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const $=this._anyOutgoingListeners.slice();for(const j of $)j.apply(this,a.data)}}}function Backoff(_){_=_||{},this.ms=_.min||100,this.max=_.max||1e4,this.factor=_.factor||2,this.jitter=_.jitter>0&&_.jitter<=1?_.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var _=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),$=Math.floor(a*this.jitter*_);_=Math.floor(a*10)&1?_+$:_-$}return Math.min(_,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(_){this.ms=_};Backoff.prototype.setMax=function(_){this.max=_};Backoff.prototype.setJitter=function(_){this.jitter=_};class Manager extends Emitter{constructor(a,$){var j;super(),this.nsps={},this.subs=[],a&&typeof a=="object"&&($=a,a=void 0),$=$||{},$.path=$.path||"/socket.io",this.opts=$,installTimerFunctions(this,$),this.reconnection($.reconnection!==!1),this.reconnectionAttempts($.reconnectionAttempts||1/0),this.reconnectionDelay($.reconnectionDelay||1e3),this.reconnectionDelayMax($.reconnectionDelayMax||5e3),this.randomizationFactor((j=$.randomizationFactor)!==null&&j!==void 0?j:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout($.timeout==null?2e4:$.timeout),this._readyState="closed",this.uri=a;const et=$.parser||parser;this.encoder=new et.Encoder,this.decoder=new et.Decoder,this._autoConnect=$.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(a){return arguments.length?(this._reconnection=!!a,this):this._reconnection}reconnectionAttempts(a){return a===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=a,this)}reconnectionDelay(a){var $;return a===void 0?this._reconnectionDelay:(this._reconnectionDelay=a,($=this.backoff)===null||$===void 0||$.setMin(a),this)}randomizationFactor(a){var $;return a===void 0?this._randomizationFactor:(this._randomizationFactor=a,($=this.backoff)===null||$===void 0||$.setJitter(a),this)}reconnectionDelayMax(a){var $;return a===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=a,($=this.backoff)===null||$===void 0||$.setMax(a),this)}timeout(a){return arguments.length?(this._timeout=a,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(a){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const $=this.engine,j=this;this._readyState="opening",this.skipReconnect=!1;const et=on($,"open",function(){j.onopen(),a&&a()}),tt=nt=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",nt),a?a(nt):this.maybeReconnectOnOpen()},rt=on($,"error",tt);if(this._timeout!==!1){const nt=this._timeout,it=this.setTimeoutFn(()=>{et(),tt(new Error("timeout")),$.close()},nt);this.opts.autoUnref&&it.unref(),this.subs.push(()=>{this.clearTimeoutFn(it)})}return this.subs.push(et),this.subs.push(rt),this}connect(a){return this.open(a)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const a=this.engine;this.subs.push(on(a,"ping",this.onping.bind(this)),on(a,"data",this.ondata.bind(this)),on(a,"error",this.onerror.bind(this)),on(a,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(a){try{this.decoder.add(a)}catch($){this.onclose("parse error",$)}}ondecoded(a){nextTick(()=>{this.emitReserved("packet",a)},this.setTimeoutFn)}onerror(a){this.emitReserved("error",a)}socket(a,$){let j=this.nsps[a];return j?this._autoConnect&&!j.active&&j.connect():(j=new Socket(this,a,$),this.nsps[a]=j),j}_destroy(a){const $=Object.keys(this.nsps);for(const j of $)if(this.nsps[j].active)return;this._close()}_packet(a){const $=this.encoder.encode(a);for(let j=0;j<$.length;j++)this.engine.write($[j],a.options)}cleanup(){this.subs.forEach(a=>a()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(a,$){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",a,$),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const a=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const $=this.backoff.duration();this._reconnecting=!0;const j=this.setTimeoutFn(()=>{a.skipReconnect||(this.emitReserved("reconnect_attempt",a.backoff.attempts),!a.skipReconnect&&a.open(et=>{et?(a._reconnecting=!1,a.reconnect(),this.emitReserved("reconnect_error",et)):a.onreconnect()}))},$);this.opts.autoUnref&&j.unref(),this.subs.push(()=>{this.clearTimeoutFn(j)})}}onreconnect(){const a=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",a)}}const cache={};function lookup(_,a){typeof _=="object"&&(a=_,_=void 0),a=a||{};const $=url(_,a.path||"/socket.io"),j=$.source,et=$.id,tt=$.path,rt=cache[et]&&tt in cache[et].nsps,nt=a.forceNew||a["force new connection"]||a.multiplex===!1||rt;let it;return nt?it=new Manager(j,a):(cache[et]||(cache[et]=new Manager(j,a)),it=cache[et]),$.query&&!a.query&&(a.query=$.queryKey),it.socket($.path,a)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});var cryptoBrowserifyExports=requireCryptoBrowserify();const nodeCrypto=getDefaultExportFromCjs$1(cryptoBrowserifyExports),ec$2=new elliptic$2.ec("secp256k1"),browserCrypto=global$1.crypto||global$1.msCrypto||{},subtle=browserCrypto.subtle||browserCrypto.webkitSubtle,EC_GROUP_ORDER=Buffer$g.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),ZERO32=Buffer$g.alloc(32,0);function assert$a(_,a){if(!_)throw new Error(a||"Assertion failed")}function isScalar(_){return Buffer$g.isBuffer(_)&&_.length===32}function isValidPrivateKey(_){return isScalar(_)?_.compare(ZERO32)>0&&_.compare(EC_GROUP_ORDER)<0:!1}function equalConstTime(_,a){if(_.length!==a.length)return!1;let $=0;for(let j=0;j<_.length;j++)$|=_[j]^a[j];return $===0}function randomBytes(_){const a=new Uint8Array(_);return typeof browserCrypto.getRandomValues>"u"?Buffer$g.from(nodeCrypto.randomBytes(_)):(browserCrypto.getRandomValues(a),Buffer$g.from(a))}async function sha512(_){if(subtle){const j=await subtle.digest("SHA-512",_);return new Uint8Array(j)}const $=nodeCrypto.createHash("sha512").update(_).digest();return new Uint8Array($)}function getAes(_){return async function(a,$,j){if(subtle){const et={name:"AES-CBC"},tt=await subtle.importKey("raw",$,et,!1,[_]),rt={name:"AES-CBC",iv:a},nt=await subtle[_](rt,tt,j);return Buffer$g.from(new Uint8Array(nt))}else if(_==="encrypt"){const et=nodeCrypto.createCipheriv("aes-256-cbc",$,a),tt=et.update(j),rt=et.final();return Buffer$g.concat([tt,rt])}else if(_==="decrypt"){const et=nodeCrypto.createDecipheriv("aes-256-cbc",$,a),tt=et.update(j),rt=et.final();return Buffer$g.concat([tt,rt])}throw new Error(`Unsupported operation: ${_}`)}}const aesCbcEncrypt=getAes("encrypt"),aesCbcDecrypt=getAes("decrypt");async function hmacSha256Sign(_,a){if(subtle){const et={name:"HMAC",hash:{name:"SHA-256"}},tt=await subtle.importKey("raw",new Uint8Array(_),et,!1,["sign","verify"]),rt=await subtle.sign("HMAC",tt,a);return Buffer$g.from(new Uint8Array(rt))}const $=nodeCrypto.createHmac("sha256",Buffer$g.from(_));return $.update(a),$.digest()}async function hmacSha256Verify(_,a,$){const j=await hmacSha256Sign(_,a);return equalConstTime(j,$)}const generatePrivate=function(){let _=randomBytes(32);for(;!isValidPrivateKey(_);)_=randomBytes(32);return _},getPublic=function(_){return assert$a(_.length===32,"Bad private key"),assert$a(isValidPrivateKey(_),"Bad private key"),Buffer$g.from(ec$2.keyFromPrivate(_).getPublic("array"))},sign=async function(_,a){return assert$a(_.length===32,"Bad private key"),assert$a(isValidPrivateKey(_),"Bad private key"),assert$a(a.length>0,"Message should not be empty"),assert$a(a.length<=32,"Message is too long"),Buffer$g.from(ec$2.sign(a,_,{canonical:!0}).toDER())},derive=async function(_,a){assert$a(Buffer$g.isBuffer(_),"Bad private key"),assert$a(Buffer$g.isBuffer(a),"Bad public key"),assert$a(_.length===32,"Bad private key"),assert$a(isValidPrivateKey(_),"Bad private key"),assert$a(a.length===65||a.length===33,"Bad public key"),a.length===65&&assert$a(a[0]===4,"Bad public key"),a.length===33&&assert$a(a[0]===2||a[0]===3,"Bad public key");const $=ec$2.keyFromPrivate(_),j=ec$2.keyFromPublic(a),et=$.derive(j.getPublic());return Buffer$g.from(et.toArray())},deriveUnpadded=derive,derivePadded=async function(_,a){assert$a(Buffer$g.isBuffer(_),"Bad private key"),assert$a(Buffer$g.isBuffer(a),"Bad public key"),assert$a(_.length===32,"Bad private key"),assert$a(isValidPrivateKey(_),"Bad private key"),assert$a(a.length===65||a.length===33,"Bad public key"),a.length===65&&assert$a(a[0]===4,"Bad public key"),a.length===33&&assert$a(a[0]===2||a[0]===3,"Bad public key");const $=ec$2.keyFromPrivate(_),j=ec$2.keyFromPublic(a),et=$.derive(j.getPublic());return Buffer$g.from(et.toString(16,64),"hex")},encrypt=async function(_,a,$){$=$||{};let j=$.ephemPrivateKey||randomBytes(32);for(;!isValidPrivateKey(j);)j=$.ephemPrivateKey||randomBytes(32);const et=getPublic(j),tt=await deriveUnpadded(j,_),rt=await sha512(tt),nt=$.iv||randomBytes(16),it=rt.slice(0,32),ot=rt.slice(32),at=await aesCbcEncrypt(nt,Buffer$g.from(it),a),ut=Buffer$g.concat([nt,et,at]),ht=await hmacSha256Sign(Buffer$g.from(ot),ut);return{iv:nt,ephemPublicKey:et,ciphertext:at,mac:ht}},decrypt=async function(_,a,$){const j=$??!1,tt=await(j?derivePadded:deriveUnpadded)(_,a.ephemPublicKey),rt=await sha512(tt),nt=rt.slice(0,32),it=rt.slice(32),ot=Buffer$g.concat([a.iv,a.ephemPublicKey,a.ciphertext]),st=await hmacSha256Verify(Buffer$g.from(it),ot,a.mac);if(!st&&j===!1)return decrypt(_,a,!0);if(!st&&j===!0)throw new Error("bad MAC after trying padded");const at=await aesCbcDecrypt(a.iv,Buffer$g.from(nt),a.ciphertext);return Buffer$g.from(new Uint8Array(at))},log$4=log$1$1.getLogger("http-helpers");log$4.setLevel(loglevelExports.levels.INFO);let apiKey$1="torus-default";const gatewayAuthHeader$1="x-api-key";async function fetchAndTrace$1(_,a){let $=null;try{$=new URL(_)}catch{}return fetch(_,a)}function getApiKeyHeaders$1(){const _={};return _[gatewayAuthHeader$1]=apiKey$1,_}function debugLogResponse$1(_){log$4.info(`Response: ${_.status} ${_.statusText}`),log$4.info(`Url: ${_.url}`)}const get$1=async function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j={mode:"cors",headers:{}};$.useAPIKey&&(j.headers=_objectSpread2(_objectSpread2({},j.headers),getApiKeyHeaders$1()));const et=deepmerge$1(j,a,{method:"GET"}),tt=await fetchAndTrace$1(_,et);if(tt.ok){const rt=tt.headers.get("content-type");return rt!=null&&rt.includes("application/json")?tt.json():tt.text()}throw debugLogResponse$1(tt),tt};var jsonify={},parse$1,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse$1;hasRequiredParse=1;var _,a,$={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` -`,r:"\r",t:" "},j;function et(ht){throw{name:"SyntaxError",message:ht,at:_,text:j}}function tt(ht){return ht&&ht!==a&&et("Expected '"+ht+"' instead of '"+a+"'"),a=j.charAt(_),_+=1,a}function rt(){var ht,bt="";for(a==="-"&&(bt="-",tt("-"));a>="0"&&a<="9";)bt+=a,tt();if(a===".")for(bt+=".";tt()&&a>="0"&&a<="9";)bt+=a;if(a==="e"||a==="E")for(bt+=a,tt(),(a==="-"||a==="+")&&(bt+=a,tt());a>="0"&&a<="9";)bt+=a,tt();return ht=Number(bt),isFinite(ht)||et("Bad number"),ht}function nt(){var ht,bt,Et="",Ct;if(a==='"')for(;tt();){if(a==='"')return tt(),Et;if(a==="\\")if(tt(),a==="u"){for(Ct=0,bt=0;bt<4&&(ht=parseInt(tt(),16),!!isFinite(ht));bt+=1)Ct=Ct*16+ht;Et+=String.fromCharCode(Ct)}else if(typeof $[a]=="string")Et+=$[a];else break;else Et+=a}et("Bad string")}function it(){for(;a&&a<=" ";)tt()}function ot(){switch(a){case"t":return tt("t"),tt("r"),tt("u"),tt("e"),!0;case"f":return tt("f"),tt("a"),tt("l"),tt("s"),tt("e"),!1;case"n":return tt("n"),tt("u"),tt("l"),tt("l"),null;default:et("Unexpected '"+a+"'")}}function st(){var ht=[];if(a==="["){if(tt("["),it(),a==="]")return tt("]"),ht;for(;a;){if(ht.push(ut()),it(),a==="]")return tt("]"),ht;tt(","),it()}}et("Bad array")}function at(){var ht,bt={};if(a==="{"){if(tt("{"),it(),a==="}")return tt("}"),bt;for(;a;){if(ht=nt(),it(),tt(":"),Object.prototype.hasOwnProperty.call(bt,ht)&&et('Duplicate key "'+ht+'"'),bt[ht]=ut(),it(),a==="}")return tt("}"),bt;tt(","),it()}}et("Bad object")}function ut(){switch(it(),a){case"{":return at();case"[":return st();case'"':return nt();case"-":return rt();default:return a>="0"&&a<="9"?rt():ot()}}return parse$1=function(ht,bt){var Et;return j=ht,_=0,a=" ",Et=ut(),it(),a&&et("Syntax error"),typeof bt=="function"?function Ct(Pt,Tt){var It,Lt,Nt=Pt[Tt];if(Nt&&typeof Nt=="object")for(It in ut)Object.prototype.hasOwnProperty.call(Nt,It)&&(Lt=Ct(Nt,It),typeof Lt>"u"?delete Nt[It]:Nt[It]=Lt);return bt.call(Pt,Tt,Nt)}({"":Et},""):Et},parse$1}var stringify$1,hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify$1;hasRequiredStringify=1;var _=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a,$,j={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},et;function tt(nt){return _.lastIndex=0,_.test(nt)?'"'+nt.replace(_,function(it){var ot=j[it];return typeof ot=="string"?ot:"\\u"+("0000"+it.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+nt+'"'}function rt(nt,it){var ot,st,at,ut,ht=a,bt,Et=it[nt];switch(Et&&typeof Et=="object"&&typeof Et.toJSON=="function"&&(Et=Et.toJSON(nt)),typeof et=="function"&&(Et=et.call(it,nt,Et)),typeof Et){case"string":return tt(Et);case"number":return isFinite(Et)?String(Et):"null";case"boolean":case"null":return String(Et);case"object":if(!Et)return"null";if(a+=$,bt=[],Object.prototype.toString.apply(Et)==="[object Array]"){for(ut=Et.length,ot=0;ot"u")return!1;var _=Bowser.parse(navigator.userAgent);log$6.info(JSON.stringify(_),"current browser info");var a=!0;return navigator.brave&&(a=!1),(_.engine.name===Bowser.ENGINE_MAP.WebKit||_.engine.name===Bowser.ENGINE_MAP.Gecko)&&(a=!1),a}var log$6=log$1$1.getLogger("broadcast-channel");log$6.setLevel("error");var microSeconds$4=microSeconds$5,type$4="native";function create$4(_){var a={messagesCallback:null,bc:new BroadcastChannel(_),subFns:[]};return a.bc.onmessage=function($){a.messagesCallback&&a.messagesCallback($.data)},a}function close$4(_){_.bc.close(),_.subFns=[]}function postMessage$4(_,a){try{return _.bc.postMessage(a,!1),PROMISE_RESOLVED_VOID}catch($){return Promise.reject($)}}function onMessage$4(_,a){_.messagesCallback=a}function canBeUsed$4(_){if(typeof window>"u"||!_.support3PC)return!1;if(typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}function averageResponseTime$4(){return 150}const NativeMethod={create:create$4,close:close$4,onMessage:onMessage$4,postMessage:postMessage$4,canBeUsed:canBeUsed$4,type:type$4,averageResponseTime:averageResponseTime$4,microSeconds:microSeconds$4};var ObliviousSet=function(){function _(a){this.ttl=a,this.map=new Map,this._to=!1}return _.prototype.has=function(a){return this.map.has(a)},_.prototype.add=function(a){var $=this;this.map.set(a,now()),this._to||(this._to=!0,setTimeout(function(){$._to=!1,removeTooOldValues($)},0))},_.prototype.clear=function(){this.map.clear()},_}();function removeTooOldValues(_){for(var a=now()-_.ttl,$=_.map[Symbol.iterator]();;){var j=$.next().value;if(!j)return;var et=j[0],tt=j[1];if(tt0&&arguments[0]!==void 0?arguments[0]:{},a=JSON.parse(JSON.stringify(_));return typeof a.support3PC>"u"&&(a.support3PC=are3PCSupported$1()),typeof a.webWorkerSupport>"u"&&(a.webWorkerSupport=!0),a.idb||(a.idb={}),a.idb.ttl||(a.idb.ttl=1e3*45),a.idb.fallbackInterval||(a.idb.fallbackInterval=150),_.idb&&typeof _.idb.onclose=="function"&&(a.idb.onclose=_.idb.onclose),a.localstorage||(a.localstorage={}),a.localstorage.removeTimeout||(a.localstorage.removeTimeout=1e3*60),a.server||(a.server={}),a.server.url||(a.server.url="https://broadcast-server.tor.us"),a.server.removeTimeout||(a.server.removeTimeout=1e3*60*5),_.methods&&(a.methods=_.methods),a}var microSeconds$3=microSeconds$5,DB_PREFIX="pubkey.broadcast-channel-0-",OBJECT_STORE_ID="messages",TRANSACTION_SETTINGS={durability:"relaxed"},type$3="idb";function getIdb(){if(typeof indexedDB<"u")return indexedDB;if(typeof window<"u"){if(typeof window.mozIndexedDB<"u")return window.mozIndexedDB;if(typeof window.webkitIndexedDB<"u")return window.webkitIndexedDB;if(typeof window.msIndexedDB<"u")return window.msIndexedDB}return!1}function commitIndexedDBTransaction(_){_.commit&&_.commit()}function createDatabase(_){var a=getIdb(),$=DB_PREFIX+_,j=a.open($);j.onupgradeneeded=function(tt){var rt=tt.target.result;rt.createObjectStore(OBJECT_STORE_ID,{keyPath:"id",autoIncrement:!0})};var et=new Promise(function(tt,rt){j.onerror=function(nt){return rt(nt)},j.onsuccess=function(){tt(j.result)}});return et}function writeMessage(_,a,$){var j=new Date().getTime(),et={uuid:a,time:j,data:$},tt=_.transaction([OBJECT_STORE_ID],"readwrite",TRANSACTION_SETTINGS);return new Promise(function(rt,nt){tt.oncomplete=function(){return rt()},tt.onerror=function(at){return nt(at)};var it=tt.objectStore(OBJECT_STORE_ID);it.add(et),commitIndexedDBTransaction(tt)})}function getMessagesHigherThan(_,a){var $=_.transaction(OBJECT_STORE_ID,"readonly",TRANSACTION_SETTINGS),j=$.objectStore(OBJECT_STORE_ID),et=[],tt=IDBKeyRange.bound(a+1,1/0);if(j.getAll){var rt=j.getAll(tt);return new Promise(function(it,at){rt.onerror=function(st){return at(st)},rt.onsuccess=function(st){it(st.target.result)}})}function nt(){try{return tt=IDBKeyRange.bound(a+1,1/0),j.openCursor(tt)}catch{return j.openCursor()}}return new Promise(function(it,at){var st=nt();st.onerror=function(ot){return at(ot)},st.onsuccess=function(ot){var ut=ot.target.result;ut?ut.value.id_.lastCursorId&&(_.lastCursorId=j.id),j}).filter(function(j){return _filterMessage(j,_)}).sort(function(j,et){return j.time-et.time});return $.forEach(function(j){_.messagesCallback&&(_.eMIs.add(j.id),_.messagesCallback(j.data))}),PROMISE_RESOLVED_VOID})}function close$3(_){_.closed=!0,_.db.close()}function postMessage$3(_,a){return _.writeBlockPromise=_.writeBlockPromise.then(function(){return writeMessage(_.db,_.uuid,a)}).then(function(){randomInt(0,10)===0&&cleanOldMessages(_.db,_.options.idb.ttl)}),_.writeBlockPromise}function onMessage$3(_,a,$){_.messagesCallbackTime=$,_.messagesCallback=a,readNewMessages(_)}function canBeUsed$3(_){if(!_.support3PC)return!1;var a=getIdb();return!!a}function averageResponseTime$3(_){return _.idb.fallbackInterval*2}const IndexeDbMethod={create:create$3,close:close$3,onMessage:onMessage$3,postMessage:postMessage$3,canBeUsed:canBeUsed$3,type:type$3,averageResponseTime:averageResponseTime$3,microSeconds:microSeconds$3};var microSeconds$2=microSeconds$5,KEY_PREFIX$1="pubkey.broadcastChannel-",type$2="localstorage";function getLocalStorage(){var _;if(typeof window>"u")return null;try{_=window.localStorage,_=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return _}function storageKey$1(_){return KEY_PREFIX$1+_}function postMessage$2(_,a){return new Promise(function($){sleep().then(function(){var j=storageKey$1(_.channelName),et={token:randomToken(),time:new Date().getTime(),data:a,uuid:_.uuid},tt=JSON.stringify(et);getLocalStorage().setItem(j,tt);var rt=document.createEvent("Event");rt.initEvent("storage",!0,!0),rt.key=j,rt.newValue=tt,window.dispatchEvent(rt),$()})})}function addStorageEventListener(_,a){var $=storageKey$1(_),j=function(tt){tt.key===$&&a(JSON.parse(tt.newValue))};return window.addEventListener("storage",j),j}function removeStorageEventListener(_){window.removeEventListener("storage",_)}function create$2(_,a){if(a=fillOptionsWithDefaults(a),!canBeUsed$2(a))throw new Error("BroadcastChannel: localstorage cannot be used");var $=randomToken(),j=new ObliviousSet(a.localstorage.removeTimeout),et={channelName:_,uuid:$,eMIs:j};return et.listener=addStorageEventListener(_,function(tt){et.messagesCallback&&tt.uuid!==$&&(!tt.token||j.has(tt.token)||tt.data.time&&tt.data.time=0;--Ot){var tr=this.tryEntries[Ot],nr=tr.completion;if(tr.tryLoc==="root")return wt("end");if(tr.tryLoc<=this.prev){var ir=rt.call(tr,"catchLoc"),Wt=rt.call(tr,"finallyLoc");if(ir&&Wt){if(this.prev=0;--wt){var Ot=this.tryEntries[wt];if(Ot.tryLoc<=this.prev&&rt.call(Ot,"finallyLoc")&&this.prev=0;--At){var wt=this.tryEntries[At];if(wt.finallyLoc===Et)return this.complete(wt.completion,wt.afterLoc),vt(wt),kt}},catch:function(Et){for(var At=this.tryEntries.length-1;At>=0;--At){var wt=this.tryEntries[At];if(wt.tryLoc===Et){var Ot=wt.completion;if(Ot.type==="throw"){var tr=Ot.arg;vt(wt)}return tr}}throw Error("illegal catch attempt")},delegateYield:function(Et,At,wt){return this.delegate={iterator:Rt(Et),resultName:At,nextLoc:wt},this.method==="next"&&(this.arg=j),kt}},et}_.exports=$,_.exports.__esModule=!0,_.exports.default=_.exports})(regeneratorRuntime$1);var regeneratorRuntimeExports=regeneratorRuntime$1.exports,runtime=regeneratorRuntimeExports(),regenerator=runtime;try{regeneratorRuntime=runtime}catch(_){typeof globalThis=="object"?globalThis.regeneratorRuntime=runtime:Function("r","regeneratorRuntime = r")(runtime)}const _regeneratorRuntime=getDefaultExportFromCjs$1(regenerator),PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(_=>{PACKET_TYPES_REVERSE[PACKET_TYPES[_]]=_});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=_=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(_):_&&_.buffer instanceof ArrayBuffer,encodePacket=({type:_,data:a},$,j)=>withNativeBlob$1&&a instanceof Blob?$?j(a):encodeBlobAsBase64(a,j):withNativeArrayBuffer$2&&(a instanceof ArrayBuffer||isView$1(a))?$?j(a):encodeBlobAsBase64(new Blob([a]),j):j(PACKET_TYPES[_]+(a||"")),encodeBlobAsBase64=(_,a)=>{const $=new FileReader;return $.onload=function(){const j=$.result.split(",")[1];a("b"+(j||""))},$.readAsDataURL(_)};function toArray(_){return _ instanceof Uint8Array?_:_ instanceof ArrayBuffer?new Uint8Array(_):new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(_,a){if(withNativeBlob$1&&_.data instanceof Blob)return _.data.arrayBuffer().then(toArray).then(a);if(withNativeArrayBuffer$2&&(_.data instanceof ArrayBuffer||isView$1(_.data)))return a(toArray(_.data));encodePacket(_,!1,$=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),a(TEXT_ENCODER.encode($))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let _=0;_{let a=_.length*.75,$=_.length,j,et=0,tt,rt,nt,it;_[_.length-1]==="="&&(a--,_[_.length-2]==="="&&a--);const at=new ArrayBuffer(a),st=new Uint8Array(at);for(j=0;j<$;j+=4)tt=lookup$1[_.charCodeAt(j)],rt=lookup$1[_.charCodeAt(j+1)],nt=lookup$1[_.charCodeAt(j+2)],it=lookup$1[_.charCodeAt(j+3)],st[et++]=tt<<2|rt>>4,st[et++]=(rt&15)<<4|nt>>2,st[et++]=(nt&3)<<6|it&63;return at},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(_,a)=>{if(typeof _!="string")return{type:"message",data:mapBinary(_,a)};const $=_.charAt(0);return $==="b"?{type:"message",data:decodeBase64Packet(_.substring(1),a)}:PACKET_TYPES_REVERSE[$]?_.length>1?{type:PACKET_TYPES_REVERSE[$],data:_.substring(1)}:{type:PACKET_TYPES_REVERSE[$]}:ERROR_PACKET},decodeBase64Packet=(_,a)=>{if(withNativeArrayBuffer$1){const $=decode$3(_);return mapBinary($,a)}else return{base64:!0,data:_}},mapBinary=(_,a)=>{switch(a){case"blob":return _ instanceof Blob?_:new Blob([_]);case"arraybuffer":default:return _ instanceof ArrayBuffer?_:_.buffer}},SEPARATOR="",encodePayload=(_,a)=>{const $=_.length,j=new Array($);let et=0;_.forEach((tt,rt)=>{encodePacket(tt,!1,nt=>{j[rt]=nt,++et===$&&a(j.join(SEPARATOR))})})},decodePayload=(_,a)=>{const $=_.split(SEPARATOR),j=[];for(let et=0;et<$.length;et++){const tt=decodePacket($[et],a);if(j.push(tt),tt.type==="error")break}return j};function createPacketEncoderStream(){return new TransformStream({transform(_,a){encodePacketToBinary(_,$=>{const j=$.length;let et;if(j<126)et=new Uint8Array(1),new DataView(et.buffer).setUint8(0,j);else if(j<65536){et=new Uint8Array(3);const tt=new DataView(et.buffer);tt.setUint8(0,126),tt.setUint16(1,j)}else{et=new Uint8Array(9);const tt=new DataView(et.buffer);tt.setUint8(0,127),tt.setBigUint64(1,BigInt(j))}_.data&&typeof _.data!="string"&&(et[0]|=128),a.enqueue(et),a.enqueue($)})}})}let TEXT_DECODER;function totalLength(_){return _.reduce((a,$)=>a+$.length,0)}function concatChunks(_,a){if(_[0].length===a)return _.shift();const $=new Uint8Array(a);let j=0;for(let et=0;etMath.pow(2,21)-1){nt.enqueue(ERROR_PACKET);break}et=st*Math.pow(2,32)+at.getUint32(4),j=3}else{if(totalLength($)_){nt.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(_){if(_)return mixin(_)}function mixin(_){for(var a in Emitter.prototype)_[a]=Emitter.prototype[a];return _}Emitter.prototype.on=Emitter.prototype.addEventListener=function(_,a){return this._callbacks=this._callbacks||{},(this._callbacks["$"+_]=this._callbacks["$"+_]||[]).push(a),this};Emitter.prototype.once=function(_,a){function $(){this.off(_,$),a.apply(this,arguments)}return $.fn=a,this.on(_,$),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(_,a){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var $=this._callbacks["$"+_];if(!$)return this;if(arguments.length==1)return delete this._callbacks["$"+_],this;for(var j,et=0;et<$.length;et++)if(j=$[et],j===a||j.fn===a){$.splice(et,1);break}return $.length===0&&delete this._callbacks["$"+_],this};Emitter.prototype.emit=function(_){this._callbacks=this._callbacks||{};for(var a=new Array(arguments.length-1),$=this._callbacks["$"+_],j=1;j(_.hasOwnProperty(j)&&($[j]=_[j]),$),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(_,a){a.useNativeTimers?(_.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),_.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(_.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),_.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(_){return typeof _=="string"?utf8Length(_):Math.ceil((_.byteLength||_.size)*BASE64_OVERHEAD)}function utf8Length(_){let a=0,$=0;for(let j=0,et=_.length;j=57344?$+=3:(j++,$+=4);return $}function encode$2(_){let a="";for(let $ in _)_.hasOwnProperty($)&&(a.length&&(a+="&"),a+=encodeURIComponent($)+"="+encodeURIComponent(_[$]));return a}function decode$2(_){let a={},$=_.split("&");for(let j=0,et=$.length;j0);return a}function yeast(){const _=encode$1(+new Date);return _!==prev?(seed=0,prev=_):_+"."+encode$1(seed++)}for(;i{this.readyState="paused",a()};if(this.polling||!this.writable){let j=0;this.polling&&(j++,this.once("pollComplete",function(){--j||$()})),this.writable||(j++,this.once("drain",function(){--j||$()}))}else $()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(a){const $=j=>{if(this.readyState==="opening"&&j.type==="open"&&this.onOpen(),j.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(j)};decodePayload(a,this.socket.binaryType).forEach($),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const a=()=>{this.write([{type:"close"}])};this.readyState==="open"?a():this.once("open",a)}write(a){this.writable=!1,encodePayload(a,$=>{this.doWrite($,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const a=this.opts.secure?"https":"http",$=this.query||{};return this.opts.timestampRequests!==!1&&($[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!$.sid&&($.b64=1),this.createUri(a,$)}request(a={}){return Object.assign(a,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),a)}doWrite(a,$){const j=this.request({method:"POST",data:a});j.on("success",$),j.on("error",(et,tt)=>{this.onError("xhr post error",et,tt)})}doPoll(){const a=this.request();a.on("data",this.onData.bind(this)),a.on("error",($,j)=>{this.onError("xhr poll error",$,j)}),this.pollXhr=a}}let Request$1=class n0 extends Emitter{constructor(a,$){super(),installTimerFunctions(this,$),this.opts=$,this.method=$.method||"GET",this.uri=a,this.data=$.data!==void 0?$.data:null,this.create()}create(){var a;const $=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");$.xdomain=!!this.opts.xd;const j=this.xhr=new XHR($);try{j.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){j.setDisableHeaderCheck&&j.setDisableHeaderCheck(!0);for(let et in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(et)&&j.setRequestHeader(et,this.opts.extraHeaders[et])}}catch{}if(this.method==="POST")try{j.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{j.setRequestHeader("Accept","*/*")}catch{}(a=this.opts.cookieJar)===null||a===void 0||a.addCookies(j),"withCredentials"in j&&(j.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(j.timeout=this.opts.requestTimeout),j.onreadystatechange=()=>{var et;j.readyState===3&&((et=this.opts.cookieJar)===null||et===void 0||et.parseCookies(j)),j.readyState===4&&(j.status===200||j.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof j.status=="number"?j.status:0)},0))},j.send(this.data)}catch(et){this.setTimeoutFn(()=>{this.onError(et)},0);return}typeof document<"u"&&(this.index=n0.requestsCount++,n0.requests[this.index]=this)}onError(a){this.emitReserved("error",a,this.xhr),this.cleanup(!0)}cleanup(a){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,a)try{this.xhr.abort()}catch{}typeof document<"u"&&delete n0.requests[this.index],this.xhr=null}}onLoad(){const a=this.xhr.responseText;a!==null&&(this.emitReserved("data",a),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const _="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(_,unloadHandler,!1)}}function unloadHandler(){for(let _ in Request$1.requests)Request$1.requests.hasOwnProperty(_)&&Request$1.requests[_].abort()}const nextTick=typeof Promise=="function"&&typeof Promise.resolve=="function"?a=>Promise.resolve().then(a):(a,$)=>$(a,0),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(a){super(a),this.supportsBinary=!a.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const a=this.uri(),$=this.opts.protocols,j=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(j.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?$?new WebSocket(a,$):new WebSocket(a):new WebSocket(a,$,j)}catch(et){return this.emitReserved("error",et)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=a=>this.onClose({description:"websocket connection closed",context:a}),this.ws.onmessage=a=>this.onData(a.data),this.ws.onerror=a=>this.onError("websocket error",a)}write(a){this.writable=!1;for(let $=0;${const rt={};try{usingBrowserWebSocket&&this.ws.send(tt)}catch{}et&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const a=this.opts.secure?"wss":"ws",$=this.query||{};return this.opts.timestampRequests&&($[this.opts.timestampParam]=yeast()),this.supportsBinary||($.b64=1),this.createUri(a,$)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(a=>{this.onError("webtransport error",a)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(a=>{const $=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),j=a.readable.pipeThrough($).getReader(),et=createPacketEncoderStream();et.readable.pipeTo(a.writable),this.writer=et.writable.getWriter();const tt=()=>{j.read().then(({done:nt,value:it})=>{nt||(this.onPacket(it),tt())}).catch(nt=>{})};tt();const rt={type:"open"};this.query.sid&&(rt.data=`{"sid":"${this.query.sid}"}`),this.writer.write(rt).then(()=>this.onOpen())})}))}write(a){this.writable=!1;for(let $=0;${et&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var a;(a=this.transport)===null||a===void 0||a.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$2(_){if(_.length>2e3)throw"URI too long";const a=_,$=_.indexOf("["),j=_.indexOf("]");$!=-1&&j!=-1&&(_=_.substring(0,$)+_.substring($,j).replace(/:/g,";")+_.substring(j,_.length));let et=re.exec(_||""),tt={},rt=14;for(;rt--;)tt[parts[rt]]=et[rt]||"";return $!=-1&&j!=-1&&(tt.source=a,tt.host=tt.host.substring(1,tt.host.length-1).replace(/;/g,":"),tt.authority=tt.authority.replace("[","").replace("]","").replace(/;/g,":"),tt.ipv6uri=!0),tt.pathNames=pathNames(tt,tt.path),tt.queryKey=queryKey(tt,tt.query),tt}function pathNames(_,a){const $=/\/{2,9}/g,j=a.replace($,"/").split("/");return(a.slice(0,1)=="/"||a.length===0)&&j.splice(0,1),a.slice(-1)=="/"&&j.splice(j.length-1,1),j}function queryKey(_,a){const $={};return a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(j,et,tt){et&&($[et]=tt)}),$}let Socket$1=class Pu extends Emitter{constructor(a,$={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],a&&typeof a=="object"&&($=a,a=null),a?(a=parse$2(a),$.hostname=a.host,$.secure=a.protocol==="https"||a.protocol==="wss",$.port=a.port,a.query&&($.query=a.query)):$.host&&($.hostname=parse$2($.host).host),installTimerFunctions(this,$),this.secure=$.secure!=null?$.secure:typeof location<"u"&&location.protocol==="https:",$.hostname&&!$.port&&($.port=this.secure?"443":"80"),this.hostname=$.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=$.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=$.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},$),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(a){const $=Object.assign({},this.opts.query);$.EIO=protocol$1,$.transport=a,this.id&&($.sid=this.id);const j=Object.assign({},this.opts,{query:$,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[a]);return new transports[a](j)}open(){let a;if(this.opts.rememberUpgrade&&Pu.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)a="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else a=this.transports[0];this.readyState="opening";try{a=this.createTransport(a)}catch{this.transports.shift(),this.open();return}a.open(),this.setTransport(a)}setTransport(a){this.transport&&this.transport.removeAllListeners(),this.transport=a,a.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",$=>this.onClose("transport close",$))}probe(a){let $=this.createTransport(a),j=!1;Pu.priorWebsocketSuccess=!1;const et=()=>{j||($.send([{type:"ping",data:"probe"}]),$.once("packet",ot=>{if(!j)if(ot.type==="pong"&&ot.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",$),!$)return;Pu.priorWebsocketSuccess=$.name==="websocket",this.transport.pause(()=>{j||this.readyState!=="closed"&&(st(),this.setTransport($),$.send([{type:"upgrade"}]),this.emitReserved("upgrade",$),$=null,this.upgrading=!1,this.flush())})}else{const ut=new Error("probe error");ut.transport=$.name,this.emitReserved("upgradeError",ut)}}))};function tt(){j||(j=!0,st(),$.close(),$=null)}const rt=ot=>{const ut=new Error("probe error: "+ot);ut.transport=$.name,tt(),this.emitReserved("upgradeError",ut)};function nt(){rt("transport closed")}function it(){rt("socket closed")}function at(ot){$&&ot.name!==$.name&&tt()}const st=()=>{$.removeListener("open",et),$.removeListener("error",rt),$.removeListener("close",nt),this.off("close",it),this.off("upgrading",at)};$.once("open",et),$.once("error",rt),$.once("close",nt),this.once("close",it),this.once("upgrading",at),this.upgrades.indexOf("webtransport")!==-1&&a!=="webtransport"?this.setTimeoutFn(()=>{j||$.open()},200):$.open()}onOpen(){if(this.readyState="open",Pu.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let a=0;const $=this.upgrades.length;for(;a<$;a++)this.probe(this.upgrades[a])}}onPacket(a){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",a),this.emitReserved("heartbeat"),this.resetPingTimeout(),a.type){case"open":this.onHandshake(JSON.parse(a.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const $=new Error("server error");$.code=a.data,this.onError($);break;case"message":this.emitReserved("data",a.data),this.emitReserved("message",a.data);break}}onHandshake(a){this.emitReserved("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.maxPayload=a.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const a=this.getWritablePackets();this.transport.send(a),this.prevBufferLen=a.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let $=1;for(let j=0;j0&&$>this.maxPayload)return this.writeBuffer.slice(0,j);$+=2}return this.writeBuffer}write(a,$,j){return this.sendPacket("message",a,$,j),this}send(a,$,j){return this.sendPacket("message",a,$,j),this}sendPacket(a,$,j,et){if(typeof $=="function"&&(et=$,$=void 0),typeof j=="function"&&(et=j,j=null),this.readyState==="closing"||this.readyState==="closed")return;j=j||{},j.compress=j.compress!==!1;const tt={type:a,data:$,options:j};this.emitReserved("packetCreate",tt),this.writeBuffer.push(tt),et&&this.once("flush",et),this.flush()}close(){const a=()=>{this.onClose("forced close"),this.transport.close()},$=()=>{this.off("upgrade",$),this.off("upgradeError",$),a()},j=()=>{this.once("upgrade",$),this.once("upgradeError",$)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?j():a()}):this.upgrading?j():a()),this}onError(a){Pu.priorWebsocketSuccess=!1,this.emitReserved("error",a),this.onClose("transport error",a)}onClose(a,$){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",a,$),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(a){const $=[];let j=0;const et=a.length;for(;jtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(_):_.buffer instanceof ArrayBuffer,toString$1=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$1.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$1.call(File)==="[object FileConstructor]";function isBinary(_){return withNativeArrayBuffer&&(_ instanceof ArrayBuffer||isView(_))||withNativeBlob&&_ instanceof Blob||withNativeFile&&_ instanceof File}function hasBinary(_,a){if(!_||typeof _!="object")return!1;if(Array.isArray(_)){for(let $=0,j=_.length;$=0&&_.num{delete this.acks[a];for(let nt=0;nt{this.io.clearTimeoutFn(tt),$.apply(this,nt)};rt.withError=!0,this.acks[a]=rt}emitWithAck(a,...$){return new Promise((j,et)=>{const tt=(rt,nt)=>rt?et(rt):j(nt);tt.withError=!0,$.push(tt),this.emit(a,...$)})}_addToQueue(a){let $;typeof a[a.length-1]=="function"&&($=a.pop());const j={id:this._queueSeq++,tryCount:0,pending:!1,args:a,flags:Object.assign({fromQueue:!0},this.flags)};a.push((et,...tt)=>j!==this._queue[0]?void 0:(et!==null?j.tryCount>this._opts.retries&&(this._queue.shift(),$&&$(et)):(this._queue.shift(),$&&$(null,...tt)),j.pending=!1,this._drainQueue())),this._queue.push(j),this._drainQueue()}_drainQueue(a=!1){if(!this.connected||this._queue.length===0)return;const $=this._queue[0];$.pending&&!a||($.pending=!0,$.tryCount++,this.flags=$.flags,this.emit.apply(this,$.args))}packet(a){a.nsp=this.nsp,this.io._packet(a)}onopen(){typeof this.auth=="function"?this.auth(a=>{this._sendConnectPacket(a)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(a){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},a):a})}onerror(a){this.connected||this.emitReserved("connect_error",a)}onclose(a,$){this.connected=!1,delete this.id,this.emitReserved("disconnect",a,$),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(a=>{if(!this.sendBuffer.some(j=>String(j.id)===a)){const j=this.acks[a];delete this.acks[a],j.withError&&j.call(this,new Error("socket has been disconnected"))}})}onpacket(a){if(a.nsp===this.nsp)switch(a.type){case PacketType.CONNECT:a.data&&a.data.sid?this.onconnect(a.data.sid,a.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(a);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(a);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const j=new Error(a.data.message);j.data=a.data.data,this.emitReserved("connect_error",j);break}}onevent(a){const $=a.data||[];a.id!=null&&$.push(this.ack(a.id)),this.connected?this.emitEvent($):this.receiveBuffer.push(Object.freeze($))}emitEvent(a){if(this._anyListeners&&this._anyListeners.length){const $=this._anyListeners.slice();for(const j of $)j.apply(this,a)}super.emit.apply(this,a),this._pid&&a.length&&typeof a[a.length-1]=="string"&&(this._lastOffset=a[a.length-1])}ack(a){const $=this;let j=!1;return function(...et){j||(j=!0,$.packet({type:PacketType.ACK,id:a,data:et}))}}onack(a){const $=this.acks[a.id];typeof $=="function"&&(delete this.acks[a.id],$.withError&&a.data.unshift(null),$.apply(this,a.data))}onconnect(a,$){this.id=a,this.recovered=$&&this._pid===$,this._pid=$,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(a=>this.emitEvent(a)),this.receiveBuffer=[],this.sendBuffer.forEach(a=>{this.notifyOutgoingListeners(a),this.packet(a)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(a=>a()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(a){return this.flags.compress=a,this}get volatile(){return this.flags.volatile=!0,this}timeout(a){return this.flags.timeout=a,this}onAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(a),this}prependAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(a),this}offAny(a){if(!this._anyListeners)return this;if(a){const $=this._anyListeners;for(let j=0;j<$.length;j++)if(a===$[j])return $.splice(j,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(a),this}prependAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(a),this}offAnyOutgoing(a){if(!this._anyOutgoingListeners)return this;if(a){const $=this._anyOutgoingListeners;for(let j=0;j<$.length;j++)if(a===$[j])return $.splice(j,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(a){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const $=this._anyOutgoingListeners.slice();for(const j of $)j.apply(this,a.data)}}}function Backoff(_){_=_||{},this.ms=_.min||100,this.max=_.max||1e4,this.factor=_.factor||2,this.jitter=_.jitter>0&&_.jitter<=1?_.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var _=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),$=Math.floor(a*this.jitter*_);_=Math.floor(a*10)&1?_+$:_-$}return Math.min(_,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(_){this.ms=_};Backoff.prototype.setMax=function(_){this.max=_};Backoff.prototype.setJitter=function(_){this.jitter=_};class Manager extends Emitter{constructor(a,$){var j;super(),this.nsps={},this.subs=[],a&&typeof a=="object"&&($=a,a=void 0),$=$||{},$.path=$.path||"/socket.io",this.opts=$,installTimerFunctions(this,$),this.reconnection($.reconnection!==!1),this.reconnectionAttempts($.reconnectionAttempts||1/0),this.reconnectionDelay($.reconnectionDelay||1e3),this.reconnectionDelayMax($.reconnectionDelayMax||5e3),this.randomizationFactor((j=$.randomizationFactor)!==null&&j!==void 0?j:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout($.timeout==null?2e4:$.timeout),this._readyState="closed",this.uri=a;const et=$.parser||parser;this.encoder=new et.Encoder,this.decoder=new et.Decoder,this._autoConnect=$.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(a){return arguments.length?(this._reconnection=!!a,this):this._reconnection}reconnectionAttempts(a){return a===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=a,this)}reconnectionDelay(a){var $;return a===void 0?this._reconnectionDelay:(this._reconnectionDelay=a,($=this.backoff)===null||$===void 0||$.setMin(a),this)}randomizationFactor(a){var $;return a===void 0?this._randomizationFactor:(this._randomizationFactor=a,($=this.backoff)===null||$===void 0||$.setJitter(a),this)}reconnectionDelayMax(a){var $;return a===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=a,($=this.backoff)===null||$===void 0||$.setMax(a),this)}timeout(a){return arguments.length?(this._timeout=a,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(a){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const $=this.engine,j=this;this._readyState="opening",this.skipReconnect=!1;const et=on($,"open",function(){j.onopen(),a&&a()}),tt=nt=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",nt),a?a(nt):this.maybeReconnectOnOpen()},rt=on($,"error",tt);if(this._timeout!==!1){const nt=this._timeout,it=this.setTimeoutFn(()=>{et(),tt(new Error("timeout")),$.close()},nt);this.opts.autoUnref&&it.unref(),this.subs.push(()=>{this.clearTimeoutFn(it)})}return this.subs.push(et),this.subs.push(rt),this}connect(a){return this.open(a)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const a=this.engine;this.subs.push(on(a,"ping",this.onping.bind(this)),on(a,"data",this.ondata.bind(this)),on(a,"error",this.onerror.bind(this)),on(a,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(a){try{this.decoder.add(a)}catch($){this.onclose("parse error",$)}}ondecoded(a){nextTick(()=>{this.emitReserved("packet",a)},this.setTimeoutFn)}onerror(a){this.emitReserved("error",a)}socket(a,$){let j=this.nsps[a];return j?this._autoConnect&&!j.active&&j.connect():(j=new Socket(this,a,$),this.nsps[a]=j),j}_destroy(a){const $=Object.keys(this.nsps);for(const j of $)if(this.nsps[j].active)return;this._close()}_packet(a){const $=this.encoder.encode(a);for(let j=0;j<$.length;j++)this.engine.write($[j],a.options)}cleanup(){this.subs.forEach(a=>a()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(a,$){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",a,$),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const a=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const $=this.backoff.duration();this._reconnecting=!0;const j=this.setTimeoutFn(()=>{a.skipReconnect||(this.emitReserved("reconnect_attempt",a.backoff.attempts),!a.skipReconnect&&a.open(et=>{et?(a._reconnecting=!1,a.reconnect(),this.emitReserved("reconnect_error",et)):a.onreconnect()}))},$);this.opts.autoUnref&&j.unref(),this.subs.push(()=>{this.clearTimeoutFn(j)})}}onreconnect(){const a=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",a)}}const cache={};function lookup(_,a){typeof _=="object"&&(a=_,_=void 0),a=a||{};const $=url(_,a.path||"/socket.io"),j=$.source,et=$.id,tt=$.path,rt=cache[et]&&tt in cache[et].nsps,nt=a.forceNew||a["force new connection"]||a.multiplex===!1||rt;let it;return nt?it=new Manager(j,a):(cache[et]||(cache[et]=new Manager(j,a)),it=cache[et]),$.query&&!a.query&&(a.query=$.queryKey),it.socket($.path,a)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});var cryptoBrowserifyExports=requireCryptoBrowserify();const nodeCrypto=getDefaultExportFromCjs$1(cryptoBrowserifyExports),ec$4=new elliptic$3.ec("secp256k1"),browserCrypto=global$1.crypto||global$1.msCrypto||{},subtle=browserCrypto.subtle||browserCrypto.webkitSubtle,EC_GROUP_ORDER=Buffer$g.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),ZERO32=Buffer$g.alloc(32,0);function assert$j(_,a){if(!_)throw new Error(a||"Assertion failed")}function isScalar(_){return Buffer$g.isBuffer(_)&&_.length===32}function isValidPrivateKey(_){return isScalar(_)?_.compare(ZERO32)>0&&_.compare(EC_GROUP_ORDER)<0:!1}function equalConstTime(_,a){if(_.length!==a.length)return!1;let $=0;for(let j=0;j<_.length;j++)$|=_[j]^a[j];return $===0}function randomBytes(_){const a=new Uint8Array(_);return typeof browserCrypto.getRandomValues>"u"?Buffer$g.from(nodeCrypto.randomBytes(_)):(browserCrypto.getRandomValues(a),Buffer$g.from(a))}async function sha512(_){if(subtle){const j=await subtle.digest("SHA-512",_);return new Uint8Array(j)}const $=nodeCrypto.createHash("sha512").update(_).digest();return new Uint8Array($)}function getAes(_){return async function(a,$,j){if(subtle){const et={name:"AES-CBC"},tt=await subtle.importKey("raw",$,et,!1,[_]),rt={name:"AES-CBC",iv:a},nt=await subtle[_](rt,tt,j);return Buffer$g.from(new Uint8Array(nt))}else if(_==="encrypt"){const et=nodeCrypto.createCipheriv("aes-256-cbc",$,a),tt=et.update(j),rt=et.final();return Buffer$g.concat([tt,rt])}else if(_==="decrypt"){const et=nodeCrypto.createDecipheriv("aes-256-cbc",$,a),tt=et.update(j),rt=et.final();return Buffer$g.concat([tt,rt])}throw new Error(`Unsupported operation: ${_}`)}}const aesCbcEncrypt=getAes("encrypt"),aesCbcDecrypt=getAes("decrypt");async function hmacSha256Sign(_,a){if(subtle){const et={name:"HMAC",hash:{name:"SHA-256"}},tt=await subtle.importKey("raw",new Uint8Array(_),et,!1,["sign","verify"]),rt=await subtle.sign("HMAC",tt,a);return Buffer$g.from(new Uint8Array(rt))}const $=nodeCrypto.createHmac("sha256",Buffer$g.from(_));return $.update(a),$.digest()}async function hmacSha256Verify(_,a,$){const j=await hmacSha256Sign(_,a);return equalConstTime(j,$)}const generatePrivate=function(){let _=randomBytes(32);for(;!isValidPrivateKey(_);)_=randomBytes(32);return _},getPublic=function(_){return assert$j(_.length===32,"Bad private key"),assert$j(isValidPrivateKey(_),"Bad private key"),Buffer$g.from(ec$4.keyFromPrivate(_).getPublic("array"))},sign=async function(_,a){return assert$j(_.length===32,"Bad private key"),assert$j(isValidPrivateKey(_),"Bad private key"),assert$j(a.length>0,"Message should not be empty"),assert$j(a.length<=32,"Message is too long"),Buffer$g.from(ec$4.sign(a,_,{canonical:!0}).toDER())},derive=async function(_,a){assert$j(Buffer$g.isBuffer(_),"Bad private key"),assert$j(Buffer$g.isBuffer(a),"Bad public key"),assert$j(_.length===32,"Bad private key"),assert$j(isValidPrivateKey(_),"Bad private key"),assert$j(a.length===65||a.length===33,"Bad public key"),a.length===65&&assert$j(a[0]===4,"Bad public key"),a.length===33&&assert$j(a[0]===2||a[0]===3,"Bad public key");const $=ec$4.keyFromPrivate(_),j=ec$4.keyFromPublic(a),et=$.derive(j.getPublic());return Buffer$g.from(et.toArray())},deriveUnpadded=derive,derivePadded=async function(_,a){assert$j(Buffer$g.isBuffer(_),"Bad private key"),assert$j(Buffer$g.isBuffer(a),"Bad public key"),assert$j(_.length===32,"Bad private key"),assert$j(isValidPrivateKey(_),"Bad private key"),assert$j(a.length===65||a.length===33,"Bad public key"),a.length===65&&assert$j(a[0]===4,"Bad public key"),a.length===33&&assert$j(a[0]===2||a[0]===3,"Bad public key");const $=ec$4.keyFromPrivate(_),j=ec$4.keyFromPublic(a),et=$.derive(j.getPublic());return Buffer$g.from(et.toString(16,64),"hex")},encrypt=async function(_,a,$){$=$||{};let j=$.ephemPrivateKey||randomBytes(32);for(;!isValidPrivateKey(j);)j=$.ephemPrivateKey||randomBytes(32);const et=getPublic(j),tt=await deriveUnpadded(j,_),rt=await sha512(tt),nt=$.iv||randomBytes(16),it=rt.slice(0,32),at=rt.slice(32),ot=await aesCbcEncrypt(nt,Buffer$g.from(it),a),ut=Buffer$g.concat([nt,et,ot]),dt=await hmacSha256Sign(Buffer$g.from(at),ut);return{iv:nt,ephemPublicKey:et,ciphertext:ot,mac:dt}},decrypt=async function(_,a,$){const j=$??!1,tt=await(j?derivePadded:deriveUnpadded)(_,a.ephemPublicKey),rt=await sha512(tt),nt=rt.slice(0,32),it=rt.slice(32),at=Buffer$g.concat([a.iv,a.ephemPublicKey,a.ciphertext]),st=await hmacSha256Verify(Buffer$g.from(it),at,a.mac);if(!st&&j===!1)return decrypt(_,a,!0);if(!st&&j===!0)throw new Error("bad MAC after trying padded");const ot=await aesCbcDecrypt(a.iv,Buffer$g.from(nt),a.ciphertext);return Buffer$g.from(new Uint8Array(ot))},log$5=log$1$1.getLogger("http-helpers");log$5.setLevel(loglevelExports.levels.INFO);var jsonify={},parse$1,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse$1;hasRequiredParse=1;var _,a,$={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` +`,r:"\r",t:" "},j;function et(dt){throw{name:"SyntaxError",message:dt,at:_,text:j}}function tt(dt){return dt&&dt!==a&&et("Expected '"+dt+"' instead of '"+a+"'"),a=j.charAt(_),_+=1,a}function rt(){var dt,mt="";for(a==="-"&&(mt="-",tt("-"));a>="0"&&a<="9";)mt+=a,tt();if(a===".")for(mt+=".";tt()&&a>="0"&&a<="9";)mt+=a;if(a==="e"||a==="E")for(mt+=a,tt(),(a==="-"||a==="+")&&(mt+=a,tt());a>="0"&&a<="9";)mt+=a,tt();return dt=Number(mt),isFinite(dt)||et("Bad number"),dt}function nt(){var dt,mt,xt="",Ct;if(a==='"')for(;tt();){if(a==='"')return tt(),xt;if(a==="\\")if(tt(),a==="u"){for(Ct=0,mt=0;mt<4&&(dt=parseInt(tt(),16),!!isFinite(dt));mt+=1)Ct=Ct*16+dt;xt+=String.fromCharCode(Ct)}else if(typeof $[a]=="string")xt+=$[a];else break;else xt+=a}et("Bad string")}function it(){for(;a&&a<=" ";)tt()}function at(){switch(a){case"t":return tt("t"),tt("r"),tt("u"),tt("e"),!0;case"f":return tt("f"),tt("a"),tt("l"),tt("s"),tt("e"),!1;case"n":return tt("n"),tt("u"),tt("l"),tt("l"),null;default:et("Unexpected '"+a+"'")}}function st(){var dt=[];if(a==="["){if(tt("["),it(),a==="]")return tt("]"),dt;for(;a;){if(dt.push(ut()),it(),a==="]")return tt("]"),dt;tt(","),it()}}et("Bad array")}function ot(){var dt,mt={};if(a==="{"){if(tt("{"),it(),a==="}")return tt("}"),mt;for(;a;){if(dt=nt(),it(),tt(":"),Object.prototype.hasOwnProperty.call(mt,dt)&&et('Duplicate key "'+dt+'"'),mt[dt]=ut(),it(),a==="}")return tt("}"),mt;tt(","),it()}}et("Bad object")}function ut(){switch(it(),a){case"{":return ot();case"[":return st();case'"':return nt();case"-":return rt();default:return a>="0"&&a<="9"?rt():at()}}return parse$1=function(dt,mt){var xt;return j=dt,_=0,a=" ",xt=ut(),it(),a&&et("Syntax error"),typeof mt=="function"?function Ct(Pt,Tt){var kt,Lt,Nt=Pt[Tt];if(Nt&&typeof Nt=="object")for(kt in ut)Object.prototype.hasOwnProperty.call(Nt,kt)&&(Lt=Ct(Nt,kt),typeof Lt>"u"?delete Nt[kt]:Nt[kt]=Lt);return mt.call(Pt,Tt,Nt)}({"":xt},""):xt},parse$1}var stringify$1,hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify$1;hasRequiredStringify=1;var _=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a,$,j={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},et;function tt(nt){return _.lastIndex=0,_.test(nt)?'"'+nt.replace(_,function(it){var at=j[it];return typeof at=="string"?at:"\\u"+("0000"+it.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+nt+'"'}function rt(nt,it){var at,st,ot,ut,dt=a,mt,xt=it[nt];switch(xt&&typeof xt=="object"&&typeof xt.toJSON=="function"&&(xt=xt.toJSON(nt)),typeof et=="function"&&(xt=et.call(it,nt,xt)),typeof xt){case"string":return tt(xt);case"number":return isFinite(xt)?String(xt):"null";case"boolean":case"null":return String(xt);case"object":if(!xt)return"null";if(a+=$,mt=[],Object.prototype.toString.apply(xt)==="[object Array]"){for(ut=xt.length,at=0;at=0&&toStr$2.call(a.callee)==="[object Function]"),j},implementation$4,hasRequiredImplementation;function requireImplementation(){if(hasRequiredImplementation)return implementation$4;hasRequiredImplementation=1;var _;if(!Object.keys){var a=Object.prototype.hasOwnProperty,$=Object.prototype.toString,j=isArguments,et=Object.prototype.propertyIsEnumerable,tt=!et.call({toString:null},"toString"),rt=et.call(function(){},"prototype"),nt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],it=function(ut){var ht=ut.constructor;return ht&&ht.prototype===ut},ot={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},st=function(){if(typeof window>"u")return!1;for(var ut in window)try{if(!ot["$"+ut]&&a.call(window,ut)&&window[ut]!==null&&typeof window[ut]=="object")try{it(window[ut])}catch{return!0}}catch{return!0}return!1}(),at=function(ut){if(typeof window>"u"||!st)return it(ut);try{return it(ut)}catch{return!1}};_=function(ht){var bt=ht!==null&&typeof ht=="object",Et=$.call(ht)==="[object Function]",Ct=j(ht),Pt=bt&&$.call(ht)==="[object String]",Tt=[];if(!bt&&!Et&&!Ct)throw new TypeError("Object.keys called on a non-object");var It=rt&&Et;if(Pt&&ht.length>0&&!a.call(ht,0))for(var Lt=0;Lt0)for(var Nt=0;Nt"u"||!getProto$1?undefined$2:getProto$1(Uint8Array),INTRINSICS$1={"%AggregateError%":typeof AggregateError>"u"?undefined$2:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$2:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$1&&getProto$1?getProto$1([][Symbol.iterator]()):undefined$2,"%AsyncFromSyncIteratorPrototype%":undefined$2,"%AsyncFunction%":needsEval$1,"%AsyncGenerator%":needsEval$1,"%AsyncGeneratorFunction%":needsEval$1,"%AsyncIteratorPrototype%":needsEval$1,"%Atomics%":typeof Atomics>"u"?undefined$2:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$2:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$2:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$2:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$2:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$2:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$2:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$2:FinalizationRegistry,"%Function%":$Function$1,"%GeneratorFunction%":needsEval$1,"%Int8Array%":typeof Int8Array>"u"?undefined$2:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$2:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$2:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols$1&&getProto$1?getProto$1(getProto$1([][Symbol.iterator]())):undefined$2,"%JSON%":typeof JSON=="object"?JSON:undefined$2,"%Map%":typeof Map>"u"?undefined$2:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols$1||!getProto$1?undefined$2:getProto$1(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$2:Promise,"%Proxy%":typeof Proxy>"u"?undefined$2:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$2:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$2:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols$1||!getProto$1?undefined$2:getProto$1(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$2:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$1&&getProto$1?getProto$1(""[Symbol.iterator]()):undefined$2,"%Symbol%":hasSymbols$1?Symbol:undefined$2,"%SyntaxError%":$SyntaxError$2,"%ThrowTypeError%":ThrowTypeError$1,"%TypedArray%":TypedArray$1,"%TypeError%":$TypeError$3,"%Uint8Array%":typeof Uint8Array>"u"?undefined$2:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$2:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$2:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$2:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$2:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$2:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$2:WeakSet};if(getProto$1)try{null.error}catch(_){var errorProto$1=getProto$1(getProto$1(_));INTRINSICS$1["%Error.prototype%"]=errorProto$1}var doEval$1=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor$1("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor$1("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor$1("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto$1&&($=getProto$1(et.prototype))}return INTRINSICS$1[a]=$,$},LEGACY_ALIASES$1={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$1=functionBind$1,hasOwn$1=hasown,$concat$1=bind$1.call(Function.call,Array.prototype.concat),$spliceApply$1=bind$1.call(Function.apply,Array.prototype.splice),$replace$1=bind$1.call(Function.call,String.prototype.replace),$strSlice$1=bind$1.call(Function.call,String.prototype.slice),$exec$1=bind$1.call(Function.call,RegExp.prototype.exec),rePropName$1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$1=/\\(\\)?/g,stringToPath$1=function _(a){var $=$strSlice$1(a,0,1),j=$strSlice$1(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$2("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$2("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace$1(a,rePropName$1,function(tt,rt,nt,it){et[et.length]=nt?$replace$1(it,reEscapeChar$1,"$1"):rt||tt}),et},getBaseIntrinsic$1=function _(a,$){var j=a,et;if(hasOwn$1(LEGACY_ALIASES$1,j)&&(et=LEGACY_ALIASES$1[j],j="%"+et[0]+"%"),hasOwn$1(INTRINSICS$1,j)){var tt=INTRINSICS$1[j];if(tt===needsEval$1&&(tt=doEval$1(j)),typeof tt>"u"&&!$)throw new $TypeError$3("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$2("intrinsic "+a+" does not exist!")},getIntrinsic$1=function _(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$3("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$3('"allowMissing" argument must be a boolean');if($exec$1(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$2("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$1(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$1("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,ot=tt.alias;ot&&(et=ot[0],$spliceApply$1(j,$concat$1([0,1],ot)));for(var st=1,at=!0;st=j.length){var Et=$gOPD$1(nt,ut);at=!!Et,at&&"get"in Et&&!("originalValue"in Et.get)?nt=Et.get:nt=nt[ut]}else at=hasOwn$1(nt,ut),nt=nt[ut];at&&!it&&(INTRINSICS$1[rt]=nt)}}return nt},ERROR_MESSAGE="Function.prototype.bind called on incompatible ",slice=Array.prototype.slice,toStr=Object.prototype.toString,funcType="[object Function]",implementation$1=function _(a){var $=this;if(typeof $!="function"||toStr.call($)!==funcType)throw new TypeError(ERROR_MESSAGE+$);for(var j=slice.call(arguments,1),et,tt=function(){if(this instanceof et){var st=$.apply(this,j.concat(slice.call(arguments)));return Object(st)===st?st:this}else return $.apply(a,j.concat(slice.call(arguments)))},rt=Math.max(0,$.length-j.length),nt=[],it=0;it"u"||!getProto?undefined$1:getProto(Uint8Array),INTRINSICS={"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto?undefined$1:getProto(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto?undefined$1:getProto(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$2,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet};if(getProto)try{null.error}catch(_){var errorProto=getProto(getProto(_));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto&&($=getProto(et.prototype))}return INTRINSICS[a]=$,$},LEGACY_ALIASES={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=functionBind,hasOwn=src$3,$concat=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function _(a){var $=$strSlice(a,0,1),j=$strSlice(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace(a,rePropName,function(tt,rt,nt,it){et[et.length]=nt?$replace(it,reEscapeChar,"$1"):rt||tt}),et},getBaseIntrinsic=function _(a,$){var j=a,et;if(hasOwn(LEGACY_ALIASES,j)&&(et=LEGACY_ALIASES[j],j="%"+et[0]+"%"),hasOwn(INTRINSICS,j)){var tt=INTRINSICS[j];if(tt===needsEval&&(tt=doEval(j)),typeof tt>"u"&&!$)throw new $TypeError$2("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$1("intrinsic "+a+" does not exist!")},getIntrinsic=function _(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$2("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$2('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,ot=tt.alias;ot&&(et=ot[0],$spliceApply(j,$concat([0,1],ot)));for(var st=1,at=!0;st=j.length){var Et=$gOPD(nt,ut);at=!!Et,at&&"get"in Et&&!("originalValue"in Et.get)?nt=Et.get:nt=nt[ut]}else at=hasOwn(nt,ut),nt=nt[ut];at&&!it&&(INTRINSICS[rt]=nt)}}return nt},GetIntrinsic$3=getIntrinsic,$defineProperty$1=GetIntrinsic$3("%Object.defineProperty%",!0),hasPropertyDescriptors$1=function _(){if($defineProperty$1)try{return $defineProperty$1({},"a",{value:1}),!0}catch{return!1}return!1};hasPropertyDescriptors$1.hasArrayLengthDefineBug=function _(){if(!hasPropertyDescriptors$1())return null;try{return $defineProperty$1([],"length",{value:1}).length!==1}catch{return!0}};var hasPropertyDescriptors_1=hasPropertyDescriptors$1,hasPropertyDescriptors=hasPropertyDescriptors_1(),GetIntrinsic$2=getIntrinsic$1,$defineProperty=hasPropertyDescriptors&&GetIntrinsic$2("%Object.defineProperty%",!0);if($defineProperty)try{$defineProperty({},"a",{value:1})}catch{$defineProperty=!1}var $SyntaxError=GetIntrinsic$2("%SyntaxError%"),$TypeError$1=GetIntrinsic$2("%TypeError%"),gopd=gopd$1,defineDataProperty=function _(a,$,j){if(!a||typeof a!="object"&&typeof a!="function")throw new $TypeError$1("`obj` must be an object or a function`");if(typeof $!="string"&&typeof $!="symbol")throw new $TypeError$1("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $TypeError$1("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $TypeError$1("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $TypeError$1("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $TypeError$1("`loose`, if provided, must be a boolean");var et=arguments.length>3?arguments[3]:null,tt=arguments.length>4?arguments[4]:null,rt=arguments.length>5?arguments[5]:null,nt=arguments.length>6?arguments[6]:!1,it=!!gopd&&gopd(a,$);if($defineProperty)$defineProperty(a,$,{configurable:rt===null&&it?it.configurable:!rt,enumerable:et===null&&it?it.enumerable:!et,value:j,writable:tt===null&&it?it.writable:!tt});else if(nt||!et&&!tt&&!rt)a[$]=j;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},GetIntrinsic$1=getIntrinsic$1,define=defineDataProperty,hasDescriptors=hasPropertyDescriptors_1(),gOPD=gopd$1,$TypeError=GetIntrinsic$1("%TypeError%"),$floor=GetIntrinsic$1("%Math.floor%"),setFunctionLength=function _(a,$){if(typeof a!="function")throw new $TypeError("`fn` is not a function");if(typeof $!="number"||$<0||$>4294967295||$floor($)!==$)throw new $TypeError("`length` must be a positive 32-bit integer");var j=arguments.length>2&&!!arguments[2],et=!0,tt=!0;if("length"in a&&gOPD){var rt=gOPD(a,"length");rt&&!rt.configurable&&(et=!1),rt&&!rt.writable&&(tt=!1)}return(et||tt||!j)&&(hasDescriptors?define(a,"length",$,!0,!0):define(a,"length",$)),a};(function(_){var a=functionBind$1,$=getIntrinsic$1,j=setFunctionLength,et=$("%TypeError%"),tt=$("%Function.prototype.apply%"),rt=$("%Function.prototype.call%"),nt=$("%Reflect.apply%",!0)||a.call(rt,tt),it=$("%Object.defineProperty%",!0),ot=$("%Math.max%");if(it)try{it({},"a",{value:1})}catch{it=null}_.exports=function(ut){if(typeof ut!="function")throw new et("a function is required");var ht=nt(a,rt,arguments);return j(ht,1+ot(0,ut.length-(arguments.length-1)),!0)};var st=function(){return nt(a,tt,arguments)};it?it(_.exports,"apply",{value:st}):_.exports.apply=st})(callBind$2);var callBindExports=callBind$2.exports,GetIntrinsic=getIntrinsic$1,callBind$1=callBindExports,$indexOf=callBind$1(GetIntrinsic("String.prototype.indexOf")),callBound$1=function _(a,$){var j=GetIntrinsic(a,!!$);return typeof j=="function"&&$indexOf(a,".prototype.")>-1?callBind$1(j):j},jsonStringify=(typeof JSON<"u"?JSON:requireJsonify()).stringify,isArray=isarray,objectKeys=objectKeys$1,callBind=callBindExports,callBound=callBound$1,$join=callBound("Array.prototype.join"),$push=callBound("Array.prototype.push"),strRepeat=function _(a,$){for(var j="",et=0;et1?arguments[1]:void 0,j=$&&$.space||"";typeof j=="number"&&(j=strRepeat(j," "));var et=!!$&&typeof $.cycles=="boolean"&&$.cycles,tt=$&&$.replacer?callBind($.replacer):defaultReplacer,rt=typeof $=="function"?$:$&&$.cmp,nt=rt&&function(ot){var st=rt.length>2&&function(ut){return ot[ut]};return function(at,ut){return rt({key:at,value:ot[at]},{key:ut,value:ot[ut]},st?{__proto__:null,get:st}:void 0)}},it=[];return function ot(st,at,ut,ht){var bt=j?` -`+strRepeat(ht,j):"",Et=j?": ":":";if(ut&&ut.toJSON&&typeof ut.toJSON=="function"&&(ut=ut.toJSON()),ut=tt(st,at,ut),ut!==void 0){if(typeof ut!="object"||ut===null)return jsonStringify(ut);if(isArray(ut)){for(var It=[],Ct=0;Ct",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$c={};(function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$G;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,at,ut){var ht=new Array(Math.max(st.bitLength(),ut)+1),bt;for(bt=0;bt(Et>>1)-1?Pt=(Et>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,ht[bt]=Pt,Ct.iushrn(1)}return ht}a.getNAF=tt;function rt(st,at){var ut=[[],[]];st=st.clone(),at=at.clone();for(var ht=0,bt=0,Et;st.cmpn(-ht)>0||at.cmpn(-bt)>0;){var Ct=st.andln(3)+ht&3,Pt=at.andln(3)+bt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(Et=st.andln(7)+ht&7,(Et===3||Et===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var It;Pt&1?(Et=at.andln(7)+bt&7,(Et===3||Et===5)&&Ct===2?It=-Pt:It=Pt):It=0,ut[1].push(It),2*ht===Tt+1&&(ht=1-ht),2*bt===It+1&&(bt=1-bt),st.iushrn(1),at.iushrn(1)}return ut}a.getJSF=rt;function nt(st,at,ut){var ht="_"+at;st.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function ot(st){return new $(st,"hex","le")}a.intFromLE=ot})(utils$c);var curve={},BN$8=bnExports$1,utils$b=utils$c,getNAF=utils$b.getNAF,getJSF=utils$b.getJSF,assert$9=utils$b.assert;function BaseCurve(_,a){this.type=_,this.p=new BN$8(a.p,16),this.red=a.prime?BN$8.red(a.prime):BN$8.mont(this.p),this.zero=new BN$8(0).toRed(this.red),this.one=new BN$8(1).toRed(this.red),this.two=new BN$8(2).toRed(this.red),this.n=a.n&&new BN$8(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var $=this.n&&this.p.div(this.n);!$||$.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base=BaseCurve;BaseCurve.prototype.point=function _(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function _(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function _(a,$){assert$9(a.precomputed);var j=a._getDoubles(),et=getNAF($,1,this._bitLength),tt=(1<=nt;ot--)it=(it<<1)+et[ot];rt.push(it)}for(var st=this.jpoint(null,null,null),at=this.jpoint(null,null,null),ut=tt;ut>0;ut--){for(nt=0;nt=0;it--){for(var ot=0;it>=0&&rt[it]===0;it--)ot++;if(it>=0&&ot++,nt=nt.dblp(ot),it<0)break;var st=rt[it];assert$9(st!==0),a.type==="affine"?st>0?nt=nt.mixedAdd(tt[st-1>>1]):nt=nt.mixedAdd(tt[-st-1>>1].neg()):st>0?nt=nt.add(tt[st-1>>1]):nt=nt.add(tt[-st-1>>1].neg())}return a.type==="affine"?nt.toP():nt};BaseCurve.prototype._wnafMulAdd=function _(a,$,j,et,tt){var rt=this._wnafT1,nt=this._wnafT2,it=this._wnafT3,ot=0,st,at,ut;for(st=0;st=1;st-=2){var bt=st-1,Et=st;if(rt[bt]!==1||rt[Et]!==1){it[bt]=getNAF(j[bt],rt[bt],this._bitLength),it[Et]=getNAF(j[Et],rt[Et],this._bitLength),ot=Math.max(it[bt].length,ot),ot=Math.max(it[Et].length,ot);continue}var Ct=[$[bt],null,null,$[Et]];$[bt].y.cmp($[Et].y)===0?(Ct[1]=$[bt].add($[Et]),Ct[2]=$[bt].toJ().mixedAdd($[Et].neg())):$[bt].y.cmp($[Et].y.redNeg())===0?(Ct[1]=$[bt].toJ().mixedAdd($[Et]),Ct[2]=$[bt].add($[Et].neg())):(Ct[1]=$[bt].toJ().mixedAdd($[Et]),Ct[2]=$[bt].toJ().mixedAdd($[Et].neg()));var Pt=[-3,-1,-5,-7,0,7,5,1,3],Tt=getJSF(j[bt],j[Et]);for(ot=Math.max(Tt[0].length,ot),it[bt]=new Array(ot),it[Et]=new Array(ot),at=0;at=0;st--){for(var jt=0;st>=0;){var Mt=!0;for(at=0;at=0&&jt++,Nt=Nt.dblp(jt),st<0)break;for(at=0;at0?ut=nt[at][Dt-1>>1]:Dt<0&&(ut=nt[at][-Dt-1>>1].neg()),ut.type==="affine"?Nt=Nt.mixedAdd(ut):Nt=Nt.add(ut))}}for(st=0;st=Math.ceil((a.bitLength()+1)/$.step):!1};BasePoint.prototype._getDoubles=function _(a,$){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var j=[this],et=this,tt=0;tt<$;tt+=a){for(var rt=0;rt=0&&(ht=ot,bt=st),at.negative&&(at=at.neg(),ut=ut.neg()),ht.negative&&(ht=ht.neg(),bt=bt.neg()),[{a:at,b:ut},{a:ht,b:bt}]};ShortCurve.prototype._endoSplit=function _(a){var $=this.endo.basis,j=$[0],et=$[1],tt=et.b.mul(a).divRound(this.n),rt=j.b.neg().mul(a).divRound(this.n),nt=tt.mul(j.a),it=rt.mul(et.a),ot=tt.mul(j.b),st=rt.mul(et.b),at=a.sub(nt).sub(it),ut=ot.add(st).neg();return{k1:at,k2:ut}};ShortCurve.prototype.pointFromX=function _(a,$){a=new BN$7(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");var tt=et.fromRed().isOdd();return($&&!tt||!$&&tt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve.prototype.validate=function _(a){if(a.inf)return!0;var $=a.x,j=a.y,et=this.a.redMul($),tt=$.redSqr().redMul($).redIAdd(et).redIAdd(this.b);return j.redSqr().redISub(tt).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function _(a,$,j){for(var et=this._endoWnafT1,tt=this._endoWnafT2,rt=0;rt":""};Point$2.prototype.isInfinity=function _(){return this.inf};Point$2.prototype.add=function _(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var $=this.y.redSub(a.y);$.cmpn(0)!==0&&($=$.redMul(this.x.redSub(a.x).redInvm()));var j=$.redSqr().redISub(this.x).redISub(a.x),et=$.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$2.prototype.dbl=function _(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var $=this.curve.a,j=this.x.redSqr(),et=a.redInvm(),tt=j.redAdd(j).redIAdd(j).redIAdd($).redMul(et),rt=tt.redSqr().redISub(this.x.redAdd(this.x)),nt=tt.redMul(this.x.redSub(rt)).redISub(this.y);return this.curve.point(rt,nt)};Point$2.prototype.getX=function _(){return this.x.fromRed()};Point$2.prototype.getY=function _(){return this.y.fromRed()};Point$2.prototype.mul=function _(a){return a=new BN$7(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$2.prototype.mulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt):this.curve._wnafMulAdd(1,et,tt,2)};Point$2.prototype.jmulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt,!0):this.curve._wnafMulAdd(1,et,tt,2,!0)};Point$2.prototype.eq=function _(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$2.prototype.neg=function _(a){if(this.inf)return this;var $=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var j=this.precomputed,et=function(tt){return tt.neg()};$.precomputed={naf:j.naf&&{wnd:j.naf.wnd,points:j.naf.points.map(et)},doubles:j.doubles&&{step:j.doubles.step,points:j.doubles.points.map(et)}}}return $};Point$2.prototype.toJ=function _(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint(_,a,$,j){Base$2.BasePoint.call(this,_,"jacobian"),a===null&&$===null&&j===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$7(0)):(this.x=new BN$7(a,16),this.y=new BN$7($,16),this.z=new BN$7(j,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$2(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function _(a,$,j){return new JPoint(this,a,$,j)};JPoint.prototype.toP=function _(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),$=a.redSqr(),j=this.x.redMul($),et=this.y.redMul($).redMul(a);return this.curve.point(j,et)};JPoint.prototype.neg=function _(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function _(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var $=a.z.redSqr(),j=this.z.redSqr(),et=this.x.redMul($),tt=a.x.redMul(j),rt=this.y.redMul($.redMul(a.z)),nt=a.y.redMul(j.redMul(this.z)),it=et.redSub(tt),ot=rt.redSub(nt);if(it.cmpn(0)===0)return ot.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var st=it.redSqr(),at=st.redMul(it),ut=et.redMul(st),ht=ot.redSqr().redIAdd(at).redISub(ut).redISub(ut),bt=ot.redMul(ut.redISub(ht)).redISub(rt.redMul(at)),Et=this.z.redMul(a.z).redMul(it);return this.curve.jpoint(ht,bt,Et)};JPoint.prototype.mixedAdd=function _(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var $=this.z.redSqr(),j=this.x,et=a.x.redMul($),tt=this.y,rt=a.y.redMul($).redMul(this.z),nt=j.redSub(et),it=tt.redSub(rt);if(nt.cmpn(0)===0)return it.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ot=nt.redSqr(),st=ot.redMul(nt),at=j.redMul(ot),ut=it.redSqr().redIAdd(st).redISub(at).redISub(at),ht=it.redMul(at.redISub(ut)).redISub(tt.redMul(st)),bt=this.z.redMul(nt);return this.curve.jpoint(ut,ht,bt)};JPoint.prototype.dblp=function _(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var $;if(this.curve.zeroA||this.curve.threeA){var j=this;for($=0;$=0)return!1;if(j.redIAdd(tt),this.x.cmp(j)===0)return!0}};JPoint.prototype.inspect=function _(){return this.isInfinity()?"":""};JPoint.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};var BN$6=bnExports$1,inherits$1=inherits_browserExports,Base$1=base,utils$9=utils$c;function MontCurve(_){Base$1.call(this,"mont",_),this.a=new BN$6(_.a,16).toRed(this.red),this.b=new BN$6(_.b,16).toRed(this.red),this.i4=new BN$6(4).toRed(this.red).redInvm(),this.two=new BN$6(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$1(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function _(a){var $=a.normalize().x,j=$.redSqr(),et=j.redMul($).redAdd(j.redMul(this.a)).redAdd($),tt=et.redSqrt();return tt.redSqr().cmp(et)===0};function Point$1(_,a,$){Base$1.BasePoint.call(this,_,"projective"),a===null&&$===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$6(a,16),this.z=new BN$6($,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$1(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function _(a,$){return this.point(utils$9.toArray(a,$),1)};MontCurve.prototype.point=function _(a,$){return new Point$1(this,a,$)};MontCurve.prototype.pointFromJSON=function _(a){return Point$1.fromJSON(this,a)};Point$1.prototype.precompute=function _(){};Point$1.prototype._encode=function _(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function _(a,$){return new Point$1(a,$[0],$[1]||a.one)};Point$1.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$1.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function _(){var a=this.x.redAdd(this.z),$=a.redSqr(),j=this.x.redSub(this.z),et=j.redSqr(),tt=$.redSub(et),rt=$.redMul(et),nt=tt.redMul(et.redAdd(this.curve.a24.redMul(tt)));return this.curve.point(rt,nt)};Point$1.prototype.add=function _(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function _(a,$){var j=this.x.redAdd(this.z),et=this.x.redSub(this.z),tt=a.x.redAdd(a.z),rt=a.x.redSub(a.z),nt=rt.redMul(j),it=tt.redMul(et),ot=$.z.redMul(nt.redAdd(it).redSqr()),st=$.x.redMul(nt.redISub(it).redSqr());return this.curve.point(ot,st)};Point$1.prototype.mul=function _(a){for(var $=a.clone(),j=this,et=this.curve.point(null,null),tt=this,rt=[];$.cmpn(0)!==0;$.iushrn(1))rt.push($.andln(1));for(var nt=rt.length-1;nt>=0;nt--)rt[nt]===0?(j=j.diffAdd(et,tt),et=et.dbl()):(et=j.diffAdd(et,tt),j=j.dbl());return et};Point$1.prototype.mulAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function _(a){return this.getX().cmp(a.getX())===0};Point$1.prototype.normalize=function _(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};var utils$8=utils$c,BN$5=bnExports$1,inherits=inherits_browserExports,Base=base,assert$7=utils$8.assert;function EdwardsCurve(_){this.twisted=(_.a|0)!==1,this.mOneA=this.twisted&&(_.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",_),this.a=new BN$5(_.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$5(_.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$5(_.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(_.c|0)===1}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function _(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve.prototype._mulC=function _(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve.prototype.jpoint=function _(a,$,j,et){return this.point(a,$,j,et)};EdwardsCurve.prototype.pointFromX=function _(a,$){a=new BN$5(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=this.c2.redSub(this.a.redMul(j)),tt=this.one.redSub(this.c2.redMul(this.d).redMul(j)),rt=et.redMul(tt.redInvm()),nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");var it=nt.fromRed().isOdd();return($&&!it||!$&&it)&&(nt=nt.redNeg()),this.point(a,nt)};EdwardsCurve.prototype.pointFromY=function _(a,$){a=new BN$5(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=j.redSub(this.c2),tt=j.redMul(this.d).redMul(this.c2).redSub(this.a),rt=et.redMul(tt.redInvm());if(rt.cmp(this.zero)===0){if($)throw new Error("invalid point");return this.point(this.zero,a)}var nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");return nt.fromRed().isOdd()!==$&&(nt=nt.redNeg()),this.point(nt,a)};EdwardsCurve.prototype.validate=function _(a){if(a.isInfinity())return!0;a.normalize();var $=a.x.redSqr(),j=a.y.redSqr(),et=$.redMul(this.a).redAdd(j),tt=this.c2.redMul(this.one.redAdd(this.d.redMul($).redMul(j)));return et.cmp(tt)===0};function Point(_,a,$,j,et){Base.BasePoint.call(this,_,"projective"),a===null&&$===null&&j===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$5(a,16),this.y=new BN$5($,16),this.z=j?new BN$5(j,16):this.curve.one,this.t=et&&new BN$5(et,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function _(a){return Point.fromJSON(this,a)};EdwardsCurve.prototype.point=function _(a,$,j,et){return new Point(this,a,$,j,et)};Point.fromJSON=function _(a,$){return new Point(a,$[0],$[1],$[2])};Point.prototype.inspect=function _(){return this.isInfinity()?"":""};Point.prototype.isInfinity=function _(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function _(){var a=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr();j=j.redIAdd(j);var et=this.curve._mulA(a),tt=this.x.redAdd(this.y).redSqr().redISub(a).redISub($),rt=et.redAdd($),nt=rt.redSub(j),it=et.redSub($),ot=tt.redMul(nt),st=rt.redMul(it),at=tt.redMul(it),ut=nt.redMul(rt);return this.curve.point(ot,st,ut,at)};Point.prototype._projDbl=function _(){var a=this.x.redAdd(this.y).redSqr(),$=this.x.redSqr(),j=this.y.redSqr(),et,tt,rt,nt,it,ot;if(this.curve.twisted){nt=this.curve._mulA($);var st=nt.redAdd(j);this.zOne?(et=a.redSub($).redSub(j).redMul(st.redSub(this.curve.two)),tt=st.redMul(nt.redSub(j)),rt=st.redSqr().redSub(st).redSub(st)):(it=this.z.redSqr(),ot=st.redSub(it).redISub(it),et=a.redSub($).redISub(j).redMul(ot),tt=st.redMul(nt.redSub(j)),rt=st.redMul(ot))}else nt=$.redAdd(j),it=this.curve._mulC(this.z).redSqr(),ot=nt.redSub(it).redSub(it),et=this.curve._mulC(a.redISub(nt)).redMul(ot),tt=this.curve._mulC(nt).redMul($.redISub(j)),rt=nt.redMul(ot);return this.curve.point(et,tt,rt)};Point.prototype.dbl=function _(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function _(a){var $=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),j=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),tt=this.z.redMul(a.z.redAdd(a.z)),rt=j.redSub($),nt=tt.redSub(et),it=tt.redAdd(et),ot=j.redAdd($),st=rt.redMul(nt),at=it.redMul(ot),ut=rt.redMul(ot),ht=nt.redMul(it);return this.curve.point(st,at,ht,ut)};Point.prototype._projAdd=function _(a){var $=this.z.redMul(a.z),j=$.redSqr(),et=this.x.redMul(a.x),tt=this.y.redMul(a.y),rt=this.curve.d.redMul(et).redMul(tt),nt=j.redSub(rt),it=j.redAdd(rt),ot=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(tt),st=$.redMul(nt).redMul(ot),at,ut;return this.curve.twisted?(at=$.redMul(it).redMul(tt.redSub(this.curve._mulA(et))),ut=nt.redMul(it)):(at=$.redMul(it).redMul(tt.redSub(et)),ut=this.curve._mulC(nt).redMul(it)),this.curve.point(st,at,ut)};Point.prototype.add=function _(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point.prototype.mul=function _(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point.prototype.mulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!1)};Point.prototype.jmulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!0)};Point.prototype.normalize=function _(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function _(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function _(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function _(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point.prototype.eqXToP=function _(a){var $=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp($)===0)return!0;for(var j=a.clone(),et=this.curve.redN.redMul(this.z);;){if(j.iadd(this.curve.n),j.cmp(this.curve.p)>=0)return!1;if($.redIAdd(et),this.x.cmp($)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(_){var a=_;a.base=base,a.short=short,a.mont=mont,a.edwards=edwards})(curve);var curves$2={},secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1}(function(_){var a=_,$=hash$7,j=curve,et=utils$c,tt=et.assert;function rt(ot){ot.type==="short"?this.curve=new j.short(ot):ot.type==="edwards"?this.curve=new j.edwards(ot):this.curve=new j.mont(ot),this.g=this.curve.g,this.n=this.curve.n,this.hash=ot.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(ot,st){Object.defineProperty(a,ot,{configurable:!0,enumerable:!0,get:function(){var at=new rt(st);return Object.defineProperty(a,ot,{configurable:!0,enumerable:!0,value:at}),at}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})})(curves$2);var BN$4=bnExports$1,utils$7=utils$c,assert$6=utils$7.assert;function KeyPair$3(_,a){this.ec=_,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function _(a,$,j){return $ instanceof KeyPair$3?$:new KeyPair$3(a,{pub:$,pubEnc:j})};KeyPair$3.fromPrivate=function _(a,$,j){return $ instanceof KeyPair$3?$:new KeyPair$3(a,{priv:$,privEnc:j})};KeyPair$3.prototype.validate=function _(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$3.prototype.getPublic=function _(a,$){return typeof a=="string"&&($=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),$?this.pub.encode($,a):this.pub};KeyPair$3.prototype.getPrivate=function _(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$3.prototype._importPrivate=function _(a,$){this.priv=new BN$4(a,$||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$3.prototype._importPublic=function _(a,$){if(a.x||a.y){this.ec.curve.type==="mont"?assert$6(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$6(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,$)};KeyPair$3.prototype.derive=function _(a){return a.validate()||assert$6(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$3.prototype.sign=function _(a,$,j){return this.ec.sign(a,this,$,j)};KeyPair$3.prototype.verify=function _(a,$){return this.ec.verify(a,$,this)};KeyPair$3.prototype.inspect=function _(){return""};var BN$3=bnExports$1,utils$6=utils$c,assert$5=utils$6.assert;function Signature$3(_,a){if(_ instanceof Signature$3)return _;this._importDER(_,a)||(assert$5(_.r&&_.s,"Signature without r or s"),this.r=new BN$3(_.r,16),this.s=new BN$3(_.s,16),_.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=_.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(_,a){var $=_[a.place++];if(!($&128))return $;var j=$&15;if(j===0||j>4)return!1;for(var et=0,tt=0,rt=a.place;tt>>=0;return et<=127?!1:(a.place=rt,et)}function rmPadding(_){for(var a=0,$=_.length-1;!_[a]&&!(_[a+1]&128)&&a<$;)a++;return a===0?_:_.slice(a)}Signature$3.prototype._importDER=function _(a,$){a=utils$6.toArray(a,$);var j=new Position;if(a[j.place++]!==48)return!1;var et=getLength(a,j);if(et===!1||et+j.place!==a.length||a[j.place++]!==2)return!1;var tt=getLength(a,j);if(tt===!1)return!1;var rt=a.slice(j.place,tt+j.place);if(j.place+=tt,a[j.place++]!==2)return!1;var nt=getLength(a,j);if(nt===!1||a.length!==nt+j.place)return!1;var it=a.slice(j.place,nt+j.place);if(rt[0]===0)if(rt[1]&128)rt=rt.slice(1);else return!1;if(it[0]===0)if(it[1]&128)it=it.slice(1);else return!1;return this.r=new BN$3(rt),this.s=new BN$3(it),this.recoveryParam=null,!0};function constructLength(_,a){if(a<128){_.push(a);return}var $=1+(Math.log(a)/Math.LN2>>>3);for(_.push($|128);--$;)_.push(a>>>($<<3)&255);_.push(a)}Signature$3.prototype.toDER=function _(a){var $=this.r.toArray(),j=this.s.toArray();for($[0]&128&&($=[0].concat($)),j[0]&128&&(j=[0].concat(j)),$=rmPadding($),j=rmPadding(j);!j[0]&&!(j[1]&128);)j=j.slice(1);var et=[2];constructLength(et,$.length),et=et.concat($),et.push(2),constructLength(et,j.length);var tt=et.concat(j),rt=[48];return constructLength(rt,tt.length),rt=rt.concat(tt),utils$6.encode(rt,a)};var BN$2=bnExports$1,HmacDRBG=hmacDrbg,utils$5=utils$c,curves$1=curves$2,rand=requireBrorand(),assert$4=utils$5.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC(_){if(!(this instanceof EC))return new EC(_);typeof _=="string"&&(assert$4(Object.prototype.hasOwnProperty.call(curves$1,_),"Unknown curve "+_),_=curves$1[_]),_ instanceof curves$1.PresetCurve&&(_={curve:_}),this.curve=_.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=_.curve.g,this.g.precompute(_.curve.n.bitLength()+1),this.hash=_.hash||_.curve.hash}var ec$1=EC;EC.prototype.keyPair=function _(a){return new KeyPair$2(this,a)};EC.prototype.keyFromPrivate=function _(a,$){return KeyPair$2.fromPrivate(this,a,$)};EC.prototype.keyFromPublic=function _(a,$){return KeyPair$2.fromPublic(this,a,$)};EC.prototype.genKeyPair=function _(a){a||(a={});for(var $=new HmacDRBG({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),j=this.n.byteLength(),et=this.n.sub(new BN$2(2));;){var tt=new BN$2($.generate(j));if(!(tt.cmp(et)>0))return tt.iaddn(1),this.keyFromPrivate(tt)}};EC.prototype._truncateToN=function _(a,$){var j=a.byteLength()*8-this.n.bitLength();return j>0&&(a=a.ushrn(j)),!$&&a.cmp(this.n)>=0?a.sub(this.n):a};EC.prototype.sign=function _(a,$,j,et){typeof j=="object"&&(et=j,j=null),et||(et={}),$=this.keyFromPrivate($,j),a=this._truncateToN(new BN$2(a,16));for(var tt=this.n.byteLength(),rt=$.getPrivate().toArray("be",tt),nt=a.toArray("be",tt),it=new HmacDRBG({hash:this.hash,entropy:rt,nonce:nt,pers:et.pers,persEnc:et.persEnc||"utf8"}),ot=this.n.sub(new BN$2(1)),st=0;;st++){var at=et.k?et.k(st):new BN$2(it.generate(this.n.byteLength()));if(at=this._truncateToN(at,!0),!(at.cmpn(1)<=0||at.cmp(ot)>=0)){var ut=this.g.mul(at);if(!ut.isInfinity()){var ht=ut.getX(),bt=ht.umod(this.n);if(bt.cmpn(0)!==0){var Et=at.invm(this.n).mul(bt.mul($.getPrivate()).iadd(a));if(Et=Et.umod(this.n),Et.cmpn(0)!==0){var Ct=(ut.getY().isOdd()?1:0)|(ht.cmp(bt)!==0?2:0);return et.canonical&&Et.cmp(this.nh)>0&&(Et=this.n.sub(Et),Ct^=1),new Signature$2({r:bt,s:Et,recoveryParam:Ct})}}}}}};EC.prototype.verify=function _(a,$,j,et){a=this._truncateToN(new BN$2(a,16)),j=this.keyFromPublic(j,et),$=new Signature$2($,"hex");var tt=$.r,rt=$.s;if(tt.cmpn(1)<0||tt.cmp(this.n)>=0||rt.cmpn(1)<0||rt.cmp(this.n)>=0)return!1;var nt=rt.invm(this.n),it=nt.mul(a).umod(this.n),ot=nt.mul(tt).umod(this.n),st;return this.curve._maxwellTrick?(st=this.g.jmulAdd(it,j.getPublic(),ot),st.isInfinity()?!1:st.eqXToP(tt)):(st=this.g.mulAdd(it,j.getPublic(),ot),st.isInfinity()?!1:st.getX().umod(this.n).cmp(tt)===0)};EC.prototype.recoverPubKey=function(_,a,$,j){assert$4((3&$)===$,"The recovery param is more than two bits"),a=new Signature$2(a,j);var et=this.n,tt=new BN$2(_),rt=a.r,nt=a.s,it=$&1,ot=$>>1;if(rt.cmp(this.curve.p.umod(this.curve.n))>=0&&ot)throw new Error("Unable to find sencond key candinate");ot?rt=this.curve.pointFromX(rt.add(this.curve.n),it):rt=this.curve.pointFromX(rt,it);var st=a.r.invm(et),at=et.sub(tt).mul(st).umod(et),ut=nt.mul(st).umod(et);return this.g.mulAdd(at,rt,ut)};EC.prototype.getKeyRecoveryParam=function(_,a,$,j){if(a=new Signature$2(a,j),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var tt;try{tt=this.recoverPubKey(_,a,et)}catch{continue}if(tt.eq($))return et}throw new Error("Unable to find valid recovery factor")};var utils$4=utils$c,assert$3=utils$4.assert,parseBytes$2=utils$4.parseBytes,cachedProperty$1=utils$4.cachedProperty;function KeyPair$1(_,a){this.eddsa=_,this._secret=parseBytes$2(a.secret),_.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$2(a.pub)}KeyPair$1.fromPublic=function _(a,$){return $ instanceof KeyPair$1?$:new KeyPair$1(a,{pub:$})};KeyPair$1.fromSecret=function _(a,$){return $ instanceof KeyPair$1?$:new KeyPair$1(a,{secret:$})};KeyPair$1.prototype.secret=function _(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function _(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function _(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function _(){var a=this.eddsa,$=this.hash(),j=a.encodingLength-1,et=$.slice(0,a.encodingLength);return et[0]&=248,et[j]&=127,et[j]|=64,et});cachedProperty$1(KeyPair$1,"priv",function _(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function _(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function _(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function _(a){return assert$3(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$1.prototype.verify=function _(a,$){return this.eddsa.verify(a,$,this)};KeyPair$1.prototype.getSecret=function _(a){return assert$3(this._secret,"KeyPair is public only"),utils$4.encode(this.secret(),a)};KeyPair$1.prototype.getPublic=function _(a){return utils$4.encode(this.pubBytes(),a)};var key=KeyPair$1,BN$1=bnExports$1,utils$3=utils$c,assert$2=utils$3.assert,cachedProperty=utils$3.cachedProperty,parseBytes$1=utils$3.parseBytes;function Signature$1(_,a){this.eddsa=_,typeof a!="object"&&(a=parseBytes$1(a)),Array.isArray(a)&&(a={R:a.slice(0,_.encodingLength),S:a.slice(_.encodingLength)}),assert$2(a.R&&a.S,"Signature without R or S"),_.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN$1&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty(Signature$1,"S",function _(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function _(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function _(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function _(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function _(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function _(){return utils$3.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$7,curves=curves$2,utils$2=utils$c,assert$1=utils$2.assert,parseBytes=utils$2.parseBytes,KeyPair=key,Signature=signature;function EDDSA(_){if(assert$1(_==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(_);_=curves[_].curve,this.curve=_,this.g=_.g,this.g.precompute(_.n.bitLength()+1),this.pointClass=_.point().constructor,this.encodingLength=Math.ceil(_.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function _(a,$){a=parseBytes(a);var j=this.keyFromSecret($),et=this.hashInt(j.messagePrefix(),a),tt=this.g.mul(et),rt=this.encodePoint(tt),nt=this.hashInt(rt,j.pubBytes(),a).mul(j.priv()),it=et.add(nt).umod(this.curve.n);return this.makeSignature({R:tt,S:it,Rencoded:rt})};EDDSA.prototype.verify=function _(a,$,j){a=parseBytes(a),$=this.makeSignature($);var et=this.keyFromPublic(j),tt=this.hashInt($.Rencoded(),et.pubBytes(),a),rt=this.g.mul($.S()),nt=$.R().add(et.pub().mul(tt));return nt.eq(rt)};EDDSA.prototype.hashInt=function _(){for(var a=this.hash(),$=0;$0&&!a.includes(_.length))throw new Error(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}function hash(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(_.outputLen),number$1(_.blockLen)}function exists(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}function output(_,a){bytes(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}const assert={number:number$1,bool:bool$1,bytes,hash,exists,output},U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(_,a=!1){return a?{h:Number(_&U32_MASK64),l:Number(_>>_32n&U32_MASK64)}:{h:Number(_>>_32n&U32_MASK64)|0,l:Number(_&U32_MASK64)|0}}function split(_,a=!1){let $=new Uint32Array(_.length),j=new Uint32Array(_.length);for(let et=0;et<_.length;et++){const{h:tt,l:rt}=fromBig(_[et],a);[$[et],j[et]]=[tt,rt]}return[$,j]}const rotlSH=(_,a,$)=>_<<$|a>>>32-$,rotlSL=(_,a,$)=>a<<$|_>>>32-$,rotlBH=(_,a,$)=>a<<$-32|_>>>64-$,rotlBL=(_,a,$)=>_<<$-32|a>>>64-$;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32=_=>new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4));function isBytes(_){return _ instanceof Uint8Array||_!=null&&typeof _=="object"&&_.constructor.name==="Uint8Array"}const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(_){if(typeof _!="string")throw new Error(`utf8ToBytes expected string, got ${typeof _}`);return new Uint8Array(new TextEncoder().encode(_))}function toBytes(_){if(typeof _=="string"&&(_=utf8ToBytes(_)),!isBytes(_))throw new Error(`expected Uint8Array, got ${typeof _}`);return _}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(_){const a=j=>_().update(toBytes(j)).digest(),$=_();return a.outputLen=$.outputLen,a.blockLen=$.blockLen,a.create=()=>_(),a}const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let _=0,a=_1n,$=1,j=0;_<24;_++){[$,j]=[j,(2*$+3*j)%5],SHA3_PI.push(2*(5*j+$)),SHA3_ROTL.push((_+1)*(_+2)/2%64);let et=_0n;for(let tt=0;tt<7;tt++)a=(a<<_1n^(a>>_7n)*_0x71n)%_256n,a&_2n&&(et^=_1n<<(_1n<$>32?rotlBH(_,a,$):rotlSH(_,a,$),rotlL=(_,a,$)=>$>32?rotlBL(_,a,$):rotlSL(_,a,$);function keccakP(_,a=24){const $=new Uint32Array(10);for(let j=24-a;j<24;j++){for(let rt=0;rt<10;rt++)$[rt]=_[rt]^_[rt+10]^_[rt+20]^_[rt+30]^_[rt+40];for(let rt=0;rt<10;rt+=2){const nt=(rt+8)%10,it=(rt+2)%10,ot=$[it],st=$[it+1],at=rotlH(ot,st,1)^$[nt],ut=rotlL(ot,st,1)^$[nt+1];for(let ht=0;ht<50;ht+=10)_[rt+ht]^=at,_[rt+ht+1]^=ut}let et=_[2],tt=_[3];for(let rt=0;rt<24;rt++){const nt=SHA3_ROTL[rt],it=rotlH(et,tt,nt),ot=rotlL(et,tt,nt),st=SHA3_PI[rt];et=_[st],tt=_[st+1],_[st]=it,_[st+1]=ot}for(let rt=0;rt<50;rt+=10){for(let nt=0;nt<10;nt++)$[nt]=_[rt+nt];for(let nt=0;nt<10;nt++)_[rt+nt]^=~$[(nt+2)%10]&$[(nt+4)%10]}_[0]^=SHA3_IOTA_H[j],_[1]^=SHA3_IOTA_L[j]}$.fill(0)}class Keccak extends Hash{constructor(a,$,j,et=!1,tt=24){if(super(),this.blockLen=a,this.suffix=$,this.outputLen=j,this.enableXOF=et,this.rounds=tt,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$1(j),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(a){exists(this);const{blockLen:$,state:j}=this;a=toBytes(a);const et=a.length;for(let tt=0;tt=j&&this.keccak();const rt=Math.min(j-this.posOut,tt-et);a.set($.subarray(this.posOut,this.posOut+rt),et),this.posOut+=rt,et+=rt}return a}xofInto(a){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(a)}xof(a){return number$1(a),this.xofInto(new Uint8Array(a))}digestInto(a){if(output(a,this),this.finished)throw new Error("digest() was already called");return this.writeInto(a),this.destroy(),a}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(a){const{blockLen:$,suffix:j,outputLen:et,rounds:tt,enableXOF:rt}=this;return a||(a=new Keccak($,j,et,rt,tt)),a.state32.set(this.state32),a.pos=this.pos,a.posOut=this.posOut,a.finished=this.finished,a.rounds=tt,a.suffix=j,a.outputLen=et,a.enableXOF=rt,a.destroyed=this.destroyed,a}}const gen=(_,a,$)=>wrapConstructor(()=>new Keccak(a,_,$)),keccak_256=gen(1,136,256/8);function wrapHash(_){return a=>(assert.bytes(a),_(a))}(()=>{const _=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,a=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);return{node:a&&!_?a("crypto"):void 0,web:_}})();const keccak256$2=(()=>{const _=wrapHash(keccak_256);return _.create=keccak_256.create,_})();function keccak256$1(_){return Buffer$g.from(keccak256$2(_))}const ec=new elliptic.ec("secp256k1");function encParamsHexToBuf$1(_){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$1(_){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$1(et);return JSON.stringify(tt)}async function decryptData(_,a){const $=JSON.parse(a),j=encParamsHexToBuf$1($),et=ec.keyFromPrivate(_),rt=(await decrypt(Buffer$g.from(et.getPrivate().toString("hex",64),"hex"),j)).toString("utf-8");return JSON.parse(rt)}var microSeconds$1=microSeconds$5,KEY_PREFIX="pubkey.broadcastChannel-",type$1="server",SOCKET_CONN_INSTANCE=null,runningChannels=new Set;function storageKey(_){return KEY_PREFIX+_}function postMessage$1(_,a){return new Promise(function($,j){sleep().then(_asyncToGenerator(_regeneratorRuntime.mark(function et(){var tt,rt,nt,it;return _regeneratorRuntime.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:return tt=storageKey(_.channelName),rt=keccak256$1(Buffer$g.from(tt,"utf8")),st.next=4,encryptData(rt.toString("hex"),{token:randomToken(),time:new Date().getTime(),data:a,uuid:_.uuid});case 4:return nt=st.sent,st.t0=getPublic(rt).toString("hex"),st.t1=nt,st.next=9,sign(rt,keccak256$1(Buffer$g.from(nt,"utf8")));case 9:return st.t2=st.sent.toString("hex"),it={key:st.t0,data:st.t1,signature:st.t2},_.timeout&&(it.timeout=_.timeout),st.abrupt("return",fetch(_.serverUrl+"/channel/set",{method:"POST",body:JSON.stringify(it),headers:{"Content-Type":"application/json; charset=utf-8"}}).then($).catch(j));case 13:case"end":return st.stop()}},et)})))})}function getSocketInstance(_){if(SOCKET_CONN_INSTANCE)return SOCKET_CONN_INSTANCE;var a=lookup(_,{transports:["websocket","polling"],withCredentials:!0,reconnectionDelayMax:1e4,reconnectionAttempts:10});return a.on("connect_error",function($){a.io.opts.transports=["polling","websocket"],log$5.error("connect error",$)}),a.on("connect",_asyncToGenerator(_regeneratorRuntime.mark(function $(){var j;return _regeneratorRuntime.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:j=a.io.engine,log$5.debug("initially connected to",j.transport.name),j.once("upgrade",function(){log$5.debug("upgraded",j.transport.name)}),j.once("close",function(rt){log$5.debug("connection closed",rt)});case 4:case"end":return tt.stop()}},$)}))),a.on("error",function($){log$5.error("socket errored",$),a.disconnect()}),SOCKET_CONN_INSTANCE=a,a}function setupSocketConnection(_,a,$){var j=getSocketInstance(_),et=storageKey(a),tt=keccak256$1(Buffer$g.from(et,"utf8")),rt=getPublic(tt).toString("hex");j.connected?j.emit("check_auth_status",rt):j.once("connect",function(){log$5.debug("connected with socket"),j.emit("check_auth_status",rt)});var nt=function(){j.once("connect",_asyncToGenerator(_regeneratorRuntime.mark(function at(){return _regeneratorRuntime.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:j.emit("check_auth_status",rt);case 1:case"end":return ht.stop()}},at)})))},it=function st(){if(!j){document.removeEventListener("visibilitychange",st);return}!j.connected&&document.visibilityState==="visible"&&nt()},ot=function(){var st=_asyncToGenerator(_regeneratorRuntime.mark(function at(ut){var ht;return _regeneratorRuntime.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return Et.prev=0,Et.next=3,decryptData(tt.toString("hex"),ut);case 3:ht=Et.sent,log$5.info(ht),$(ht),Et.next=11;break;case 8:Et.prev=8,Et.t0=Et.catch(0),log$5.error(Et.t0);case 11:case"end":return Et.stop()}},at,null,[[0,8]])}));return function(ut){return st.apply(this,arguments)}}();return j.on("disconnect",function(){log$5.debug("socket disconnected"),runningChannels.has(a)&&(log$5.error("socket disconnected unexpectedly, reconnecting socket"),nt())}),j.on(rt+"_success",ot),typeof document<"u"&&document.addEventListener("visibilitychange",it),j}function create$1(_,a){a=fillOptionsWithDefaults(a);var $=randomToken(),j=new ObliviousSet(a.server.removeTimeout),et={channelName:_,uuid:$,eMIs:j,serverUrl:a.server.url};return a.server.timeout&&(et.timeout=a.server.timeout),setupSocketConnection(a.server.url,_,function(tt){et.messagesCallback&&tt.uuid!==et.uuid&&(!tt.token||et.eMIs.has(tt.token)||(et.eMIs.add(tt.token),et.messagesCallback(tt.data)))}),runningChannels.add(_),et}function close$1(_){runningChannels.delete(_.channelName)}function onMessage$1(_,a,$){_.messagesCallbackTime=$,_.messagesCallback=a}function canBeUsed$1(){return!0}function averageResponseTime$1(){var _=500;return _}const ServerMethod={create:create$1,close:close$1,onMessage:onMessage$1,postMessage:postMessage$1,canBeUsed:canBeUsed$1,type:type$1,averageResponseTime:averageResponseTime$1,microSeconds:microSeconds$1};var microSeconds=microSeconds$5,type="simulate",SIMULATE_CHANNELS=new Set;function create(_){var a={name:_,messagesCallback:null};return SIMULATE_CHANNELS.add(a),a}function close(_){SIMULATE_CHANNELS.delete(_)}function postMessage(_,a){return new Promise(function($){return setTimeout(function(){var j=Array.from(SIMULATE_CHANNELS);j.filter(function(et){return et.name===_.name}).filter(function(et){return et!==_}).filter(function(et){return!!et.messagesCallback}).forEach(function(et){return et.messagesCallback(a)}),$()},5)})}function onMessage(_,a){_.messagesCallback=a}function canBeUsed(){return!0}function averageResponseTime(){return 5}const SimulateMethod={create,close,onMessage,postMessage,canBeUsed,type,averageResponseTime,microSeconds};var METHODS=[NativeMethod,IndexeDbMethod,LocalstorageMethod,ServerMethod];function chooseMethod(_){var a=[].concat(_.methods,METHODS).filter(Boolean);if(_.type){if(_.type==="simulate")return SimulateMethod;var $=a.find(function(et){return et.type===_.type});if($)return $;throw new Error("method-type "+_.type+" not found")}_.webWorkerSupport||(a=a.filter(function(et){return et.type!=="idb"}));var j=a.find(function(et){return et.canBeUsed(_)});if(j)return j;throw new Error("No useable method found in "+JSON.stringify(METHODS.map(function(et){return et.type})))}var OPEN_BROADCAST_CHANNELS=new Set,lastId=0,BroadcastChannel$1=function _(a,$){this.id=lastId++,OPEN_BROADCAST_CHANNELS.add(this),this.name=a,ENFORCED_OPTIONS&&($=ENFORCED_OPTIONS),this.options=fillOptionsWithDefaults($),this.method=chooseMethod(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,_prepareChannel(this)};BroadcastChannel$1._pubkey=!0;var ENFORCED_OPTIONS;BroadcastChannel$1.prototype={postMessage:function _(a){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(a));return _post(this,"message",a)},postInternal:function _(a){return _post(this,"internal",a)},set onmessage(_){var a=this.method.microSeconds(),$={time:a,fn:_};_removeListenerObject(this,"message",this._onML),_&&typeof _=="function"?(this._onML=$,_addListenerObject(this,"message",$)):this._onML=null},addEventListener:function _(a,$){var j=this.method.microSeconds(),et={time:j,fn:$};_addListenerObject(this,a,et)},removeEventListener:function _(a,$){var j=this._addEL[a].find(function(et){return et.fn===$});_removeListenerObject(this,a,j)},close:function _(){var a=this;if(!this.closed){OPEN_BROADCAST_CHANNELS.delete(this),this.closed=!0;var $=this._prepP?this._prepP:PROMISE_RESOLVED_VOID;return this._onML=null,this._addEL.message=[],$.then(function(){return Promise.all(Array.from(a._uMP))}).then(function(){return Promise.all(a._befC.map(function(j){return j()}))}).then(function(){return a.method.close(a._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function _post(_,a,$){var j=_.method.microSeconds(),et={time:j,type:a,data:$},tt=_._prepP?_._prepP:PROMISE_RESOLVED_VOID;return tt.then(function(){var rt=_.method.postMessage(_._state,et);return _._uMP.add(rt),rt.catch().then(function(){return _._uMP.delete(rt)}),rt})}function _prepareChannel(_){var a=_.method.create(_.name,_.options);isPromise(a)?(_._prepP=a,a.then(function($){_._state=$})):_._state=a}function _hasMessageListeners(_){return _._addEL.message.length>0||_._addEL.internal.length>0}function _addListenerObject(_,a,$){_._addEL[a].push($),_startListening(_)}function _removeListenerObject(_,a,$){_._addEL[a]=_._addEL[a].filter(function(j){return j!==$}),_stopListening(_)}function _startListening(_){if(!_._iL&&_hasMessageListeners(_)){var a=function(et){_._addEL[et.type].forEach(function(tt){var rt=1e5,nt=tt.time-rt;(et.time>=nt||_.method.type==="server")&&tt.fn(et.data)})},$=_.method.microSeconds();_._prepP?_._prepP.then(function(){_._iL=!0,_.method.onMessage(_._state,a,$)}):(_._iL=!0,_.method.onMessage(_._state,a,$))}}function _stopListening(_){if(_._iL&&!_hasMessageListeners(_)){_._iL=!1;var a=_.method.microSeconds();_.method.onMessage(_._state,null,a)}}var base64url$3={exports:{}},base64url$2={},padString$1={};Object.defineProperty(padString$1,"__esModule",{value:!0});function padString(_){var a=4,$=_.length,j=$%a;if(!j)return _;var et=$,tt=a-j,rt=$+tt,nt=Buffer$g.alloc(rt);for(nt.write(_);tt--;)nt.write("=",et++);return nt.toString()}padString$1.default=padString;Object.defineProperty(base64url$2,"__esModule",{value:!0});var pad_string_1=padString$1;function encode(_,a){return a===void 0&&(a="utf8"),Buffer$g.isBuffer(_)?fromBase64(_.toString("base64")):fromBase64(Buffer$g.from(_,a).toString("base64"))}function decode$1(_,a){return a===void 0&&(a="utf8"),Buffer$g.from(toBase64(_),"base64").toString(a)}function toBase64(_){return _=_.toString(),pad_string_1.default(_).replace(/\-/g,"+").replace(/_/g,"/")}function fromBase64(_){return _.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function toBuffer(_){return Buffer$g.from(toBase64(_),"base64")}var base64url$1=encode;base64url$1.encode=encode;base64url$1.decode=decode$1;base64url$1.toBase64=toBase64;base64url$1.fromBase64=fromBase64;base64url$1.toBuffer=toBuffer;base64url$2.default=base64url$1;(function(_){_.exports=base64url$2.default,_.exports.default=_.exports})(base64url$3);var base64urlExports=base64url$3.exports;const base64url=getDefaultExportFromCjs$1(base64urlExports);function e(_){this.message=_}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(_){var a=String(_).replace(/=+$/,"");if(a.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var $,j,et=0,tt=0,rt="";j=a.charAt(tt++);~j&&($=et%4?64*$+j:j,et++%4)?rt+=String.fromCharCode(255&$>>(-2*et&6)):0)j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(j);return rt};function t(_){var a=_.replace(/-/g,"+").replace(/_/g,"/");switch(a.length%4){case 0:break;case 2:a+="==";break;case 3:a+="=";break;default:throw"Illegal base64url string!"}try{return function($){return decodeURIComponent(r($).replace(/(.)/g,function(j,et){var tt=et.charCodeAt(0).toString(16).toUpperCase();return tt.length<2&&(tt="0"+tt),"%"+tt}))}(a)}catch{return r(a)}}function n(_){this.message=_}function o(_,a){if(typeof _!="string")throw new n("Invalid token specified");var $=(a=a||{}).header===!0?0:1;try{return JSON.parse(t(_.split(".")[$]))}catch(j){throw new n("Invalid token specified: "+j.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";const TORUS_LEGACY_NETWORK={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},TORUS_SAPPHIRE_NETWORK={SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"},MULTI_CLUSTER_NETWORKS=[],LEGACY_NETWORKS_ROUTE_MAP={[TORUS_LEGACY_NETWORK.AQUA]:{migrationCompleted:!0,networkIdentifier:"aqua",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.CELESTE]:{migrationCompleted:!0,networkIdentifier:"celeste",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.CYAN]:{migrationCompleted:!0,networkIdentifier:"cyan",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.MAINNET]:{migrationCompleted:!0,networkIdentifier:"mainnet",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.TESTNET]:{migrationCompleted:!0,networkIdentifier:"teal",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET}},SIGNER_MAP={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:"https://signer.web3auth.io",[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:"https://signer.web3auth.io",[TORUS_LEGACY_NETWORK.MAINNET]:"https://signer.web3auth.io",[TORUS_LEGACY_NETWORK.TESTNET]:"https://signer.web3auth.io",[TORUS_LEGACY_NETWORK.CYAN]:"https://signer-polygon.web3auth.io",[TORUS_LEGACY_NETWORK.AQUA]:"https://signer-polygon.web3auth.io",[TORUS_LEGACY_NETWORK.CELESTE]:"https://signer-polygon.web3auth.io"},METADATA_MAP={[TORUS_LEGACY_NETWORK.MAINNET]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.TESTNET]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.CYAN]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.AQUA]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.CELESTE]:"https://metadata.web3auth.io"},FND_SERVER="https://fnd.web3auth.io",KEY_TYPE={SECP256K1:"secp256k1",ED25519:"ed25519"},SAPPHIRE_NETWORK_URLS={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:["https://node-1.dev-node.web3auth.io","https://node-2.dev-node.web3auth.io","https://node-3.dev-node.web3auth.io","https://node-4.dev-node.web3auth.io","https://node-5.dev-node.web3auth.io"],[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:["https://node-1.node.web3auth.io","https://node-2.node.web3auth.io","https://node-3.node.web3auth.io","https://node-4.node.web3auth.io","https://node-5.node.web3auth.io"]},getSSSEndpoints=(_,a)=>{const $=SAPPHIRE_NETWORK_URLS[_];if(!$||$.length===0)throw new Error(`Unsupported network: ${_}`);const j=LEGACY_NETWORKS_ROUTE_MAP[a];return $.map(et=>j&&j.networkIdentifier?`${et}/sss/${j.networkIdentifier}/jrpc`:`${et}/sss/jrpc`)},getRSSEndpoints=(_,a)=>{const $=SAPPHIRE_NETWORK_URLS[_];if(!$||$.length===0)throw new Error(`Unsupported network: ${_}`);const j=LEGACY_NETWORKS_ROUTE_MAP[a];return $.map(et=>j&&j.networkIdentifier?`${et}/rss/${j.networkIdentifier}`:`${et}/rss`)},getTSSEndpoints=function(_,a){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:KEY_TYPE.SECP256K1;const j=SAPPHIRE_NETWORK_URLS[_];if(!j||j.length===0)throw new Error(`Unsupported network: ${_}`);const et=$===KEY_TYPE.ED25519?"tss-frost":"tss",tt=LEGACY_NETWORKS_ROUTE_MAP[a];return j.map(rt=>tt&&tt.networkIdentifier?`${rt}/${et}/${tt.networkIdentifier}`:`${rt}/${et}`)},SAPPHIRE_NODE_PUB_KEYS={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:[{X:"e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052",Y:"54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1"},{X:"9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637",Y:"fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107"},{X:"555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476",Y:"606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e"},{X:"2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128",Y:"4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247"},{X:"3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a",Y:"dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4"}],[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:[{X:"f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247",Y:"54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7"},{X:"bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a",Y:"ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a"},{X:"b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb",Y:"759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c"},{X:"7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767",Y:"336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b"},{X:"bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773",Y:"bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4"}]},getSapphireNodeDetails=(_,a,$)=>({currentEpoch:"1",torusNodeEndpoints:getSSSEndpoints(_,a),torusNodeSSSEndpoints:getSSSEndpoints(_,a),torusNodeRSSEndpoints:getRSSEndpoints(_,a),torusNodeTSSEndpoints:getTSSEndpoints(_,a,$),torusIndexes:[1,2,3,4,5],torusNodePub:SAPPHIRE_NODE_PUB_KEYS[_]});function fetchLocalConfig(_,a){if(Object.values(TORUS_SAPPHIRE_NETWORK).includes(_))return getSapphireNodeDetails(_,void 0,a);if(Object.values(TORUS_LEGACY_NETWORK).includes(_)){const $=LEGACY_NETWORKS_ROUTE_MAP[_];if($.migrationCompleted)return getSapphireNodeDetails($.networkMigratedTo,_,a)}}const log$3=log$1$1.getLogger("fnd");class NodeDetailManager{constructor(){let{network:a=TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET,keyType:$=KEY_TYPE.SECP256K1,fndServerEndpoint:j,enableLogging:et=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_defineProperty$4(this,"fndServerEndpoint",`${FND_SERVER}/node-details`),_defineProperty$4(this,"_currentEpoch","1"),_defineProperty$4(this,"_keyType",void 0),_defineProperty$4(this,"_torusNodeEndpoints",[]),_defineProperty$4(this,"_torusNodeRSSEndpoints",[]),_defineProperty$4(this,"_torusNodeSSSEndpoints",[]),_defineProperty$4(this,"_torusNodeTSSEndpoints",[]),_defineProperty$4(this,"_torusNodePub",[]),_defineProperty$4(this,"_torusIndexes",[]),_defineProperty$4(this,"updated",void 0),_defineProperty$4(this,"network",void 0),this.network=a,this._keyType=$,this.updated=!1,j&&(this.fndServerEndpoint=j),et?log$3.enableAll():log$3.disableAll()}get _nodeDetails(){return{currentEpoch:this._currentEpoch,torusNodeEndpoints:this._torusNodeEndpoints,torusNodeSSSEndpoints:this._torusNodeSSSEndpoints,torusNodeRSSEndpoints:this._torusNodeRSSEndpoints,torusNodeTSSEndpoints:this._torusNodeTSSEndpoints,torusNodePub:this._torusNodePub,torusIndexes:this._torusIndexes,updated:this.updated}}async getNodeDetails(a){let{verifier:$,verifierId:j}=a;try{if(this.updated&&!MULTI_CLUSTER_NETWORKS.includes(this.network))return this._nodeDetails;try{const{nodeDetails:tt}=await get$1(`${this.fndServerEndpoint}?network=${this.network}&verifier=${$}&verifierId=${j}&keyType=${this._keyType}`);return this.setNodeDetails(tt),this._nodeDetails}catch(tt){log$3.error("Failed to fetch node details from server, using local.",tt)}const et=fetchLocalConfig(this.network,this._keyType);if(!et)throw new Error("Failed to fetch node details");return this.setNodeDetails(et),this._nodeDetails}catch(et){throw log$3.error("Failed to fetch node details",et),et}}async getMetadataUrl(){return Object.values(TORUS_LEGACY_NETWORK).includes(this.network)?METADATA_MAP[this.network]:(await this.getNodeDetails({verifier:"test-verifier",verifierId:"test-verifier-id"})).torusNodeEndpoints[0].replace("/sss/jrpc","/metadata")}setNodeDetails(a){const{currentEpoch:$,torusNodeEndpoints:j,torusNodeSSSEndpoints:et,torusNodeRSSEndpoints:tt,torusNodeTSSEndpoints:rt,torusNodePub:nt,torusIndexes:it}=a;this._torusNodeEndpoints=j,this._torusNodeSSSEndpoints=et||[],this._torusNodeRSSEndpoints=tt||[],this._torusNodeTSSEndpoints=rt||[],this._torusNodePub=nt,this._torusIndexes=it,this._currentEpoch=$,this.updated=!0}}var bn={exports:{}};bn.exports;(function(_){(function(a,$){function j(mt,ct){if(!mt)throw new Error(ct||"Assertion failed")}function et(mt,ct){mt.super_=ct;var dt=function(){};dt.prototype=ct.prototype,mt.prototype=new dt,mt.prototype.constructor=mt}function tt(mt,ct,dt){if(tt.isBN(mt))return mt;this.negative=0,this.words=null,this.length=0,this.red=null,mt!==null&&((ct==="le"||ct==="be")&&(dt=ct,ct=10),this._init(mt||0,ct||10,dt||"be"))}typeof a=="object"?a.exports=tt:$.BN=tt,tt.BN=tt,tt.wordSize=26;var rt;try{typeof window<"u"&&typeof window.Buffer<"u"?rt=window.Buffer:rt=require$$0$5.Buffer}catch{}tt.isBN=function(ct){return ct instanceof tt?!0:ct!==null&&typeof ct=="object"&&ct.constructor.wordSize===tt.wordSize&&Array.isArray(ct.words)},tt.max=function(ct,dt){return ct.cmp(dt)>0?ct:dt},tt.min=function(ct,dt){return ct.cmp(dt)<0?ct:dt},tt.prototype._init=function(ct,dt,vt){if(typeof ct=="number")return this._initNumber(ct,dt,vt);if(typeof ct=="object")return this._initArray(ct,dt,vt);dt==="hex"&&(dt=16),j(dt===(dt|0)&&dt>=2&&dt<=36),ct=ct.toString().replace(/\s+/g,"");var St=0;ct[0]==="-"&&(St++,this.negative=1),St=0;St-=3)$t=ct[St]|ct[St-1]<<8|ct[St-2]<<16,this.words[Rt]|=$t<>>26-xt&67108863,xt+=24,xt>=26&&(xt-=26,Rt++);else if(vt==="le")for(St=0,Rt=0;St>>26-xt&67108863,xt+=24,xt>=26&&(xt-=26,Rt++);return this._strip()};function nt(mt,ct){var dt=mt.charCodeAt(ct);if(dt>=48&&dt<=57)return dt-48;if(dt>=65&&dt<=70)return dt-55;if(dt>=97&&dt<=102)return dt-87;j(!1,"Invalid character in "+mt)}function it(mt,ct,dt){var vt=nt(mt,dt);return dt-1>=ct&&(vt|=nt(mt,dt-1)<<4),vt}tt.prototype._parseHex=function(ct,dt,vt){this.length=Math.ceil((ct.length-dt)/6),this.words=new Array(this.length);for(var St=0;St=dt;St-=2)xt=it(ct,dt,St)<=18?(Rt-=18,$t+=1,this.words[$t]|=xt>>>26):Rt+=8;else{var At=ct.length-dt;for(St=At%2===0?dt+1:dt;St=18?(Rt-=18,$t+=1,this.words[$t]|=xt>>>26):Rt+=8}this._strip()};function ot(mt,ct,dt,vt){for(var St=0,Rt=0,$t=Math.min(mt.length,dt),xt=ct;xt<$t;xt++){var At=mt.charCodeAt(xt)-48;St*=vt,At>=49?Rt=At-49+10:At>=17?Rt=At-17+10:Rt=At,j(At>=0&&Rt1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=at}catch{tt.prototype.inspect=at}else tt.prototype.inspect=at;function at(){return(this.red?""}var ut=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ht=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],bt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(ct,dt){ct=ct||10,dt=dt|0||1;var vt;if(ct===16||ct==="hex"){vt="";for(var St=0,Rt=0,$t=0;$t>>24-St&16777215,St+=2,St>=26&&(St-=26,$t--),Rt!==0||$t!==this.length-1?vt=ut[6-At.length]+At+vt:vt=At+vt}for(Rt!==0&&(vt=Rt.toString(16)+vt);vt.length%dt!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}if(ct===(ct|0)&&ct>=2&&ct<=36){var wt=ht[ct],Ot=bt[ct];vt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var nr=tr.modrn(Ot).toString(ct);tr=tr.idivn(Ot),tr.isZero()?vt=nr+vt:vt=ut[wt-nr.length]+nr+vt}for(this.isZero()&&(vt="0"+vt);vt.length%dt!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var ct=this.words[0];return this.length===2?ct+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ct+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-ct:ct},tt.prototype.toJSON=function(){return this.toString(16,2)},rt&&(tt.prototype.toBuffer=function(ct,dt){return this.toArrayLike(rt,ct,dt)}),tt.prototype.toArray=function(ct,dt){return this.toArrayLike(Array,ct,dt)};var Et=function(ct,dt){return ct.allocUnsafe?ct.allocUnsafe(dt):new ct(dt)};tt.prototype.toArrayLike=function(ct,dt,vt){this._strip();var St=this.byteLength(),Rt=vt||Math.max(1,St);j(St<=Rt,"byte array longer than desired length"),j(Rt>0,"Requested array length <= 0");var $t=Et(ct,Rt),xt=dt==="le"?"LE":"BE";return this["_toArrayLike"+xt]($t,St),$t},tt.prototype._toArrayLikeLE=function(ct,dt){for(var vt=0,St=0,Rt=0,$t=0;Rt>8&255),vt>16&255),$t===6?(vt>24&255),St=0,$t=0):(St=xt>>>24,$t+=2)}if(vt=0&&(ct[vt--]=xt>>8&255),vt>=0&&(ct[vt--]=xt>>16&255),$t===6?(vt>=0&&(ct[vt--]=xt>>24&255),St=0,$t=0):(St=xt>>>24,$t+=2)}if(vt>=0)for(ct[vt--]=St;vt>=0;)ct[vt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var dt=ct,vt=0;return dt>=4096&&(vt+=13,dt>>>=13),dt>=64&&(vt+=7,dt>>>=7),dt>=8&&(vt+=4,dt>>>=4),dt>=2&&(vt+=2,dt>>>=2),vt+dt},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var dt=ct,vt=0;return dt&8191||(vt+=13,dt>>>=13),dt&127||(vt+=7,dt>>>=7),dt&15||(vt+=4,dt>>>=4),dt&3||(vt+=2,dt>>>=2),dt&1||vt++,vt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],dt=this._countBits(ct);return(this.length-1)*26+dt};function Ct(mt){for(var ct=new Array(mt.bitLength()),dt=0;dt>>St&1}return ct}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var ct=0,dt=0;dtct.length?this.clone().ior(ct):ct.clone().ior(this)},tt.prototype.uor=function(ct){return this.length>ct.length?this.clone().iuor(ct):ct.clone().iuor(this)},tt.prototype.iuand=function(ct){var dt;this.length>ct.length?dt=ct:dt=this;for(var vt=0;vtct.length?this.clone().iand(ct):ct.clone().iand(this)},tt.prototype.uand=function(ct){return this.length>ct.length?this.clone().iuand(ct):ct.clone().iuand(this)},tt.prototype.iuxor=function(ct){var dt,vt;this.length>ct.length?(dt=this,vt=ct):(dt=ct,vt=this);for(var St=0;Stct.length?this.clone().ixor(ct):ct.clone().ixor(this)},tt.prototype.uxor=function(ct){return this.length>ct.length?this.clone().iuxor(ct):ct.clone().iuxor(this)},tt.prototype.inotn=function(ct){j(typeof ct=="number"&&ct>=0);var dt=Math.ceil(ct/26)|0,vt=ct%26;this._expand(dt),vt>0&&dt--;for(var St=0;St0&&(this.words[St]=~this.words[St]&67108863>>26-vt),this._strip()},tt.prototype.notn=function(ct){return this.clone().inotn(ct)},tt.prototype.setn=function(ct,dt){j(typeof ct=="number"&&ct>=0);var vt=ct/26|0,St=ct%26;return this._expand(vt+1),dt?this.words[vt]=this.words[vt]|1<ct.length?(vt=this,St=ct):(vt=ct,St=this);for(var Rt=0,$t=0;$t>>26;for(;Rt!==0&&$t>>26;if(this.length=vt.length,Rt!==0)this.words[this.length]=Rt,this.length++;else if(vt!==this)for(;$tct.length?this.clone().iadd(ct):ct.clone().iadd(this)},tt.prototype.isub=function(ct){if(ct.negative!==0){ct.negative=0;var dt=this.iadd(ct);return ct.negative=1,dt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(ct),this.negative=1,this._normSign();var vt=this.cmp(ct);if(vt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Rt;vt>0?(St=this,Rt=ct):(St=ct,Rt=this);for(var $t=0,xt=0;xt>26,this.words[xt]=dt&67108863;for(;$t!==0&&xt>26,this.words[xt]=dt&67108863;if($t===0&&xt>>26,tr=At&67108863,nr=Math.min(wt,ct.length-1),ir=Math.max(0,wt-mt.length+1);ir<=nr;ir++){var Wt=wt-ir|0;St=mt.words[Wt]|0,Rt=ct.words[ir]|0,$t=St*Rt+tr,Ot+=$t/67108864|0,tr=$t&67108863}dt.words[wt]=tr|0,At=Ot|0}return At!==0?dt.words[wt]=At|0:dt.length--,dt._strip()}var Tt=function(ct,dt,vt){var St=ct.words,Rt=dt.words,$t=vt.words,xt=0,At,wt,Ot,tr=St[0]|0,nr=tr&8191,ir=tr>>>13,Wt=St[1]|0,Kt=Wt&8191,Jt=Wt>>>13,Ht=St[2]|0,qt=Ht&8191,Qt=Ht>>>13,dr=St[3]|0,xr=dr&8191,pr=dr>>>13,kr=St[4]|0,Ir=kr&8191,lr=kr>>>13,fr=St[5]|0,Er=fr&8191,$r=fr>>>13,Pr=St[6]|0,Rr=Pr&8191,Ar=Pr>>>13,Or=St[7]|0,Lr=Or&8191,or=Or>>>13,Yt=St[8]|0,er=Yt&8191,Zt=Yt>>>13,Vt=St[9]|0,Gt=Vt&8191,ar=Vt>>>13,br=Rt[0]|0,wr=br&8191,Sr=br>>>13,Wr=Rt[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=Rt[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=Rt[3]|0,ln=mn&8191,qr=mn>>>13,wn=Rt[4]|0,un=wn&8191,Vr=wn>>>13,hn=Rt[5]|0,fn=hn&8191,Kr=hn>>>13,$n=Rt[6]|0,dn=$n&8191,Gr=$n>>>13,gn=Rt[7]|0,an=gn&8191,Zr=gn>>>13,Rn=Rt[8]|0,Sn=Rn&8191,nn=Rn>>>13,Tn=Rt[9]|0,yn=Tn&8191,En=Tn>>>13;vt.negative=ct.negative^dt.negative,vt.length=19,At=Math.imul(nr,wr),wt=Math.imul(nr,Sr),wt=wt+Math.imul(ir,wr)|0,Ot=Math.imul(ir,Sr);var ds=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ds>>>26)|0,ds&=67108863,At=Math.imul(Kt,wr),wt=Math.imul(Kt,Sr),wt=wt+Math.imul(Jt,wr)|0,Ot=Math.imul(Jt,Sr),At=At+Math.imul(nr,Hr)|0,wt=wt+Math.imul(nr,Fr)|0,wt=wt+Math.imul(ir,Hr)|0,Ot=Ot+Math.imul(ir,Fr)|0;var fs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(fs>>>26)|0,fs&=67108863,At=Math.imul(qt,wr),wt=Math.imul(qt,Sr),wt=wt+Math.imul(Qt,wr)|0,Ot=Math.imul(Qt,Sr),At=At+Math.imul(Kt,Hr)|0,wt=wt+Math.imul(Kt,Fr)|0,wt=wt+Math.imul(Jt,Hr)|0,Ot=Ot+Math.imul(Jt,Fr)|0,At=At+Math.imul(nr,Jr)|0,wt=wt+Math.imul(nr,Qr)|0,wt=wt+Math.imul(ir,Jr)|0,Ot=Ot+Math.imul(ir,Qr)|0;var hs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(hs>>>26)|0,hs&=67108863,At=Math.imul(xr,wr),wt=Math.imul(xr,Sr),wt=wt+Math.imul(pr,wr)|0,Ot=Math.imul(pr,Sr),At=At+Math.imul(qt,Hr)|0,wt=wt+Math.imul(qt,Fr)|0,wt=wt+Math.imul(Qt,Hr)|0,Ot=Ot+Math.imul(Qt,Fr)|0,At=At+Math.imul(Kt,Jr)|0,wt=wt+Math.imul(Kt,Qr)|0,wt=wt+Math.imul(Jt,Jr)|0,Ot=Ot+Math.imul(Jt,Qr)|0,At=At+Math.imul(nr,ln)|0,wt=wt+Math.imul(nr,qr)|0,wt=wt+Math.imul(ir,ln)|0,Ot=Ot+Math.imul(ir,qr)|0;var ps=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ps>>>26)|0,ps&=67108863,At=Math.imul(Ir,wr),wt=Math.imul(Ir,Sr),wt=wt+Math.imul(lr,wr)|0,Ot=Math.imul(lr,Sr),At=At+Math.imul(xr,Hr)|0,wt=wt+Math.imul(xr,Fr)|0,wt=wt+Math.imul(pr,Hr)|0,Ot=Ot+Math.imul(pr,Fr)|0,At=At+Math.imul(qt,Jr)|0,wt=wt+Math.imul(qt,Qr)|0,wt=wt+Math.imul(Qt,Jr)|0,Ot=Ot+Math.imul(Qt,Qr)|0,At=At+Math.imul(Kt,ln)|0,wt=wt+Math.imul(Kt,qr)|0,wt=wt+Math.imul(Jt,ln)|0,Ot=Ot+Math.imul(Jt,qr)|0,At=At+Math.imul(nr,un)|0,wt=wt+Math.imul(nr,Vr)|0,wt=wt+Math.imul(ir,un)|0,Ot=Ot+Math.imul(ir,Vr)|0;var Vn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,At=Math.imul(Er,wr),wt=Math.imul(Er,Sr),wt=wt+Math.imul($r,wr)|0,Ot=Math.imul($r,Sr),At=At+Math.imul(Ir,Hr)|0,wt=wt+Math.imul(Ir,Fr)|0,wt=wt+Math.imul(lr,Hr)|0,Ot=Ot+Math.imul(lr,Fr)|0,At=At+Math.imul(xr,Jr)|0,wt=wt+Math.imul(xr,Qr)|0,wt=wt+Math.imul(pr,Jr)|0,Ot=Ot+Math.imul(pr,Qr)|0,At=At+Math.imul(qt,ln)|0,wt=wt+Math.imul(qt,qr)|0,wt=wt+Math.imul(Qt,ln)|0,Ot=Ot+Math.imul(Qt,qr)|0,At=At+Math.imul(Kt,un)|0,wt=wt+Math.imul(Kt,Vr)|0,wt=wt+Math.imul(Jt,un)|0,Ot=Ot+Math.imul(Jt,Vr)|0,At=At+Math.imul(nr,fn)|0,wt=wt+Math.imul(nr,Kr)|0,wt=wt+Math.imul(ir,fn)|0,Ot=Ot+Math.imul(ir,Kr)|0;var ss=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ss>>>26)|0,ss&=67108863,At=Math.imul(Rr,wr),wt=Math.imul(Rr,Sr),wt=wt+Math.imul(Ar,wr)|0,Ot=Math.imul(Ar,Sr),At=At+Math.imul(Er,Hr)|0,wt=wt+Math.imul(Er,Fr)|0,wt=wt+Math.imul($r,Hr)|0,Ot=Ot+Math.imul($r,Fr)|0,At=At+Math.imul(Ir,Jr)|0,wt=wt+Math.imul(Ir,Qr)|0,wt=wt+Math.imul(lr,Jr)|0,Ot=Ot+Math.imul(lr,Qr)|0,At=At+Math.imul(xr,ln)|0,wt=wt+Math.imul(xr,qr)|0,wt=wt+Math.imul(pr,ln)|0,Ot=Ot+Math.imul(pr,qr)|0,At=At+Math.imul(qt,un)|0,wt=wt+Math.imul(qt,Vr)|0,wt=wt+Math.imul(Qt,un)|0,Ot=Ot+Math.imul(Qt,Vr)|0,At=At+Math.imul(Kt,fn)|0,wt=wt+Math.imul(Kt,Kr)|0,wt=wt+Math.imul(Jt,fn)|0,Ot=Ot+Math.imul(Jt,Kr)|0,At=At+Math.imul(nr,dn)|0,wt=wt+Math.imul(nr,Gr)|0,wt=wt+Math.imul(ir,dn)|0,Ot=Ot+Math.imul(ir,Gr)|0;var Jn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,At=Math.imul(Lr,wr),wt=Math.imul(Lr,Sr),wt=wt+Math.imul(or,wr)|0,Ot=Math.imul(or,Sr),At=At+Math.imul(Rr,Hr)|0,wt=wt+Math.imul(Rr,Fr)|0,wt=wt+Math.imul(Ar,Hr)|0,Ot=Ot+Math.imul(Ar,Fr)|0,At=At+Math.imul(Er,Jr)|0,wt=wt+Math.imul(Er,Qr)|0,wt=wt+Math.imul($r,Jr)|0,Ot=Ot+Math.imul($r,Qr)|0,At=At+Math.imul(Ir,ln)|0,wt=wt+Math.imul(Ir,qr)|0,wt=wt+Math.imul(lr,ln)|0,Ot=Ot+Math.imul(lr,qr)|0,At=At+Math.imul(xr,un)|0,wt=wt+Math.imul(xr,Vr)|0,wt=wt+Math.imul(pr,un)|0,Ot=Ot+Math.imul(pr,Vr)|0,At=At+Math.imul(qt,fn)|0,wt=wt+Math.imul(qt,Kr)|0,wt=wt+Math.imul(Qt,fn)|0,Ot=Ot+Math.imul(Qt,Kr)|0,At=At+Math.imul(Kt,dn)|0,wt=wt+Math.imul(Kt,Gr)|0,wt=wt+Math.imul(Jt,dn)|0,Ot=Ot+Math.imul(Jt,Gr)|0,At=At+Math.imul(nr,an)|0,wt=wt+Math.imul(nr,Zr)|0,wt=wt+Math.imul(ir,an)|0,Ot=Ot+Math.imul(ir,Zr)|0;var Yn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,At=Math.imul(er,wr),wt=Math.imul(er,Sr),wt=wt+Math.imul(Zt,wr)|0,Ot=Math.imul(Zt,Sr),At=At+Math.imul(Lr,Hr)|0,wt=wt+Math.imul(Lr,Fr)|0,wt=wt+Math.imul(or,Hr)|0,Ot=Ot+Math.imul(or,Fr)|0,At=At+Math.imul(Rr,Jr)|0,wt=wt+Math.imul(Rr,Qr)|0,wt=wt+Math.imul(Ar,Jr)|0,Ot=Ot+Math.imul(Ar,Qr)|0,At=At+Math.imul(Er,ln)|0,wt=wt+Math.imul(Er,qr)|0,wt=wt+Math.imul($r,ln)|0,Ot=Ot+Math.imul($r,qr)|0,At=At+Math.imul(Ir,un)|0,wt=wt+Math.imul(Ir,Vr)|0,wt=wt+Math.imul(lr,un)|0,Ot=Ot+Math.imul(lr,Vr)|0,At=At+Math.imul(xr,fn)|0,wt=wt+Math.imul(xr,Kr)|0,wt=wt+Math.imul(pr,fn)|0,Ot=Ot+Math.imul(pr,Kr)|0,At=At+Math.imul(qt,dn)|0,wt=wt+Math.imul(qt,Gr)|0,wt=wt+Math.imul(Qt,dn)|0,Ot=Ot+Math.imul(Qt,Gr)|0,At=At+Math.imul(Kt,an)|0,wt=wt+Math.imul(Kt,Zr)|0,wt=wt+Math.imul(Jt,an)|0,Ot=Ot+Math.imul(Jt,Zr)|0,At=At+Math.imul(nr,Sn)|0,wt=wt+Math.imul(nr,nn)|0,wt=wt+Math.imul(ir,Sn)|0,Ot=Ot+Math.imul(ir,nn)|0;var ms=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ms>>>26)|0,ms&=67108863,At=Math.imul(Gt,wr),wt=Math.imul(Gt,Sr),wt=wt+Math.imul(ar,wr)|0,Ot=Math.imul(ar,Sr),At=At+Math.imul(er,Hr)|0,wt=wt+Math.imul(er,Fr)|0,wt=wt+Math.imul(Zt,Hr)|0,Ot=Ot+Math.imul(Zt,Fr)|0,At=At+Math.imul(Lr,Jr)|0,wt=wt+Math.imul(Lr,Qr)|0,wt=wt+Math.imul(or,Jr)|0,Ot=Ot+Math.imul(or,Qr)|0,At=At+Math.imul(Rr,ln)|0,wt=wt+Math.imul(Rr,qr)|0,wt=wt+Math.imul(Ar,ln)|0,Ot=Ot+Math.imul(Ar,qr)|0,At=At+Math.imul(Er,un)|0,wt=wt+Math.imul(Er,Vr)|0,wt=wt+Math.imul($r,un)|0,Ot=Ot+Math.imul($r,Vr)|0,At=At+Math.imul(Ir,fn)|0,wt=wt+Math.imul(Ir,Kr)|0,wt=wt+Math.imul(lr,fn)|0,Ot=Ot+Math.imul(lr,Kr)|0,At=At+Math.imul(xr,dn)|0,wt=wt+Math.imul(xr,Gr)|0,wt=wt+Math.imul(pr,dn)|0,Ot=Ot+Math.imul(pr,Gr)|0,At=At+Math.imul(qt,an)|0,wt=wt+Math.imul(qt,Zr)|0,wt=wt+Math.imul(Qt,an)|0,Ot=Ot+Math.imul(Qt,Zr)|0,At=At+Math.imul(Kt,Sn)|0,wt=wt+Math.imul(Kt,nn)|0,wt=wt+Math.imul(Jt,Sn)|0,Ot=Ot+Math.imul(Jt,nn)|0,At=At+Math.imul(nr,yn)|0,wt=wt+Math.imul(nr,En)|0,wt=wt+Math.imul(ir,yn)|0,Ot=Ot+Math.imul(ir,En)|0;var Qn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,At=Math.imul(Gt,Hr),wt=Math.imul(Gt,Fr),wt=wt+Math.imul(ar,Hr)|0,Ot=Math.imul(ar,Fr),At=At+Math.imul(er,Jr)|0,wt=wt+Math.imul(er,Qr)|0,wt=wt+Math.imul(Zt,Jr)|0,Ot=Ot+Math.imul(Zt,Qr)|0,At=At+Math.imul(Lr,ln)|0,wt=wt+Math.imul(Lr,qr)|0,wt=wt+Math.imul(or,ln)|0,Ot=Ot+Math.imul(or,qr)|0,At=At+Math.imul(Rr,un)|0,wt=wt+Math.imul(Rr,Vr)|0,wt=wt+Math.imul(Ar,un)|0,Ot=Ot+Math.imul(Ar,Vr)|0,At=At+Math.imul(Er,fn)|0,wt=wt+Math.imul(Er,Kr)|0,wt=wt+Math.imul($r,fn)|0,Ot=Ot+Math.imul($r,Kr)|0,At=At+Math.imul(Ir,dn)|0,wt=wt+Math.imul(Ir,Gr)|0,wt=wt+Math.imul(lr,dn)|0,Ot=Ot+Math.imul(lr,Gr)|0,At=At+Math.imul(xr,an)|0,wt=wt+Math.imul(xr,Zr)|0,wt=wt+Math.imul(pr,an)|0,Ot=Ot+Math.imul(pr,Zr)|0,At=At+Math.imul(qt,Sn)|0,wt=wt+Math.imul(qt,nn)|0,wt=wt+Math.imul(Qt,Sn)|0,Ot=Ot+Math.imul(Qt,nn)|0,At=At+Math.imul(Kt,yn)|0,wt=wt+Math.imul(Kt,En)|0,wt=wt+Math.imul(Jt,yn)|0,Ot=Ot+Math.imul(Jt,En)|0;var es=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(es>>>26)|0,es&=67108863,At=Math.imul(Gt,Jr),wt=Math.imul(Gt,Qr),wt=wt+Math.imul(ar,Jr)|0,Ot=Math.imul(ar,Qr),At=At+Math.imul(er,ln)|0,wt=wt+Math.imul(er,qr)|0,wt=wt+Math.imul(Zt,ln)|0,Ot=Ot+Math.imul(Zt,qr)|0,At=At+Math.imul(Lr,un)|0,wt=wt+Math.imul(Lr,Vr)|0,wt=wt+Math.imul(or,un)|0,Ot=Ot+Math.imul(or,Vr)|0,At=At+Math.imul(Rr,fn)|0,wt=wt+Math.imul(Rr,Kr)|0,wt=wt+Math.imul(Ar,fn)|0,Ot=Ot+Math.imul(Ar,Kr)|0,At=At+Math.imul(Er,dn)|0,wt=wt+Math.imul(Er,Gr)|0,wt=wt+Math.imul($r,dn)|0,Ot=Ot+Math.imul($r,Gr)|0,At=At+Math.imul(Ir,an)|0,wt=wt+Math.imul(Ir,Zr)|0,wt=wt+Math.imul(lr,an)|0,Ot=Ot+Math.imul(lr,Zr)|0,At=At+Math.imul(xr,Sn)|0,wt=wt+Math.imul(xr,nn)|0,wt=wt+Math.imul(pr,Sn)|0,Ot=Ot+Math.imul(pr,nn)|0,At=At+Math.imul(qt,yn)|0,wt=wt+Math.imul(qt,En)|0,wt=wt+Math.imul(Qt,yn)|0,Ot=Ot+Math.imul(Qt,En)|0;var ls=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(ls>>>26)|0,ls&=67108863,At=Math.imul(Gt,ln),wt=Math.imul(Gt,qr),wt=wt+Math.imul(ar,ln)|0,Ot=Math.imul(ar,qr),At=At+Math.imul(er,un)|0,wt=wt+Math.imul(er,Vr)|0,wt=wt+Math.imul(Zt,un)|0,Ot=Ot+Math.imul(Zt,Vr)|0,At=At+Math.imul(Lr,fn)|0,wt=wt+Math.imul(Lr,Kr)|0,wt=wt+Math.imul(or,fn)|0,Ot=Ot+Math.imul(or,Kr)|0,At=At+Math.imul(Rr,dn)|0,wt=wt+Math.imul(Rr,Gr)|0,wt=wt+Math.imul(Ar,dn)|0,Ot=Ot+Math.imul(Ar,Gr)|0,At=At+Math.imul(Er,an)|0,wt=wt+Math.imul(Er,Zr)|0,wt=wt+Math.imul($r,an)|0,Ot=Ot+Math.imul($r,Zr)|0,At=At+Math.imul(Ir,Sn)|0,wt=wt+Math.imul(Ir,nn)|0,wt=wt+Math.imul(lr,Sn)|0,Ot=Ot+Math.imul(lr,nn)|0,At=At+Math.imul(xr,yn)|0,wt=wt+Math.imul(xr,En)|0,wt=wt+Math.imul(pr,yn)|0,Ot=Ot+Math.imul(pr,En)|0;var us=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(us>>>26)|0,us&=67108863,At=Math.imul(Gt,un),wt=Math.imul(Gt,Vr),wt=wt+Math.imul(ar,un)|0,Ot=Math.imul(ar,Vr),At=At+Math.imul(er,fn)|0,wt=wt+Math.imul(er,Kr)|0,wt=wt+Math.imul(Zt,fn)|0,Ot=Ot+Math.imul(Zt,Kr)|0,At=At+Math.imul(Lr,dn)|0,wt=wt+Math.imul(Lr,Gr)|0,wt=wt+Math.imul(or,dn)|0,Ot=Ot+Math.imul(or,Gr)|0,At=At+Math.imul(Rr,an)|0,wt=wt+Math.imul(Rr,Zr)|0,wt=wt+Math.imul(Ar,an)|0,Ot=Ot+Math.imul(Ar,Zr)|0,At=At+Math.imul(Er,Sn)|0,wt=wt+Math.imul(Er,nn)|0,wt=wt+Math.imul($r,Sn)|0,Ot=Ot+Math.imul($r,nn)|0,At=At+Math.imul(Ir,yn)|0,wt=wt+Math.imul(Ir,En)|0,wt=wt+Math.imul(lr,yn)|0,Ot=Ot+Math.imul(lr,En)|0;var Wn=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,At=Math.imul(Gt,fn),wt=Math.imul(Gt,Kr),wt=wt+Math.imul(ar,fn)|0,Ot=Math.imul(ar,Kr),At=At+Math.imul(er,dn)|0,wt=wt+Math.imul(er,Gr)|0,wt=wt+Math.imul(Zt,dn)|0,Ot=Ot+Math.imul(Zt,Gr)|0,At=At+Math.imul(Lr,an)|0,wt=wt+Math.imul(Lr,Zr)|0,wt=wt+Math.imul(or,an)|0,Ot=Ot+Math.imul(or,Zr)|0,At=At+Math.imul(Rr,Sn)|0,wt=wt+Math.imul(Rr,nn)|0,wt=wt+Math.imul(Ar,Sn)|0,Ot=Ot+Math.imul(Ar,nn)|0,At=At+Math.imul(Er,yn)|0,wt=wt+Math.imul(Er,En)|0,wt=wt+Math.imul($r,yn)|0,Ot=Ot+Math.imul($r,En)|0;var as=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(as>>>26)|0,as&=67108863,At=Math.imul(Gt,dn),wt=Math.imul(Gt,Gr),wt=wt+Math.imul(ar,dn)|0,Ot=Math.imul(ar,Gr),At=At+Math.imul(er,an)|0,wt=wt+Math.imul(er,Zr)|0,wt=wt+Math.imul(Zt,an)|0,Ot=Ot+Math.imul(Zt,Zr)|0,At=At+Math.imul(Lr,Sn)|0,wt=wt+Math.imul(Lr,nn)|0,wt=wt+Math.imul(or,Sn)|0,Ot=Ot+Math.imul(or,nn)|0,At=At+Math.imul(Rr,yn)|0,wt=wt+Math.imul(Rr,En)|0,wt=wt+Math.imul(Ar,yn)|0,Ot=Ot+Math.imul(Ar,En)|0;var gs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(gs>>>26)|0,gs&=67108863,At=Math.imul(Gt,an),wt=Math.imul(Gt,Zr),wt=wt+Math.imul(ar,an)|0,Ot=Math.imul(ar,Zr),At=At+Math.imul(er,Sn)|0,wt=wt+Math.imul(er,nn)|0,wt=wt+Math.imul(Zt,Sn)|0,Ot=Ot+Math.imul(Zt,nn)|0,At=At+Math.imul(Lr,yn)|0,wt=wt+Math.imul(Lr,En)|0,wt=wt+Math.imul(or,yn)|0,Ot=Ot+Math.imul(or,En)|0;var vs=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(vs>>>26)|0,vs&=67108863,At=Math.imul(Gt,Sn),wt=Math.imul(Gt,nn),wt=wt+Math.imul(ar,Sn)|0,Ot=Math.imul(ar,nn),At=At+Math.imul(er,yn)|0,wt=wt+Math.imul(er,En)|0,wt=wt+Math.imul(Zt,yn)|0,Ot=Ot+Math.imul(Zt,En)|0;var Ps=(xt+At|0)+((wt&8191)<<13)|0;xt=(Ot+(wt>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,At=Math.imul(Gt,yn),wt=Math.imul(Gt,En),wt=wt+Math.imul(ar,yn)|0,Ot=Math.imul(ar,En);var As=(xt+At|0)+((wt&8191)<<13)|0;return xt=(Ot+(wt>>>13)|0)+(As>>>26)|0,As&=67108863,$t[0]=ds,$t[1]=fs,$t[2]=hs,$t[3]=ps,$t[4]=Vn,$t[5]=ss,$t[6]=Jn,$t[7]=Yn,$t[8]=ms,$t[9]=Qn,$t[10]=es,$t[11]=ls,$t[12]=us,$t[13]=Wn,$t[14]=as,$t[15]=gs,$t[16]=vs,$t[17]=Ps,$t[18]=As,xt!==0&&($t[19]=xt,vt.length++),vt};Math.imul||(Tt=Pt);function It(mt,ct,dt){dt.negative=ct.negative^mt.negative,dt.length=mt.length+ct.length;for(var vt=0,St=0,Rt=0;Rt>>26)|0,St+=$t>>>26,$t&=67108863}dt.words[Rt]=xt,vt=$t,$t=St}return vt!==0?dt.words[Rt]=vt:dt.length--,dt._strip()}function Lt(mt,ct,dt){return It(mt,ct,dt)}tt.prototype.mulTo=function(ct,dt){var vt,St=this.length+ct.length;return this.length===10&&ct.length===10?vt=Tt(this,ct,dt):St<63?vt=Pt(this,ct,dt):St<1024?vt=It(this,ct,dt):vt=Lt(this,ct,dt),vt},tt.prototype.mul=function(ct){var dt=new tt(null);return dt.words=new Array(this.length+ct.length),this.mulTo(ct,dt)},tt.prototype.mulf=function(ct){var dt=new tt(null);return dt.words=new Array(this.length+ct.length),Lt(this,ct,dt)},tt.prototype.imul=function(ct){return this.clone().mulTo(ct,this)},tt.prototype.imuln=function(ct){var dt=ct<0;dt&&(ct=-ct),j(typeof ct=="number"),j(ct<67108864);for(var vt=0,St=0;St>=26,vt+=Rt/67108864|0,vt+=$t>>>26,this.words[St]=$t&67108863}return vt!==0&&(this.words[St]=vt,this.length++),dt?this.ineg():this},tt.prototype.muln=function(ct){return this.clone().imuln(ct)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(ct){var dt=Ct(ct);if(dt.length===0)return new tt(1);for(var vt=this,St=0;St=0);var dt=ct%26,vt=(ct-dt)/26,St=67108863>>>26-dt<<26-dt,Rt;if(dt!==0){var $t=0;for(Rt=0;Rt>>26-dt}$t&&(this.words[Rt]=$t,this.length++)}if(vt!==0){for(Rt=this.length-1;Rt>=0;Rt--)this.words[Rt+vt]=this.words[Rt];for(Rt=0;Rt=0);var St;dt?St=(dt-dt%26)/26:St=0;var Rt=ct%26,$t=Math.min((ct-Rt)/26,this.length),xt=67108863^67108863>>>Rt<$t)for(this.length-=$t,wt=0;wt=0&&(Ot!==0||wt>=St);wt--){var tr=this.words[wt]|0;this.words[wt]=Ot<<26-Rt|tr>>>Rt,Ot=tr&xt}return At&&Ot!==0&&(At.words[At.length++]=Ot),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,dt,vt){return j(this.negative===0),this.iushrn(ct,dt,vt)},tt.prototype.shln=function(ct){return this.clone().ishln(ct)},tt.prototype.ushln=function(ct){return this.clone().iushln(ct)},tt.prototype.shrn=function(ct){return this.clone().ishrn(ct)},tt.prototype.ushrn=function(ct){return this.clone().iushrn(ct)},tt.prototype.testn=function(ct){j(typeof ct=="number"&&ct>=0);var dt=ct%26,vt=(ct-dt)/26,St=1<=0);var dt=ct%26,vt=(ct-dt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=vt)return this;if(dt!==0&&vt++,this.length=Math.min(vt,this.length),dt!==0){var St=67108863^67108863>>>dt<=67108864;dt++)this.words[dt]-=67108864,dt===this.length-1?this.words[dt+1]=1:this.words[dt+1]++;return this.length=Math.max(this.length,dt+1),this},tt.prototype.isubn=function(ct){if(j(typeof ct=="number"),j(ct<67108864),ct<0)return this.iaddn(-ct);if(this.negative!==0)return this.negative=0,this.iaddn(ct),this.negative=1,this;if(this.words[0]-=ct,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var dt=0;dt>26)-(At/67108864|0),this.words[Rt+vt]=$t&67108863}for(;Rt>26,this.words[Rt+vt]=$t&67108863;if(xt===0)return this._strip();for(j(xt===-1),xt=0,Rt=0;Rt>26,this.words[Rt]=$t&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,dt){var vt=this.length-ct.length,St=this.clone(),Rt=ct,$t=Rt.words[Rt.length-1]|0,xt=this._countBits($t);vt=26-xt,vt!==0&&(Rt=Rt.ushln(vt),St.iushln(vt),$t=Rt.words[Rt.length-1]|0);var At=St.length-Rt.length,wt;if(dt!=="mod"){wt=new tt(null),wt.length=At+1,wt.words=new Array(wt.length);for(var Ot=0;Ot=0;nr--){var ir=(St.words[Rt.length+nr]|0)*67108864+(St.words[Rt.length+nr-1]|0);for(ir=Math.min(ir/$t|0,67108863),St._ishlnsubmul(Rt,ir,nr);St.negative!==0;)ir--,St.negative=0,St._ishlnsubmul(Rt,1,nr),St.isZero()||(St.negative^=1);wt&&(wt.words[nr]=ir)}return wt&&wt._strip(),St._strip(),dt!=="div"&&vt!==0&&St.iushrn(vt),{div:wt||null,mod:St}},tt.prototype.divmod=function(ct,dt,vt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var St,Rt,$t;return this.negative!==0&&ct.negative===0?($t=this.neg().divmod(ct,dt),dt!=="mod"&&(St=$t.div.neg()),dt!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.iadd(ct)),{div:St,mod:Rt}):this.negative===0&&ct.negative!==0?($t=this.divmod(ct.neg(),dt),dt!=="mod"&&(St=$t.div.neg()),{div:St,mod:$t.mod}):this.negative&ct.negative?($t=this.neg().divmod(ct.neg(),dt),dt!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.isub(ct)),{div:$t.div,mod:Rt}):ct.length>this.length||this.cmp(ct)<0?{div:new tt(0),mod:this}:ct.length===1?dt==="div"?{div:this.divn(ct.words[0]),mod:null}:dt==="mod"?{div:null,mod:new tt(this.modrn(ct.words[0]))}:{div:this.divn(ct.words[0]),mod:new tt(this.modrn(ct.words[0]))}:this._wordDiv(ct,dt)},tt.prototype.div=function(ct){return this.divmod(ct,"div",!1).div},tt.prototype.mod=function(ct){return this.divmod(ct,"mod",!1).mod},tt.prototype.umod=function(ct){return this.divmod(ct,"mod",!0).mod},tt.prototype.divRound=function(ct){var dt=this.divmod(ct);if(dt.mod.isZero())return dt.div;var vt=dt.div.negative!==0?dt.mod.isub(ct):dt.mod,St=ct.ushrn(1),Rt=ct.andln(1),$t=vt.cmp(St);return $t<0||Rt===1&&$t===0?dt.div:dt.div.negative!==0?dt.div.isubn(1):dt.div.iaddn(1)},tt.prototype.modrn=function(ct){var dt=ct<0;dt&&(ct=-ct),j(ct<=67108863);for(var vt=(1<<26)%ct,St=0,Rt=this.length-1;Rt>=0;Rt--)St=(vt*St+(this.words[Rt]|0))%ct;return dt?-St:St},tt.prototype.modn=function(ct){return this.modrn(ct)},tt.prototype.idivn=function(ct){var dt=ct<0;dt&&(ct=-ct),j(ct<=67108863);for(var vt=0,St=this.length-1;St>=0;St--){var Rt=(this.words[St]|0)+vt*67108864;this.words[St]=Rt/ct|0,vt=Rt%ct}return this._strip(),dt?this.ineg():this},tt.prototype.divn=function(ct){return this.clone().idivn(ct)},tt.prototype.egcd=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,vt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var St=new tt(1),Rt=new tt(0),$t=new tt(0),xt=new tt(1),At=0;dt.isEven()&&vt.isEven();)dt.iushrn(1),vt.iushrn(1),++At;for(var wt=vt.clone(),Ot=dt.clone();!dt.isZero();){for(var tr=0,nr=1;!(dt.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(dt.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(wt),Rt.isub(Ot)),St.iushrn(1),Rt.iushrn(1);for(var ir=0,Wt=1;!(vt.words[0]&Wt)&&ir<26;++ir,Wt<<=1);if(ir>0)for(vt.iushrn(ir);ir-- >0;)($t.isOdd()||xt.isOdd())&&($t.iadd(wt),xt.isub(Ot)),$t.iushrn(1),xt.iushrn(1);dt.cmp(vt)>=0?(dt.isub(vt),St.isub($t),Rt.isub(xt)):(vt.isub(dt),$t.isub(St),xt.isub(Rt))}return{a:$t,b:xt,gcd:vt.iushln(At)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,vt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var St=new tt(1),Rt=new tt(0),$t=vt.clone();dt.cmpn(1)>0&&vt.cmpn(1)>0;){for(var xt=0,At=1;!(dt.words[0]&At)&&xt<26;++xt,At<<=1);if(xt>0)for(dt.iushrn(xt);xt-- >0;)St.isOdd()&&St.iadd($t),St.iushrn(1);for(var wt=0,Ot=1;!(vt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(vt.iushrn(wt);wt-- >0;)Rt.isOdd()&&Rt.iadd($t),Rt.iushrn(1);dt.cmp(vt)>=0?(dt.isub(vt),St.isub(Rt)):(vt.isub(dt),Rt.isub(St))}var tr;return dt.cmpn(1)===0?tr=St:tr=Rt,tr.cmpn(0)<0&&tr.iadd(ct),tr},tt.prototype.gcd=function(ct){if(this.isZero())return ct.abs();if(ct.isZero())return this.abs();var dt=this.clone(),vt=ct.clone();dt.negative=0,vt.negative=0;for(var St=0;dt.isEven()&&vt.isEven();St++)dt.iushrn(1),vt.iushrn(1);do{for(;dt.isEven();)dt.iushrn(1);for(;vt.isEven();)vt.iushrn(1);var Rt=dt.cmp(vt);if(Rt<0){var $t=dt;dt=vt,vt=$t}else if(Rt===0||vt.cmpn(1)===0)break;dt.isub(vt)}while(!0);return vt.iushln(St)},tt.prototype.invm=function(ct){return this.egcd(ct).a.umod(ct)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(ct){return this.words[0]&ct},tt.prototype.bincn=function(ct){j(typeof ct=="number");var dt=ct%26,vt=(ct-dt)/26,St=1<>>26,xt&=67108863,this.words[$t]=xt}return Rt!==0&&(this.words[$t]=Rt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(ct){var dt=ct<0;if(this.negative!==0&&!dt)return-1;if(this.negative===0&&dt)return 1;this._strip();var vt;if(this.length>1)vt=1;else{dt&&(ct=-ct),j(ct<=67108863,"Number is too big");var St=this.words[0]|0;vt=St===ct?0:Stct.length)return 1;if(this.length=0;vt--){var St=this.words[vt]|0,Rt=ct.words[vt]|0;if(St!==Rt){StRt&&(dt=1);break}}return dt},tt.prototype.gtn=function(ct){return this.cmpn(ct)===1},tt.prototype.gt=function(ct){return this.cmp(ct)===1},tt.prototype.gten=function(ct){return this.cmpn(ct)>=0},tt.prototype.gte=function(ct){return this.cmp(ct)>=0},tt.prototype.ltn=function(ct){return this.cmpn(ct)===-1},tt.prototype.lt=function(ct){return this.cmp(ct)===-1},tt.prototype.lten=function(ct){return this.cmpn(ct)<=0},tt.prototype.lte=function(ct){return this.cmp(ct)<=0},tt.prototype.eqn=function(ct){return this.cmpn(ct)===0},tt.prototype.eq=function(ct){return this.cmp(ct)===0},tt.red=function(ct){return new Bt(ct)},tt.prototype.toRed=function(ct){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),ct.convertTo(this)._forceRed(ct)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(ct){return this.red=ct,this},tt.prototype.forceRed=function(ct){return j(!this.red,"Already a number in reduction context"),this._forceRed(ct)},tt.prototype.redAdd=function(ct){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,ct)},tt.prototype.redIAdd=function(ct){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,ct)},tt.prototype.redSub=function(ct){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,ct)},tt.prototype.redISub=function(ct){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,ct)},tt.prototype.redShl=function(ct){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,ct)},tt.prototype.redMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.mul(this,ct)},tt.prototype.redIMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.imul(this,ct)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(ct){return j(this.red&&!ct.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,ct)};var Nt={k256:null,p224:null,p192:null,p25519:null};function Ut(mt,ct){this.name=mt,this.p=new tt(ct,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Ut.prototype._tmp=function(){var ct=new tt(null);return ct.words=new Array(Math.ceil(this.n/13)),ct},Ut.prototype.ireduce=function(ct){var dt=ct,vt;do this.split(dt,this.tmp),dt=this.imulK(dt),dt=dt.iadd(this.tmp),vt=dt.bitLength();while(vt>this.n);var St=vt0?dt.isub(this.p):dt.strip!==void 0?dt.strip():dt._strip(),dt},Ut.prototype.split=function(ct,dt){ct.iushrn(this.n,0,dt)},Ut.prototype.imulK=function(ct){return ct.imul(this.k)};function jt(){Ut.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(jt,Ut),jt.prototype.split=function(ct,dt){for(var vt=4194303,St=Math.min(ct.length,9),Rt=0;Rt>>22,$t=xt}$t>>>=22,ct.words[Rt-10]=$t,$t===0&&ct.length>10?ct.length-=10:ct.length-=9},jt.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var dt=0,vt=0;vt>>=26,ct.words[vt]=Rt,dt=St}return dt!==0&&(ct.words[ct.length++]=dt),ct},tt._prime=function(ct){if(Nt[ct])return Nt[ct];var dt;if(ct==="k256")dt=new jt;else if(ct==="p224")dt=new Mt;else if(ct==="p192")dt=new Dt;else if(ct==="p25519")dt=new Ft;else throw new Error("Unknown prime "+ct);return Nt[ct]=dt,dt};function Bt(mt){if(typeof mt=="string"){var ct=tt._prime(mt);this.m=ct.p,this.prime=ct}else j(mt.gtn(1),"modulus must be greater than 1"),this.m=mt,this.prime=null}Bt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},Bt.prototype._verify2=function(ct,dt){j((ct.negative|dt.negative)===0,"red works only with positives"),j(ct.red&&ct.red===dt.red,"red works only with red numbers")},Bt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(st(ct,ct.umod(this.m)._forceRed(this)),ct)},Bt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},Bt.prototype.add=function(ct,dt){this._verify2(ct,dt);var vt=ct.add(dt);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt._forceRed(this)},Bt.prototype.iadd=function(ct,dt){this._verify2(ct,dt);var vt=ct.iadd(dt);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt},Bt.prototype.sub=function(ct,dt){this._verify2(ct,dt);var vt=ct.sub(dt);return vt.cmpn(0)<0&&vt.iadd(this.m),vt._forceRed(this)},Bt.prototype.isub=function(ct,dt){this._verify2(ct,dt);var vt=ct.isub(dt);return vt.cmpn(0)<0&&vt.iadd(this.m),vt},Bt.prototype.shl=function(ct,dt){return this._verify1(ct),this.imod(ct.ushln(dt))},Bt.prototype.imul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.imul(dt))},Bt.prototype.mul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.mul(dt))},Bt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},Bt.prototype.sqr=function(ct){return this.mul(ct,ct)},Bt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var dt=this.m.andln(3);if(j(dt%2===1),dt===3){var vt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,vt)}for(var St=this.m.subn(1),Rt=0;!St.isZero()&&St.andln(1)===0;)Rt++,St.iushrn(1);j(!St.isZero());var $t=new tt(1).toRed(this),xt=$t.redNeg(),At=this.m.subn(1).iushrn(1),wt=this.m.bitLength();for(wt=new tt(2*wt*wt).toRed(this);this.pow(wt,At).cmp(xt)!==0;)wt.redIAdd(xt);for(var Ot=this.pow(wt,St),tr=this.pow(ct,St.addn(1).iushrn(1)),nr=this.pow(ct,St),ir=Rt;nr.cmp($t)!==0;){for(var Wt=nr,Kt=0;Wt.cmp($t)!==0;Kt++)Wt=Wt.redSqr();j(Kt=0;Rt--){for(var Ot=dt.words[Rt],tr=wt-1;tr>=0;tr--){var nr=Ot>>tr&1;if($t!==St[0]&&($t=this.sqr($t)),nr===0&&xt===0){At=0;continue}xt<<=1,xt|=nr,At++,!(At!==vt&&(Rt!==0||tr!==0))&&($t=this.mul($t,St[xt]),At=0,xt=0)}wt=26}return $t},Bt.prototype.convertTo=function(ct){var dt=ct.umod(this.m);return dt===ct?dt.clone():dt},Bt.prototype.convertFrom=function(ct){var dt=ct.clone();return dt.red=null,dt},tt.mont=function(ct){return new yt(ct)};function yt(mt){Bt.call(this,mt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(yt,Bt),yt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},yt.prototype.convertFrom=function(ct){var dt=this.imod(ct.mul(this.rinv));return dt.red=null,dt},yt.prototype.imul=function(ct,dt){if(ct.isZero()||dt.isZero())return ct.words[0]=0,ct.length=1,ct;var vt=ct.imul(dt),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.mul=function(ct,dt){if(ct.isZero()||dt.isZero())return new tt(0)._forceRed(this);var vt=ct.mul(dt),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.invm=function(ct){var dt=this.imod(ct._invmp(this.m).mul(this.r2));return dt._forceRed(this)}})(_,commonjsGlobal)})(bn);var bnExports=bn.exports;const BN=getDefaultExportFromCjs$1(bnExports),log$2=log$1$1.getLogger("http-helpers");log$2.setLevel(loglevelExports.levels.INFO);let apiKey="torus-default",embedHost="";const gatewayAuthHeader="x-api-key",gatewayEmbedHostHeader="x-embed-host";function setEmbedHost(_){embedHost=_}function setAPIKey(_){apiKey=_}async function fetchAndTrace(_,a){let $=null;try{$=new URL(_)}catch{}return fetch(_,a)}function getApiKeyHeaders(){const _={};return apiKey&&(_[gatewayAuthHeader]=apiKey),embedHost&&(_[gatewayEmbedHostHeader]=embedHost),_}function debugLogResponse(_){log$2.info(`Response: ${_.status} ${_.statusText}`),log$2.info(`Url: ${_.url}`)}function logTracingHeader(_){log$2.info(`Request tracing with traceID=${_.headers.get("x-web3-correlation-id")}`)}const promiseTimeout=(_,a)=>{const $=new Promise((j,et)=>{const tt=setTimeout(()=>{clearTimeout(tt),et(new Error(`Timed out in ${_}ms`))},_)});return Promise.race([a,$])},get=async function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j={mode:"cors",headers:{}};$.useAPIKey&&(j.headers=_objectSpread2(_objectSpread2({},j.headers),getApiKeyHeaders()));const et=deepmerge$1(j,a,{method:"GET"}),tt=await fetchAndTrace(_,et);if(tt.ok){const rt=tt.headers.get("content-type");return rt!=null&&rt.includes("application/json")?tt.json():tt.text()}throw debugLogResponse(tt),tt},post=function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const et={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};j.useAPIKey&&(et.headers=_objectSpread2(_objectSpread2({},et.headers),getApiKeyHeaders()));const tt=deepmerge$1(et,$,{method:"POST"});return j.isUrlEncodedData?(tt.body=a,tt.headers["Content-Type"]==="application/json; charset=utf-8"&&delete tt.headers["Content-Type"]):tt.body=JSON.stringify(a),promiseTimeout(j.timeout||6e4,fetchAndTrace(_,tt).then(rt=>{if(j.logTracingHeader&&logTracingHeader(rt),rt.ok){const nt=rt.headers.get("content-type");return nt!=null&&nt.includes("application/json")?rt.json():rt.text()}throw debugLogResponse(rt),rt}))},generateJsonRPCObject=(_,a)=>({jsonrpc:"2.0",method:_,id:10,params:a}),JRPC_METHODS={GET_OR_SET_KEY:"GetPubKeyOrKeyAssign",COMMITMENT_REQUEST:"CommitmentRequest",IMPORT_SHARE:"ImportShare",GET_SHARE_OR_KEY_ASSIGN:"GetShareOrKeyAssign"},LEGACY_METADATA_HOST="https://metadata.tor.us",normalizeKeysResult=_=>{const a={keys:[],is_new_key:_.is_new_key};return _&&_.keys&&_.keys.length>0&&(a.keys=_.keys.map($=>({pub_key_X:$.pub_key_X,pub_key_Y:$.pub_key_Y,address:$.address}))),a},kCombinations=(_,a)=>{let $=_;if(typeof $=="number"&&($=Array.from({length:$},(tt,rt)=>rt)),a>$.length||a<=0)return[];if(a===$.length)return[$];if(a===1)return $.reduce((tt,rt)=>[...tt,[rt]],[]);const j=[];let et=[];for(let tt=0;tt<=$.length-a+1;tt+=1){et=kCombinations($.slice(tt+1),a-1);for(let rt=0;rt{const $={};for(let j=0;j<_.length;j+=1){const et=stringify(_[j]);if($[et]=$[et]?$[et]+1:1,$[et]===a)return _[j]}};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"),mode:"AES256"}}function encParamsHexToBuf(_){return{ephemPublicKey:Buffer$g.from(_.ephemPublicKey,"hex"),iv:Buffer$g.from(_.iv,"hex"),mac:Buffer$g.from(_.mac,"hex")}}class GetOrSetNonceError extends Error{}const log$1=log$1$1.getLogger("torus.js");log$1.disableAll();function keccak256(_){return`0x${Buffer$g.from(keccak256$2(_)).toString("hex")}`}function stripHexPrefix(_){return _.startsWith("0x")?_.slice(2):_}function toChecksumAddress(_){const a=stripHexPrefix(_).toLowerCase(),$=Buffer$g.from(a,"utf8"),j=Buffer$g.from(keccak256$2($)).toString("hex");let et="0x";for(let tt=0;tt=8?et+=a[tt].toUpperCase():et+=a[tt];return et}function generateAddressFromPrivKey(_,a){const j=_.keyFromPrivate(a.toString("hex",64),"hex").getPublic().encode("hex",!1).slice(2);log$1.info(j,"public key");const et=`0x${keccak256(Buffer$g.from(j,"hex")).slice(26)}`;return toChecksumAddress(et)}function generateAddressFromPubKey(_,a,$){const j=_.keyFromPublic({x:a.toString("hex",64),y:$.toString("hex",64)}),et=j.getPublic().encode("hex",!1).slice(2);log$1.info(j.getPublic().encode("hex",!1),"public key");const tt=`0x${keccak256(Buffer$g.from(et,"hex")).slice(26)}`;return toChecksumAddress(tt)}class Share{constructor(a,$){_defineProperty$4(this,"share",void 0),_defineProperty$4(this,"shareIndex",void 0),this.share=new BN($,"hex"),this.shareIndex=new BN(a,"hex")}static fromJSON(a){const{share:$,shareIndex:j}=a;return new Share(j,$)}toJSON(){return{share:this.share.toString("hex"),shareIndex:this.shareIndex.toString("hex")}}}class Polynomial{constructor(a,$){_defineProperty$4(this,"polynomial",void 0),_defineProperty$4(this,"ecCurve",void 0),this.polynomial=a,this.ecCurve=$}getThreshold(){return this.polynomial.length}polyEval(a){const $=new BN(a,"hex");let j=new BN($),et=new BN(0);et=et.add(this.polynomial[0]);for(let tt=1;tttypeof et=="number"?new BN(et):et instanceof BN?et:typeof et=="string"?new BN(et,"hex"):et),j={};for(let et=0;et<$.length;et+=1)j[$[et].toString("hex",64)]=new Share($[et],this.polyEval($[et]));return j}}function generatePrivateExcludingIndexes(_){const a=new BN(generatePrivate());return _.find($=>$.eq(a))?generatePrivateExcludingIndexes(_):a}function lagrangeInterpolation(_,a,$){if(a.length!==$.length)throw new Error("shares not equal to nodeIndex length in lagrangeInterpolation");let j=new BN(0);for(let et=0;et2&&arguments[2]!==void 0?arguments[2]:{};try{const j=await post(`${_}/get`,a,$,{useAPIKey:!0});return!j||!j.message?new BN(0):new BN(j.message,16)}catch(j){return log$1$1.error("get metadata error",j),new BN(0)}}async function getOrSetNonce(_,a,$,j,et,tt){let rt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,nt;const it=rt?"getNonce":"getOrSetNonce";return tt?nt=generateMetadataParams(a,$,it,tt):nt={pub_key_X:j,pub_key_Y:et,set_data:{data:it}},post(`${_}/get_or_set_nonce`,nt,void 0,{useAPIKey:!0})}async function getNonce(_,a,$,j,et,tt){return getOrSetNonce(_,a,$,j,et,tt,!0)}const config={logRequestTracing:!1};function capitalizeFirstLetter(_){return _.charAt(0).toUpperCase()+_.slice(1)}class SomeError extends Error{constructor(a){let{errors:$,responses:j,predicate:et}=a;super("Unable to resolve enough promises."),_defineProperty$4(this,"errors",void 0),_defineProperty$4(this,"responses",void 0),_defineProperty$4(this,"predicate",void 0),this.errors=$,this.responses=j,this.predicate=et}get message(){return`${super.message}. ${this.errors.length} errors: ${this.errors.map(a=>a.message||a).join(", ")} and ${this.responses.length} responses: ${JSON.stringify(this.responses)}`}toString(){return this.message}}const Some=(_,a)=>new Promise(($,j)=>{let et=0;const tt={resolved:!1},rt=new Array(_.length).fill(void 0),nt=new Array(_.length).fill(void 0);let it;return _.forEach((ot,st)=>ot.then(at=>{nt[st]=at}).catch(at=>{rt[st]=at}).finally(()=>{if(!tt.resolved)return a(nt.slice(0),tt).then(at=>{tt.resolved=!0,$(at)}).catch(at=>{it=at}).finally(()=>{if(et+=1,et===_.length){const ut=Object.values(nt.reduce((ht,bt)=>{if(bt){var Et;const{id:Ct,error:Pt}=bt;(Pt==null||(Et=Pt.data)===null||Et===void 0?void 0:Et.length)>0&&(Pt.data.startsWith("Error occurred while verifying params")?ht[Ct]=capitalizeFirstLetter(Pt.data):ht[Ct]=Pt.data)}return ht},{}));if(ut.length>0){const ht=ut.length>1?` -${ut.map(bt=>`• ${bt}`).join(` -`)}`:ut[0];j(new Error(ht))}else{var at;j(new SomeError({errors:rt,responses:nt,predicate:((at=it)===null||at===void 0?void 0:at.message)||it}))}}})}))}),GetPubKeyOrKeyAssign=async _=>{const{endpoints:a,network:$,verifier:j,verifierId:et,extendedVerifierId:tt}=_,rt=a.map(st=>post(st,generateJsonRPCObject(JRPC_METHODS.GET_OR_SET_KEY,{verifier:j,verifier_id:et.toString(),extended_verifier_id:tt,one_key_flow:!0,fetch_node_index:!0}),null,{logTracingHeader:config.logRequestTracing}).catch(at=>log$1.error(`${JRPC_METHODS.GET_OR_SET_KEY} request failed`,at)));let nt;const it=[];return await Some(rt,st=>{const at=st.filter(bt=>{if(bt&&!bt.error){if(!nt){var Et;((Et=bt.result)===null||Et===void 0||(Et=Et.keys[0].nonce_data)===null||Et===void 0||(Et=Et.pubNonce)===null||Et===void 0?void 0:Et.x)&&(nt=bt.result.keys[0].nonce_data)}return bt}return!1}),ut=thresholdSame(at.map(bt=>bt&&bt.error),~~(a.length/2)+1),ht=thresholdSame(at.map(bt=>bt&&normalizeKeysResult(bt.result)),~~(a.length/2)+1);return ht&&(nt||tt||LEGACY_NETWORKS_ROUTE_MAP[$])||ut?(ht&&st.forEach(bt=>{if(bt&&bt.result){const Et=bt.result.keys[0].pub_key_X.toLowerCase(),Ct=ht.keys[0].pub_key_X.toLowerCase();if(Et===Ct){const Pt=parseInt(bt.result.node_index);Pt&&it.push(Pt)}}}),Promise.resolve({keyResult:ht,nodeIndexes:it,errorResult:ut,nonceResult:nt})):Promise.reject(new Error(`invalid public key result: ${JSON.stringify(st)} and nonce result:${JSON.stringify(nt||{})} for verifier: ${j}, verifierId: ${et} and extendedVerifierId: ${tt} `))})};async function retrieveOrImportShare(_){const{legacyMetadataHost:a,serverTimeOffset:$,enableOneKey:j,ecCurve:et,allowHost:tt,network:rt,clientId:nt,endpoints:it,verifier:ot,verifierParams:st,idToken:at,importedShares:ut,extraParams:ht}=_;await get(tt,{headers:{verifier:ot,verifierId:st.verifier_id,network:rt,clientId:nt}},{useAPIKey:!0});const bt=[],Et=generatePrivate(),Ct=getPublic(Et).toString("hex"),Pt=Ct.slice(2,66),Tt=Ct.slice(66),It=keccak256(Buffer$g.from(at,"utf8"));let Lt=!1;if(ut&&ut.length>0){if(ut.length!==it.length)throw new Error("Invalid imported shares length");Lt=!0}for(let Nt=0;Nt{log$1.error("commitment error",jt)});bt.push(Ut)}return Some(bt,Nt=>{const Ut=Nt.filter(jt=>!(!jt||typeof jt!="object"||jt.error));return ut.length>0&&Ut.length===it.length||ut.length===0&&Ut.length>=~~(it.length*3/4)+1&&Ut.find(Mt=>{var Dt;return!!(Mt&&((Dt=Mt.result)===null||Dt===void 0?void 0:Dt.nodeindex)==="1")})?Promise.resolve(Nt):Promise.reject(new Error(`invalid ${JSON.stringify(Nt)}`))}).then(Nt=>{const Ut=[],jt=[];for(let Dt=0;Dtlog$1.error("share req",mt));Ut.push(yt)}else{const Bt=post(it[Dt],generateJsonRPCObject(JRPC_METHODS.GET_SHARE_OR_KEY_ASSIGN,{encrypted:"yes",use_temp:!0,item:[_objectSpread2(_objectSpread2({},st),{},{idtoken:at,nodesignatures:jt,verifieridentifier:ot},ht)],one_key_flow:!0}),null,{logTracingHeader:config.logRequestTracing}).catch(yt=>log$1.error("share req",yt));Ut.push(Bt)}}let Mt;return Some(Ut,async(Dt,Ft)=>{const Bt=Dt.filter(St=>!(!St||typeof St!="object"||St.error)),yt=Dt.map(St=>{if(St&&St.result&&St.result.keys[0].public_key){if(!Mt&&!st.extended_verifier_id){var Rt;((Rt=St.result.keys[0].nonce_data)===null||Rt===void 0||(Rt=Rt.pubNonce)===null||Rt===void 0?void 0:Rt.x)&&(Mt=St.result.keys[0].nonce_data)}return St.result.keys[0].public_key}}),mt=thresholdSame(yt,~~(it.length/2)+1);if(!mt)throw new Error("invalid result from nodes, threshold number of public key results are not matching");if(!Mt&&!st.extended_verifier_id&&!LEGACY_NETWORKS_ROUTE_MAP[rt])throw new Error(`invalid metadata result from nodes, nonce metadata is empty for verifier: ${ot} and verifierId: ${st.verifier_id}`);const ct=ut.length>0?it.length:~~(it.length/2)+1;if(Bt.length>=ct&&mt&&(Mt||st.extended_verifier_id||LEGACY_NETWORKS_ROUTE_MAP[rt])){const St=[],Rt=[],$t=[],xt=[],At=[],wt=[];for(let xr=0;xr0){var dt;fr&&(dt=fr[0])!==null&&dt!==void 0&&dt.ephemPublicKey?Rt.push(decryptNodeData(fr[0],lr[0],Et).catch(Pr=>log$1.debug("session sig decryption",Pr))):Rt.push(Promise.resolve(Buffer$g.from(lr[0],"hex")))}else Rt.push(Promise.resolve(void 0));if((kr==null?void 0:kr.length)>0){var vt;Ir&&(vt=Ir[0])!==null&&vt!==void 0&&vt.ephemPublicKey?$t.push(decryptNodeData(Ir[0],kr[0],Et).catch(Pr=>log$1.debug("session token sig decryption",Pr))):$t.push(Promise.resolve(Buffer$g.from(kr[0],"base64")))}else $t.push(Promise.resolve(void 0));if((Er==null?void 0:Er.length)>0){const Pr=pr.result.keys[0];xt.push(new BN(Pr.node_index)),Pr.share_metadata&&St.push(decryptNodeData(Pr.share_metadata,Buffer$g.from(Pr.share,"base64").toString("binary").padStart(64,"0"),Et).catch(Rr=>log$1.debug("share decryption",Rr)))}else xt.push(void 0),St.push(Promise.resolve(void 0))}const Ot=await Promise.all(St.concat(Rt).concat($t)),tr=Ot.slice(0,St.length),nr=Ot.slice(St.length,St.length+Rt.length),ir=Ot.slice(St.length+Rt.length,Ot.length),Wt=nr.filter(xr=>!!xr),Kt=~~(it.length/2)+1;if(!st.extended_verifier_id&&Wt.length!!xr);if(!st.extended_verifier_id&&Jt.length{xr?At.push({token:xr.toString("base64"),signature:nr[pr].toString("hex"),node_pubx:Bt[pr].result.node_pubx,node_puby:Bt[pr].result.node_puby}):At.push(void 0)}),Ft.resolved)return;const Ht=tr.reduce((xr,pr,kr)=>(pr&&xr.push({index:xt[kr],value:new BN(pr)}),xr),[]),qt=kCombinations(Ht.length,~~(it.length/2)+1);let Qt=null;for(let xr=0;xrpr.includes(Ar)),Ir=kr.map(Rr=>Rr.value),lr=kr.map(Rr=>Rr.index),fr=lagrangeInterpolation(et,Ir,lr);if(!fr)continue;const Er=getPublic(Buffer$g.from(fr.toString(16,64),"hex")).toString("hex"),$r=Er.slice(2,66),Pr=Er.slice(66);if(new BN($r,16).cmp(new BN(mt.X,16))===0&&new BN(Pr,16).cmp(new BN(mt.Y,16))===0){Qt=fr;break}}if(Qt==null)throw new Error("could not derive private key");const dr=thresholdSame(wt,~~(it.length/2)+1);return{privateKey:Qt,sessionTokenData:At,thresholdNonceData:Mt,nodeIndexes:xt,isNewKey:dr==="true"}}throw new Error("Invalid")})}).then(async Nt=>{var Ut;const{privateKey:jt,sessionTokenData:Mt,thresholdNonceData:Dt,nodeIndexes:Ft,isNewKey:Bt}=Nt;let yt=Dt;if(!jt)throw new Error("Invalid private key returned");const mt=jt,ct=getPublic(Buffer$g.from(mt.toString(16,64),"hex")).toString("hex"),dt=ct.slice(2,66),vt=ct.slice(66);let St=new BN((Ut=yt)!==null&&Ut!==void 0&&Ut.nonce?yt.nonce.padStart(64,"0"):"0","hex"),Rt,$t,xt="v1";if(st.extended_verifier_id)xt="v2",Rt=et.keyFromPublic({x:dt,y:vt}).getPublic();else if(LEGACY_NETWORKS_ROUTE_MAP[rt])if(j)if(yt=await getOrSetNonce(a,et,$,dt,vt,mt,!Bt),St=new BN(yt.nonce||"0",16),xt=yt.typeOfUser,xt==="v2")$t={X:yt.pubNonce.x,Y:yt.pubNonce.y},Rt=et.keyFromPublic({x:dt,y:vt}).getPublic().add(et.keyFromPublic({x:yt.pubNonce.x,y:yt.pubNonce.y}).getPublic());else{xt="v1",St=await getMetadata(a,{pub_key_X:dt,pub_key_Y:vt});const nr=mt.add(St).umod(et.curve.n);Rt=et.keyFromPrivate(nr.toString(16,64),"hex").getPublic()}else{xt="v1",St=await getMetadata(a,{pub_key_X:dt,pub_key_Y:vt});const nr=mt.add(St).umod(et.curve.n);Rt=et.keyFromPrivate(nr.toString(16,64),"hex").getPublic()}else xt="v2",Rt=et.keyFromPublic({x:dt,y:vt}).getPublic().add(et.keyFromPublic({x:yt.pubNonce.x,y:yt.pubNonce.y}).getPublic()),$t={X:yt.pubNonce.x,Y:yt.pubNonce.y};if(!Rt)throw new Error("Invalid public key, this might be a bug, please report this to web3auth team");const At=generateAddressFromPrivKey(et,mt),wt=generateAddressFromPubKey(et,Rt.getX(),Rt.getY());log$1.debug("> torus.js/retrieveShares",{finalEvmAddress:wt});let Ot="";(xt==="v1"||xt==="v2"&&St.gt(new BN(0)))&&(Ot=mt.add(St).umod(et.curve.n).toString("hex",64));let tr=!1;return xt==="v1"?tr=null:xt==="v2"&&(tr=St.eq(new BN("0"))),{finalKeyData:{evmAddress:wt,X:Rt.getX().toString(16,64),Y:Rt.getY().toString(16,64),privKey:Ot},oAuthKeyData:{evmAddress:At,X:dt,Y:vt,privKey:mt.toString("hex",64).padStart(64,"0")},sessionData:{sessionTokenData:Mt,sessionAuthKey:Et.toString("hex").padStart(64,"0")},metadata:{pubNonce:$t,nonce:St,typeOfUser:xt,upgraded:tr},nodesData:{nodeIndexes:Ft.map(nr=>nr.toNumber())}}})}const legacyKeyLookup=async(_,a,$)=>{const j=_.map(et=>post(et,generateJsonRPCObject("VerifierLookupRequest",{verifier:a,verifier_id:$.toString()})).catch(tt=>log$1.error("lookup request failed",tt)));return Some(j,et=>{const tt=et.filter(it=>it),rt=thresholdSame(tt.map(it=>it&&it.error),~~(_.length/2)+1),nt=thresholdSame(tt.map(it=>it&&it.result),~~(_.length/2)+1);return nt||rt?Promise.resolve({keyResult:nt,errorResult:rt}):Promise.reject(new Error(`invalid results ${JSON.stringify(et)}`))})},legacyKeyAssign=async _=>{let{endpoints:a,torusNodePubs:$,lastPoint:j,firstPoint:et,verifier:tt,verifierId:rt,signerHost:nt,network:it,clientId:ot}=_,st,at;if(j===void 0?(st=Math.floor(Math.random()*a.length),log$1.info("keyassign",st,a[st]),at=st):st=j%a.length,st===et)throw new Error("Looped through all");et!==void 0&&(at=et);const ut=generateJsonRPCObject("KeyAssign",{verifier:tt,verifier_id:rt.toString()});try{const ht=await post(nt,ut,{headers:{pubKeyX:$[st].X,pubKeyY:$[st].Y,network:it,clientId:ot}},{useAPIKey:!0});return await post(a[st],_objectSpread2(_objectSpread2({},ut),ht),{headers:{"Content-Type":"application/json; charset=utf-8"}})}catch(ht){const bt=ht;log$1.error(bt.status,bt.message,bt,"key assign error");const Et=["Timed out","Failed to fetch","cancelled","NetworkError when attempting to fetch resource.","TypeError: Failed to fetch","TypeError: cancelled","TypeError: NetworkError when attempting to fetch resource."];if((bt==null?void 0:bt.status)===502||(bt==null?void 0:bt.status)===504||(bt==null?void 0:bt.status)===401||Et.includes(bt.message)||Et.some(Ct=>{var Pt;return(Pt=bt.message)===null||Pt===void 0?void 0:Pt.includes(Ct)})||bt.message&&bt.message.includes("reason: getaddrinfo EAI_AGAIN"))return legacyKeyAssign({endpoints:a,torusNodePubs:$,lastPoint:st+1,firstPoint:at,verifier:tt,verifierId:rt,signerHost:nt,network:it,clientId:ot});throw new Error(`Sorry, the Torus Network that powers Web3Auth is currently very busy. +`+dt+"}":"{"+mt.join(",")+"}",a=dt,ot}}return stringify$1=function(nt,it,at){var st;if(a="",$="",typeof at=="number")for(st=0;st=0&&toStr$2.call(a.callee)==="[object Function]"),j},implementation$4,hasRequiredImplementation;function requireImplementation(){if(hasRequiredImplementation)return implementation$4;hasRequiredImplementation=1;var _;if(!Object.keys){var a=Object.prototype.hasOwnProperty,$=Object.prototype.toString,j=isArguments,et=Object.prototype.propertyIsEnumerable,tt=!et.call({toString:null},"toString"),rt=et.call(function(){},"prototype"),nt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],it=function(ut){var dt=ut.constructor;return dt&&dt.prototype===ut},at={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},st=function(){if(typeof window>"u")return!1;for(var ut in window)try{if(!at["$"+ut]&&a.call(window,ut)&&window[ut]!==null&&typeof window[ut]=="object")try{it(window[ut])}catch{return!0}}catch{return!0}return!1}(),ot=function(ut){if(typeof window>"u"||!st)return it(ut);try{return it(ut)}catch{return!1}};_=function(dt){var mt=dt!==null&&typeof dt=="object",xt=$.call(dt)==="[object Function]",Ct=j(dt),Pt=mt&&$.call(dt)==="[object String]",Tt=[];if(!mt&&!xt&&!Ct)throw new TypeError("Object.keys called on a non-object");var kt=rt&&xt;if(Pt&&dt.length>0&&!a.call(dt,0))for(var Lt=0;Lt0)for(var Nt=0;Nt"u"||!getProto$1?undefined$2:getProto$1(Uint8Array),INTRINSICS$1={"%AggregateError%":typeof AggregateError>"u"?undefined$2:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$2:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$1&&getProto$1?getProto$1([][Symbol.iterator]()):undefined$2,"%AsyncFromSyncIteratorPrototype%":undefined$2,"%AsyncFunction%":needsEval$1,"%AsyncGenerator%":needsEval$1,"%AsyncGeneratorFunction%":needsEval$1,"%AsyncIteratorPrototype%":needsEval$1,"%Atomics%":typeof Atomics>"u"?undefined$2:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$2:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$2:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$2:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$2:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$2:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$2:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$2:FinalizationRegistry,"%Function%":$Function$1,"%GeneratorFunction%":needsEval$1,"%Int8Array%":typeof Int8Array>"u"?undefined$2:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$2:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$2:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols$1&&getProto$1?getProto$1(getProto$1([][Symbol.iterator]())):undefined$2,"%JSON%":typeof JSON=="object"?JSON:undefined$2,"%Map%":typeof Map>"u"?undefined$2:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols$1||!getProto$1?undefined$2:getProto$1(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$2:Promise,"%Proxy%":typeof Proxy>"u"?undefined$2:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$2:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$2:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols$1||!getProto$1?undefined$2:getProto$1(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$2:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$1&&getProto$1?getProto$1(""[Symbol.iterator]()):undefined$2,"%Symbol%":hasSymbols$1?Symbol:undefined$2,"%SyntaxError%":$SyntaxError$2,"%ThrowTypeError%":ThrowTypeError$1,"%TypedArray%":TypedArray$1,"%TypeError%":$TypeError$3,"%Uint8Array%":typeof Uint8Array>"u"?undefined$2:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$2:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$2:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$2:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$2:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$2:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$2:WeakSet};if(getProto$1)try{null.error}catch(_){var errorProto$1=getProto$1(getProto$1(_));INTRINSICS$1["%Error.prototype%"]=errorProto$1}var doEval$1=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor$1("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor$1("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor$1("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto$1&&($=getProto$1(et.prototype))}return INTRINSICS$1[a]=$,$},LEGACY_ALIASES$1={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind$1=functionBind$1,hasOwn$1=hasown,$concat$1=bind$1.call(Function.call,Array.prototype.concat),$spliceApply$1=bind$1.call(Function.apply,Array.prototype.splice),$replace$1=bind$1.call(Function.call,String.prototype.replace),$strSlice$1=bind$1.call(Function.call,String.prototype.slice),$exec$1=bind$1.call(Function.call,RegExp.prototype.exec),rePropName$1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$1=/\\(\\)?/g,stringToPath$1=function _(a){var $=$strSlice$1(a,0,1),j=$strSlice$1(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$2("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$2("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace$1(a,rePropName$1,function(tt,rt,nt,it){et[et.length]=nt?$replace$1(it,reEscapeChar$1,"$1"):rt||tt}),et},getBaseIntrinsic$1=function _(a,$){var j=a,et;if(hasOwn$1(LEGACY_ALIASES$1,j)&&(et=LEGACY_ALIASES$1[j],j="%"+et[0]+"%"),hasOwn$1(INTRINSICS$1,j)){var tt=INTRINSICS$1[j];if(tt===needsEval$1&&(tt=doEval$1(j)),typeof tt>"u"&&!$)throw new $TypeError$3("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$2("intrinsic "+a+" does not exist!")},getIntrinsic$1=function _(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$3("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$3('"allowMissing" argument must be a boolean');if($exec$1(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$2("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$1(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$1("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,at=tt.alias;at&&(et=at[0],$spliceApply$1(j,$concat$1([0,1],at)));for(var st=1,ot=!0;st=j.length){var xt=$gOPD$1(nt,ut);ot=!!xt,ot&&"get"in xt&&!("originalValue"in xt.get)?nt=xt.get:nt=nt[ut]}else ot=hasOwn$1(nt,ut),nt=nt[ut];ot&&!it&&(INTRINSICS$1[rt]=nt)}}return nt},ERROR_MESSAGE="Function.prototype.bind called on incompatible ",slice=Array.prototype.slice,toStr=Object.prototype.toString,funcType="[object Function]",implementation$1=function _(a){var $=this;if(typeof $!="function"||toStr.call($)!==funcType)throw new TypeError(ERROR_MESSAGE+$);for(var j=slice.call(arguments,1),et,tt=function(){if(this instanceof et){var st=$.apply(this,j.concat(slice.call(arguments)));return Object(st)===st?st:this}else return $.apply(a,j.concat(slice.call(arguments)))},rt=Math.max(0,$.length-j.length),nt=[],it=0;it"u"||!getProto?undefined$1:getProto(Uint8Array),INTRINSICS={"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols||!getProto?undefined$1:getProto(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols||!getProto?undefined$1:getProto(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$2,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet};if(getProto)try{null.error}catch(_){var errorProto=getProto(getProto(_));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function _(a){var $;if(a==="%AsyncFunction%")$=getEvalledConstructor("async function () {}");else if(a==="%GeneratorFunction%")$=getEvalledConstructor("function* () {}");else if(a==="%AsyncGeneratorFunction%")$=getEvalledConstructor("async function* () {}");else if(a==="%AsyncGenerator%"){var j=_("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(a==="%AsyncIteratorPrototype%"){var et=_("%AsyncGenerator%");et&&getProto&&($=getProto(et.prototype))}return INTRINSICS[a]=$,$},LEGACY_ALIASES={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=functionBind,hasOwn=src$3,$concat=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function _(a){var $=$strSlice(a,0,1),j=$strSlice(a,-1);if($==="%"&&j!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError$1("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace(a,rePropName,function(tt,rt,nt,it){et[et.length]=nt?$replace(it,reEscapeChar,"$1"):rt||tt}),et},getBaseIntrinsic=function _(a,$){var j=a,et;if(hasOwn(LEGACY_ALIASES,j)&&(et=LEGACY_ALIASES[j],j="%"+et[0]+"%"),hasOwn(INTRINSICS,j)){var tt=INTRINSICS[j];if(tt===needsEval&&(tt=doEval(j)),typeof tt>"u"&&!$)throw new $TypeError$2("intrinsic "+a+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$1("intrinsic "+a+" does not exist!")},getIntrinsic=function _(a,$){if(typeof a!="string"||a.length===0)throw new $TypeError$2("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$2('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,a)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath(a),et=j.length>0?j[0]:"",tt=getBaseIntrinsic("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,at=tt.alias;at&&(et=at[0],$spliceApply(j,$concat([0,1],at)));for(var st=1,ot=!0;st=j.length){var xt=$gOPD(nt,ut);ot=!!xt,ot&&"get"in xt&&!("originalValue"in xt.get)?nt=xt.get:nt=nt[ut]}else ot=hasOwn(nt,ut),nt=nt[ut];ot&&!it&&(INTRINSICS[rt]=nt)}}return nt},GetIntrinsic$3=getIntrinsic,$defineProperty$1=GetIntrinsic$3("%Object.defineProperty%",!0),hasPropertyDescriptors$1=function _(){if($defineProperty$1)try{return $defineProperty$1({},"a",{value:1}),!0}catch{return!1}return!1};hasPropertyDescriptors$1.hasArrayLengthDefineBug=function _(){if(!hasPropertyDescriptors$1())return null;try{return $defineProperty$1([],"length",{value:1}).length!==1}catch{return!0}};var hasPropertyDescriptors_1=hasPropertyDescriptors$1,hasPropertyDescriptors=hasPropertyDescriptors_1(),GetIntrinsic$2=getIntrinsic$1,$defineProperty=hasPropertyDescriptors&&GetIntrinsic$2("%Object.defineProperty%",!0);if($defineProperty)try{$defineProperty({},"a",{value:1})}catch{$defineProperty=!1}var $SyntaxError=GetIntrinsic$2("%SyntaxError%"),$TypeError$1=GetIntrinsic$2("%TypeError%"),gopd=gopd$1,defineDataProperty=function _(a,$,j){if(!a||typeof a!="object"&&typeof a!="function")throw new $TypeError$1("`obj` must be an object or a function`");if(typeof $!="string"&&typeof $!="symbol")throw new $TypeError$1("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $TypeError$1("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $TypeError$1("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $TypeError$1("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $TypeError$1("`loose`, if provided, must be a boolean");var et=arguments.length>3?arguments[3]:null,tt=arguments.length>4?arguments[4]:null,rt=arguments.length>5?arguments[5]:null,nt=arguments.length>6?arguments[6]:!1,it=!!gopd&&gopd(a,$);if($defineProperty)$defineProperty(a,$,{configurable:rt===null&&it?it.configurable:!rt,enumerable:et===null&&it?it.enumerable:!et,value:j,writable:tt===null&&it?it.writable:!tt});else if(nt||!et&&!tt&&!rt)a[$]=j;else throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},GetIntrinsic$1=getIntrinsic$1,define=defineDataProperty,hasDescriptors=hasPropertyDescriptors_1(),gOPD=gopd$1,$TypeError=GetIntrinsic$1("%TypeError%"),$floor=GetIntrinsic$1("%Math.floor%"),setFunctionLength=function _(a,$){if(typeof a!="function")throw new $TypeError("`fn` is not a function");if(typeof $!="number"||$<0||$>4294967295||$floor($)!==$)throw new $TypeError("`length` must be a positive 32-bit integer");var j=arguments.length>2&&!!arguments[2],et=!0,tt=!0;if("length"in a&&gOPD){var rt=gOPD(a,"length");rt&&!rt.configurable&&(et=!1),rt&&!rt.writable&&(tt=!1)}return(et||tt||!j)&&(hasDescriptors?define(a,"length",$,!0,!0):define(a,"length",$)),a};(function(_){var a=functionBind$1,$=getIntrinsic$1,j=setFunctionLength,et=$("%TypeError%"),tt=$("%Function.prototype.apply%"),rt=$("%Function.prototype.call%"),nt=$("%Reflect.apply%",!0)||a.call(rt,tt),it=$("%Object.defineProperty%",!0),at=$("%Math.max%");if(it)try{it({},"a",{value:1})}catch{it=null}_.exports=function(ut){if(typeof ut!="function")throw new et("a function is required");var dt=nt(a,rt,arguments);return j(dt,1+at(0,ut.length-(arguments.length-1)),!0)};var st=function(){return nt(a,tt,arguments)};it?it(_.exports,"apply",{value:st}):_.exports.apply=st})(callBind$2);var callBindExports=callBind$2.exports,GetIntrinsic=getIntrinsic$1,callBind$1=callBindExports,$indexOf=callBind$1(GetIntrinsic("String.prototype.indexOf")),callBound$1=function _(a,$){var j=GetIntrinsic(a,!!$);return typeof j=="function"&&$indexOf(a,".prototype.")>-1?callBind$1(j):j},jsonStringify=(typeof JSON<"u"?JSON:requireJsonify()).stringify,isArray=isarray,objectKeys=objectKeys$1,callBind=callBindExports,callBound=callBound$1,$join=callBound("Array.prototype.join"),$push=callBound("Array.prototype.push"),strRepeat=function _(a,$){for(var j="",et=0;et1?arguments[1]:void 0,j=$&&$.space||"";typeof j=="number"&&(j=strRepeat(j," "));var et=!!$&&typeof $.cycles=="boolean"&&$.cycles,tt=$&&$.replacer?callBind($.replacer):defaultReplacer,rt=typeof $=="function"?$:$&&$.cmp,nt=rt&&function(at){var st=rt.length>2&&function(ut){return at[ut]};return function(ot,ut){return rt({key:ot,value:at[ot]},{key:ut,value:at[ut]},st?{__proto__:null,get:st}:void 0)}},it=[];return function at(st,ot,ut,dt){var mt=j?` +`+strRepeat(dt,j):"",xt=j?": ":":";if(ut&&ut.toJSON&&typeof ut.toJSON=="function"&&(ut=ut.toJSON()),ut=tt(st,ot,ut),ut!==void 0){if(typeof ut!="object"||ut===null)return jsonStringify(ut);if(isArray(ut)){for(var kt=[],Ct=0;Ct",license$1="MIT",bugs$1={url:"https://github.com/indutny/elliptic/issues"},homepage$1="https://github.com/indutny/elliptic",devDependencies$1={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$1={name:name$1,version:version$1,description:description$1,main:main$1,files:files$1,scripts:scripts$1,repository:repository$1,keywords:keywords$1,author:author$1,license:license$1,bugs:bugs$1,homepage:homepage$1,devDependencies:devDependencies$1,dependencies:dependencies$1};var utils$n={};(function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$R;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,ot,ut){var dt=new Array(Math.max(st.bitLength(),ut)+1),mt;for(mt=0;mt(xt>>1)-1?Pt=(xt>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,dt[mt]=Pt,Ct.iushrn(1)}return dt}a.getNAF=tt;function rt(st,ot){var ut=[[],[]];st=st.clone(),ot=ot.clone();for(var dt=0,mt=0,xt;st.cmpn(-dt)>0||ot.cmpn(-mt)>0;){var Ct=st.andln(3)+dt&3,Pt=ot.andln(3)+mt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(xt=st.andln(7)+dt&7,(xt===3||xt===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var kt;Pt&1?(xt=ot.andln(7)+mt&7,(xt===3||xt===5)&&Ct===2?kt=-Pt:kt=Pt):kt=0,ut[1].push(kt),2*dt===Tt+1&&(dt=1-dt),2*mt===kt+1&&(mt=1-mt),st.iushrn(1),ot.iushrn(1)}return ut}a.getJSF=rt;function nt(st,ot,ut){var dt="_"+ot;st.prototype[ot]=function(){return this[dt]!==void 0?this[dt]:this[dt]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function at(st){return new $(st,"hex","le")}a.intFromLE=at})(utils$n);var curve$1={},BN$g=bnExports$1,utils$m=utils$n,getNAF$1=utils$m.getNAF,getJSF$1=utils$m.getJSF,assert$i=utils$m.assert;function BaseCurve$1(_,a){this.type=_,this.p=new BN$g(a.p,16),this.red=a.prime?BN$g.red(a.prime):BN$g.mont(this.p),this.zero=new BN$g(0).toRed(this.red),this.one=new BN$g(1).toRed(this.red),this.two=new BN$g(2).toRed(this.red),this.n=a.n&&new BN$g(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var $=this.n&&this.p.div(this.n);!$||$.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve$1;BaseCurve$1.prototype.point=function _(){throw new Error("Not implemented")};BaseCurve$1.prototype.validate=function _(){throw new Error("Not implemented")};BaseCurve$1.prototype._fixedNafMul=function _(a,$){assert$i(a.precomputed);var j=a._getDoubles(),et=getNAF$1($,1,this._bitLength),tt=(1<=nt;at--)it=(it<<1)+et[at];rt.push(it)}for(var st=this.jpoint(null,null,null),ot=this.jpoint(null,null,null),ut=tt;ut>0;ut--){for(nt=0;nt=0;it--){for(var at=0;it>=0&&rt[it]===0;it--)at++;if(it>=0&&at++,nt=nt.dblp(at),it<0)break;var st=rt[it];assert$i(st!==0),a.type==="affine"?st>0?nt=nt.mixedAdd(tt[st-1>>1]):nt=nt.mixedAdd(tt[-st-1>>1].neg()):st>0?nt=nt.add(tt[st-1>>1]):nt=nt.add(tt[-st-1>>1].neg())}return a.type==="affine"?nt.toP():nt};BaseCurve$1.prototype._wnafMulAdd=function _(a,$,j,et,tt){var rt=this._wnafT1,nt=this._wnafT2,it=this._wnafT3,at=0,st,ot,ut;for(st=0;st=1;st-=2){var mt=st-1,xt=st;if(rt[mt]!==1||rt[xt]!==1){it[mt]=getNAF$1(j[mt],rt[mt],this._bitLength),it[xt]=getNAF$1(j[xt],rt[xt],this._bitLength),at=Math.max(it[mt].length,at),at=Math.max(it[xt].length,at);continue}var Ct=[$[mt],null,null,$[xt]];$[mt].y.cmp($[xt].y)===0?(Ct[1]=$[mt].add($[xt]),Ct[2]=$[mt].toJ().mixedAdd($[xt].neg())):$[mt].y.cmp($[xt].y.redNeg())===0?(Ct[1]=$[mt].toJ().mixedAdd($[xt]),Ct[2]=$[mt].add($[xt].neg())):(Ct[1]=$[mt].toJ().mixedAdd($[xt]),Ct[2]=$[mt].toJ().mixedAdd($[xt].neg()));var Pt=[-3,-1,-5,-7,0,7,5,1,3],Tt=getJSF$1(j[mt],j[xt]);for(at=Math.max(Tt[0].length,at),it[mt]=new Array(at),it[xt]=new Array(at),ot=0;ot=0;st--){for(var jt=0;st>=0;){var Mt=!0;for(ot=0;ot=0&&jt++,Nt=Nt.dblp(jt),st<0)break;for(ot=0;ot0?ut=nt[ot][Dt-1>>1]:Dt<0&&(ut=nt[ot][-Dt-1>>1].neg()),ut.type==="affine"?Nt=Nt.mixedAdd(ut):Nt=Nt.add(ut))}}for(st=0;st=Math.ceil((a.bitLength()+1)/$.step):!1};BasePoint$1.prototype._getDoubles=function _(a,$){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var j=[this],et=this,tt=0;tt<$;tt+=a){for(var rt=0;rt=0&&(dt=at,mt=st),ot.negative&&(ot=ot.neg(),ut=ut.neg()),dt.negative&&(dt=dt.neg(),mt=mt.neg()),[{a:ot,b:ut},{a:dt,b:mt}]};ShortCurve$1.prototype._endoSplit=function _(a){var $=this.endo.basis,j=$[0],et=$[1],tt=et.b.mul(a).divRound(this.n),rt=j.b.neg().mul(a).divRound(this.n),nt=tt.mul(j.a),it=rt.mul(et.a),at=tt.mul(j.b),st=rt.mul(et.b),ot=a.sub(nt).sub(it),ut=at.add(st).neg();return{k1:ot,k2:ut}};ShortCurve$1.prototype.pointFromX=function _(a,$){a=new BN$f(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");var tt=et.fromRed().isOdd();return($&&!tt||!$&&tt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve$1.prototype.validate=function _(a){if(a.inf)return!0;var $=a.x,j=a.y,et=this.a.redMul($),tt=$.redSqr().redMul($).redIAdd(et).redIAdd(this.b);return j.redSqr().redISub(tt).cmpn(0)===0};ShortCurve$1.prototype._endoWnafMulAdd=function _(a,$,j){for(var et=this._endoWnafT1,tt=this._endoWnafT2,rt=0;rt":""};Point$5.prototype.isInfinity=function _(){return this.inf};Point$5.prototype.add=function _(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var $=this.y.redSub(a.y);$.cmpn(0)!==0&&($=$.redMul(this.x.redSub(a.x).redInvm()));var j=$.redSqr().redISub(this.x).redISub(a.x),et=$.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$5.prototype.dbl=function _(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var $=this.curve.a,j=this.x.redSqr(),et=a.redInvm(),tt=j.redAdd(j).redIAdd(j).redIAdd($).redMul(et),rt=tt.redSqr().redISub(this.x.redAdd(this.x)),nt=tt.redMul(this.x.redSub(rt)).redISub(this.y);return this.curve.point(rt,nt)};Point$5.prototype.getX=function _(){return this.x.fromRed()};Point$5.prototype.getY=function _(){return this.y.fromRed()};Point$5.prototype.mul=function _(a){return a=new BN$f(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$5.prototype.mulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt):this.curve._wnafMulAdd(1,et,tt,2)};Point$5.prototype.jmulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt,!0):this.curve._wnafMulAdd(1,et,tt,2,!0)};Point$5.prototype.eq=function _(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$5.prototype.neg=function _(a){if(this.inf)return this;var $=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var j=this.precomputed,et=function(tt){return tt.neg()};$.precomputed={naf:j.naf&&{wnd:j.naf.wnd,points:j.naf.points.map(et)},doubles:j.doubles&&{step:j.doubles.step,points:j.doubles.points.map(et)}}}return $};Point$5.prototype.toJ=function _(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint$1(_,a,$,j){Base$5.BasePoint.call(this,_,"jacobian"),a===null&&$===null&&j===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$f(0)):(this.x=new BN$f(a,16),this.y=new BN$f($,16),this.z=new BN$f(j,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$5(JPoint$1,Base$5.BasePoint);ShortCurve$1.prototype.jpoint=function _(a,$,j){return new JPoint$1(this,a,$,j)};JPoint$1.prototype.toP=function _(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),$=a.redSqr(),j=this.x.redMul($),et=this.y.redMul($).redMul(a);return this.curve.point(j,et)};JPoint$1.prototype.neg=function _(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint$1.prototype.add=function _(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var $=a.z.redSqr(),j=this.z.redSqr(),et=this.x.redMul($),tt=a.x.redMul(j),rt=this.y.redMul($.redMul(a.z)),nt=a.y.redMul(j.redMul(this.z)),it=et.redSub(tt),at=rt.redSub(nt);if(it.cmpn(0)===0)return at.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var st=it.redSqr(),ot=st.redMul(it),ut=et.redMul(st),dt=at.redSqr().redIAdd(ot).redISub(ut).redISub(ut),mt=at.redMul(ut.redISub(dt)).redISub(rt.redMul(ot)),xt=this.z.redMul(a.z).redMul(it);return this.curve.jpoint(dt,mt,xt)};JPoint$1.prototype.mixedAdd=function _(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var $=this.z.redSqr(),j=this.x,et=a.x.redMul($),tt=this.y,rt=a.y.redMul($).redMul(this.z),nt=j.redSub(et),it=tt.redSub(rt);if(nt.cmpn(0)===0)return it.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var at=nt.redSqr(),st=at.redMul(nt),ot=j.redMul(at),ut=it.redSqr().redIAdd(st).redISub(ot).redISub(ot),dt=it.redMul(ot.redISub(ut)).redISub(tt.redMul(st)),mt=this.z.redMul(nt);return this.curve.jpoint(ut,dt,mt)};JPoint$1.prototype.dblp=function _(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var $;if(this.curve.zeroA||this.curve.threeA){var j=this;for($=0;$=0)return!1;if(j.redIAdd(tt),this.x.cmp(j)===0)return!0}};JPoint$1.prototype.inspect=function _(){return this.isInfinity()?"":""};JPoint$1.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};var BN$e=bnExports$1,inherits$4=inherits_browserExports,Base$4=base$1,utils$k=utils$n;function MontCurve$1(_){Base$4.call(this,"mont",_),this.a=new BN$e(_.a,16).toRed(this.red),this.b=new BN$e(_.b,16).toRed(this.red),this.i4=new BN$e(4).toRed(this.red).redInvm(),this.two=new BN$e(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$4(MontCurve$1,Base$4);var mont$1=MontCurve$1;MontCurve$1.prototype.validate=function _(a){var $=a.normalize().x,j=$.redSqr(),et=j.redMul($).redAdd(j.redMul(this.a)).redAdd($),tt=et.redSqrt();return tt.redSqr().cmp(et)===0};function Point$4(_,a,$){Base$4.BasePoint.call(this,_,"projective"),a===null&&$===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$e(a,16),this.z=new BN$e($,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$4(Point$4,Base$4.BasePoint);MontCurve$1.prototype.decodePoint=function _(a,$){return this.point(utils$k.toArray(a,$),1)};MontCurve$1.prototype.point=function _(a,$){return new Point$4(this,a,$)};MontCurve$1.prototype.pointFromJSON=function _(a){return Point$4.fromJSON(this,a)};Point$4.prototype.precompute=function _(){};Point$4.prototype._encode=function _(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$4.fromJSON=function _(a,$){return new Point$4(a,$[0],$[1]||a.one)};Point$4.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$4.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};Point$4.prototype.dbl=function _(){var a=this.x.redAdd(this.z),$=a.redSqr(),j=this.x.redSub(this.z),et=j.redSqr(),tt=$.redSub(et),rt=$.redMul(et),nt=tt.redMul(et.redAdd(this.curve.a24.redMul(tt)));return this.curve.point(rt,nt)};Point$4.prototype.add=function _(){throw new Error("Not supported on Montgomery curve")};Point$4.prototype.diffAdd=function _(a,$){var j=this.x.redAdd(this.z),et=this.x.redSub(this.z),tt=a.x.redAdd(a.z),rt=a.x.redSub(a.z),nt=rt.redMul(j),it=tt.redMul(et),at=$.z.redMul(nt.redAdd(it).redSqr()),st=$.x.redMul(nt.redISub(it).redSqr());return this.curve.point(at,st)};Point$4.prototype.mul=function _(a){for(var $=a.clone(),j=this,et=this.curve.point(null,null),tt=this,rt=[];$.cmpn(0)!==0;$.iushrn(1))rt.push($.andln(1));for(var nt=rt.length-1;nt>=0;nt--)rt[nt]===0?(j=j.diffAdd(et,tt),et=et.dbl()):(et=j.diffAdd(et,tt),j=j.dbl());return et};Point$4.prototype.mulAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$4.prototype.jumlAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$4.prototype.eq=function _(a){return this.getX().cmp(a.getX())===0};Point$4.prototype.normalize=function _(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$4.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};var utils$j=utils$n,BN$d=bnExports$1,inherits$3=inherits_browserExports,Base$3=base$1,assert$g=utils$j.assert;function EdwardsCurve$1(_){this.twisted=(_.a|0)!==1,this.mOneA=this.twisted&&(_.a|0)===-1,this.extended=this.mOneA,Base$3.call(this,"edwards",_),this.a=new BN$d(_.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$d(_.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$d(_.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$g(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(_.c|0)===1}inherits$3(EdwardsCurve$1,Base$3);var edwards$1=EdwardsCurve$1;EdwardsCurve$1.prototype._mulA=function _(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve$1.prototype._mulC=function _(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve$1.prototype.jpoint=function _(a,$,j,et){return this.point(a,$,j,et)};EdwardsCurve$1.prototype.pointFromX=function _(a,$){a=new BN$d(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=this.c2.redSub(this.a.redMul(j)),tt=this.one.redSub(this.c2.redMul(this.d).redMul(j)),rt=et.redMul(tt.redInvm()),nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");var it=nt.fromRed().isOdd();return($&&!it||!$&&it)&&(nt=nt.redNeg()),this.point(a,nt)};EdwardsCurve$1.prototype.pointFromY=function _(a,$){a=new BN$d(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=j.redSub(this.c2),tt=j.redMul(this.d).redMul(this.c2).redSub(this.a),rt=et.redMul(tt.redInvm());if(rt.cmp(this.zero)===0){if($)throw new Error("invalid point");return this.point(this.zero,a)}var nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");return nt.fromRed().isOdd()!==$&&(nt=nt.redNeg()),this.point(nt,a)};EdwardsCurve$1.prototype.validate=function _(a){if(a.isInfinity())return!0;a.normalize();var $=a.x.redSqr(),j=a.y.redSqr(),et=$.redMul(this.a).redAdd(j),tt=this.c2.redMul(this.one.redAdd(this.d.redMul($).redMul(j)));return et.cmp(tt)===0};function Point$3(_,a,$,j,et){Base$3.BasePoint.call(this,_,"projective"),a===null&&$===null&&j===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$d(a,16),this.y=new BN$d($,16),this.z=j?new BN$d(j,16):this.curve.one,this.t=et&&new BN$d(et,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits$3(Point$3,Base$3.BasePoint);EdwardsCurve$1.prototype.pointFromJSON=function _(a){return Point$3.fromJSON(this,a)};EdwardsCurve$1.prototype.point=function _(a,$,j,et){return new Point$3(this,a,$,j,et)};Point$3.fromJSON=function _(a,$){return new Point$3(a,$[0],$[1],$[2])};Point$3.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$3.prototype.isInfinity=function _(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point$3.prototype._extDbl=function _(){var a=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr();j=j.redIAdd(j);var et=this.curve._mulA(a),tt=this.x.redAdd(this.y).redSqr().redISub(a).redISub($),rt=et.redAdd($),nt=rt.redSub(j),it=et.redSub($),at=tt.redMul(nt),st=rt.redMul(it),ot=tt.redMul(it),ut=nt.redMul(rt);return this.curve.point(at,st,ut,ot)};Point$3.prototype._projDbl=function _(){var a=this.x.redAdd(this.y).redSqr(),$=this.x.redSqr(),j=this.y.redSqr(),et,tt,rt,nt,it,at;if(this.curve.twisted){nt=this.curve._mulA($);var st=nt.redAdd(j);this.zOne?(et=a.redSub($).redSub(j).redMul(st.redSub(this.curve.two)),tt=st.redMul(nt.redSub(j)),rt=st.redSqr().redSub(st).redSub(st)):(it=this.z.redSqr(),at=st.redSub(it).redISub(it),et=a.redSub($).redISub(j).redMul(at),tt=st.redMul(nt.redSub(j)),rt=st.redMul(at))}else nt=$.redAdd(j),it=this.curve._mulC(this.z).redSqr(),at=nt.redSub(it).redSub(it),et=this.curve._mulC(a.redISub(nt)).redMul(at),tt=this.curve._mulC(nt).redMul($.redISub(j)),rt=nt.redMul(at);return this.curve.point(et,tt,rt)};Point$3.prototype.dbl=function _(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point$3.prototype._extAdd=function _(a){var $=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),j=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),tt=this.z.redMul(a.z.redAdd(a.z)),rt=j.redSub($),nt=tt.redSub(et),it=tt.redAdd(et),at=j.redAdd($),st=rt.redMul(nt),ot=it.redMul(at),ut=rt.redMul(at),dt=nt.redMul(it);return this.curve.point(st,ot,dt,ut)};Point$3.prototype._projAdd=function _(a){var $=this.z.redMul(a.z),j=$.redSqr(),et=this.x.redMul(a.x),tt=this.y.redMul(a.y),rt=this.curve.d.redMul(et).redMul(tt),nt=j.redSub(rt),it=j.redAdd(rt),at=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(tt),st=$.redMul(nt).redMul(at),ot,ut;return this.curve.twisted?(ot=$.redMul(it).redMul(tt.redSub(this.curve._mulA(et))),ut=nt.redMul(it)):(ot=$.redMul(it).redMul(tt.redSub(et)),ut=this.curve._mulC(nt).redMul(it)),this.curve.point(st,ot,ut)};Point$3.prototype.add=function _(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point$3.prototype.mul=function _(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point$3.prototype.mulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!1)};Point$3.prototype.jmulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!0)};Point$3.prototype.normalize=function _(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point$3.prototype.neg=function _(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point$3.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};Point$3.prototype.getY=function _(){return this.normalize(),this.y.fromRed()};Point$3.prototype.eq=function _(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point$3.prototype.eqXToP=function _(a){var $=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp($)===0)return!0;for(var j=a.clone(),et=this.curve.redN.redMul(this.z);;){if(j.iadd(this.curve.n),j.cmp(this.curve.p)>=0)return!1;if($.redIAdd(et),this.x.cmp($)===0)return!0}};Point$3.prototype.toP=Point$3.prototype.normalize;Point$3.prototype.mixedAdd=Point$3.prototype.add;(function(_){var a=_;a.base=base$1,a.short=short$1,a.mont=mont$1,a.edwards=edwards$1})(curve$1);var curves$5={},secp256k1$1,hasRequiredSecp256k1$1;function requireSecp256k1$1(){return hasRequiredSecp256k1$1||(hasRequiredSecp256k1$1=1,secp256k1$1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1$1}(function(_){var a=_,$=hash$8,j=curve$1,et=utils$n,tt=et.assert;function rt(at){at.type==="short"?this.curve=new j.short(at):at.type==="edwards"?this.curve=new j.edwards(at):this.curve=new j.mont(at),this.g=this.curve.g,this.n=this.curve.n,this.hash=at.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(at,st){Object.defineProperty(a,at,{configurable:!0,enumerable:!0,get:function(){var ot=new rt(st);return Object.defineProperty(a,at,{configurable:!0,enumerable:!0,value:ot}),ot}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1$1()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})})(curves$5);var BN$c=bnExports$1,utils$i=utils$n,assert$f=utils$i.assert;function KeyPair$7(_,a){this.ec=_,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$3=KeyPair$7;KeyPair$7.fromPublic=function _(a,$,j){return $ instanceof KeyPair$7?$:new KeyPair$7(a,{pub:$,pubEnc:j})};KeyPair$7.fromPrivate=function _(a,$,j){return $ instanceof KeyPair$7?$:new KeyPair$7(a,{priv:$,privEnc:j})};KeyPair$7.prototype.validate=function _(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$7.prototype.getPublic=function _(a,$){return typeof a=="string"&&($=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),$?this.pub.encode($,a):this.pub};KeyPair$7.prototype.getPrivate=function _(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$7.prototype._importPrivate=function _(a,$){this.priv=new BN$c(a,$||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$7.prototype._importPublic=function _(a,$){if(a.x||a.y){this.ec.curve.type==="mont"?assert$f(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$f(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,$)};KeyPair$7.prototype.derive=function _(a){return a.validate()||assert$f(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$7.prototype.sign=function _(a,$,j){return this.ec.sign(a,this,$,j)};KeyPair$7.prototype.verify=function _(a,$){return this.ec.verify(a,$,this)};KeyPair$7.prototype.inspect=function _(){return""};var BN$b=bnExports$1,utils$h=utils$n,assert$e=utils$h.assert;function Signature$7(_,a){if(_ instanceof Signature$7)return _;this._importDER(_,a)||(assert$e(_.r&&_.s,"Signature without r or s"),this.r=new BN$b(_.r,16),this.s=new BN$b(_.s,16),_.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=_.recoveryParam)}var signature$3=Signature$7;function Position$1(){this.place=0}function getLength$1(_,a){var $=_[a.place++];if(!($&128))return $;var j=$&15;if(j===0||j>4)return!1;for(var et=0,tt=0,rt=a.place;tt>>=0;return et<=127?!1:(a.place=rt,et)}function rmPadding$1(_){for(var a=0,$=_.length-1;!_[a]&&!(_[a+1]&128)&&a<$;)a++;return a===0?_:_.slice(a)}Signature$7.prototype._importDER=function _(a,$){a=utils$h.toArray(a,$);var j=new Position$1;if(a[j.place++]!==48)return!1;var et=getLength$1(a,j);if(et===!1||et+j.place!==a.length||a[j.place++]!==2)return!1;var tt=getLength$1(a,j);if(tt===!1)return!1;var rt=a.slice(j.place,tt+j.place);if(j.place+=tt,a[j.place++]!==2)return!1;var nt=getLength$1(a,j);if(nt===!1||a.length!==nt+j.place)return!1;var it=a.slice(j.place,nt+j.place);if(rt[0]===0)if(rt[1]&128)rt=rt.slice(1);else return!1;if(it[0]===0)if(it[1]&128)it=it.slice(1);else return!1;return this.r=new BN$b(rt),this.s=new BN$b(it),this.recoveryParam=null,!0};function constructLength$1(_,a){if(a<128){_.push(a);return}var $=1+(Math.log(a)/Math.LN2>>>3);for(_.push($|128);--$;)_.push(a>>>($<<3)&255);_.push(a)}Signature$7.prototype.toDER=function _(a){var $=this.r.toArray(),j=this.s.toArray();for($[0]&128&&($=[0].concat($)),j[0]&128&&(j=[0].concat(j)),$=rmPadding$1($),j=rmPadding$1(j);!j[0]&&!(j[1]&128);)j=j.slice(1);var et=[2];constructLength$1(et,$.length),et=et.concat($),et.push(2),constructLength$1(et,j.length);var tt=et.concat(j),rt=[48];return constructLength$1(rt,tt.length),rt=rt.concat(tt),utils$h.encode(rt,a)};var BN$a=bnExports$1,HmacDRBG$1=hmacDrbg,utils$g=utils$n,curves$4=curves$5,rand$1=requireBrorand(),assert$d=utils$g.assert,KeyPair$6=key$3,Signature$6=signature$3;function EC$1(_){if(!(this instanceof EC$1))return new EC$1(_);typeof _=="string"&&(assert$d(Object.prototype.hasOwnProperty.call(curves$4,_),"Unknown curve "+_),_=curves$4[_]),_ instanceof curves$4.PresetCurve&&(_={curve:_}),this.curve=_.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=_.curve.g,this.g.precompute(_.curve.n.bitLength()+1),this.hash=_.hash||_.curve.hash}var ec$3=EC$1;EC$1.prototype.keyPair=function _(a){return new KeyPair$6(this,a)};EC$1.prototype.keyFromPrivate=function _(a,$){return KeyPair$6.fromPrivate(this,a,$)};EC$1.prototype.keyFromPublic=function _(a,$){return KeyPair$6.fromPublic(this,a,$)};EC$1.prototype.genKeyPair=function _(a){a||(a={});for(var $=new HmacDRBG$1({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand$1(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),j=this.n.byteLength(),et=this.n.sub(new BN$a(2));;){var tt=new BN$a($.generate(j));if(!(tt.cmp(et)>0))return tt.iaddn(1),this.keyFromPrivate(tt)}};EC$1.prototype._truncateToN=function _(a,$){var j=a.byteLength()*8-this.n.bitLength();return j>0&&(a=a.ushrn(j)),!$&&a.cmp(this.n)>=0?a.sub(this.n):a};EC$1.prototype.sign=function _(a,$,j,et){typeof j=="object"&&(et=j,j=null),et||(et={}),$=this.keyFromPrivate($,j),a=this._truncateToN(new BN$a(a,16));for(var tt=this.n.byteLength(),rt=$.getPrivate().toArray("be",tt),nt=a.toArray("be",tt),it=new HmacDRBG$1({hash:this.hash,entropy:rt,nonce:nt,pers:et.pers,persEnc:et.persEnc||"utf8"}),at=this.n.sub(new BN$a(1)),st=0;;st++){var ot=et.k?et.k(st):new BN$a(it.generate(this.n.byteLength()));if(ot=this._truncateToN(ot,!0),!(ot.cmpn(1)<=0||ot.cmp(at)>=0)){var ut=this.g.mul(ot);if(!ut.isInfinity()){var dt=ut.getX(),mt=dt.umod(this.n);if(mt.cmpn(0)!==0){var xt=ot.invm(this.n).mul(mt.mul($.getPrivate()).iadd(a));if(xt=xt.umod(this.n),xt.cmpn(0)!==0){var Ct=(ut.getY().isOdd()?1:0)|(dt.cmp(mt)!==0?2:0);return et.canonical&&xt.cmp(this.nh)>0&&(xt=this.n.sub(xt),Ct^=1),new Signature$6({r:mt,s:xt,recoveryParam:Ct})}}}}}};EC$1.prototype.verify=function _(a,$,j,et){a=this._truncateToN(new BN$a(a,16)),j=this.keyFromPublic(j,et),$=new Signature$6($,"hex");var tt=$.r,rt=$.s;if(tt.cmpn(1)<0||tt.cmp(this.n)>=0||rt.cmpn(1)<0||rt.cmp(this.n)>=0)return!1;var nt=rt.invm(this.n),it=nt.mul(a).umod(this.n),at=nt.mul(tt).umod(this.n),st;return this.curve._maxwellTrick?(st=this.g.jmulAdd(it,j.getPublic(),at),st.isInfinity()?!1:st.eqXToP(tt)):(st=this.g.mulAdd(it,j.getPublic(),at),st.isInfinity()?!1:st.getX().umod(this.n).cmp(tt)===0)};EC$1.prototype.recoverPubKey=function(_,a,$,j){assert$d((3&$)===$,"The recovery param is more than two bits"),a=new Signature$6(a,j);var et=this.n,tt=new BN$a(_),rt=a.r,nt=a.s,it=$&1,at=$>>1;if(rt.cmp(this.curve.p.umod(this.curve.n))>=0&&at)throw new Error("Unable to find sencond key candinate");at?rt=this.curve.pointFromX(rt.add(this.curve.n),it):rt=this.curve.pointFromX(rt,it);var st=a.r.invm(et),ot=et.sub(tt).mul(st).umod(et),ut=nt.mul(st).umod(et);return this.g.mulAdd(ot,rt,ut)};EC$1.prototype.getKeyRecoveryParam=function(_,a,$,j){if(a=new Signature$6(a,j),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var tt;try{tt=this.recoverPubKey(_,a,et)}catch{continue}if(tt.eq($))return et}throw new Error("Unable to find valid recovery factor")};var utils$f=utils$n,assert$c=utils$f.assert,parseBytes$5=utils$f.parseBytes,cachedProperty$3=utils$f.cachedProperty;function KeyPair$5(_,a){this.eddsa=_,this._secret=parseBytes$5(a.secret),_.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$5(a.pub)}KeyPair$5.fromPublic=function _(a,$){return $ instanceof KeyPair$5?$:new KeyPair$5(a,{pub:$})};KeyPair$5.fromSecret=function _(a,$){return $ instanceof KeyPair$5?$:new KeyPair$5(a,{secret:$})};KeyPair$5.prototype.secret=function _(){return this._secret};cachedProperty$3(KeyPair$5,"pubBytes",function _(){return this.eddsa.encodePoint(this.pub())});cachedProperty$3(KeyPair$5,"pub",function _(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$3(KeyPair$5,"privBytes",function _(){var a=this.eddsa,$=this.hash(),j=a.encodingLength-1,et=$.slice(0,a.encodingLength);return et[0]&=248,et[j]&=127,et[j]|=64,et});cachedProperty$3(KeyPair$5,"priv",function _(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$3(KeyPair$5,"hash",function _(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$3(KeyPair$5,"messagePrefix",function _(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$5.prototype.sign=function _(a){return assert$c(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$5.prototype.verify=function _(a,$){return this.eddsa.verify(a,$,this)};KeyPair$5.prototype.getSecret=function _(a){return assert$c(this._secret,"KeyPair is public only"),utils$f.encode(this.secret(),a)};KeyPair$5.prototype.getPublic=function _(a){return utils$f.encode(this.pubBytes(),a)};var key$2=KeyPair$5,BN$9=bnExports$1,utils$e=utils$n,assert$b=utils$e.assert,cachedProperty$2=utils$e.cachedProperty,parseBytes$4=utils$e.parseBytes;function Signature$5(_,a){this.eddsa=_,typeof a!="object"&&(a=parseBytes$4(a)),Array.isArray(a)&&(a={R:a.slice(0,_.encodingLength),S:a.slice(_.encodingLength)}),assert$b(a.R&&a.S,"Signature without R or S"),_.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN$9&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty$2(Signature$5,"S",function _(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty$2(Signature$5,"R",function _(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty$2(Signature$5,"Rencoded",function _(){return this.eddsa.encodePoint(this.R())});cachedProperty$2(Signature$5,"Sencoded",function _(){return this.eddsa.encodeInt(this.S())});Signature$5.prototype.toBytes=function _(){return this.Rencoded().concat(this.Sencoded())};Signature$5.prototype.toHex=function _(){return utils$e.encode(this.toBytes(),"hex").toUpperCase()};var signature$2=Signature$5,hash$2=hash$8,curves$3=curves$5,utils$d=utils$n,assert$a=utils$d.assert,parseBytes$3=utils$d.parseBytes,KeyPair$4=key$2,Signature$4=signature$2;function EDDSA$1(_){if(assert$a(_==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA$1))return new EDDSA$1(_);_=curves$3[_].curve,this.curve=_,this.g=_.g,this.g.precompute(_.n.bitLength()+1),this.pointClass=_.point().constructor,this.encodingLength=Math.ceil(_.n.bitLength()/8),this.hash=hash$2.sha512}var eddsa$1=EDDSA$1;EDDSA$1.prototype.sign=function _(a,$){a=parseBytes$3(a);var j=this.keyFromSecret($),et=this.hashInt(j.messagePrefix(),a),tt=this.g.mul(et),rt=this.encodePoint(tt),nt=this.hashInt(rt,j.pubBytes(),a).mul(j.priv()),it=et.add(nt).umod(this.curve.n);return this.makeSignature({R:tt,S:it,Rencoded:rt})};EDDSA$1.prototype.verify=function _(a,$,j){a=parseBytes$3(a),$=this.makeSignature($);var et=this.keyFromPublic(j),tt=this.hashInt($.Rencoded(),et.pubBytes(),a),rt=this.g.mul($.S()),nt=$.R().add(et.pub().mul(tt));return nt.eq(rt)};EDDSA$1.prototype.hashInt=function _(){for(var a=this.hash(),$=0;$0&&!a.includes(_.length))throw new Error(`Expected Uint8Array of length ${a}, not of length=${_.length}`)}function hash$1(_){if(typeof _!="function"||typeof _.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(_.outputLen),number$1(_.blockLen)}function exists(_,a=!0){if(_.destroyed)throw new Error("Hash instance has been destroyed");if(a&&_.finished)throw new Error("Hash#digest() has already been called")}function output(_,a){bytes(_);const $=a.outputLen;if(_.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}const assert$9={number:number$1,bool:bool$1,bytes,hash:hash$1,exists,output},U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(_,a=!1){return a?{h:Number(_&U32_MASK64),l:Number(_>>_32n&U32_MASK64)}:{h:Number(_>>_32n&U32_MASK64)|0,l:Number(_&U32_MASK64)|0}}function split(_,a=!1){let $=new Uint32Array(_.length),j=new Uint32Array(_.length);for(let et=0;et<_.length;et++){const{h:tt,l:rt}=fromBig(_[et],a);[$[et],j[et]]=[tt,rt]}return[$,j]}const rotlSH=(_,a,$)=>_<<$|a>>>32-$,rotlSL=(_,a,$)=>a<<$|_>>>32-$,rotlBH=(_,a,$)=>a<<$-32|_>>>64-$,rotlBL=(_,a,$)=>_<<$-32|a>>>64-$;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32=_=>new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4));function isBytes(_){return _ instanceof Uint8Array||_!=null&&typeof _=="object"&&_.constructor.name==="Uint8Array"}const isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(_){if(typeof _!="string")throw new Error(`utf8ToBytes expected string, got ${typeof _}`);return new Uint8Array(new TextEncoder().encode(_))}function toBytes(_){if(typeof _=="string"&&(_=utf8ToBytes(_)),!isBytes(_))throw new Error(`expected Uint8Array, got ${typeof _}`);return _}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(_){const a=j=>_().update(toBytes(j)).digest(),$=_();return a.outputLen=$.outputLen,a.blockLen=$.blockLen,a.create=()=>_(),a}const[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let _=0,a=_1n,$=1,j=0;_<24;_++){[$,j]=[j,(2*$+3*j)%5],SHA3_PI.push(2*(5*j+$)),SHA3_ROTL.push((_+1)*(_+2)/2%64);let et=_0n;for(let tt=0;tt<7;tt++)a=(a<<_1n^(a>>_7n)*_0x71n)%_256n,a&_2n&&(et^=_1n<<(_1n<$>32?rotlBH(_,a,$):rotlSH(_,a,$),rotlL=(_,a,$)=>$>32?rotlBL(_,a,$):rotlSL(_,a,$);function keccakP(_,a=24){const $=new Uint32Array(10);for(let j=24-a;j<24;j++){for(let rt=0;rt<10;rt++)$[rt]=_[rt]^_[rt+10]^_[rt+20]^_[rt+30]^_[rt+40];for(let rt=0;rt<10;rt+=2){const nt=(rt+8)%10,it=(rt+2)%10,at=$[it],st=$[it+1],ot=rotlH(at,st,1)^$[nt],ut=rotlL(at,st,1)^$[nt+1];for(let dt=0;dt<50;dt+=10)_[rt+dt]^=ot,_[rt+dt+1]^=ut}let et=_[2],tt=_[3];for(let rt=0;rt<24;rt++){const nt=SHA3_ROTL[rt],it=rotlH(et,tt,nt),at=rotlL(et,tt,nt),st=SHA3_PI[rt];et=_[st],tt=_[st+1],_[st]=it,_[st+1]=at}for(let rt=0;rt<50;rt+=10){for(let nt=0;nt<10;nt++)$[nt]=_[rt+nt];for(let nt=0;nt<10;nt++)_[rt+nt]^=~$[(nt+2)%10]&$[(nt+4)%10]}_[0]^=SHA3_IOTA_H[j],_[1]^=SHA3_IOTA_L[j]}$.fill(0)}class Keccak extends Hash{constructor(a,$,j,et=!1,tt=24){if(super(),this.blockLen=a,this.suffix=$,this.outputLen=j,this.enableXOF=et,this.rounds=tt,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$1(j),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(a){exists(this);const{blockLen:$,state:j}=this;a=toBytes(a);const et=a.length;for(let tt=0;tt=j&&this.keccak();const rt=Math.min(j-this.posOut,tt-et);a.set($.subarray(this.posOut,this.posOut+rt),et),this.posOut+=rt,et+=rt}return a}xofInto(a){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(a)}xof(a){return number$1(a),this.xofInto(new Uint8Array(a))}digestInto(a){if(output(a,this),this.finished)throw new Error("digest() was already called");return this.writeInto(a),this.destroy(),a}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(a){const{blockLen:$,suffix:j,outputLen:et,rounds:tt,enableXOF:rt}=this;return a||(a=new Keccak($,j,et,rt,tt)),a.state32.set(this.state32),a.pos=this.pos,a.posOut=this.posOut,a.finished=this.finished,a.rounds=tt,a.suffix=j,a.outputLen=et,a.enableXOF=rt,a.destroyed=this.destroyed,a}}const gen=(_,a,$)=>wrapConstructor(()=>new Keccak(a,_,$)),keccak_256=gen(1,136,256/8);function wrapHash(_){return a=>(assert$9.bytes(a),_(a))}(()=>{const _=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,a=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);return{node:a&&!_?a("crypto"):void 0,web:_}})();const keccak256$3=(()=>{const _=wrapHash(keccak_256);return _.create=keccak_256.create,_})();function keccak256$2(_){return Buffer$g.from(keccak256$3(_))}const ec$2=new elliptic$1.ec("secp256k1");function encParamsHexToBuf$2(_){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$2(_){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$1(_,a){const $=JSON.stringify(a),j=Buffer$g.from($,"utf-8"),et=await encrypt(getPublic(Buffer$g.from(_,"hex")),j),tt=encParamsBufToHex$2(et);return JSON.stringify(tt)}async function decryptData$1(_,a){const $=JSON.parse(a),j=encParamsHexToBuf$2($),et=ec$2.keyFromPrivate(_),rt=(await decrypt(Buffer$g.from(et.getPrivate().toString("hex",64),"hex"),j)).toString("utf-8");return JSON.parse(rt)}var microSeconds$1=microSeconds$5,KEY_PREFIX="pubkey.broadcastChannel-",type$1="server",SOCKET_CONN_INSTANCE=null,runningChannels=new Set;function storageKey(_){return KEY_PREFIX+_}function postMessage$1(_,a){return new Promise(function($,j){sleep().then(_asyncToGenerator(_regeneratorRuntime.mark(function et(){var tt,rt,nt,it;return _regeneratorRuntime.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:return tt=storageKey(_.channelName),rt=keccak256$2(Buffer$g.from(tt,"utf8")),st.next=4,encryptData$1(rt.toString("hex"),{token:randomToken(),time:new Date().getTime(),data:a,uuid:_.uuid});case 4:return nt=st.sent,st.t0=getPublic(rt).toString("hex"),st.t1=nt,st.next=9,sign(rt,keccak256$2(Buffer$g.from(nt,"utf8")));case 9:return st.t2=st.sent.toString("hex"),it={key:st.t0,data:st.t1,signature:st.t2},_.timeout&&(it.timeout=_.timeout),st.abrupt("return",fetch(_.serverUrl+"/channel/set",{method:"POST",body:JSON.stringify(it),headers:{"Content-Type":"application/json; charset=utf-8"}}).then($).catch(j));case 13:case"end":return st.stop()}},et)})))})}function getSocketInstance(_){if(SOCKET_CONN_INSTANCE)return SOCKET_CONN_INSTANCE;var a=lookup(_,{transports:["websocket","polling"],withCredentials:!0,reconnectionDelayMax:1e4,reconnectionAttempts:10});return a.on("connect_error",function($){a.io.opts.transports=["polling","websocket"],log$6.error("connect error",$)}),a.on("connect",_asyncToGenerator(_regeneratorRuntime.mark(function $(){var j;return _regeneratorRuntime.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:j=a.io.engine,log$6.debug("initially connected to",j.transport.name),j.once("upgrade",function(){log$6.debug("upgraded",j.transport.name)}),j.once("close",function(rt){log$6.debug("connection closed",rt)});case 4:case"end":return tt.stop()}},$)}))),a.on("error",function($){log$6.error("socket errored",$),a.disconnect()}),SOCKET_CONN_INSTANCE=a,a}function setupSocketConnection(_,a,$){var j=getSocketInstance(_),et=storageKey(a),tt=keccak256$2(Buffer$g.from(et,"utf8")),rt=getPublic(tt).toString("hex");j.connected?j.emit("check_auth_status",rt):j.once("connect",function(){log$6.debug("connected with socket"),j.emit("check_auth_status",rt)});var nt=function(){j.once("connect",_asyncToGenerator(_regeneratorRuntime.mark(function ot(){return _regeneratorRuntime.wrap(function(dt){for(;;)switch(dt.prev=dt.next){case 0:j.emit("check_auth_status",rt);case 1:case"end":return dt.stop()}},ot)})))},it=function st(){if(!j){document.removeEventListener("visibilitychange",st);return}!j.connected&&document.visibilityState==="visible"&&nt()},at=function(){var st=_asyncToGenerator(_regeneratorRuntime.mark(function ot(ut){var dt;return _regeneratorRuntime.wrap(function(xt){for(;;)switch(xt.prev=xt.next){case 0:return xt.prev=0,xt.next=3,decryptData$1(tt.toString("hex"),ut);case 3:dt=xt.sent,log$6.info(dt),$(dt),xt.next=11;break;case 8:xt.prev=8,xt.t0=xt.catch(0),log$6.error(xt.t0);case 11:case"end":return xt.stop()}},ot,null,[[0,8]])}));return function(ut){return st.apply(this,arguments)}}();return j.on("disconnect",function(){log$6.debug("socket disconnected"),runningChannels.has(a)&&(log$6.error("socket disconnected unexpectedly, reconnecting socket"),nt())}),j.on(rt+"_success",at),typeof document<"u"&&document.addEventListener("visibilitychange",it),j}function create$1(_,a){a=fillOptionsWithDefaults(a);var $=randomToken(),j=new ObliviousSet(a.server.removeTimeout),et={channelName:_,uuid:$,eMIs:j,serverUrl:a.server.url};return a.server.timeout&&(et.timeout=a.server.timeout),setupSocketConnection(a.server.url,_,function(tt){et.messagesCallback&&tt.uuid!==et.uuid&&(!tt.token||et.eMIs.has(tt.token)||(et.eMIs.add(tt.token),et.messagesCallback(tt.data)))}),runningChannels.add(_),et}function close$1(_){runningChannels.delete(_.channelName)}function onMessage$1(_,a,$){_.messagesCallbackTime=$,_.messagesCallback=a}function canBeUsed$1(){return!0}function averageResponseTime$1(){var _=500;return _}const ServerMethod={create:create$1,close:close$1,onMessage:onMessage$1,postMessage:postMessage$1,canBeUsed:canBeUsed$1,type:type$1,averageResponseTime:averageResponseTime$1,microSeconds:microSeconds$1};var microSeconds=microSeconds$5,type="simulate",SIMULATE_CHANNELS=new Set;function create(_){var a={name:_,messagesCallback:null};return SIMULATE_CHANNELS.add(a),a}function close(_){SIMULATE_CHANNELS.delete(_)}function postMessage(_,a){return new Promise(function($){return setTimeout(function(){var j=Array.from(SIMULATE_CHANNELS);j.filter(function(et){return et.name===_.name}).filter(function(et){return et!==_}).filter(function(et){return!!et.messagesCallback}).forEach(function(et){return et.messagesCallback(a)}),$()},5)})}function onMessage(_,a){_.messagesCallback=a}function canBeUsed(){return!0}function averageResponseTime(){return 5}const SimulateMethod={create,close,onMessage,postMessage,canBeUsed,type,averageResponseTime,microSeconds};var METHODS=[NativeMethod,IndexeDbMethod,LocalstorageMethod,ServerMethod];function chooseMethod(_){var a=[].concat(_.methods,METHODS).filter(Boolean);if(_.type){if(_.type==="simulate")return SimulateMethod;var $=a.find(function(et){return et.type===_.type});if($)return $;throw new Error("method-type "+_.type+" not found")}_.webWorkerSupport||(a=a.filter(function(et){return et.type!=="idb"}));var j=a.find(function(et){return et.canBeUsed(_)});if(j)return j;throw new Error("No useable method found in "+JSON.stringify(METHODS.map(function(et){return et.type})))}var OPEN_BROADCAST_CHANNELS=new Set,lastId=0,BroadcastChannel$1=function _(a,$){this.id=lastId++,OPEN_BROADCAST_CHANNELS.add(this),this.name=a,ENFORCED_OPTIONS&&($=ENFORCED_OPTIONS),this.options=fillOptionsWithDefaults($),this.method=chooseMethod(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,_prepareChannel(this)};BroadcastChannel$1._pubkey=!0;var ENFORCED_OPTIONS;BroadcastChannel$1.prototype={postMessage:function _(a){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(a));return _post(this,"message",a)},postInternal:function _(a){return _post(this,"internal",a)},set onmessage(_){var a=this.method.microSeconds(),$={time:a,fn:_};_removeListenerObject(this,"message",this._onML),_&&typeof _=="function"?(this._onML=$,_addListenerObject(this,"message",$)):this._onML=null},addEventListener:function _(a,$){var j=this.method.microSeconds(),et={time:j,fn:$};_addListenerObject(this,a,et)},removeEventListener:function _(a,$){var j=this._addEL[a].find(function(et){return et.fn===$});_removeListenerObject(this,a,j)},close:function _(){var a=this;if(!this.closed){OPEN_BROADCAST_CHANNELS.delete(this),this.closed=!0;var $=this._prepP?this._prepP:PROMISE_RESOLVED_VOID;return this._onML=null,this._addEL.message=[],$.then(function(){return Promise.all(Array.from(a._uMP))}).then(function(){return Promise.all(a._befC.map(function(j){return j()}))}).then(function(){return a.method.close(a._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function _post(_,a,$){var j=_.method.microSeconds(),et={time:j,type:a,data:$},tt=_._prepP?_._prepP:PROMISE_RESOLVED_VOID;return tt.then(function(){var rt=_.method.postMessage(_._state,et);return _._uMP.add(rt),rt.catch().then(function(){return _._uMP.delete(rt)}),rt})}function _prepareChannel(_){var a=_.method.create(_.name,_.options);isPromise(a)?(_._prepP=a,a.then(function($){_._state=$})):_._state=a}function _hasMessageListeners(_){return _._addEL.message.length>0||_._addEL.internal.length>0}function _addListenerObject(_,a,$){_._addEL[a].push($),_startListening(_)}function _removeListenerObject(_,a,$){_._addEL[a]=_._addEL[a].filter(function(j){return j!==$}),_stopListening(_)}function _startListening(_){if(!_._iL&&_hasMessageListeners(_)){var a=function(et){_._addEL[et.type].forEach(function(tt){var rt=1e5,nt=tt.time-rt;(et.time>=nt||_.method.type==="server")&&tt.fn(et.data)})},$=_.method.microSeconds();_._prepP?_._prepP.then(function(){_._iL=!0,_.method.onMessage(_._state,a,$)}):(_._iL=!0,_.method.onMessage(_._state,a,$))}}function _stopListening(_){if(_._iL&&!_hasMessageListeners(_)){_._iL=!1;var a=_.method.microSeconds();_.method.onMessage(_._state,null,a)}}var base64url$3={exports:{}},base64url$2={},padString$1={};Object.defineProperty(padString$1,"__esModule",{value:!0});function padString(_){var a=4,$=_.length,j=$%a;if(!j)return _;var et=$,tt=a-j,rt=$+tt,nt=Buffer$g.alloc(rt);for(nt.write(_);tt--;)nt.write("=",et++);return nt.toString()}padString$1.default=padString;Object.defineProperty(base64url$2,"__esModule",{value:!0});var pad_string_1=padString$1;function encode(_,a){return a===void 0&&(a="utf8"),Buffer$g.isBuffer(_)?fromBase64(_.toString("base64")):fromBase64(Buffer$g.from(_,a).toString("base64"))}function decode$1(_,a){return a===void 0&&(a="utf8"),Buffer$g.from(toBase64(_),"base64").toString(a)}function toBase64(_){return _=_.toString(),pad_string_1.default(_).replace(/\-/g,"+").replace(/_/g,"/")}function fromBase64(_){return _.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function toBuffer(_){return Buffer$g.from(toBase64(_),"base64")}var base64url$1=encode;base64url$1.encode=encode;base64url$1.decode=decode$1;base64url$1.toBase64=toBase64;base64url$1.fromBase64=fromBase64;base64url$1.toBuffer=toBuffer;base64url$2.default=base64url$1;(function(_){_.exports=base64url$2.default,_.exports.default=_.exports})(base64url$3);var base64urlExports=base64url$3.exports;const base64url=getDefaultExportFromCjs$1(base64urlExports);function e(_){this.message=_}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(_){var a=String(_).replace(/=+$/,"");if(a.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var $,j,et=0,tt=0,rt="";j=a.charAt(tt++);~j&&($=et%4?64*$+j:j,et++%4)?rt+=String.fromCharCode(255&$>>(-2*et&6)):0)j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(j);return rt};function t(_){var a=_.replace(/-/g,"+").replace(/_/g,"/");switch(a.length%4){case 0:break;case 2:a+="==";break;case 3:a+="=";break;default:throw"Illegal base64url string!"}try{return function($){return decodeURIComponent(r($).replace(/(.)/g,function(j,et){var tt=et.charCodeAt(0).toString(16).toUpperCase();return tt.length<2&&(tt="0"+tt),"%"+tt}))}(a)}catch{return r(a)}}function n(_){this.message=_}function o(_,a){if(typeof _!="string")throw new n("Invalid token specified");var $=(a=a||{}).header===!0?0:1;try{return JSON.parse(t(_.split(".")[$]))}catch(j){throw new n("Invalid token specified: "+j.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";const TORUS_LEGACY_NETWORK={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},TORUS_SAPPHIRE_NETWORK={SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"},MULTI_CLUSTER_NETWORKS=[],LEGACY_NETWORKS_ROUTE_MAP={[TORUS_LEGACY_NETWORK.AQUA]:{migrationCompleted:!0,networkIdentifier:"aqua",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.CELESTE]:{migrationCompleted:!0,networkIdentifier:"celeste",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.CYAN]:{migrationCompleted:!0,networkIdentifier:"cyan",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.MAINNET]:{migrationCompleted:!0,networkIdentifier:"mainnet",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.TESTNET]:{migrationCompleted:!0,networkIdentifier:"teal",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET}},SIGNER_MAP={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:"https://signer.web3auth.io",[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:"https://signer.web3auth.io",[TORUS_LEGACY_NETWORK.MAINNET]:"https://signer.web3auth.io",[TORUS_LEGACY_NETWORK.TESTNET]:"https://signer.web3auth.io",[TORUS_LEGACY_NETWORK.CYAN]:"https://signer-polygon.web3auth.io",[TORUS_LEGACY_NETWORK.AQUA]:"https://signer-polygon.web3auth.io",[TORUS_LEGACY_NETWORK.CELESTE]:"https://signer-polygon.web3auth.io"},METADATA_MAP={[TORUS_LEGACY_NETWORK.MAINNET]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.TESTNET]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.CYAN]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.AQUA]:"https://metadata.web3auth.io",[TORUS_LEGACY_NETWORK.CELESTE]:"https://metadata.web3auth.io"},FND_SERVER="https://fnd.web3auth.io",KEY_TYPE={SECP256K1:"secp256k1",ED25519:"ed25519"},SAPPHIRE_NETWORK_URLS={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:["https://node-1.dev-node.web3auth.io","https://node-2.dev-node.web3auth.io","https://node-3.dev-node.web3auth.io","https://node-4.dev-node.web3auth.io","https://node-5.dev-node.web3auth.io"],[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:["https://node-1.node.web3auth.io","https://node-2.node.web3auth.io","https://node-3.node.web3auth.io","https://node-4.node.web3auth.io","https://node-5.node.web3auth.io"]},getSSSEndpoints=(_,a)=>{const $=SAPPHIRE_NETWORK_URLS[_];if(!$||$.length===0)throw new Error(`Unsupported network: ${_}`);const j=LEGACY_NETWORKS_ROUTE_MAP[a];return $.map(et=>j&&j.networkIdentifier?`${et}/sss/${j.networkIdentifier}/jrpc`:`${et}/sss/jrpc`)},getRSSEndpoints=(_,a)=>{const $=SAPPHIRE_NETWORK_URLS[_];if(!$||$.length===0)throw new Error(`Unsupported network: ${_}`);const j=LEGACY_NETWORKS_ROUTE_MAP[a];return $.map(et=>j&&j.networkIdentifier?`${et}/rss/${j.networkIdentifier}`:`${et}/rss`)},getTSSEndpoints=function(_,a){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:KEY_TYPE.SECP256K1;const j=SAPPHIRE_NETWORK_URLS[_];if(!j||j.length===0)throw new Error(`Unsupported network: ${_}`);const et=$===KEY_TYPE.ED25519?"tss-frost":"tss",tt=LEGACY_NETWORKS_ROUTE_MAP[a];return j.map(rt=>tt&&tt.networkIdentifier?`${rt}/${et}/${tt.networkIdentifier}`:`${rt}/${et}`)},SAPPHIRE_NODE_PUB_KEYS={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:[{X:"e0925898fee0e9e941fdca7ee88deec99939ae9407e923535c4d4a3a3ff8b052",Y:"54b9fea924e3f3e40791f9987f4234ae4222412d65b74068032fa5d8b63375c1"},{X:"9124cf1e280aab32ba50dffd2de81cecabc13d82d2c1fe9de82f3b3523f9b637",Y:"fca939a1ceb42ce745c55b21ef094f543b457630cb63a94ef4f1afeee2b1f107"},{X:"555f681a63d469cc6c3a58a97e29ebd277425f0e6159708e7c7bf05f18f89476",Y:"606f2bcc0884fa5b64366fc3e8362e4939841b56acd60d5f4553cf36b891ac4e"},{X:"2b5f58d8e340f1ab922e89b3a69a68930edfe51364644a456335e179bc130128",Y:"4b4daa05939426e3cbe7d08f0e773d2bf36f64c00d04620ee6df2a7af4d2247"},{X:"3ecbb6a68afe72cf34ec6c0a12b5cb78a0d2e83ba402983b6adbc5f36219861a",Y:"dc1031c5cc8f0472bd521a62a64ebca9e163902c247bf05937daf4ae835091e4"}],[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:[{X:"f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247",Y:"54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7"},{X:"bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a",Y:"ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a"},{X:"b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb",Y:"759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c"},{X:"7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767",Y:"336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b"},{X:"bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773",Y:"bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4"}]},getSapphireNodeDetails=(_,a,$)=>({currentEpoch:"1",torusNodeEndpoints:getSSSEndpoints(_,a),torusNodeSSSEndpoints:getSSSEndpoints(_,a),torusNodeRSSEndpoints:getRSSEndpoints(_,a),torusNodeTSSEndpoints:getTSSEndpoints(_,a,$),torusIndexes:[1,2,3,4,5],torusNodePub:SAPPHIRE_NODE_PUB_KEYS[_]});function fetchLocalConfig(_,a){if(Object.values(TORUS_SAPPHIRE_NETWORK).includes(_))return getSapphireNodeDetails(_,void 0,a);if(Object.values(TORUS_LEGACY_NETWORK).includes(_)){const $=LEGACY_NETWORKS_ROUTE_MAP[_];if($.migrationCompleted)return getSapphireNodeDetails($.networkMigratedTo,_,a)}}const log$4=log$1$1.getLogger("http-helpers");log$4.setLevel(loglevelExports.levels.INFO);let apiKey$1="torus-default";const gatewayAuthHeader$1="x-api-key";async function fetchAndTrace$1(_,a){let $=null;try{$=new URL(_)}catch{}return fetch(_,a)}function getApiKeyHeaders$1(){const _={};return _[gatewayAuthHeader$1]=apiKey$1,_}function debugLogResponse$1(_){log$4.info(`Response: ${_.status} ${_.statusText}`),log$4.info(`Url: ${_.url}`)}const get$1=async function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j={mode:"cors",headers:{}};$.useAPIKey&&(j.headers=_objectSpread2(_objectSpread2({},j.headers),getApiKeyHeaders$1()));const et=deepmerge$1(j,a,{method:"GET"}),tt=await fetchAndTrace$1(_,et);if(tt.ok){const rt=tt.headers.get("content-type");return rt!=null&&rt.includes("application/json")?tt.json():tt.text()}throw debugLogResponse$1(tt),tt},log$3=log$1$1.getLogger("fnd");class NodeDetailManager{constructor(){let{network:a=TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET,keyType:$=KEY_TYPE.SECP256K1,fndServerEndpoint:j,enableLogging:et=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_defineProperty$4(this,"fndServerEndpoint",`${FND_SERVER}/node-details`),_defineProperty$4(this,"_currentEpoch","1"),_defineProperty$4(this,"_keyType",void 0),_defineProperty$4(this,"_torusNodeEndpoints",[]),_defineProperty$4(this,"_torusNodeRSSEndpoints",[]),_defineProperty$4(this,"_torusNodeSSSEndpoints",[]),_defineProperty$4(this,"_torusNodeTSSEndpoints",[]),_defineProperty$4(this,"_torusNodePub",[]),_defineProperty$4(this,"_torusIndexes",[]),_defineProperty$4(this,"updated",void 0),_defineProperty$4(this,"network",void 0),this.network=a,this._keyType=$,this.updated=!1,j&&(this.fndServerEndpoint=j),et?log$3.enableAll():log$3.disableAll()}get _nodeDetails(){return{currentEpoch:this._currentEpoch,torusNodeEndpoints:this._torusNodeEndpoints,torusNodeSSSEndpoints:this._torusNodeSSSEndpoints,torusNodeRSSEndpoints:this._torusNodeRSSEndpoints,torusNodeTSSEndpoints:this._torusNodeTSSEndpoints,torusNodePub:this._torusNodePub,torusIndexes:this._torusIndexes,updated:this.updated}}async getNodeDetails(a){let{verifier:$,verifierId:j}=a;try{if(this.updated&&!MULTI_CLUSTER_NETWORKS.includes(this.network))return this._nodeDetails;try{const{nodeDetails:tt}=await get$1(`${this.fndServerEndpoint}?network=${this.network}&verifier=${$}&verifierId=${j}&keyType=${this._keyType}`);return this.setNodeDetails(tt),this._nodeDetails}catch(tt){log$3.error("Failed to fetch node details from server, using local.",tt)}const et=fetchLocalConfig(this.network,this._keyType);if(!et)throw new Error("Failed to fetch node details");return this.setNodeDetails(et),this._nodeDetails}catch(et){throw log$3.error("Failed to fetch node details",et),et}}async getMetadataUrl(){return Object.values(TORUS_LEGACY_NETWORK).includes(this.network)?METADATA_MAP[this.network]:(await this.getNodeDetails({verifier:"test-verifier",verifierId:"test-verifier-id"})).torusNodeEndpoints[0].replace("/sss/jrpc","/metadata")}setNodeDetails(a){const{currentEpoch:$,torusNodeEndpoints:j,torusNodeSSSEndpoints:et,torusNodeRSSEndpoints:tt,torusNodeTSSEndpoints:rt,torusNodePub:nt,torusIndexes:it}=a;this._torusNodeEndpoints=j,this._torusNodeSSSEndpoints=et||[],this._torusNodeRSSEndpoints=tt||[],this._torusNodeTSSEndpoints=rt||[],this._torusNodePub=nt,this._torusIndexes=it,this._currentEpoch=$,this.updated=!0}}var bn={exports:{}};bn.exports;(function(_){(function(a,$){function j(bt,ct){if(!bt)throw new Error(ct||"Assertion failed")}function et(bt,ct){bt.super_=ct;var ht=function(){};ht.prototype=ct.prototype,bt.prototype=new ht,bt.prototype.constructor=bt}function tt(bt,ct,ht){if(tt.isBN(bt))return bt;this.negative=0,this.words=null,this.length=0,this.red=null,bt!==null&&((ct==="le"||ct==="be")&&(ht=ct,ct=10),this._init(bt||0,ct||10,ht||"be"))}typeof a=="object"?a.exports=tt:$.BN=tt,tt.BN=tt,tt.wordSize=26;var rt;try{typeof window<"u"&&typeof window.Buffer<"u"?rt=window.Buffer:rt=require$$0$6.Buffer}catch{}tt.isBN=function(ct){return ct instanceof tt?!0:ct!==null&&typeof ct=="object"&&ct.constructor.wordSize===tt.wordSize&&Array.isArray(ct.words)},tt.max=function(ct,ht){return ct.cmp(ht)>0?ct:ht},tt.min=function(ct,ht){return ct.cmp(ht)<0?ct:ht},tt.prototype._init=function(ct,ht,vt){if(typeof ct=="number")return this._initNumber(ct,ht,vt);if(typeof ct=="object")return this._initArray(ct,ht,vt);ht==="hex"&&(ht=16),j(ht===(ht|0)&&ht>=2&&ht<=36),ct=ct.toString().replace(/\s+/g,"");var St=0;ct[0]==="-"&&(St++,this.negative=1),St=0;St-=3)$t=ct[St]|ct[St-1]<<8|ct[St-2]<<16,this.words[Rt]|=$t<>>26-Et&67108863,Et+=24,Et>=26&&(Et-=26,Rt++);else if(vt==="le")for(St=0,Rt=0;St>>26-Et&67108863,Et+=24,Et>=26&&(Et-=26,Rt++);return this._strip()};function nt(bt,ct){var ht=bt.charCodeAt(ct);if(ht>=48&&ht<=57)return ht-48;if(ht>=65&&ht<=70)return ht-55;if(ht>=97&&ht<=102)return ht-87;j(!1,"Invalid character in "+bt)}function it(bt,ct,ht){var vt=nt(bt,ht);return ht-1>=ct&&(vt|=nt(bt,ht-1)<<4),vt}tt.prototype._parseHex=function(ct,ht,vt){this.length=Math.ceil((ct.length-ht)/6),this.words=new Array(this.length);for(var St=0;St=ht;St-=2)Et=it(ct,ht,St)<=18?(Rt-=18,$t+=1,this.words[$t]|=Et>>>26):Rt+=8;else{var At=ct.length-ht;for(St=At%2===0?ht+1:ht;St=18?(Rt-=18,$t+=1,this.words[$t]|=Et>>>26):Rt+=8}this._strip()};function at(bt,ct,ht,vt){for(var St=0,Rt=0,$t=Math.min(bt.length,ht),Et=ct;Et<$t;Et++){var At=bt.charCodeAt(Et)-48;St*=vt,At>=49?Rt=At-49+10:At>=17?Rt=At-17+10:Rt=At,j(At>=0&&Rt1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},tt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{tt.prototype[Symbol.for("nodejs.util.inspect.custom")]=ot}catch{tt.prototype.inspect=ot}else tt.prototype.inspect=ot;function ot(){return(this.red?""}var ut=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],dt=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],mt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];tt.prototype.toString=function(ct,ht){ct=ct||10,ht=ht|0||1;var vt;if(ct===16||ct==="hex"){vt="";for(var St=0,Rt=0,$t=0;$t>>24-St&16777215,St+=2,St>=26&&(St-=26,$t--),Rt!==0||$t!==this.length-1?vt=ut[6-At.length]+At+vt:vt=At+vt}for(Rt!==0&&(vt=Rt.toString(16)+vt);vt.length%ht!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}if(ct===(ct|0)&&ct>=2&&ct<=36){var wt=dt[ct],Ot=mt[ct];vt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var nr=tr.modrn(Ot).toString(ct);tr=tr.idivn(Ot),tr.isZero()?vt=nr+vt:vt=ut[wt-nr.length]+nr+vt}for(this.isZero()&&(vt="0"+vt);vt.length%ht!==0;)vt="0"+vt;return this.negative!==0&&(vt="-"+vt),vt}j(!1,"Base should be between 2 and 36")},tt.prototype.toNumber=function(){var ct=this.words[0];return this.length===2?ct+=this.words[1]*67108864:this.length===3&&this.words[2]===1?ct+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-ct:ct},tt.prototype.toJSON=function(){return this.toString(16,2)},rt&&(tt.prototype.toBuffer=function(ct,ht){return this.toArrayLike(rt,ct,ht)}),tt.prototype.toArray=function(ct,ht){return this.toArrayLike(Array,ct,ht)};var xt=function(ct,ht){return ct.allocUnsafe?ct.allocUnsafe(ht):new ct(ht)};tt.prototype.toArrayLike=function(ct,ht,vt){this._strip();var St=this.byteLength(),Rt=vt||Math.max(1,St);j(St<=Rt,"byte array longer than desired length"),j(Rt>0,"Requested array length <= 0");var $t=xt(ct,Rt),Et=ht==="le"?"LE":"BE";return this["_toArrayLike"+Et]($t,St),$t},tt.prototype._toArrayLikeLE=function(ct,ht){for(var vt=0,St=0,Rt=0,$t=0;Rt>8&255),vt>16&255),$t===6?(vt>24&255),St=0,$t=0):(St=Et>>>24,$t+=2)}if(vt=0&&(ct[vt--]=Et>>8&255),vt>=0&&(ct[vt--]=Et>>16&255),$t===6?(vt>=0&&(ct[vt--]=Et>>24&255),St=0,$t=0):(St=Et>>>24,$t+=2)}if(vt>=0)for(ct[vt--]=St;vt>=0;)ct[vt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var ht=ct,vt=0;return ht>=4096&&(vt+=13,ht>>>=13),ht>=64&&(vt+=7,ht>>>=7),ht>=8&&(vt+=4,ht>>>=4),ht>=2&&(vt+=2,ht>>>=2),vt+ht},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var ht=ct,vt=0;return ht&8191||(vt+=13,ht>>>=13),ht&127||(vt+=7,ht>>>=7),ht&15||(vt+=4,ht>>>=4),ht&3||(vt+=2,ht>>>=2),ht&1||vt++,vt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],ht=this._countBits(ct);return(this.length-1)*26+ht};function Ct(bt){for(var ct=new Array(bt.bitLength()),ht=0;ht>>St&1}return ct}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var ct=0,ht=0;htct.length?this.clone().ior(ct):ct.clone().ior(this)},tt.prototype.uor=function(ct){return this.length>ct.length?this.clone().iuor(ct):ct.clone().iuor(this)},tt.prototype.iuand=function(ct){var ht;this.length>ct.length?ht=ct:ht=this;for(var vt=0;vtct.length?this.clone().iand(ct):ct.clone().iand(this)},tt.prototype.uand=function(ct){return this.length>ct.length?this.clone().iuand(ct):ct.clone().iuand(this)},tt.prototype.iuxor=function(ct){var ht,vt;this.length>ct.length?(ht=this,vt=ct):(ht=ct,vt=this);for(var St=0;Stct.length?this.clone().ixor(ct):ct.clone().ixor(this)},tt.prototype.uxor=function(ct){return this.length>ct.length?this.clone().iuxor(ct):ct.clone().iuxor(this)},tt.prototype.inotn=function(ct){j(typeof ct=="number"&&ct>=0);var ht=Math.ceil(ct/26)|0,vt=ct%26;this._expand(ht),vt>0&&ht--;for(var St=0;St0&&(this.words[St]=~this.words[St]&67108863>>26-vt),this._strip()},tt.prototype.notn=function(ct){return this.clone().inotn(ct)},tt.prototype.setn=function(ct,ht){j(typeof ct=="number"&&ct>=0);var vt=ct/26|0,St=ct%26;return this._expand(vt+1),ht?this.words[vt]=this.words[vt]|1<ct.length?(vt=this,St=ct):(vt=ct,St=this);for(var Rt=0,$t=0;$t>>26;for(;Rt!==0&&$t>>26;if(this.length=vt.length,Rt!==0)this.words[this.length]=Rt,this.length++;else if(vt!==this)for(;$tct.length?this.clone().iadd(ct):ct.clone().iadd(this)},tt.prototype.isub=function(ct){if(ct.negative!==0){ct.negative=0;var ht=this.iadd(ct);return ct.negative=1,ht._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(ct),this.negative=1,this._normSign();var vt=this.cmp(ct);if(vt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Rt;vt>0?(St=this,Rt=ct):(St=ct,Rt=this);for(var $t=0,Et=0;Et>26,this.words[Et]=ht&67108863;for(;$t!==0&&Et>26,this.words[Et]=ht&67108863;if($t===0&&Et>>26,tr=At&67108863,nr=Math.min(wt,ct.length-1),ir=Math.max(0,wt-bt.length+1);ir<=nr;ir++){var Wt=wt-ir|0;St=bt.words[Wt]|0,Rt=ct.words[ir]|0,$t=St*Rt+tr,Ot+=$t/67108864|0,tr=$t&67108863}ht.words[wt]=tr|0,At=Ot|0}return At!==0?ht.words[wt]=At|0:ht.length--,ht._strip()}var Tt=function(ct,ht,vt){var St=ct.words,Rt=ht.words,$t=vt.words,Et=0,At,wt,Ot,tr=St[0]|0,nr=tr&8191,ir=tr>>>13,Wt=St[1]|0,Kt=Wt&8191,Jt=Wt>>>13,Ht=St[2]|0,Vt=Ht&8191,Qt=Ht>>>13,dr=St[3]|0,xr=dr&8191,pr=dr>>>13,Ir=St[4]|0,kr=Ir&8191,lr=Ir>>>13,fr=St[5]|0,Er=fr&8191,$r=fr>>>13,Pr=St[6]|0,Rr=Pr&8191,Ar=Pr>>>13,Or=St[7]|0,Lr=Or&8191,ar=Or>>>13,Yt=St[8]|0,er=Yt&8191,Zt=Yt>>>13,qt=St[9]|0,Gt=qt&8191,or=qt>>>13,vr=Rt[0]|0,wr=vr&8191,Sr=vr>>>13,Wr=Rt[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=Rt[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=Rt[3]|0,ln=mn&8191,Vr=mn>>>13,wn=Rt[4]|0,un=wn&8191,qr=wn>>>13,hn=Rt[5]|0,fn=hn&8191,Kr=hn>>>13,$n=Rt[6]|0,dn=$n&8191,Gr=$n>>>13,gn=Rt[7]|0,an=gn&8191,Zr=gn>>>13,Rn=Rt[8]|0,Sn=Rn&8191,nn=Rn>>>13,Tn=Rt[9]|0,yn=Tn&8191,En=Tn>>>13;vt.negative=ct.negative^ht.negative,vt.length=19,At=Math.imul(nr,wr),wt=Math.imul(nr,Sr),wt=wt+Math.imul(ir,wr)|0,Ot=Math.imul(ir,Sr);var ds=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ds>>>26)|0,ds&=67108863,At=Math.imul(Kt,wr),wt=Math.imul(Kt,Sr),wt=wt+Math.imul(Jt,wr)|0,Ot=Math.imul(Jt,Sr),At=At+Math.imul(nr,Hr)|0,wt=wt+Math.imul(nr,Fr)|0,wt=wt+Math.imul(ir,Hr)|0,Ot=Ot+Math.imul(ir,Fr)|0;var fs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(fs>>>26)|0,fs&=67108863,At=Math.imul(Vt,wr),wt=Math.imul(Vt,Sr),wt=wt+Math.imul(Qt,wr)|0,Ot=Math.imul(Qt,Sr),At=At+Math.imul(Kt,Hr)|0,wt=wt+Math.imul(Kt,Fr)|0,wt=wt+Math.imul(Jt,Hr)|0,Ot=Ot+Math.imul(Jt,Fr)|0,At=At+Math.imul(nr,Jr)|0,wt=wt+Math.imul(nr,Qr)|0,wt=wt+Math.imul(ir,Jr)|0,Ot=Ot+Math.imul(ir,Qr)|0;var hs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(hs>>>26)|0,hs&=67108863,At=Math.imul(xr,wr),wt=Math.imul(xr,Sr),wt=wt+Math.imul(pr,wr)|0,Ot=Math.imul(pr,Sr),At=At+Math.imul(Vt,Hr)|0,wt=wt+Math.imul(Vt,Fr)|0,wt=wt+Math.imul(Qt,Hr)|0,Ot=Ot+Math.imul(Qt,Fr)|0,At=At+Math.imul(Kt,Jr)|0,wt=wt+Math.imul(Kt,Qr)|0,wt=wt+Math.imul(Jt,Jr)|0,Ot=Ot+Math.imul(Jt,Qr)|0,At=At+Math.imul(nr,ln)|0,wt=wt+Math.imul(nr,Vr)|0,wt=wt+Math.imul(ir,ln)|0,Ot=Ot+Math.imul(ir,Vr)|0;var ps=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ps>>>26)|0,ps&=67108863,At=Math.imul(kr,wr),wt=Math.imul(kr,Sr),wt=wt+Math.imul(lr,wr)|0,Ot=Math.imul(lr,Sr),At=At+Math.imul(xr,Hr)|0,wt=wt+Math.imul(xr,Fr)|0,wt=wt+Math.imul(pr,Hr)|0,Ot=Ot+Math.imul(pr,Fr)|0,At=At+Math.imul(Vt,Jr)|0,wt=wt+Math.imul(Vt,Qr)|0,wt=wt+Math.imul(Qt,Jr)|0,Ot=Ot+Math.imul(Qt,Qr)|0,At=At+Math.imul(Kt,ln)|0,wt=wt+Math.imul(Kt,Vr)|0,wt=wt+Math.imul(Jt,ln)|0,Ot=Ot+Math.imul(Jt,Vr)|0,At=At+Math.imul(nr,un)|0,wt=wt+Math.imul(nr,qr)|0,wt=wt+Math.imul(ir,un)|0,Ot=Ot+Math.imul(ir,qr)|0;var qn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(qn>>>26)|0,qn&=67108863,At=Math.imul(Er,wr),wt=Math.imul(Er,Sr),wt=wt+Math.imul($r,wr)|0,Ot=Math.imul($r,Sr),At=At+Math.imul(kr,Hr)|0,wt=wt+Math.imul(kr,Fr)|0,wt=wt+Math.imul(lr,Hr)|0,Ot=Ot+Math.imul(lr,Fr)|0,At=At+Math.imul(xr,Jr)|0,wt=wt+Math.imul(xr,Qr)|0,wt=wt+Math.imul(pr,Jr)|0,Ot=Ot+Math.imul(pr,Qr)|0,At=At+Math.imul(Vt,ln)|0,wt=wt+Math.imul(Vt,Vr)|0,wt=wt+Math.imul(Qt,ln)|0,Ot=Ot+Math.imul(Qt,Vr)|0,At=At+Math.imul(Kt,un)|0,wt=wt+Math.imul(Kt,qr)|0,wt=wt+Math.imul(Jt,un)|0,Ot=Ot+Math.imul(Jt,qr)|0,At=At+Math.imul(nr,fn)|0,wt=wt+Math.imul(nr,Kr)|0,wt=wt+Math.imul(ir,fn)|0,Ot=Ot+Math.imul(ir,Kr)|0;var ss=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ss>>>26)|0,ss&=67108863,At=Math.imul(Rr,wr),wt=Math.imul(Rr,Sr),wt=wt+Math.imul(Ar,wr)|0,Ot=Math.imul(Ar,Sr),At=At+Math.imul(Er,Hr)|0,wt=wt+Math.imul(Er,Fr)|0,wt=wt+Math.imul($r,Hr)|0,Ot=Ot+Math.imul($r,Fr)|0,At=At+Math.imul(kr,Jr)|0,wt=wt+Math.imul(kr,Qr)|0,wt=wt+Math.imul(lr,Jr)|0,Ot=Ot+Math.imul(lr,Qr)|0,At=At+Math.imul(xr,ln)|0,wt=wt+Math.imul(xr,Vr)|0,wt=wt+Math.imul(pr,ln)|0,Ot=Ot+Math.imul(pr,Vr)|0,At=At+Math.imul(Vt,un)|0,wt=wt+Math.imul(Vt,qr)|0,wt=wt+Math.imul(Qt,un)|0,Ot=Ot+Math.imul(Qt,qr)|0,At=At+Math.imul(Kt,fn)|0,wt=wt+Math.imul(Kt,Kr)|0,wt=wt+Math.imul(Jt,fn)|0,Ot=Ot+Math.imul(Jt,Kr)|0,At=At+Math.imul(nr,dn)|0,wt=wt+Math.imul(nr,Gr)|0,wt=wt+Math.imul(ir,dn)|0,Ot=Ot+Math.imul(ir,Gr)|0;var Jn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,At=Math.imul(Lr,wr),wt=Math.imul(Lr,Sr),wt=wt+Math.imul(ar,wr)|0,Ot=Math.imul(ar,Sr),At=At+Math.imul(Rr,Hr)|0,wt=wt+Math.imul(Rr,Fr)|0,wt=wt+Math.imul(Ar,Hr)|0,Ot=Ot+Math.imul(Ar,Fr)|0,At=At+Math.imul(Er,Jr)|0,wt=wt+Math.imul(Er,Qr)|0,wt=wt+Math.imul($r,Jr)|0,Ot=Ot+Math.imul($r,Qr)|0,At=At+Math.imul(kr,ln)|0,wt=wt+Math.imul(kr,Vr)|0,wt=wt+Math.imul(lr,ln)|0,Ot=Ot+Math.imul(lr,Vr)|0,At=At+Math.imul(xr,un)|0,wt=wt+Math.imul(xr,qr)|0,wt=wt+Math.imul(pr,un)|0,Ot=Ot+Math.imul(pr,qr)|0,At=At+Math.imul(Vt,fn)|0,wt=wt+Math.imul(Vt,Kr)|0,wt=wt+Math.imul(Qt,fn)|0,Ot=Ot+Math.imul(Qt,Kr)|0,At=At+Math.imul(Kt,dn)|0,wt=wt+Math.imul(Kt,Gr)|0,wt=wt+Math.imul(Jt,dn)|0,Ot=Ot+Math.imul(Jt,Gr)|0,At=At+Math.imul(nr,an)|0,wt=wt+Math.imul(nr,Zr)|0,wt=wt+Math.imul(ir,an)|0,Ot=Ot+Math.imul(ir,Zr)|0;var Yn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,At=Math.imul(er,wr),wt=Math.imul(er,Sr),wt=wt+Math.imul(Zt,wr)|0,Ot=Math.imul(Zt,Sr),At=At+Math.imul(Lr,Hr)|0,wt=wt+Math.imul(Lr,Fr)|0,wt=wt+Math.imul(ar,Hr)|0,Ot=Ot+Math.imul(ar,Fr)|0,At=At+Math.imul(Rr,Jr)|0,wt=wt+Math.imul(Rr,Qr)|0,wt=wt+Math.imul(Ar,Jr)|0,Ot=Ot+Math.imul(Ar,Qr)|0,At=At+Math.imul(Er,ln)|0,wt=wt+Math.imul(Er,Vr)|0,wt=wt+Math.imul($r,ln)|0,Ot=Ot+Math.imul($r,Vr)|0,At=At+Math.imul(kr,un)|0,wt=wt+Math.imul(kr,qr)|0,wt=wt+Math.imul(lr,un)|0,Ot=Ot+Math.imul(lr,qr)|0,At=At+Math.imul(xr,fn)|0,wt=wt+Math.imul(xr,Kr)|0,wt=wt+Math.imul(pr,fn)|0,Ot=Ot+Math.imul(pr,Kr)|0,At=At+Math.imul(Vt,dn)|0,wt=wt+Math.imul(Vt,Gr)|0,wt=wt+Math.imul(Qt,dn)|0,Ot=Ot+Math.imul(Qt,Gr)|0,At=At+Math.imul(Kt,an)|0,wt=wt+Math.imul(Kt,Zr)|0,wt=wt+Math.imul(Jt,an)|0,Ot=Ot+Math.imul(Jt,Zr)|0,At=At+Math.imul(nr,Sn)|0,wt=wt+Math.imul(nr,nn)|0,wt=wt+Math.imul(ir,Sn)|0,Ot=Ot+Math.imul(ir,nn)|0;var ms=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ms>>>26)|0,ms&=67108863,At=Math.imul(Gt,wr),wt=Math.imul(Gt,Sr),wt=wt+Math.imul(or,wr)|0,Ot=Math.imul(or,Sr),At=At+Math.imul(er,Hr)|0,wt=wt+Math.imul(er,Fr)|0,wt=wt+Math.imul(Zt,Hr)|0,Ot=Ot+Math.imul(Zt,Fr)|0,At=At+Math.imul(Lr,Jr)|0,wt=wt+Math.imul(Lr,Qr)|0,wt=wt+Math.imul(ar,Jr)|0,Ot=Ot+Math.imul(ar,Qr)|0,At=At+Math.imul(Rr,ln)|0,wt=wt+Math.imul(Rr,Vr)|0,wt=wt+Math.imul(Ar,ln)|0,Ot=Ot+Math.imul(Ar,Vr)|0,At=At+Math.imul(Er,un)|0,wt=wt+Math.imul(Er,qr)|0,wt=wt+Math.imul($r,un)|0,Ot=Ot+Math.imul($r,qr)|0,At=At+Math.imul(kr,fn)|0,wt=wt+Math.imul(kr,Kr)|0,wt=wt+Math.imul(lr,fn)|0,Ot=Ot+Math.imul(lr,Kr)|0,At=At+Math.imul(xr,dn)|0,wt=wt+Math.imul(xr,Gr)|0,wt=wt+Math.imul(pr,dn)|0,Ot=Ot+Math.imul(pr,Gr)|0,At=At+Math.imul(Vt,an)|0,wt=wt+Math.imul(Vt,Zr)|0,wt=wt+Math.imul(Qt,an)|0,Ot=Ot+Math.imul(Qt,Zr)|0,At=At+Math.imul(Kt,Sn)|0,wt=wt+Math.imul(Kt,nn)|0,wt=wt+Math.imul(Jt,Sn)|0,Ot=Ot+Math.imul(Jt,nn)|0,At=At+Math.imul(nr,yn)|0,wt=wt+Math.imul(nr,En)|0,wt=wt+Math.imul(ir,yn)|0,Ot=Ot+Math.imul(ir,En)|0;var Qn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,At=Math.imul(Gt,Hr),wt=Math.imul(Gt,Fr),wt=wt+Math.imul(or,Hr)|0,Ot=Math.imul(or,Fr),At=At+Math.imul(er,Jr)|0,wt=wt+Math.imul(er,Qr)|0,wt=wt+Math.imul(Zt,Jr)|0,Ot=Ot+Math.imul(Zt,Qr)|0,At=At+Math.imul(Lr,ln)|0,wt=wt+Math.imul(Lr,Vr)|0,wt=wt+Math.imul(ar,ln)|0,Ot=Ot+Math.imul(ar,Vr)|0,At=At+Math.imul(Rr,un)|0,wt=wt+Math.imul(Rr,qr)|0,wt=wt+Math.imul(Ar,un)|0,Ot=Ot+Math.imul(Ar,qr)|0,At=At+Math.imul(Er,fn)|0,wt=wt+Math.imul(Er,Kr)|0,wt=wt+Math.imul($r,fn)|0,Ot=Ot+Math.imul($r,Kr)|0,At=At+Math.imul(kr,dn)|0,wt=wt+Math.imul(kr,Gr)|0,wt=wt+Math.imul(lr,dn)|0,Ot=Ot+Math.imul(lr,Gr)|0,At=At+Math.imul(xr,an)|0,wt=wt+Math.imul(xr,Zr)|0,wt=wt+Math.imul(pr,an)|0,Ot=Ot+Math.imul(pr,Zr)|0,At=At+Math.imul(Vt,Sn)|0,wt=wt+Math.imul(Vt,nn)|0,wt=wt+Math.imul(Qt,Sn)|0,Ot=Ot+Math.imul(Qt,nn)|0,At=At+Math.imul(Kt,yn)|0,wt=wt+Math.imul(Kt,En)|0,wt=wt+Math.imul(Jt,yn)|0,Ot=Ot+Math.imul(Jt,En)|0;var es=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(es>>>26)|0,es&=67108863,At=Math.imul(Gt,Jr),wt=Math.imul(Gt,Qr),wt=wt+Math.imul(or,Jr)|0,Ot=Math.imul(or,Qr),At=At+Math.imul(er,ln)|0,wt=wt+Math.imul(er,Vr)|0,wt=wt+Math.imul(Zt,ln)|0,Ot=Ot+Math.imul(Zt,Vr)|0,At=At+Math.imul(Lr,un)|0,wt=wt+Math.imul(Lr,qr)|0,wt=wt+Math.imul(ar,un)|0,Ot=Ot+Math.imul(ar,qr)|0,At=At+Math.imul(Rr,fn)|0,wt=wt+Math.imul(Rr,Kr)|0,wt=wt+Math.imul(Ar,fn)|0,Ot=Ot+Math.imul(Ar,Kr)|0,At=At+Math.imul(Er,dn)|0,wt=wt+Math.imul(Er,Gr)|0,wt=wt+Math.imul($r,dn)|0,Ot=Ot+Math.imul($r,Gr)|0,At=At+Math.imul(kr,an)|0,wt=wt+Math.imul(kr,Zr)|0,wt=wt+Math.imul(lr,an)|0,Ot=Ot+Math.imul(lr,Zr)|0,At=At+Math.imul(xr,Sn)|0,wt=wt+Math.imul(xr,nn)|0,wt=wt+Math.imul(pr,Sn)|0,Ot=Ot+Math.imul(pr,nn)|0,At=At+Math.imul(Vt,yn)|0,wt=wt+Math.imul(Vt,En)|0,wt=wt+Math.imul(Qt,yn)|0,Ot=Ot+Math.imul(Qt,En)|0;var ls=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(ls>>>26)|0,ls&=67108863,At=Math.imul(Gt,ln),wt=Math.imul(Gt,Vr),wt=wt+Math.imul(or,ln)|0,Ot=Math.imul(or,Vr),At=At+Math.imul(er,un)|0,wt=wt+Math.imul(er,qr)|0,wt=wt+Math.imul(Zt,un)|0,Ot=Ot+Math.imul(Zt,qr)|0,At=At+Math.imul(Lr,fn)|0,wt=wt+Math.imul(Lr,Kr)|0,wt=wt+Math.imul(ar,fn)|0,Ot=Ot+Math.imul(ar,Kr)|0,At=At+Math.imul(Rr,dn)|0,wt=wt+Math.imul(Rr,Gr)|0,wt=wt+Math.imul(Ar,dn)|0,Ot=Ot+Math.imul(Ar,Gr)|0,At=At+Math.imul(Er,an)|0,wt=wt+Math.imul(Er,Zr)|0,wt=wt+Math.imul($r,an)|0,Ot=Ot+Math.imul($r,Zr)|0,At=At+Math.imul(kr,Sn)|0,wt=wt+Math.imul(kr,nn)|0,wt=wt+Math.imul(lr,Sn)|0,Ot=Ot+Math.imul(lr,nn)|0,At=At+Math.imul(xr,yn)|0,wt=wt+Math.imul(xr,En)|0,wt=wt+Math.imul(pr,yn)|0,Ot=Ot+Math.imul(pr,En)|0;var us=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(us>>>26)|0,us&=67108863,At=Math.imul(Gt,un),wt=Math.imul(Gt,qr),wt=wt+Math.imul(or,un)|0,Ot=Math.imul(or,qr),At=At+Math.imul(er,fn)|0,wt=wt+Math.imul(er,Kr)|0,wt=wt+Math.imul(Zt,fn)|0,Ot=Ot+Math.imul(Zt,Kr)|0,At=At+Math.imul(Lr,dn)|0,wt=wt+Math.imul(Lr,Gr)|0,wt=wt+Math.imul(ar,dn)|0,Ot=Ot+Math.imul(ar,Gr)|0,At=At+Math.imul(Rr,an)|0,wt=wt+Math.imul(Rr,Zr)|0,wt=wt+Math.imul(Ar,an)|0,Ot=Ot+Math.imul(Ar,Zr)|0,At=At+Math.imul(Er,Sn)|0,wt=wt+Math.imul(Er,nn)|0,wt=wt+Math.imul($r,Sn)|0,Ot=Ot+Math.imul($r,nn)|0,At=At+Math.imul(kr,yn)|0,wt=wt+Math.imul(kr,En)|0,wt=wt+Math.imul(lr,yn)|0,Ot=Ot+Math.imul(lr,En)|0;var Wn=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,At=Math.imul(Gt,fn),wt=Math.imul(Gt,Kr),wt=wt+Math.imul(or,fn)|0,Ot=Math.imul(or,Kr),At=At+Math.imul(er,dn)|0,wt=wt+Math.imul(er,Gr)|0,wt=wt+Math.imul(Zt,dn)|0,Ot=Ot+Math.imul(Zt,Gr)|0,At=At+Math.imul(Lr,an)|0,wt=wt+Math.imul(Lr,Zr)|0,wt=wt+Math.imul(ar,an)|0,Ot=Ot+Math.imul(ar,Zr)|0,At=At+Math.imul(Rr,Sn)|0,wt=wt+Math.imul(Rr,nn)|0,wt=wt+Math.imul(Ar,Sn)|0,Ot=Ot+Math.imul(Ar,nn)|0,At=At+Math.imul(Er,yn)|0,wt=wt+Math.imul(Er,En)|0,wt=wt+Math.imul($r,yn)|0,Ot=Ot+Math.imul($r,En)|0;var os=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(os>>>26)|0,os&=67108863,At=Math.imul(Gt,dn),wt=Math.imul(Gt,Gr),wt=wt+Math.imul(or,dn)|0,Ot=Math.imul(or,Gr),At=At+Math.imul(er,an)|0,wt=wt+Math.imul(er,Zr)|0,wt=wt+Math.imul(Zt,an)|0,Ot=Ot+Math.imul(Zt,Zr)|0,At=At+Math.imul(Lr,Sn)|0,wt=wt+Math.imul(Lr,nn)|0,wt=wt+Math.imul(ar,Sn)|0,Ot=Ot+Math.imul(ar,nn)|0,At=At+Math.imul(Rr,yn)|0,wt=wt+Math.imul(Rr,En)|0,wt=wt+Math.imul(Ar,yn)|0,Ot=Ot+Math.imul(Ar,En)|0;var gs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(gs>>>26)|0,gs&=67108863,At=Math.imul(Gt,an),wt=Math.imul(Gt,Zr),wt=wt+Math.imul(or,an)|0,Ot=Math.imul(or,Zr),At=At+Math.imul(er,Sn)|0,wt=wt+Math.imul(er,nn)|0,wt=wt+Math.imul(Zt,Sn)|0,Ot=Ot+Math.imul(Zt,nn)|0,At=At+Math.imul(Lr,yn)|0,wt=wt+Math.imul(Lr,En)|0,wt=wt+Math.imul(ar,yn)|0,Ot=Ot+Math.imul(ar,En)|0;var bs=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(bs>>>26)|0,bs&=67108863,At=Math.imul(Gt,Sn),wt=Math.imul(Gt,nn),wt=wt+Math.imul(or,Sn)|0,Ot=Math.imul(or,nn),At=At+Math.imul(er,yn)|0,wt=wt+Math.imul(er,En)|0,wt=wt+Math.imul(Zt,yn)|0,Ot=Ot+Math.imul(Zt,En)|0;var Ps=(Et+At|0)+((wt&8191)<<13)|0;Et=(Ot+(wt>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,At=Math.imul(Gt,yn),wt=Math.imul(Gt,En),wt=wt+Math.imul(or,yn)|0,Ot=Math.imul(or,En);var As=(Et+At|0)+((wt&8191)<<13)|0;return Et=(Ot+(wt>>>13)|0)+(As>>>26)|0,As&=67108863,$t[0]=ds,$t[1]=fs,$t[2]=hs,$t[3]=ps,$t[4]=qn,$t[5]=ss,$t[6]=Jn,$t[7]=Yn,$t[8]=ms,$t[9]=Qn,$t[10]=es,$t[11]=ls,$t[12]=us,$t[13]=Wn,$t[14]=os,$t[15]=gs,$t[16]=bs,$t[17]=Ps,$t[18]=As,Et!==0&&($t[19]=Et,vt.length++),vt};Math.imul||(Tt=Pt);function kt(bt,ct,ht){ht.negative=ct.negative^bt.negative,ht.length=bt.length+ct.length;for(var vt=0,St=0,Rt=0;Rt>>26)|0,St+=$t>>>26,$t&=67108863}ht.words[Rt]=Et,vt=$t,$t=St}return vt!==0?ht.words[Rt]=vt:ht.length--,ht._strip()}function Lt(bt,ct,ht){return kt(bt,ct,ht)}tt.prototype.mulTo=function(ct,ht){var vt,St=this.length+ct.length;return this.length===10&&ct.length===10?vt=Tt(this,ct,ht):St<63?vt=Pt(this,ct,ht):St<1024?vt=kt(this,ct,ht):vt=Lt(this,ct,ht),vt},tt.prototype.mul=function(ct){var ht=new tt(null);return ht.words=new Array(this.length+ct.length),this.mulTo(ct,ht)},tt.prototype.mulf=function(ct){var ht=new tt(null);return ht.words=new Array(this.length+ct.length),Lt(this,ct,ht)},tt.prototype.imul=function(ct){return this.clone().mulTo(ct,this)},tt.prototype.imuln=function(ct){var ht=ct<0;ht&&(ct=-ct),j(typeof ct=="number"),j(ct<67108864);for(var vt=0,St=0;St>=26,vt+=Rt/67108864|0,vt+=$t>>>26,this.words[St]=$t&67108863}return vt!==0&&(this.words[St]=vt,this.length++),ht?this.ineg():this},tt.prototype.muln=function(ct){return this.clone().imuln(ct)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(ct){var ht=Ct(ct);if(ht.length===0)return new tt(1);for(var vt=this,St=0;St=0);var ht=ct%26,vt=(ct-ht)/26,St=67108863>>>26-ht<<26-ht,Rt;if(ht!==0){var $t=0;for(Rt=0;Rt>>26-ht}$t&&(this.words[Rt]=$t,this.length++)}if(vt!==0){for(Rt=this.length-1;Rt>=0;Rt--)this.words[Rt+vt]=this.words[Rt];for(Rt=0;Rt=0);var St;ht?St=(ht-ht%26)/26:St=0;var Rt=ct%26,$t=Math.min((ct-Rt)/26,this.length),Et=67108863^67108863>>>Rt<$t)for(this.length-=$t,wt=0;wt=0&&(Ot!==0||wt>=St);wt--){var tr=this.words[wt]|0;this.words[wt]=Ot<<26-Rt|tr>>>Rt,Ot=tr&Et}return At&&Ot!==0&&(At.words[At.length++]=Ot),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,ht,vt){return j(this.negative===0),this.iushrn(ct,ht,vt)},tt.prototype.shln=function(ct){return this.clone().ishln(ct)},tt.prototype.ushln=function(ct){return this.clone().iushln(ct)},tt.prototype.shrn=function(ct){return this.clone().ishrn(ct)},tt.prototype.ushrn=function(ct){return this.clone().iushrn(ct)},tt.prototype.testn=function(ct){j(typeof ct=="number"&&ct>=0);var ht=ct%26,vt=(ct-ht)/26,St=1<=0);var ht=ct%26,vt=(ct-ht)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=vt)return this;if(ht!==0&&vt++,this.length=Math.min(vt,this.length),ht!==0){var St=67108863^67108863>>>ht<=67108864;ht++)this.words[ht]-=67108864,ht===this.length-1?this.words[ht+1]=1:this.words[ht+1]++;return this.length=Math.max(this.length,ht+1),this},tt.prototype.isubn=function(ct){if(j(typeof ct=="number"),j(ct<67108864),ct<0)return this.iaddn(-ct);if(this.negative!==0)return this.negative=0,this.iaddn(ct),this.negative=1,this;if(this.words[0]-=ct,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ht=0;ht>26)-(At/67108864|0),this.words[Rt+vt]=$t&67108863}for(;Rt>26,this.words[Rt+vt]=$t&67108863;if(Et===0)return this._strip();for(j(Et===-1),Et=0,Rt=0;Rt>26,this.words[Rt]=$t&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,ht){var vt=this.length-ct.length,St=this.clone(),Rt=ct,$t=Rt.words[Rt.length-1]|0,Et=this._countBits($t);vt=26-Et,vt!==0&&(Rt=Rt.ushln(vt),St.iushln(vt),$t=Rt.words[Rt.length-1]|0);var At=St.length-Rt.length,wt;if(ht!=="mod"){wt=new tt(null),wt.length=At+1,wt.words=new Array(wt.length);for(var Ot=0;Ot=0;nr--){var ir=(St.words[Rt.length+nr]|0)*67108864+(St.words[Rt.length+nr-1]|0);for(ir=Math.min(ir/$t|0,67108863),St._ishlnsubmul(Rt,ir,nr);St.negative!==0;)ir--,St.negative=0,St._ishlnsubmul(Rt,1,nr),St.isZero()||(St.negative^=1);wt&&(wt.words[nr]=ir)}return wt&&wt._strip(),St._strip(),ht!=="div"&&vt!==0&&St.iushrn(vt),{div:wt||null,mod:St}},tt.prototype.divmod=function(ct,ht,vt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var St,Rt,$t;return this.negative!==0&&ct.negative===0?($t=this.neg().divmod(ct,ht),ht!=="mod"&&(St=$t.div.neg()),ht!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.iadd(ct)),{div:St,mod:Rt}):this.negative===0&&ct.negative!==0?($t=this.divmod(ct.neg(),ht),ht!=="mod"&&(St=$t.div.neg()),{div:St,mod:$t.mod}):this.negative&ct.negative?($t=this.neg().divmod(ct.neg(),ht),ht!=="div"&&(Rt=$t.mod.neg(),vt&&Rt.negative!==0&&Rt.isub(ct)),{div:$t.div,mod:Rt}):ct.length>this.length||this.cmp(ct)<0?{div:new tt(0),mod:this}:ct.length===1?ht==="div"?{div:this.divn(ct.words[0]),mod:null}:ht==="mod"?{div:null,mod:new tt(this.modrn(ct.words[0]))}:{div:this.divn(ct.words[0]),mod:new tt(this.modrn(ct.words[0]))}:this._wordDiv(ct,ht)},tt.prototype.div=function(ct){return this.divmod(ct,"div",!1).div},tt.prototype.mod=function(ct){return this.divmod(ct,"mod",!1).mod},tt.prototype.umod=function(ct){return this.divmod(ct,"mod",!0).mod},tt.prototype.divRound=function(ct){var ht=this.divmod(ct);if(ht.mod.isZero())return ht.div;var vt=ht.div.negative!==0?ht.mod.isub(ct):ht.mod,St=ct.ushrn(1),Rt=ct.andln(1),$t=vt.cmp(St);return $t<0||Rt===1&&$t===0?ht.div:ht.div.negative!==0?ht.div.isubn(1):ht.div.iaddn(1)},tt.prototype.modrn=function(ct){var ht=ct<0;ht&&(ct=-ct),j(ct<=67108863);for(var vt=(1<<26)%ct,St=0,Rt=this.length-1;Rt>=0;Rt--)St=(vt*St+(this.words[Rt]|0))%ct;return ht?-St:St},tt.prototype.modn=function(ct){return this.modrn(ct)},tt.prototype.idivn=function(ct){var ht=ct<0;ht&&(ct=-ct),j(ct<=67108863);for(var vt=0,St=this.length-1;St>=0;St--){var Rt=(this.words[St]|0)+vt*67108864;this.words[St]=Rt/ct|0,vt=Rt%ct}return this._strip(),ht?this.ineg():this},tt.prototype.divn=function(ct){return this.clone().idivn(ct)},tt.prototype.egcd=function(ct){j(ct.negative===0),j(!ct.isZero());var ht=this,vt=ct.clone();ht.negative!==0?ht=ht.umod(ct):ht=ht.clone();for(var St=new tt(1),Rt=new tt(0),$t=new tt(0),Et=new tt(1),At=0;ht.isEven()&&vt.isEven();)ht.iushrn(1),vt.iushrn(1),++At;for(var wt=vt.clone(),Ot=ht.clone();!ht.isZero();){for(var tr=0,nr=1;!(ht.words[0]&nr)&&tr<26;++tr,nr<<=1);if(tr>0)for(ht.iushrn(tr);tr-- >0;)(St.isOdd()||Rt.isOdd())&&(St.iadd(wt),Rt.isub(Ot)),St.iushrn(1),Rt.iushrn(1);for(var ir=0,Wt=1;!(vt.words[0]&Wt)&&ir<26;++ir,Wt<<=1);if(ir>0)for(vt.iushrn(ir);ir-- >0;)($t.isOdd()||Et.isOdd())&&($t.iadd(wt),Et.isub(Ot)),$t.iushrn(1),Et.iushrn(1);ht.cmp(vt)>=0?(ht.isub(vt),St.isub($t),Rt.isub(Et)):(vt.isub(ht),$t.isub(St),Et.isub(Rt))}return{a:$t,b:Et,gcd:vt.iushln(At)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var ht=this,vt=ct.clone();ht.negative!==0?ht=ht.umod(ct):ht=ht.clone();for(var St=new tt(1),Rt=new tt(0),$t=vt.clone();ht.cmpn(1)>0&&vt.cmpn(1)>0;){for(var Et=0,At=1;!(ht.words[0]&At)&&Et<26;++Et,At<<=1);if(Et>0)for(ht.iushrn(Et);Et-- >0;)St.isOdd()&&St.iadd($t),St.iushrn(1);for(var wt=0,Ot=1;!(vt.words[0]&Ot)&&wt<26;++wt,Ot<<=1);if(wt>0)for(vt.iushrn(wt);wt-- >0;)Rt.isOdd()&&Rt.iadd($t),Rt.iushrn(1);ht.cmp(vt)>=0?(ht.isub(vt),St.isub(Rt)):(vt.isub(ht),Rt.isub(St))}var tr;return ht.cmpn(1)===0?tr=St:tr=Rt,tr.cmpn(0)<0&&tr.iadd(ct),tr},tt.prototype.gcd=function(ct){if(this.isZero())return ct.abs();if(ct.isZero())return this.abs();var ht=this.clone(),vt=ct.clone();ht.negative=0,vt.negative=0;for(var St=0;ht.isEven()&&vt.isEven();St++)ht.iushrn(1),vt.iushrn(1);do{for(;ht.isEven();)ht.iushrn(1);for(;vt.isEven();)vt.iushrn(1);var Rt=ht.cmp(vt);if(Rt<0){var $t=ht;ht=vt,vt=$t}else if(Rt===0||vt.cmpn(1)===0)break;ht.isub(vt)}while(!0);return vt.iushln(St)},tt.prototype.invm=function(ct){return this.egcd(ct).a.umod(ct)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(ct){return this.words[0]&ct},tt.prototype.bincn=function(ct){j(typeof ct=="number");var ht=ct%26,vt=(ct-ht)/26,St=1<>>26,Et&=67108863,this.words[$t]=Et}return Rt!==0&&(this.words[$t]=Rt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(ct){var ht=ct<0;if(this.negative!==0&&!ht)return-1;if(this.negative===0&&ht)return 1;this._strip();var vt;if(this.length>1)vt=1;else{ht&&(ct=-ct),j(ct<=67108863,"Number is too big");var St=this.words[0]|0;vt=St===ct?0:Stct.length)return 1;if(this.length=0;vt--){var St=this.words[vt]|0,Rt=ct.words[vt]|0;if(St!==Rt){StRt&&(ht=1);break}}return ht},tt.prototype.gtn=function(ct){return this.cmpn(ct)===1},tt.prototype.gt=function(ct){return this.cmp(ct)===1},tt.prototype.gten=function(ct){return this.cmpn(ct)>=0},tt.prototype.gte=function(ct){return this.cmp(ct)>=0},tt.prototype.ltn=function(ct){return this.cmpn(ct)===-1},tt.prototype.lt=function(ct){return this.cmp(ct)===-1},tt.prototype.lten=function(ct){return this.cmpn(ct)<=0},tt.prototype.lte=function(ct){return this.cmp(ct)<=0},tt.prototype.eqn=function(ct){return this.cmpn(ct)===0},tt.prototype.eq=function(ct){return this.cmp(ct)===0},tt.red=function(ct){return new Bt(ct)},tt.prototype.toRed=function(ct){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),ct.convertTo(this)._forceRed(ct)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(ct){return this.red=ct,this},tt.prototype.forceRed=function(ct){return j(!this.red,"Already a number in reduction context"),this._forceRed(ct)},tt.prototype.redAdd=function(ct){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,ct)},tt.prototype.redIAdd=function(ct){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,ct)},tt.prototype.redSub=function(ct){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,ct)},tt.prototype.redISub=function(ct){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,ct)},tt.prototype.redShl=function(ct){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,ct)},tt.prototype.redMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.mul(this,ct)},tt.prototype.redIMul=function(ct){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,ct),this.red.imul(this,ct)},tt.prototype.redSqr=function(){return j(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},tt.prototype.redISqr=function(){return j(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},tt.prototype.redSqrt=function(){return j(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},tt.prototype.redInvm=function(){return j(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},tt.prototype.redNeg=function(){return j(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},tt.prototype.redPow=function(ct){return j(this.red&&!ct.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,ct)};var Nt={k256:null,p224:null,p192:null,p25519:null};function zt(bt,ct){this.name=bt,this.p=new tt(ct,16),this.n=this.p.bitLength(),this.k=new tt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}zt.prototype._tmp=function(){var ct=new tt(null);return ct.words=new Array(Math.ceil(this.n/13)),ct},zt.prototype.ireduce=function(ct){var ht=ct,vt;do this.split(ht,this.tmp),ht=this.imulK(ht),ht=ht.iadd(this.tmp),vt=ht.bitLength();while(vt>this.n);var St=vt0?ht.isub(this.p):ht.strip!==void 0?ht.strip():ht._strip(),ht},zt.prototype.split=function(ct,ht){ct.iushrn(this.n,0,ht)},zt.prototype.imulK=function(ct){return ct.imul(this.k)};function jt(){zt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(jt,zt),jt.prototype.split=function(ct,ht){for(var vt=4194303,St=Math.min(ct.length,9),Rt=0;Rt>>22,$t=Et}$t>>>=22,ct.words[Rt-10]=$t,$t===0&&ct.length>10?ct.length-=10:ct.length-=9},jt.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var ht=0,vt=0;vt>>=26,ct.words[vt]=Rt,ht=St}return ht!==0&&(ct.words[ct.length++]=ht),ct},tt._prime=function(ct){if(Nt[ct])return Nt[ct];var ht;if(ct==="k256")ht=new jt;else if(ct==="p224")ht=new Mt;else if(ct==="p192")ht=new Dt;else if(ct==="p25519")ht=new Ft;else throw new Error("Unknown prime "+ct);return Nt[ct]=ht,ht};function Bt(bt){if(typeof bt=="string"){var ct=tt._prime(bt);this.m=ct.p,this.prime=ct}else j(bt.gtn(1),"modulus must be greater than 1"),this.m=bt,this.prime=null}Bt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},Bt.prototype._verify2=function(ct,ht){j((ct.negative|ht.negative)===0,"red works only with positives"),j(ct.red&&ct.red===ht.red,"red works only with red numbers")},Bt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(st(ct,ct.umod(this.m)._forceRed(this)),ct)},Bt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},Bt.prototype.add=function(ct,ht){this._verify2(ct,ht);var vt=ct.add(ht);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt._forceRed(this)},Bt.prototype.iadd=function(ct,ht){this._verify2(ct,ht);var vt=ct.iadd(ht);return vt.cmp(this.m)>=0&&vt.isub(this.m),vt},Bt.prototype.sub=function(ct,ht){this._verify2(ct,ht);var vt=ct.sub(ht);return vt.cmpn(0)<0&&vt.iadd(this.m),vt._forceRed(this)},Bt.prototype.isub=function(ct,ht){this._verify2(ct,ht);var vt=ct.isub(ht);return vt.cmpn(0)<0&&vt.iadd(this.m),vt},Bt.prototype.shl=function(ct,ht){return this._verify1(ct),this.imod(ct.ushln(ht))},Bt.prototype.imul=function(ct,ht){return this._verify2(ct,ht),this.imod(ct.imul(ht))},Bt.prototype.mul=function(ct,ht){return this._verify2(ct,ht),this.imod(ct.mul(ht))},Bt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},Bt.prototype.sqr=function(ct){return this.mul(ct,ct)},Bt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var ht=this.m.andln(3);if(j(ht%2===1),ht===3){var vt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,vt)}for(var St=this.m.subn(1),Rt=0;!St.isZero()&&St.andln(1)===0;)Rt++,St.iushrn(1);j(!St.isZero());var $t=new tt(1).toRed(this),Et=$t.redNeg(),At=this.m.subn(1).iushrn(1),wt=this.m.bitLength();for(wt=new tt(2*wt*wt).toRed(this);this.pow(wt,At).cmp(Et)!==0;)wt.redIAdd(Et);for(var Ot=this.pow(wt,St),tr=this.pow(ct,St.addn(1).iushrn(1)),nr=this.pow(ct,St),ir=Rt;nr.cmp($t)!==0;){for(var Wt=nr,Kt=0;Wt.cmp($t)!==0;Kt++)Wt=Wt.redSqr();j(Kt=0;Rt--){for(var Ot=ht.words[Rt],tr=wt-1;tr>=0;tr--){var nr=Ot>>tr&1;if($t!==St[0]&&($t=this.sqr($t)),nr===0&&Et===0){At=0;continue}Et<<=1,Et|=nr,At++,!(At!==vt&&(Rt!==0||tr!==0))&&($t=this.mul($t,St[Et]),At=0,Et=0)}wt=26}return $t},Bt.prototype.convertTo=function(ct){var ht=ct.umod(this.m);return ht===ct?ht.clone():ht},Bt.prototype.convertFrom=function(ct){var ht=ct.clone();return ht.red=null,ht},tt.mont=function(ct){return new yt(ct)};function yt(bt){Bt.call(this,bt),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new tt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(yt,Bt),yt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},yt.prototype.convertFrom=function(ct){var ht=this.imod(ct.mul(this.rinv));return ht.red=null,ht},yt.prototype.imul=function(ct,ht){if(ct.isZero()||ht.isZero())return ct.words[0]=0,ct.length=1,ct;var vt=ct.imul(ht),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.mul=function(ct,ht){if(ct.isZero()||ht.isZero())return new tt(0)._forceRed(this);var vt=ct.mul(ht),St=vt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Rt=vt.isub(St).iushrn(this.shift),$t=Rt;return Rt.cmp(this.m)>=0?$t=Rt.isub(this.m):Rt.cmpn(0)<0&&($t=Rt.iadd(this.m)),$t._forceRed(this)},yt.prototype.invm=function(ct){var ht=this.imod(ct._invmp(this.m).mul(this.r2));return ht._forceRed(this)}})(_,commonjsGlobal)})(bn);var bnExports=bn.exports;const BN$8=getDefaultExportFromCjs$1(bnExports),log$2=log$1$1.getLogger("http-helpers");log$2.setLevel(loglevelExports.levels.INFO);let apiKey="torus-default",embedHost="";const gatewayAuthHeader="x-api-key",gatewayEmbedHostHeader="x-embed-host";function setEmbedHost(_){embedHost=_}function setAPIKey(_){apiKey=_}async function fetchAndTrace(_,a){let $=null;try{$=new URL(_)}catch{}return fetch(_,a)}function getApiKeyHeaders(){const _={};return apiKey&&(_[gatewayAuthHeader]=apiKey),embedHost&&(_[gatewayEmbedHostHeader]=embedHost),_}function debugLogResponse(_){log$2.info(`Response: ${_.status} ${_.statusText}`),log$2.info(`Url: ${_.url}`)}function logTracingHeader(_){log$2.info(`Request tracing with traceID=${_.headers.get("x-web3-correlation-id")}`)}const promiseTimeout=(_,a)=>{const $=new Promise((j,et)=>{const tt=setTimeout(()=>{clearTimeout(tt),et(new Error(`Timed out in ${_}ms`))},_)});return Promise.race([a,$])},get=async function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const j={mode:"cors",headers:{}};$.useAPIKey&&(j.headers=_objectSpread2(_objectSpread2({},j.headers),getApiKeyHeaders()));const et=deepmerge$1(j,a,{method:"GET"}),tt=await fetchAndTrace(_,et);if(tt.ok){const rt=tt.headers.get("content-type");return rt!=null&&rt.includes("application/json")?tt.json():tt.text()}throw debugLogResponse(tt),tt},post=function(_){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const et={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};j.useAPIKey&&(et.headers=_objectSpread2(_objectSpread2({},et.headers),getApiKeyHeaders()));const tt=deepmerge$1(et,$,{method:"POST"});return j.isUrlEncodedData?(tt.body=a,tt.headers["Content-Type"]==="application/json; charset=utf-8"&&delete tt.headers["Content-Type"]):tt.body=JSON.stringify(a),promiseTimeout(j.timeout||6e4,fetchAndTrace(_,tt).then(rt=>{if(j.logTracingHeader&&logTracingHeader(rt),rt.ok){const nt=rt.headers.get("content-type");return nt!=null&&nt.includes("application/json")?rt.json():rt.text()}throw debugLogResponse(rt),rt}))},generateJsonRPCObject=(_,a)=>({jsonrpc:"2.0",method:_,id:10,params:a}),JRPC_METHODS={GET_OR_SET_KEY:"GetPubKeyOrKeyAssign",COMMITMENT_REQUEST:"CommitmentRequest",IMPORT_SHARE:"ImportShare",GET_SHARE_OR_KEY_ASSIGN:"GetShareOrKeyAssign"},LEGACY_METADATA_HOST="https://metadata.tor.us",normalizeKeysResult=_=>{const a={keys:[],is_new_key:_.is_new_key};return _&&_.keys&&_.keys.length>0&&(a.keys=_.keys.map($=>({pub_key_X:$.pub_key_X,pub_key_Y:$.pub_key_Y,address:$.address}))),a},kCombinations=(_,a)=>{let $=_;if(typeof $=="number"&&($=Array.from({length:$},(tt,rt)=>rt)),a>$.length||a<=0)return[];if(a===$.length)return[$];if(a===1)return $.reduce((tt,rt)=>[...tt,[rt]],[]);const j=[];let et=[];for(let tt=0;tt<=$.length-a+1;tt+=1){et=kCombinations($.slice(tt+1),a-1);for(let rt=0;rt{const $={};for(let j=0;j<_.length;j+=1){const et=stringify(_[j]);if($[et]=$[et]?$[et]+1:1,$[et]===a)return _[j]}};function encParamsBufToHex$1(_){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"),mode:"AES256"}}function encParamsHexToBuf$1(_){return{ephemPublicKey:Buffer$g.from(_.ephemPublicKey,"hex"),iv:Buffer$g.from(_.iv,"hex"),mac:Buffer$g.from(_.mac,"hex")}}class GetOrSetNonceError extends Error{}const log$1=log$1$1.getLogger("torus.js");log$1.disableAll();function keccak256$1(_){return`0x${Buffer$g.from(keccak256$3(_)).toString("hex")}`}function stripHexPrefix(_){return _.startsWith("0x")?_.slice(2):_}function toChecksumAddress(_){const a=stripHexPrefix(_).toLowerCase(),$=Buffer$g.from(a,"utf8"),j=Buffer$g.from(keccak256$3($)).toString("hex");let et="0x";for(let tt=0;tt=8?et+=a[tt].toUpperCase():et+=a[tt];return et}function generateAddressFromPrivKey(_,a){const j=_.keyFromPrivate(a.toString("hex",64),"hex").getPublic().encode("hex",!1).slice(2);log$1.info(j,"public key");const et=`0x${keccak256$1(Buffer$g.from(j,"hex")).slice(26)}`;return toChecksumAddress(et)}function generateAddressFromPubKey(_,a,$){const j=_.keyFromPublic({x:a.toString("hex",64),y:$.toString("hex",64)}),et=j.getPublic().encode("hex",!1).slice(2);log$1.info(j.getPublic().encode("hex",!1),"public key");const tt=`0x${keccak256$1(Buffer$g.from(et,"hex")).slice(26)}`;return toChecksumAddress(tt)}class Share{constructor(a,$){_defineProperty$4(this,"share",void 0),_defineProperty$4(this,"shareIndex",void 0),this.share=new BN$8($,"hex"),this.shareIndex=new BN$8(a,"hex")}static fromJSON(a){const{share:$,shareIndex:j}=a;return new Share(j,$)}toJSON(){return{share:this.share.toString("hex"),shareIndex:this.shareIndex.toString("hex")}}}class Polynomial{constructor(a,$){_defineProperty$4(this,"polynomial",void 0),_defineProperty$4(this,"ecCurve",void 0),this.polynomial=a,this.ecCurve=$}getThreshold(){return this.polynomial.length}polyEval(a){const $=new BN$8(a,"hex");let j=new BN$8($),et=new BN$8(0);et=et.add(this.polynomial[0]);for(let tt=1;tttypeof et=="number"?new BN$8(et):et instanceof BN$8?et:typeof et=="string"?new BN$8(et,"hex"):et),j={};for(let et=0;et<$.length;et+=1)j[$[et].toString("hex",64)]=new Share($[et],this.polyEval($[et]));return j}}function generatePrivateExcludingIndexes(_){const a=new BN$8(generatePrivate());return _.find($=>$.eq(a))?generatePrivateExcludingIndexes(_):a}function lagrangeInterpolation(_,a,$){if(a.length!==$.length)throw new Error("shares not equal to nodeIndex length in lagrangeInterpolation");let j=new BN$8(0);for(let et=0;et2&&arguments[2]!==void 0?arguments[2]:{};try{const j=await post(`${_}/get`,a,$,{useAPIKey:!0});return!j||!j.message?new BN$8(0):new BN$8(j.message,16)}catch(j){return log$1$1.error("get metadata error",j),new BN$8(0)}}async function getOrSetNonce(_,a,$,j,et,tt){let rt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,nt;const it=rt?"getNonce":"getOrSetNonce";return tt?nt=generateMetadataParams(a,$,it,tt):nt={pub_key_X:j,pub_key_Y:et,set_data:{data:it}},post(`${_}/get_or_set_nonce`,nt,void 0,{useAPIKey:!0})}async function getNonce(_,a,$,j,et,tt){return getOrSetNonce(_,a,$,j,et,tt,!0)}const config={logRequestTracing:!1};function capitalizeFirstLetter(_){return _.charAt(0).toUpperCase()+_.slice(1)}class SomeError extends Error{constructor(a){let{errors:$,responses:j,predicate:et}=a;super("Unable to resolve enough promises."),_defineProperty$4(this,"errors",void 0),_defineProperty$4(this,"responses",void 0),_defineProperty$4(this,"predicate",void 0),this.errors=$,this.responses=j,this.predicate=et}get message(){return`${super.message}. ${this.errors.length} errors: ${this.errors.map(a=>a.message||a).join(", ")} and ${this.responses.length} responses: ${JSON.stringify(this.responses)}`}toString(){return this.message}}const Some=(_,a)=>new Promise(($,j)=>{let et=0;const tt={resolved:!1},rt=new Array(_.length).fill(void 0),nt=new Array(_.length).fill(void 0);let it;return _.forEach((at,st)=>at.then(ot=>{nt[st]=ot}).catch(ot=>{rt[st]=ot}).finally(()=>{if(!tt.resolved)return a(nt.slice(0),tt).then(ot=>{tt.resolved=!0,$(ot)}).catch(ot=>{it=ot}).finally(()=>{if(et+=1,et===_.length){const ut=Object.values(nt.reduce((dt,mt)=>{if(mt){var xt;const{id:Ct,error:Pt}=mt;(Pt==null||(xt=Pt.data)===null||xt===void 0?void 0:xt.length)>0&&(Pt.data.startsWith("Error occurred while verifying params")?dt[Ct]=capitalizeFirstLetter(Pt.data):dt[Ct]=Pt.data)}return dt},{}));if(ut.length>0){const dt=ut.length>1?` +${ut.map(mt=>`• ${mt}`).join(` +`)}`:ut[0];j(new Error(dt))}else{var ot;j(new SomeError({errors:rt,responses:nt,predicate:((ot=it)===null||ot===void 0?void 0:ot.message)||it}))}}})}))}),GetPubKeyOrKeyAssign=async _=>{const{endpoints:a,network:$,verifier:j,verifierId:et,extendedVerifierId:tt}=_,rt=a.map(st=>post(st,generateJsonRPCObject(JRPC_METHODS.GET_OR_SET_KEY,{verifier:j,verifier_id:et.toString(),extended_verifier_id:tt,one_key_flow:!0,fetch_node_index:!0}),null,{logTracingHeader:config.logRequestTracing}).catch(ot=>log$1.error(`${JRPC_METHODS.GET_OR_SET_KEY} request failed`,ot)));let nt;const it=[];return await Some(rt,st=>{const ot=st.filter(mt=>{if(mt&&!mt.error){if(!nt){var xt;((xt=mt.result)===null||xt===void 0||(xt=xt.keys[0].nonce_data)===null||xt===void 0||(xt=xt.pubNonce)===null||xt===void 0?void 0:xt.x)&&(nt=mt.result.keys[0].nonce_data)}return mt}return!1}),ut=thresholdSame(ot.map(mt=>mt&&mt.error),~~(a.length/2)+1),dt=thresholdSame(ot.map(mt=>mt&&normalizeKeysResult(mt.result)),~~(a.length/2)+1);return dt&&(nt||tt||LEGACY_NETWORKS_ROUTE_MAP[$])||ut?(dt&&st.forEach(mt=>{if(mt&&mt.result){const xt=mt.result.keys[0].pub_key_X.toLowerCase(),Ct=dt.keys[0].pub_key_X.toLowerCase();if(xt===Ct){const Pt=parseInt(mt.result.node_index);Pt&&it.push(Pt)}}}),Promise.resolve({keyResult:dt,nodeIndexes:it,errorResult:ut,nonceResult:nt})):Promise.reject(new Error(`invalid public key result: ${JSON.stringify(st)} and nonce result:${JSON.stringify(nt||{})} for verifier: ${j}, verifierId: ${et} and extendedVerifierId: ${tt} `))})};async function retrieveOrImportShare(_){const{legacyMetadataHost:a,serverTimeOffset:$,enableOneKey:j,ecCurve:et,allowHost:tt,network:rt,clientId:nt,endpoints:it,verifier:at,verifierParams:st,idToken:ot,importedShares:ut,extraParams:dt}=_;await get(tt,{headers:{verifier:at,verifierId:st.verifier_id,network:rt,clientId:nt}},{useAPIKey:!0});const mt=[],xt=generatePrivate(),Ct=getPublic(xt).toString("hex"),Pt=Ct.slice(2,66),Tt=Ct.slice(66),kt=keccak256$1(Buffer$g.from(ot,"utf8"));let Lt=!1;if(ut&&ut.length>0){if(ut.length!==it.length)throw new Error("Invalid imported shares length");Lt=!0}for(let Nt=0;Nt{log$1.error("commitment error",jt)});mt.push(zt)}return Some(mt,Nt=>{const zt=Nt.filter(jt=>!(!jt||typeof jt!="object"||jt.error));return ut.length>0&&zt.length===it.length||ut.length===0&&zt.length>=~~(it.length*3/4)+1&&zt.find(Mt=>{var Dt;return!!(Mt&&((Dt=Mt.result)===null||Dt===void 0?void 0:Dt.nodeindex)==="1")})?Promise.resolve(Nt):Promise.reject(new Error(`invalid ${JSON.stringify(Nt)}`))}).then(Nt=>{const zt=[],jt=[];for(let Dt=0;Dtlog$1.error("share req",bt));zt.push(yt)}else{const Bt=post(it[Dt],generateJsonRPCObject(JRPC_METHODS.GET_SHARE_OR_KEY_ASSIGN,{encrypted:"yes",use_temp:!0,item:[_objectSpread2(_objectSpread2({},st),{},{idtoken:ot,nodesignatures:jt,verifieridentifier:at},dt)],one_key_flow:!0}),null,{logTracingHeader:config.logRequestTracing}).catch(yt=>log$1.error("share req",yt));zt.push(Bt)}}let Mt;return Some(zt,async(Dt,Ft)=>{const Bt=Dt.filter(St=>!(!St||typeof St!="object"||St.error)),yt=Dt.map(St=>{if(St&&St.result&&St.result.keys[0].public_key){if(!Mt&&!st.extended_verifier_id){var Rt;((Rt=St.result.keys[0].nonce_data)===null||Rt===void 0||(Rt=Rt.pubNonce)===null||Rt===void 0?void 0:Rt.x)&&(Mt=St.result.keys[0].nonce_data)}return St.result.keys[0].public_key}}),bt=thresholdSame(yt,~~(it.length/2)+1);if(!bt)throw new Error("invalid result from nodes, threshold number of public key results are not matching");if(!Mt&&!st.extended_verifier_id&&!LEGACY_NETWORKS_ROUTE_MAP[rt])throw new Error(`invalid metadata result from nodes, nonce metadata is empty for verifier: ${at} and verifierId: ${st.verifier_id}`);const ct=ut.length>0?it.length:~~(it.length/2)+1;if(Bt.length>=ct&&bt&&(Mt||st.extended_verifier_id||LEGACY_NETWORKS_ROUTE_MAP[rt])){const St=[],Rt=[],$t=[],Et=[],At=[],wt=[];for(let xr=0;xr0){var ht;fr&&(ht=fr[0])!==null&&ht!==void 0&&ht.ephemPublicKey?Rt.push(decryptNodeData(fr[0],lr[0],xt).catch(Pr=>log$1.debug("session sig decryption",Pr))):Rt.push(Promise.resolve(Buffer$g.from(lr[0],"hex")))}else Rt.push(Promise.resolve(void 0));if((Ir==null?void 0:Ir.length)>0){var vt;kr&&(vt=kr[0])!==null&&vt!==void 0&&vt.ephemPublicKey?$t.push(decryptNodeData(kr[0],Ir[0],xt).catch(Pr=>log$1.debug("session token sig decryption",Pr))):$t.push(Promise.resolve(Buffer$g.from(Ir[0],"base64")))}else $t.push(Promise.resolve(void 0));if((Er==null?void 0:Er.length)>0){const Pr=pr.result.keys[0];Et.push(new BN$8(Pr.node_index)),Pr.share_metadata&&St.push(decryptNodeData(Pr.share_metadata,Buffer$g.from(Pr.share,"base64").toString("binary").padStart(64,"0"),xt).catch(Rr=>log$1.debug("share decryption",Rr)))}else Et.push(void 0),St.push(Promise.resolve(void 0))}const Ot=await Promise.all(St.concat(Rt).concat($t)),tr=Ot.slice(0,St.length),nr=Ot.slice(St.length,St.length+Rt.length),ir=Ot.slice(St.length+Rt.length,Ot.length),Wt=nr.filter(xr=>!!xr),Kt=~~(it.length/2)+1;if(!st.extended_verifier_id&&Wt.length!!xr);if(!st.extended_verifier_id&&Jt.length{xr?At.push({token:xr.toString("base64"),signature:nr[pr].toString("hex"),node_pubx:Bt[pr].result.node_pubx,node_puby:Bt[pr].result.node_puby}):At.push(void 0)}),Ft.resolved)return;const Ht=tr.reduce((xr,pr,Ir)=>(pr&&xr.push({index:Et[Ir],value:new BN$8(pr)}),xr),[]),Vt=kCombinations(Ht.length,~~(it.length/2)+1);let Qt=null;for(let xr=0;xrpr.includes(Ar)),kr=Ir.map(Rr=>Rr.value),lr=Ir.map(Rr=>Rr.index),fr=lagrangeInterpolation(et,kr,lr);if(!fr)continue;const Er=getPublic(Buffer$g.from(fr.toString(16,64),"hex")).toString("hex"),$r=Er.slice(2,66),Pr=Er.slice(66);if(new BN$8($r,16).cmp(new BN$8(bt.X,16))===0&&new BN$8(Pr,16).cmp(new BN$8(bt.Y,16))===0){Qt=fr;break}}if(Qt==null)throw new Error("could not derive private key");const dr=thresholdSame(wt,~~(it.length/2)+1);return{privateKey:Qt,sessionTokenData:At,thresholdNonceData:Mt,nodeIndexes:Et,isNewKey:dr==="true"}}throw new Error("Invalid")})}).then(async Nt=>{var zt;const{privateKey:jt,sessionTokenData:Mt,thresholdNonceData:Dt,nodeIndexes:Ft,isNewKey:Bt}=Nt;let yt=Dt;if(!jt)throw new Error("Invalid private key returned");const bt=jt,ct=getPublic(Buffer$g.from(bt.toString(16,64),"hex")).toString("hex"),ht=ct.slice(2,66),vt=ct.slice(66);let St=new BN$8((zt=yt)!==null&&zt!==void 0&&zt.nonce?yt.nonce.padStart(64,"0"):"0","hex"),Rt,$t,Et="v1";if(st.extended_verifier_id)Et="v2",Rt=et.keyFromPublic({x:ht,y:vt}).getPublic();else if(LEGACY_NETWORKS_ROUTE_MAP[rt])if(j)if(yt=await getOrSetNonce(a,et,$,ht,vt,bt,!Bt),St=new BN$8(yt.nonce||"0",16),Et=yt.typeOfUser,Et==="v2")$t={X:yt.pubNonce.x,Y:yt.pubNonce.y},Rt=et.keyFromPublic({x:ht,y:vt}).getPublic().add(et.keyFromPublic({x:yt.pubNonce.x,y:yt.pubNonce.y}).getPublic());else{Et="v1",St=await getMetadata(a,{pub_key_X:ht,pub_key_Y:vt});const nr=bt.add(St).umod(et.curve.n);Rt=et.keyFromPrivate(nr.toString(16,64),"hex").getPublic()}else{Et="v1",St=await getMetadata(a,{pub_key_X:ht,pub_key_Y:vt});const nr=bt.add(St).umod(et.curve.n);Rt=et.keyFromPrivate(nr.toString(16,64),"hex").getPublic()}else Et="v2",Rt=et.keyFromPublic({x:ht,y:vt}).getPublic().add(et.keyFromPublic({x:yt.pubNonce.x,y:yt.pubNonce.y}).getPublic()),$t={X:yt.pubNonce.x,Y:yt.pubNonce.y};if(!Rt)throw new Error("Invalid public key, this might be a bug, please report this to web3auth team");const At=generateAddressFromPrivKey(et,bt),wt=generateAddressFromPubKey(et,Rt.getX(),Rt.getY());log$1.debug("> torus.js/retrieveShares",{finalEvmAddress:wt});let Ot="";(Et==="v1"||Et==="v2"&&St.gt(new BN$8(0)))&&(Ot=bt.add(St).umod(et.curve.n).toString("hex",64));let tr=!1;return Et==="v1"?tr=null:Et==="v2"&&(tr=St.eq(new BN$8("0"))),{finalKeyData:{evmAddress:wt,X:Rt.getX().toString(16,64),Y:Rt.getY().toString(16,64),privKey:Ot},oAuthKeyData:{evmAddress:At,X:ht,Y:vt,privKey:bt.toString("hex",64).padStart(64,"0")},sessionData:{sessionTokenData:Mt,sessionAuthKey:xt.toString("hex").padStart(64,"0")},metadata:{pubNonce:$t,nonce:St,typeOfUser:Et,upgraded:tr},nodesData:{nodeIndexes:Ft.map(nr=>nr.toNumber())}}})}const legacyKeyLookup=async(_,a,$)=>{const j=_.map(et=>post(et,generateJsonRPCObject("VerifierLookupRequest",{verifier:a,verifier_id:$.toString()})).catch(tt=>log$1.error("lookup request failed",tt)));return Some(j,et=>{const tt=et.filter(it=>it),rt=thresholdSame(tt.map(it=>it&&it.error),~~(_.length/2)+1),nt=thresholdSame(tt.map(it=>it&&it.result),~~(_.length/2)+1);return nt||rt?Promise.resolve({keyResult:nt,errorResult:rt}):Promise.reject(new Error(`invalid results ${JSON.stringify(et)}`))})},legacyKeyAssign=async _=>{let{endpoints:a,torusNodePubs:$,lastPoint:j,firstPoint:et,verifier:tt,verifierId:rt,signerHost:nt,network:it,clientId:at}=_,st,ot;if(j===void 0?(st=Math.floor(Math.random()*a.length),log$1.info("keyassign",st,a[st]),ot=st):st=j%a.length,st===et)throw new Error("Looped through all");et!==void 0&&(ot=et);const ut=generateJsonRPCObject("KeyAssign",{verifier:tt,verifier_id:rt.toString()});try{const dt=await post(nt,ut,{headers:{pubKeyX:$[st].X,pubKeyY:$[st].Y,network:it,clientId:at}},{useAPIKey:!0});return await post(a[st],_objectSpread2(_objectSpread2({},ut),dt),{headers:{"Content-Type":"application/json; charset=utf-8"}})}catch(dt){const mt=dt;log$1.error(mt.status,mt.message,mt,"key assign error");const xt=["Timed out","Failed to fetch","cancelled","NetworkError when attempting to fetch resource.","TypeError: Failed to fetch","TypeError: cancelled","TypeError: NetworkError when attempting to fetch resource."];if((mt==null?void 0:mt.status)===502||(mt==null?void 0:mt.status)===504||(mt==null?void 0:mt.status)===401||xt.includes(mt.message)||xt.some(Ct=>{var Pt;return(Pt=mt.message)===null||Pt===void 0?void 0:Pt.includes(Ct)})||mt.message&&mt.message.includes("reason: getaddrinfo EAI_AGAIN"))return legacyKeyAssign({endpoints:a,torusNodePubs:$,lastPoint:st+1,firstPoint:ot,verifier:tt,verifierId:rt,signerHost:nt,network:it,clientId:at});throw new Error(`Sorry, the Torus Network that powers Web3Auth is currently very busy. We will generate your key in time. Pls try again later. - ${bt.message||""}`)}},legacyWaitKeyLookup=(_,a,$,j)=>new Promise((et,tt)=>{setTimeout(()=>{legacyKeyLookup(_,a,$).then(et).catch(tt)},j)});class Torus{constructor(a){let{enableOneKey:$=!1,clientId:j,network:et,serverTimeOffset:tt=0,allowHost:rt="https://signer.tor.us/api/allow",legacyMetadataHost:nt=LEGACY_METADATA_HOST}=a;if(_defineProperty$4(this,"allowHost",void 0),_defineProperty$4(this,"serverTimeOffset",void 0),_defineProperty$4(this,"network",void 0),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"ec",void 0),_defineProperty$4(this,"enableOneKey",void 0),_defineProperty$4(this,"signerHost",void 0),_defineProperty$4(this,"legacyMetadataHost",void 0),!j)throw Error("Please provide a valid clientId in constructor");if(!et)throw Error("Please provide a valid network in constructor");this.ec=new elliptic$2.ec("secp256k1"),this.serverTimeOffset=tt||0,this.network=et,this.clientId=j,this.allowHost=rt,this.enableOneKey=$,this.legacyMetadataHost=nt,this.signerHost=`${SIGNER_MAP[et]}/api/sign`}get isLegacyNetwork(){const a=LEGACY_NETWORKS_ROUTE_MAP[this.network];return!!(a&&!a.migrationCompleted)}static enableLogging(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0)?(log$1.enableAll(),config.logRequestTracing=!0):log$1.disableAll()}static setAPIKey(a){setAPIKey(a)}static setEmbedHost(a){setEmbedHost(a)}static isGetOrSetNonceError(a){return a instanceof GetOrSetNonceError}static getPostboxKey(a){return a.metadata.typeOfUser==="v1"&&a.finalKeyData.privKey||a.oAuthKeyData.privKey}async retrieveShares(a,$,j,et,tt){let rt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};return this.isLegacyNetwork?this.legacyRetrieveShares(a,$,j,et,tt,rt):retrieveOrImportShare({legacyMetadataHost:this.legacyMetadataHost,serverTimeOffset:this.serverTimeOffset,enableOneKey:this.enableOneKey,ecCurve:this.ec,allowHost:this.allowHost,network:this.network,clientId:this.clientId,endpoints:a,verifier:j,verifierParams:et,idToken:tt,importedShares:[],extraParams:rt})}async getPublicAddress(a,$,j){let{verifier:et,verifierId:tt,extendedVerifierId:rt}=j;return this.isLegacyNetwork?this.getLegacyPublicAddress(a,$,{verifier:et,verifierId:tt},this.enableOneKey):this.getNewPublicAddress(a,{verifier:et,verifierId:tt,extendedVerifierId:rt},this.enableOneKey)}async importPrivateKey(a,$,j,et,tt,rt,nt){let it=arguments.length>7&&arguments[7]!==void 0?arguments[7]:{};if(this.isLegacyNetwork)throw new Error("This function is not supported on legacy networks");if(a.length!==$.length)throw new Error("length of endpoints array must be same as length of nodeIndexes array");const st=~~(a.length/2)+1-1,at=[],ut=this.ec.keyFromPrivate(nt.padStart(64,"0"),"hex");for(const Mt of $)at.push(new BN(Mt));const ht=ut.getPrivate(),bt=new BN(generatePrivate()),Et=ht.sub(bt).umod(this.ec.curve.n),Ct=this.ec.keyFromPrivate(Et.toString("hex").padStart(64,"0")).getPublic(),Tt=generateRandomPolynomial(this.ec,st,Et).generateShares(at),It=this.generateNonceMetadataParams("getOrSetNonce",Et,bt),Lt=Buffer$g.from(stringify(It.set_data),"utf8").toString("base64"),Nt=[],Ut=[];for(let Mt=0;Mt5&&arguments[5]!==void 0?arguments[5]:{};const nt=[];await get(this.allowHost,{headers:{verifier:j,verifierId:et.verifier_id,network:this.network,clientId:this.clientId}},{useAPIKey:!0});const it=generatePrivate(),ot=getPublic(it).toString("hex"),st=ot.slice(2,66),at=ot.slice(66),ut=keccak256(Buffer$g.from(tt,"utf8"));for(let ht=0;ht{log$1.error("commitment",Et)});nt.push(bt)}return Some(nt,ht=>ht.filter(Et=>!(!Et||typeof Et!="object"||Et.error)).length>=~~(a.length/4)*3+1?Promise.resolve(ht):Promise.reject(new Error(`invalid ${JSON.stringify(ht)}`))).then(ht=>{const bt=[],Et=[];for(let Ct=0;Ctlog$1.error("share req",Tt));bt.push(Pt)}return Some(bt,async(Ct,Pt)=>{const Tt=Ct.filter(Nt=>Nt),It=thresholdSame(Ct.map(Nt=>Nt&&Nt.result&&Nt.result.keys[0].PublicKey),~~(a.length/2)+1);if(Tt.length>=~~(a.length/2)+1&&It){const Nt=[],Ut=[];for(let Bt=0;Bt0){yt.result.keys.sort((ct,dt)=>new BN(ct.Index,16).cmp(new BN(dt.Index,16)));const mt=yt.result.keys[0];if(mt.Metadata){const ct={ephemPublicKey:Buffer$g.from(mt.Metadata.ephemPublicKey,"hex"),iv:Buffer$g.from(mt.Metadata.iv,"hex"),mac:Buffer$g.from(mt.Metadata.mac,"hex")};Nt.push(decrypt(it,_objectSpread2(_objectSpread2({},ct),{},{ciphertext:Buffer$g.from(Buffer$g.from(mt.Share,"base64").toString("binary").padStart(64,"0"),"hex")})).catch(dt=>log$1.debug("share decryption",dt)))}else Nt.push(Promise.resolve(Buffer$g.from(mt.Share.padStart(64,"0"),"hex")))}else Nt.push(Promise.resolve(void 0));Ut.push(new BN($[Bt],16))}const jt=await Promise.all(Nt);if(Pt.resolved)return;const Mt=jt.reduce((Bt,yt,mt)=>(yt&&Bt.push({index:Ut[mt],value:new BN(yt)}),Bt),[]),Dt=kCombinations(Mt.length,~~(a.length/2)+1);let Ft=null;for(let Bt=0;Btyt.includes(At)),ct=mt.map(xt=>xt.value),dt=mt.map(xt=>xt.index),vt=lagrangeInterpolation(this.ec,ct,dt);if(!vt)continue;const St=getPublic(Buffer$g.from(vt.toString(16,64),"hex")).toString("hex"),Rt=St.slice(2,66),$t=St.slice(66);if(new BN(Rt,16).cmp(new BN(It.X,16))===0&&new BN($t,16).cmp(new BN(It.Y,16))===0){Ft=vt;break}}if(Ft==null)throw new Error("could not derive private key");return Ft}throw new Error("invalid")})}).then(async ht=>{const bt=ht;if(!bt)throw new Error("Invalid private key returned");const Et=getPublic(Buffer$g.from(bt.toString(16,64),"hex")).toString("hex"),Ct=Et.slice(2,66),Pt=Et.slice(66);let Tt,It,Lt="v1",Nt;if(this.enableOneKey){const Ft=await getNonce(this.legacyMetadataHost,this.ec,this.serverTimeOffset,Ct,Pt,bt);if(Tt=new BN(Ft.nonce||"0",16),Lt=Ft.typeOfUser,Lt==="v2")It=this.ec.keyFromPublic({x:Ct,y:Pt}).getPublic().add(this.ec.keyFromPublic({x:Ft.pubNonce.x,y:Ft.pubNonce.y}).getPublic()),Nt={X:Ft.pubNonce.x,Y:Ft.pubNonce.y};else{Tt=await getMetadata(this.legacyMetadataHost,{pub_key_X:Ct,pub_key_Y:Pt});const Bt=bt.add(Tt).umod(this.ec.curve.n);It=this.ec.keyFromPrivate(Bt.toString("hex"),"hex").getPublic()}}else{Tt=await getMetadata(this.legacyMetadataHost,{pub_key_X:Ct,pub_key_Y:Pt});const Ft=bt.add(Tt).umod(this.ec.curve.n);It=this.ec.keyFromPrivate(Ft.toString("hex"),"hex").getPublic()}const Ut=generateAddressFromPrivKey(this.ec,bt);let jt="";(Lt==="v1"||Lt==="v2"&&Tt.gt(new BN(0)))&&(jt=bt.add(Tt).umod(this.ec.curve.n).toString("hex",64).padStart(64,"0"));let Mt=!1;Lt==="v1"?Mt=null:Lt==="v2"&&(Mt=Tt.eq(new BN("0")));let Dt="";if(It)Dt=generateAddressFromPubKey(this.ec,It.getX(),It.getY()),log$1.debug("> torus.js/retrieveShares",{finalEvmAddress:Dt});else throw new Error("Invalid public key, this might be a bug, please report this to web3auth team");return{finalKeyData:{evmAddress:Dt,X:It?It.getX().toString(16,64):"",Y:It?It.getY().toString(16,64):"",privKey:jt},oAuthKeyData:{evmAddress:Ut,X:Ct,Y:Pt,privKey:bt.toString("hex",64).padStart(64,"0")},sessionData:{sessionTokenData:[],sessionAuthKey:""},metadata:{pubNonce:Nt,nonce:Tt,typeOfUser:Lt,upgraded:Mt},nodesData:{nodeIndexes:[]}}})}async getLegacyPublicAddress(a,$,j,et){let{verifier:tt,verifierId:rt}=j;log$1.debug("> torus.js/getPublicAddress",{endpoints:a,torusNodePubs:$,verifier:tt,verifierId:rt});let nt,it=!1;const{keyResult:ot,errorResult:st}=await legacyKeyLookup(a,tt,rt)||{};if(st&&JSON.stringify(st).includes("Verifier not supported"))throw new Error(`Verifier not supported. Check if you: + ${mt.message||""}`)}},legacyWaitKeyLookup=(_,a,$,j)=>new Promise((et,tt)=>{setTimeout(()=>{legacyKeyLookup(_,a,$).then(et).catch(tt)},j)});class Torus{constructor(a){let{enableOneKey:$=!1,clientId:j,network:et,serverTimeOffset:tt=0,allowHost:rt="https://signer.tor.us/api/allow",legacyMetadataHost:nt=LEGACY_METADATA_HOST}=a;if(_defineProperty$4(this,"allowHost",void 0),_defineProperty$4(this,"serverTimeOffset",void 0),_defineProperty$4(this,"network",void 0),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"ec",void 0),_defineProperty$4(this,"enableOneKey",void 0),_defineProperty$4(this,"signerHost",void 0),_defineProperty$4(this,"legacyMetadataHost",void 0),!j)throw Error("Please provide a valid clientId in constructor");if(!et)throw Error("Please provide a valid network in constructor");this.ec=new elliptic$3.ec("secp256k1"),this.serverTimeOffset=tt||0,this.network=et,this.clientId=j,this.allowHost=rt,this.enableOneKey=$,this.legacyMetadataHost=nt,this.signerHost=`${SIGNER_MAP[et]}/api/sign`}get isLegacyNetwork(){const a=LEGACY_NETWORKS_ROUTE_MAP[this.network];return!!(a&&!a.migrationCompleted)}static enableLogging(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0)?(log$1.enableAll(),config.logRequestTracing=!0):log$1.disableAll()}static setAPIKey(a){setAPIKey(a)}static setEmbedHost(a){setEmbedHost(a)}static isGetOrSetNonceError(a){return a instanceof GetOrSetNonceError}static getPostboxKey(a){return a.metadata.typeOfUser==="v1"&&a.finalKeyData.privKey||a.oAuthKeyData.privKey}async retrieveShares(a,$,j,et,tt){let rt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};return this.isLegacyNetwork?this.legacyRetrieveShares(a,$,j,et,tt,rt):retrieveOrImportShare({legacyMetadataHost:this.legacyMetadataHost,serverTimeOffset:this.serverTimeOffset,enableOneKey:this.enableOneKey,ecCurve:this.ec,allowHost:this.allowHost,network:this.network,clientId:this.clientId,endpoints:a,verifier:j,verifierParams:et,idToken:tt,importedShares:[],extraParams:rt})}async getPublicAddress(a,$,j){let{verifier:et,verifierId:tt,extendedVerifierId:rt}=j;return this.isLegacyNetwork?this.getLegacyPublicAddress(a,$,{verifier:et,verifierId:tt},this.enableOneKey):this.getNewPublicAddress(a,{verifier:et,verifierId:tt,extendedVerifierId:rt},this.enableOneKey)}async importPrivateKey(a,$,j,et,tt,rt,nt){let it=arguments.length>7&&arguments[7]!==void 0?arguments[7]:{};if(this.isLegacyNetwork)throw new Error("This function is not supported on legacy networks");if(a.length!==$.length)throw new Error("length of endpoints array must be same as length of nodeIndexes array");const st=~~(a.length/2)+1-1,ot=[],ut=this.ec.keyFromPrivate(nt.padStart(64,"0"),"hex");for(const Mt of $)ot.push(new BN$8(Mt));const dt=ut.getPrivate(),mt=new BN$8(generatePrivate()),xt=dt.sub(mt).umod(this.ec.curve.n),Ct=this.ec.keyFromPrivate(xt.toString("hex").padStart(64,"0")).getPublic(),Tt=generateRandomPolynomial(this.ec,st,xt).generateShares(ot),kt=this.generateNonceMetadataParams("getOrSetNonce",xt,mt),Lt=Buffer$g.from(stringify(kt.set_data),"utf8").toString("base64"),Nt=[],zt=[];for(let Mt=0;Mt5&&arguments[5]!==void 0?arguments[5]:{};const nt=[];await get(this.allowHost,{headers:{verifier:j,verifierId:et.verifier_id,network:this.network,clientId:this.clientId}},{useAPIKey:!0});const it=generatePrivate(),at=getPublic(it).toString("hex"),st=at.slice(2,66),ot=at.slice(66),ut=keccak256$1(Buffer$g.from(tt,"utf8"));for(let dt=0;dt{log$1.error("commitment",xt)});nt.push(mt)}return Some(nt,dt=>dt.filter(xt=>!(!xt||typeof xt!="object"||xt.error)).length>=~~(a.length/4)*3+1?Promise.resolve(dt):Promise.reject(new Error(`invalid ${JSON.stringify(dt)}`))).then(dt=>{const mt=[],xt=[];for(let Ct=0;Ctlog$1.error("share req",Tt));mt.push(Pt)}return Some(mt,async(Ct,Pt)=>{const Tt=Ct.filter(Nt=>Nt),kt=thresholdSame(Ct.map(Nt=>Nt&&Nt.result&&Nt.result.keys[0].PublicKey),~~(a.length/2)+1);if(Tt.length>=~~(a.length/2)+1&&kt){const Nt=[],zt=[];for(let Bt=0;Bt0){yt.result.keys.sort((ct,ht)=>new BN$8(ct.Index,16).cmp(new BN$8(ht.Index,16)));const bt=yt.result.keys[0];if(bt.Metadata){const ct={ephemPublicKey:Buffer$g.from(bt.Metadata.ephemPublicKey,"hex"),iv:Buffer$g.from(bt.Metadata.iv,"hex"),mac:Buffer$g.from(bt.Metadata.mac,"hex")};Nt.push(decrypt(it,_objectSpread2(_objectSpread2({},ct),{},{ciphertext:Buffer$g.from(Buffer$g.from(bt.Share,"base64").toString("binary").padStart(64,"0"),"hex")})).catch(ht=>log$1.debug("share decryption",ht)))}else Nt.push(Promise.resolve(Buffer$g.from(bt.Share.padStart(64,"0"),"hex")))}else Nt.push(Promise.resolve(void 0));zt.push(new BN$8($[Bt],16))}const jt=await Promise.all(Nt);if(Pt.resolved)return;const Mt=jt.reduce((Bt,yt,bt)=>(yt&&Bt.push({index:zt[bt],value:new BN$8(yt)}),Bt),[]),Dt=kCombinations(Mt.length,~~(a.length/2)+1);let Ft=null;for(let Bt=0;Btyt.includes(At)),ct=bt.map(Et=>Et.value),ht=bt.map(Et=>Et.index),vt=lagrangeInterpolation(this.ec,ct,ht);if(!vt)continue;const St=getPublic(Buffer$g.from(vt.toString(16,64),"hex")).toString("hex"),Rt=St.slice(2,66),$t=St.slice(66);if(new BN$8(Rt,16).cmp(new BN$8(kt.X,16))===0&&new BN$8($t,16).cmp(new BN$8(kt.Y,16))===0){Ft=vt;break}}if(Ft==null)throw new Error("could not derive private key");return Ft}throw new Error("invalid")})}).then(async dt=>{const mt=dt;if(!mt)throw new Error("Invalid private key returned");const xt=getPublic(Buffer$g.from(mt.toString(16,64),"hex")).toString("hex"),Ct=xt.slice(2,66),Pt=xt.slice(66);let Tt,kt,Lt="v1",Nt;if(this.enableOneKey){const Ft=await getNonce(this.legacyMetadataHost,this.ec,this.serverTimeOffset,Ct,Pt,mt);if(Tt=new BN$8(Ft.nonce||"0",16),Lt=Ft.typeOfUser,Lt==="v2")kt=this.ec.keyFromPublic({x:Ct,y:Pt}).getPublic().add(this.ec.keyFromPublic({x:Ft.pubNonce.x,y:Ft.pubNonce.y}).getPublic()),Nt={X:Ft.pubNonce.x,Y:Ft.pubNonce.y};else{Tt=await getMetadata(this.legacyMetadataHost,{pub_key_X:Ct,pub_key_Y:Pt});const Bt=mt.add(Tt).umod(this.ec.curve.n);kt=this.ec.keyFromPrivate(Bt.toString("hex"),"hex").getPublic()}}else{Tt=await getMetadata(this.legacyMetadataHost,{pub_key_X:Ct,pub_key_Y:Pt});const Ft=mt.add(Tt).umod(this.ec.curve.n);kt=this.ec.keyFromPrivate(Ft.toString("hex"),"hex").getPublic()}const zt=generateAddressFromPrivKey(this.ec,mt);let jt="";(Lt==="v1"||Lt==="v2"&&Tt.gt(new BN$8(0)))&&(jt=mt.add(Tt).umod(this.ec.curve.n).toString("hex",64).padStart(64,"0"));let Mt=!1;Lt==="v1"?Mt=null:Lt==="v2"&&(Mt=Tt.eq(new BN$8("0")));let Dt="";if(kt)Dt=generateAddressFromPubKey(this.ec,kt.getX(),kt.getY()),log$1.debug("> torus.js/retrieveShares",{finalEvmAddress:Dt});else throw new Error("Invalid public key, this might be a bug, please report this to web3auth team");return{finalKeyData:{evmAddress:Dt,X:kt?kt.getX().toString(16,64):"",Y:kt?kt.getY().toString(16,64):"",privKey:jt},oAuthKeyData:{evmAddress:zt,X:Ct,Y:Pt,privKey:mt.toString("hex",64).padStart(64,"0")},sessionData:{sessionTokenData:[],sessionAuthKey:""},metadata:{pubNonce:Nt,nonce:Tt,typeOfUser:Lt,upgraded:Mt},nodesData:{nodeIndexes:[]}}})}async getLegacyPublicAddress(a,$,j,et){let{verifier:tt,verifierId:rt}=j;log$1.debug("> torus.js/getPublicAddress",{endpoints:a,torusNodePubs:$,verifier:tt,verifierId:rt});let nt,it=!1;const{keyResult:at,errorResult:st}=await legacyKeyLookup(a,tt,rt)||{};if(st&&JSON.stringify(st).includes("Verifier not supported"))throw new Error(`Verifier not supported. Check if you: 1. Are on the right network (Torus testnet/mainnet) - 2. Have setup a verifier on dashboard.web3auth.io?`);if(st&&JSON.stringify(st).includes("Verifier + VerifierID has not yet been assigned")){await legacyKeyAssign({endpoints:a,torusNodePubs:$,lastPoint:void 0,firstPoint:void 0,verifier:tt,verifierId:rt,signerHost:this.signerHost,network:this.network,clientId:this.clientId});const at=await legacyWaitKeyLookup(a,tt,rt,1e3);nt=at==null?void 0:at.keyResult,it=!0}else if(ot)nt=ot;else throw new Error(`node results do not match at first lookup ${JSON.stringify(ot||{})}, ${JSON.stringify(st||{})}`);if(log$1.debug("> torus.js/getPublicAddress",{finalKeyResult:nt,isNewKey:it}),nt)return this.formatLegacyPublicKeyData({finalKeyResult:nt,isNewKey:it,enableOneKey:et});throw new Error(`node results do not match at final lookup ${JSON.stringify(ot||{})}, ${JSON.stringify(st||{})}`)}generateNonceMetadataParams(a,$,j){const et=this.ec.keyFromPrivate($.toString("hex",64)),tt={operation:a,timestamp:new BN(~~(this.serverTimeOffset+Date.now()/1e3)).toString(16)};j&&(tt.data=j.toString("hex",64));const rt=et.sign(keccak256(Buffer$g.from(stringify(tt),"utf8")).slice(2));return{pub_key_X:et.getPublic().getX().toString("hex",64),pub_key_Y:et.getPublic().getY().toString("hex",64),set_data:tt,signature:Buffer$g.from(rt.r.toString(16,64)+rt.s.toString(16,64)+new BN("").toString(16,2),"hex").toString("base64")}}async getNewPublicAddress(a,$,j){let{verifier:et,verifierId:tt,extendedVerifierId:rt}=$;log$1.debug("> torus.js/getPublicAddress",{endpoints:a,verifier:et,verifierId:tt});const nt=await GetPubKeyOrKeyAssign({endpoints:a,network:this.network,verifier:et,verifierId:tt,extendedVerifierId:rt}),{errorResult:it,keyResult:ot,nodeIndexes:st=[]}=nt,{nonceResult:at}=nt;if(it&&JSON.stringify(it).toLowerCase().includes("verifier not supported"))throw new Error(`Verifier not supported. Check if you: + 2. Have setup a verifier on dashboard.web3auth.io?`);if(st&&JSON.stringify(st).includes("Verifier + VerifierID has not yet been assigned")){await legacyKeyAssign({endpoints:a,torusNodePubs:$,lastPoint:void 0,firstPoint:void 0,verifier:tt,verifierId:rt,signerHost:this.signerHost,network:this.network,clientId:this.clientId});const ot=await legacyWaitKeyLookup(a,tt,rt,1e3);nt=ot==null?void 0:ot.keyResult,it=!0}else if(at)nt=at;else throw new Error(`node results do not match at first lookup ${JSON.stringify(at||{})}, ${JSON.stringify(st||{})}`);if(log$1.debug("> torus.js/getPublicAddress",{finalKeyResult:nt,isNewKey:it}),nt)return this.formatLegacyPublicKeyData({finalKeyResult:nt,isNewKey:it,enableOneKey:et});throw new Error(`node results do not match at final lookup ${JSON.stringify(at||{})}, ${JSON.stringify(st||{})}`)}generateNonceMetadataParams(a,$,j){const et=this.ec.keyFromPrivate($.toString("hex",64)),tt={operation:a,timestamp:new BN$8(~~(this.serverTimeOffset+Date.now()/1e3)).toString(16)};j&&(tt.data=j.toString("hex",64));const rt=et.sign(keccak256$1(Buffer$g.from(stringify(tt),"utf8")).slice(2));return{pub_key_X:et.getPublic().getX().toString("hex",64),pub_key_Y:et.getPublic().getY().toString("hex",64),set_data:tt,signature:Buffer$g.from(rt.r.toString(16,64)+rt.s.toString(16,64)+new BN$8("").toString(16,2),"hex").toString("base64")}}async getNewPublicAddress(a,$,j){let{verifier:et,verifierId:tt,extendedVerifierId:rt}=$;log$1.debug("> torus.js/getPublicAddress",{endpoints:a,verifier:et,verifierId:tt});const nt=await GetPubKeyOrKeyAssign({endpoints:a,network:this.network,verifier:et,verifierId:tt,extendedVerifierId:rt}),{errorResult:it,keyResult:at,nodeIndexes:st=[]}=nt,{nonceResult:ot}=nt;if(it&&JSON.stringify(it).toLowerCase().includes("verifier not supported"))throw new Error(`Verifier not supported. Check if you: 1. Are on the right network (Torus testnet/mainnet) - 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(!at&&!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 bt;const Et=new BN((at==null?void 0:at.nonce)||"0",16);let Ct,Pt;if(rt)Pt=this.ec.keyFromPublic({x:ut,y:ht}).getPublic(),Ct=Pt;else{if(LEGACY_NETWORKS_ROUTE_MAP[this.network])return this.formatLegacyPublicKeyData({isNewKey:ot.is_new_key,enableOneKey:j,finalKeyResult:{keys:ot.keys}});{const Mt=at;Ct=this.ec.keyFromPublic({x:ut,y:ht}).getPublic(),Pt=this.ec.keyFromPublic({x:ut,y:ht}).getPublic().add(this.ec.keyFromPublic({x:Mt.pubNonce.x,y:Mt.pubNonce.y}).getPublic()),bt={X:Mt.pubNonce.x,Y:Mt.pubNonce.y}}}if(!Ct)throw new Error("Unable to derive oAuthPubKey");const Tt=Ct.getX().toString(16,64),It=Ct.getY().toString(16,64),Lt=generateAddressFromPubKey(this.ec,Ct.getX(),Ct.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:Tt,Y:It,oAuthAddress:Lt,nonce:Et==null?void 0:Et.toString(16),pubNonce:bt}),!Pt)throw new Error("Unable to derive finalPubKey");const Nt=Pt?Pt.getX().toString(16,64):"",Ut=Pt?Pt.getY().toString(16,64):"",jt=Pt?generateAddressFromPubKey(this.ec,Pt.getX(),Pt.getY()):"";return{oAuthKeyData:{evmAddress:Lt,X:Tt,Y:It},finalKeyData:{evmAddress:jt,X:Nt,Y:Ut},metadata:{pubNonce:bt,nonce:Et,upgraded:(at==null?void 0:at.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,at,ut,ht;const bt=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}),at=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(st.toString(16,64),"hex").getPublic());else if(ot.typeOfUser==="v2")at=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}),at=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(st.toString(16,64),"hex").getPublic());if(!bt)throw new Error("Unable to derive oAuthPubKey");const Et=bt.getX().toString(16,64),Ct=bt.getY().toString(16,64),Pt=generateAddressFromPubKey(this.ec,bt.getX(),bt.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:Et,Y:Ct,oAuthAddress:Pt,nonce:($=st)===null||$===void 0?void 0:$.toString(16),pubNonce:ht}),ut==="v2"&&!at)throw new Error("Unable to derive finalPubKey");const Tt=at?at.getX().toString(16,64):"",It=at?at.getY().toString(16,64):"",Lt=at?generateAddressFromPubKey(this.ec,at.getX(),at.getY()):"";return{oAuthKeyData:{evmAddress:Pt,X:Et,Y:Ct},finalKeyData:{evmAddress:Lt,X:Tt,Y:It},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)})}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:at,hashParams:{access_token:ut,id_token:ht}}=st,bt=_objectWithoutProperties(st.hashParams,_excluded$2);if(it){log.error(nt),et(new Error(`Error: ${it}. Info: ${JSON.stringify(nt.data||{})}`));return}nt.data&&at.verifier===this.verifier&&(log.info(nt.data),!this.redirectToOpener&&tt&&await tt.postMessage({success:!0}),j(_objectSpread2(_objectSpread2({accessToken:ut,idToken:ht||""},bt),{},{state:at})))}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:at,email:ut}=ot;return{email:ut,name:at,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:at}=it;return{profileImage:at,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:at,email:ut}=ot;return{email:ut,name:at,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:at}=it;return{profileImage:at,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:at}=it;return{email:at,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:at}=it;return{profileImage:at,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:at}}=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:at||""},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,at,ut,ht,bt;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:at,rpOrigin:ut,credId:ht,transports:bt}=JSON.parse(base64url.decode(tt)))}catch(Et){log.warn("unable to parse extraParams",Et),{verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:ot,publicKey:st,challenge:at,rpOrigin:ut,credId:ht,transports:bt}=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:at,rpOrigin:ut,credId:ht,transports:bt}=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:at,rpOrigin:ut,credId:ht,transports:bt}}}}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:at,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||!at)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$1(Buffer$g.from($,"utf8")),et=j.toString("hex"),tt=getPublic(j).toString("hex"),rt=await encryptData(et,a),nt=(await sign(j,keccak256$1(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$1(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:at="https://broadcast-server.tor.us",sentry:ut,enableOneKey:ht=!1,web3AuthClientId:bt,metadataUrl:Et="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),!bt)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 Ct=new URL($);this.config={baseUrl:padUrlString(Ct),get redirect_uri(){return`${this.baseUrl}${rt}`},redirectToOpener:tt,uxMode:it,locationReplaceOnRedirect:ot,popupFeatures:st};const Pt=new Torus({network:j,clientId:bt,enableOneKey:ht,legacyMetadataHost:Et});Torus.setAPIKey(nt),this.torus=Pt,this.nodeDetailManager=new NodeDetailManager({network:j}),et?log.enableAll():log.disableAll(),this.storageHelper=new StorageHelper(at),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 at;if(rt&&nt){const{error:bt,hashParameters:Et,instanceParameters:Ct}=handleRedirectParameters(rt,nt);if(bt)throw new Error(bt);const{access_token:Pt,id_token:Tt}=Et,It=_objectWithoutProperties(Et,_excluded);at=_objectSpread2(_objectSpread2({accessToken:Pt,idToken:Tt},It),{},{state:Ct})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_LOGIN,args:a},st.nonce),at=await st.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const ut=await st.getUserInfo(at);if(ot){const bt=this.sentryHandler.startTransaction({name:SENTRY_TXNS.FETCH_NODE_DETAILS}),Et=await this.nodeDetailManager.getNodeDetails({verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(bt);const Ct=this.sentryHandler.startTransaction({name:SENTRY_TXNS.PUB_ADDRESS_LOOKUP}),Pt=await this.torus.getPublicAddress(Et.torusNodeEndpoints,Et.torusNodePub,{verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(Ct);const Tt={userInfo:_objectSpread2(_objectSpread2({},ut),at)};return _objectSpread2(_objectSpread2(_objectSpread2({},Tt),Pt),{},{finalKeyData:_objectSpread2(_objectSpread2({},Pt.finalKeyData),{},{privKey:void 0}),oAuthKeyData:_objectSpread2(_objectSpread2({},Pt.finalKeyData),{},{privKey:void 0}),metadata:_objectSpread2(_objectSpread2({},Pt.metadata),{},{nonce:void 0}),sessionData:void 0})}const ht=await this.getTorusKey($,ut.verifierId,{verifier_id:ut.verifierId},at.idToken||at.accessToken,ut.extraVerifierParams);return _objectSpread2(_objectSpread2({},ht),{},{userInfo:_objectSpread2(_objectSpread2({},ut),at)})}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 Et of et){const{clientId:Ct,typeOfLogin:Pt,verifier:Tt,jwtParams:It,hash:Lt,queryParameters:Nt,customState:Ut}=Et,jt=createHandler({typeOfLogin:Pt,clientId:Ct,verifier:Tt,redirect_uri:this.config.redirect_uri,redirectToOpener:this.config.redirectToOpener,jwtParams:It,uxMode:this.config.uxMode,customState:Ut});let Mt;if(Lt&&Nt){const{error:Dt,hashParameters:Ft,instanceParameters:Bt}=handleRedirectParameters(Lt,Nt);if(Dt)throw new Error(Dt);const{access_token:yt,id_token:mt}=Ft,ct=_objectWithoutProperties(Ft,_excluded2);Mt=_objectSpread2(_objectSpread2({accessToken:yt,idToken:mt},ct),{},{state:Bt})}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),Mt=await jt.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;tt.push(jt.getUserInfo(Mt)),rt.push(Mt)}const it=(await Promise.all(tt)).map(Et=>_objectSpread2(_objectSpread2({},Et),{},{aggregateVerifier:j})),ot={verify_params:[],sub_verifier_ids:[],verifier_id:""},st=[];let at="",ut={};for(let Et=0;Et_objectSpread2(_objectSpread2({},Et),rt[Ct]))})}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}=$,at=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:Mt,hashParameters:Dt,instanceParameters:Ft}=handleRedirectParameters(it,ot);if(Mt)throw new Error(Mt);const{access_token:Bt,id_token:yt}=Dt,mt=_objectWithoutProperties(Dt,_excluded3);ut=_objectSpread2(_objectSpread2({accessToken:Bt,idToken:yt},mt),{},{state:Ft})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN,args:a},at.nonce),ut=await at.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const ht=await at.getUserInfo(ut),bt=this.getTorusKey(rt,ht.verifierId,{verifier_id:ht.verifierId},ut.idToken||ut.accessToken,ht.extraVerifierParams),{verifierIdentifier:Et,subVerifierDetailsArray:Ct}=j,Pt={verify_params:[],sub_verifier_ids:[],verifier_id:""},Tt=[];let It="";for(let Mt=0;Mt0&&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((Et,Ct)=>{tt[Ct]=Et}),a){const Et=window.location.origin+window.location.pathname;window.history.replaceState(_objectSpread2(_objectSpread2({},window.history.state),{},{as:Et,url:Et}),"",Et)}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:at,method:ut}=st,ht=_objectWithoutProperties(st,_excluded4);if(log.info(at,ut),$&&this.storageHelper.clearLoginDetailsStorage(ot),rt)return{error:rt,state:nt||{},method:ut,result:{},hashParameters:it,args:at};let bt;try{if(ut===TORUS_METHOD.TRIGGER_LOGIN){const Et=at;Et.hash=et,Et.queryParameters=tt,bt=await this.triggerLogin(Et)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN){const Et=at;Et.subVerifierDetailsArray.forEach(Ct=>{Ct.hash=et,Ct.queryParameters=tt}),bt=await this.triggerAggregateLogin(Et)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN){const Et=at;Et.singleLogin.hash=et,Et.singleLogin.queryParameters=tt,bt=await this.triggerHybridAggregateLogin(Et)}}catch(Et){return log.error(Et),_objectSpread2({error:`Could not get result from torus nodes - ${(Et==null?void 0:Et.message)||""}`,state:nt||{},method:ut,result:{},hashParameters:it,args:at},ht)}return _objectSpread2(bt?{method:ut,result:bt,state:nt||{},hashParameters:it,args:at}:{error:"Unsupported method type",state:nt||{},method:ut,result:{},hashParameters:it,args:at},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 at=useGetSecretKey(),ut=useToast(),{isLoading:ht,handleAsyncAction:bt}=useAsyncActionHandler(),Et=ht||$,Ct=async({password:Lt})=>bt(async()=>{const Nt=await at(_,Lt);return a(await makeToolkit({type:"mnemonic",secretKey:Nt,network:st}))}),Pt=async({password:Lt})=>bt(async()=>{const Nt=await at(_,Lt);return a(await makeToolkit({type:"secret_key",secretKey:Nt,network:st}))}),Tt=async()=>bt(async()=>{const{secretKey:Lt}=await forIDP(_.idp).getCredentials();return a(await makeToolkit({type:"social",secretKey:Lt,network:st}))}),It=async()=>bt(async()=>(ut({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}))),Lt=>({description:`${Lt.message} Please connect your ledger, open Tezos app and try submitting transaction again`,status:"error"})).finally(()=>ut.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:j||!ot,isLoading:Et,onClick:nt(_.type==="mnemonic"?Ct:Pt),size:"lg",type:"submit",children:et||"Submit Transaction"})]})});case"social":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:Et,onClick:Tt,size:"lg",children:et||"Sign with social"});case"ledger":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:Et,onClick:It,size:"lg",children:et||"Sign with Ledger"})}},SignPayloadRequestModal=({request:_})=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),j=useGetImplicitAccount()(_.sourceAddress),et=useToast(),tt=useRemovePeerBySenderId(),rt=()=>{tt(_.senderId),WalletClient.respond({id:_.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.ABORTED_ERROR})},nt=async it=>{const ot=await it.signer.sign(_.payload),st={type:BeaconMessageType.SignPayloadResponse,id:_.id,signingType:_.signingType,signature:ot.prefixSig};await WalletClient.respond(st),et({description:"Successfully submitted Beacon operation",status:"success"}),a()};return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"32px",textAlign:"center",children:"Connect with pairing request"}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:rt}),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:nt,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})]})]}),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();return{isSigning:$,onSign:async nt=>j(async()=>{const{opHash:it}=await executeOperations(_,nt),ot={type:BeaconMessageType.OperationResponse,id:a.id,transactionHash:it};return await WalletClient.respond(ot),et(jsxRuntimeExports.jsx(SuccessStep,{hash:it}))},it=>({description:`Failed to confirm Beacon operation: ${it.message}`})),network:tt(a.network.type)}},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:_,fee:a,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(_,$),{signer:rt}=_,nt=_.operations.length;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,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:$.operationDetails})})]})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"16px",children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:rt.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:nt})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:a})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:rt,text:headerText(_.type,"batch")})})]})})},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:_,fee:a,message:$})=>{const{amount:j,contract:et,entrypoint:tt,args:rt}=_.operations[0],{isSigning:nt,onSign:it,network:ot}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:a})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:et}),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:tt,values:rt}})})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:nt,network:ot,onSubmit:it,signer:_.signer,text:headerText(_.type,"single")})})]})})},DelegationSignPage=({operation:_,fee:a,message:$})=>{const{recipient:j}=_.operations[0],{isSigning:et,onSign:tt,network:rt}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,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:a})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:j})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:et,network:rt,onSubmit:tt,signer:_.signer,text:headerText(_.type,"single")})})]})})},OriginationOperationSignPage=({operation:_,fee:a,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(_,$),{code:rt,storage:nt}=_.operations[0];return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"24px",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",children:"Operation Request"}),jsxRuntimeExports.jsxs(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:[$.appMetadata.name," is requesting permission to sign this operation."]}),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($.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:$.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:$.appMetadata.name})]}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:a})}),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: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:"Storage"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"auto",maxHeight:"300px",children:jsxRuntimeExports.jsx(JsValueWrap,{value:nt})})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:_.signer,text:headerText(_.type,"single")})})]})},TezSignPage=({operation:_,fee:a,message:$})=>{const{amount:j,recipient:et}=_.operations[0],{isSigning:tt,onSign:rt,network:nt}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:a})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:et})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:tt,network:nt,onSubmit:rt,signer:_.signer,text:headerText(_.type,"single")})})]})})},UndelegationSignPage=({operation:_,fee:a,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,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:a})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:_.signer,text:headerText(_.type,"single")})})]})})},BeaconSignPage=({operation:_,fee:a,message:$})=>{switch(_.operations[0].type){case"tez":return jsxRuntimeExports.jsx(TezSignPage,{fee:a,message:$,operation:_});case"contract_call":return jsxRuntimeExports.jsx(ContractCallSignPage,{fee:a,message:$,operation:_});case"delegation":return jsxRuntimeExports.jsx(DelegationSignPage,{fee:a,message:$,operation:_});case"undelegation":return jsxRuntimeExports.jsx(UndelegationSignPage,{fee:a,message:$,operation:_});case"contract_origination":return jsxRuntimeExports.jsx(OriginationOperationSignPage,{fee:a,message:$,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,{fee:st,message:tt,operation:ot}):rt=jsxRuntimeExports.jsx(BatchSignPage,{fee:st,message:tt,operation:ot});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,at=>at.test(rt)):findKey(nt,at=>at.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,at,ut,ht;const $=toDate(_),j=$.getFullYear(),et=getDefaultOptions(),tt=(a==null?void 0:a.firstWeekContainsDate)??((at=(st=a==null?void 0:a.locale)==null?void 0:st.options)==null?void 0:at.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,at,ut,ht,bt,Et,Ct,Pt;const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=($==null?void 0:$.firstWeekContainsDate)??((at=(st=$==null?void 0:$.locale)==null?void 0:st.options)==null?void 0:at.firstWeekContainsDate)??j.firstWeekContainsDate??((ht=(ut=j.locale)==null?void 0:ut.options)==null?void 0:ht.firstWeekContainsDate)??1,rt=($==null?void 0:$.weekStartsOn)??((Et=(bt=$==null?void 0:$.locale)==null?void 0:bt.options)==null?void 0:Et.weekStartsOn)??j.weekStartsOn??((Pt=(Ct=j.locale)==null?void 0:Ct.options)==null?void 0:Pt.weekStartsOn)??0,nt=toDate(_);if(!isValid(nt))throw new RangeError("Invalid time value");let it=a.match(longFormattingTokensRegExp).map(Tt=>{const It=Tt[0];if(It==="p"||It==="P"){const Lt=longFormatters[It];return Lt(Tt,et.formatLong)}return Tt}).join("").match(formattingTokensRegExp).map(Tt=>{if(Tt==="''")return{isToken:!1,value:"'"};const It=Tt[0];if(It==="'")return{isToken:!1,value:cleanEscapedString(Tt)};if(formatters[It])return{isToken:!0,value:Tt};if(It.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+It+"`");return{isToken:!1,value:Tt}});et.localize.preprocessor&&(it=et.localize.preprocessor(nt,it));const ot={firstWeekContainsDate:tt,weekStartsOn:rt,locale:et};return it.map(Tt=>{if(!Tt.isToken)return Tt.value;const It=Tt.value;(!($!=null&&$.useAdditionalWeekYearTokens)&&isProtectedWeekYearToken(It)||!($!=null&&$.useAdditionalDayOfYearTokens)&&isProtectedDayOfYearToken(It))&&warnOrThrowProtectedError(It,a,String(_));const Lt=formatters[It[0]];return Lt(nt,It,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),at=(getTimezoneOffsetInMilliseconds(ot)-getTimezoneOffsetInMilliseconds(it))/1e3,ut=Math.round((st-at)/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 Pt=>{isValidContractPkh(Pt.pkh)?await a(async()=>{const Tt=await getNetworksForContracts(tt,[Pt.pkh]);if(!Tt.has(Pt.pkh))throw new Error(`Network not found for contract ${Pt.pkh}`);$(contactsActions.upsert({...Pt,network:Tt.get(Pt.pkh)}))}):$(contactsActions.upsert({...Pt,network:void 0})),et(),ut()},{handleSubmit:it,formState:{isValid:ot,errors:st},register:at,reset:ut}=useForm({mode:"onBlur",defaultValues:_}),ht=({name:Pt,pkh:Tt})=>{nt({name:Pt.trim(),pkh:Tt})},bt=reactExports.useRef(ut);reactExports.useEffect(()=>{j&&bt.current(_)},[j,_]);const Et=useValidateNewContactPkh(),Ct=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",...at("name",{required:"Name is required",validate:Ct}),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",...at("pkh",{required:"Address is required",validate:rt?()=>!0:Et}),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}},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}}},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,et]=reactExports.useState(!1),tt=useGetImplicitAccount(),[rt,nt]=reactExports.useState(_),[it,ot]=reactExports.useState(a),st=useSelectedNetwork(),at=useClearBatch(),{isLoading:ut,handleAsyncAction:ht,handleAsyncActionUnsafe:bt}=useAsyncActionHandler(),{openWith:Et}=reactExports.useContext(DynamicModalContext),Ct=useForm({mode:"onBlur",defaultValues:{signer:it.signer.address.pkh,sender:it.sender.address.pkh}}),Pt=Ct.watch("signer"),Tt=async Lt=>bt(async()=>{const Nt={...it,signer:tt(Lt)};nt(await estimate(it,st)),ot(Nt),et(!1)},{isClosable:!0,duration:null}).catch(()=>et(!0)),It=async Lt=>ht(async()=>{const Nt=await executeOperations(it,Lt);return $==="batch"&&at(it.sender),await Et(jsxRuntimeExports.jsx(SuccessStep,{hash:Nt.opHash})),Nt});return{fee:rt,estimationFailed:j,operations:it,isLoading:ut,form:Ct,signer:tt(Pt),reEstimate:Tt,onSign:It}},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,SignPage$6=_=>{const{mode:a,operations:$,fee:j}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:at}=useSignPageHelpers(j,$,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(TezTile,{mutezAmount:ut}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:ht}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:at,signer:ot,text:headerText(tt.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);return tt(jsxRuntimeExports.jsx(_,{data:a,fee:await estimate(ot,nt),goBack:()=>tt(jsxRuntimeExports.jsx($,{...j,form:it})),mode:"single",operations:ot}))}},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:at}=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:at(tt),onSingleSubmit:at(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 at=setTimeout(()=>et(!1),2e3),ut=setTimeout(()=>rt(!1),3500);return()=>{clearTimeout(at),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(Et){return typeof Et=="string"?new RegExp("^"+Et+"$","i"):Et}function it(Et,Ct){return Et===Ct?Ct:Et===Et.toLowerCase()?Ct.toLowerCase():Et===Et.toUpperCase()?Ct.toUpperCase():Et[0]===Et[0].toUpperCase()?Ct.charAt(0).toUpperCase()+Ct.substr(1).toLowerCase():Ct.toLowerCase()}function ot(Et,Ct){return Et.replace(/\$(\d{1,2})/g,function(Pt,Tt){return Ct[Tt]||""})}function st(Et,Ct){return Et.replace(Ct[0],function(Pt,Tt){var It=ot(Ct[1],arguments);return it(Pt===""?Et[Tt-1]:Pt,It)})}function at(Et,Ct,Pt){if(!Et.length||et.hasOwnProperty(Et))return Ct;for(var Tt=Pt.length;Tt--;){var It=Pt[Tt];if(It[0].test(Ct))return st(Ct,It)}return Ct}function ut(Et,Ct,Pt){return function(Tt){var It=Tt.toLowerCase();return Ct.hasOwnProperty(It)?it(Tt,It):Et.hasOwnProperty(It)?it(Tt,Et[It]):at(It,Tt,Pt)}}function ht(Et,Ct,Pt,Tt){return function(It){var Lt=It.toLowerCase();return Ct.hasOwnProperty(Lt)?!0:Et.hasOwnProperty(Lt)?!1:at(Lt,Lt,Pt)===Lt}}function bt(Et,Ct,Pt){var Tt=Ct===1?bt.singular(Et):bt.plural(Et);return(Pt?Ct+" ":"")+Tt}return bt.plural=ut(rt,tt,$),bt.isPlural=ht(rt,tt,$),bt.singular=ut(tt,rt,j),bt.isSingular=ht(tt,rt,j),bt.addPluralRule=function(Et,Ct){$.push([nt(Et),Ct])},bt.addSingularRule=function(Et,Ct){j.push([nt(Et),Ct])},bt.addUncountableRule=function(Et){if(typeof Et=="string"){et[Et.toLowerCase()]=!0;return}bt.addPluralRule(Et,"$0"),bt.addSingularRule(Et,"$0")},bt.addIrregularRule=function(Et,Ct){Ct=Ct.toLowerCase(),Et=Et.toLowerCase(),rt[Et]=Ct,tt[Ct]=Et},[["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(Et){return bt.addIrregularRule(Et[0],Et[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(Et){return bt.addPluralRule(Et[0],Et[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(Et){return bt.addSingularRule(Et[0],Et[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(bt.addUncountableRule),bt})})(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,at]=reactExports.useState(!1),ut=async()=>{await navigator.clipboard.writeText(et.pkh),nt(),setTimeout(it,1e3)},ht=reactExports.useRef(null);useOutsideClick$1({ref:ht,handler:()=>{at(!1)}});let bt,Et,Ct;return ot?(bt=colors.green,Et=colors.gray[300],Ct="white"):st?(bt=colors.gray[450],Et=colors.gray[400],Ct=colors.gray[200]):(bt=colors.gray[500],Et=colors.gray[450],Ct=colors.gray[300]),jsxRuntimeExports.jsx(Box,{maxWidth:"max-content","data-testid":"address-pill",...$,children:jsxRuntimeExports.jsxs(Flex,{ref:ht,alignItems:"center",background:bt,borderRadius:"full",onMouseEnter:()=>{at(!0)},onMouseLeave:()=>{at(!1)},paddingX:"4px",children:[rt&&jsxRuntimeExports.jsx(LeftIcon,{marginLeft:"4px",stroke:Et,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:Pt=>Pt.stopPropagation(),variant:"unstyled",children:jsxRuntimeExports.jsx(AddressPillText,{color:Ct,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,at)=>{const ut=getIPFSurl(thumbnailUri(st));return at===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:at>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:_,fee:a,transactionCount:$,signer:j})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:subTitle(j),title:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:j.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:a})]})]})]}),SignPage$5=({initialOperations:_,initialFee:a})=>{const{fee:$,operations:j,estimationFailed:et,isLoading:tt,signer:rt,form:nt,reEstimate:it,onSign:ot}=useSignPageHelpers(a,_,"batch"),st=headerText(j.type,"batch");return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{fee:$,signer:rt,title:st,transactionCount:j.operations.length}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:tt,operationType:j.type,reEstimate:it,sender:j.sender}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:et,isLoading:tt,onSubmit:ot,signer:rt,text:st})})]})})})},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(),at=()=>st(async()=>{it([]);try{const ht=await estimate(_,rt);return it(a.map(bt=>SUCCESSFUL_ESTIMATION_RESULT)),tt(jsxRuntimeExports.jsx(SignPage$5,{initialFee:ht,initialOperations:_}))}catch(ht){if(ht instanceof TezosOperationError){const bt=ht.operationsWithResults;bt.length>a.length&&bt.shift(),it(bt)}throw ht}}),ut=jsxRuntimeExports.jsx(RightHeader,{isLoading:ot,onSubmit:at,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,bt)=>{const Et=nt.at(bt);return jsxRuntimeExports.jsxs(Box,{"data-testid":"operation",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:Et?"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:Et})]}),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($,bt),size:"xs",variant:"circle"})]})]})]}),bt torus.js/getPublicAddress",{keyResult:at}),!(at!=null&&at.keys))throw new Error(`node results do not match at final lookup ${JSON.stringify(at||{})}, ${JSON.stringify(it||{})}`);if(!ot&&!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:dt}=at.keys[0];let mt;const xt=new BN$8((ot==null?void 0:ot.nonce)||"0",16);let Ct,Pt;if(rt)Pt=this.ec.keyFromPublic({x:ut,y:dt}).getPublic(),Ct=Pt;else{if(LEGACY_NETWORKS_ROUTE_MAP[this.network])return this.formatLegacyPublicKeyData({isNewKey:at.is_new_key,enableOneKey:j,finalKeyResult:{keys:at.keys}});{const Mt=ot;Ct=this.ec.keyFromPublic({x:ut,y:dt}).getPublic(),Pt=this.ec.keyFromPublic({x:ut,y:dt}).getPublic().add(this.ec.keyFromPublic({x:Mt.pubNonce.x,y:Mt.pubNonce.y}).getPublic()),mt={X:Mt.pubNonce.x,Y:Mt.pubNonce.y}}}if(!Ct)throw new Error("Unable to derive oAuthPubKey");const Tt=Ct.getX().toString(16,64),kt=Ct.getY().toString(16,64),Lt=generateAddressFromPubKey(this.ec,Ct.getX(),Ct.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:Tt,Y:kt,oAuthAddress:Lt,nonce:xt==null?void 0:xt.toString(16),pubNonce:mt}),!Pt)throw new Error("Unable to derive finalPubKey");const Nt=Pt?Pt.getX().toString(16,64):"",zt=Pt?Pt.getY().toString(16,64):"",jt=Pt?generateAddressFromPubKey(this.ec,Pt.getX(),Pt.getY()):"";return{oAuthKeyData:{evmAddress:Lt,X:Tt,Y:kt},finalKeyData:{evmAddress:jt,X:Nt,Y:zt},metadata:{pubNonce:mt,nonce:xt,upgraded:(ot==null?void 0:ot.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 at,st,ot,ut,dt;const mt=this.ec.keyFromPublic({x:nt,y:it}).getPublic();if(tt){try{at=await getOrSetNonce(this.legacyMetadataHost,this.ec,this.serverTimeOffset,nt,it,void 0,!rt),st=new BN$8(at.nonce||"0",16),ut=at.typeOfUser}catch{throw new GetOrSetNonceError}if(at.typeOfUser==="v1")st=await getMetadata(this.legacyMetadataHost,{pub_key_X:nt,pub_key_Y:it}),ot=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(st.toString(16,64),"hex").getPublic());else if(at.typeOfUser==="v2")ot=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPublic({x:at.pubNonce.x,y:at.pubNonce.y}).getPublic()),dt={X:at.pubNonce.x,Y:at.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}),ot=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(st.toString(16,64),"hex").getPublic());if(!mt)throw new Error("Unable to derive oAuthPubKey");const xt=mt.getX().toString(16,64),Ct=mt.getY().toString(16,64),Pt=generateAddressFromPubKey(this.ec,mt.getX(),mt.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:xt,Y:Ct,oAuthAddress:Pt,nonce:($=st)===null||$===void 0?void 0:$.toString(16),pubNonce:dt}),ut==="v2"&&!ot)throw new Error("Unable to derive finalPubKey");const Tt=ot?ot.getX().toString(16,64):"",kt=ot?ot.getY().toString(16,64):"",Lt=ot?generateAddressFromPubKey(this.ec,ot.getX(),ot.getY()):"";return{oAuthKeyData:{evmAddress:Pt,X:xt,Y:Ct},finalKeyData:{evmAddress:Lt,X:Tt,Y:kt},metadata:{pubNonce:dt,nonce:st,upgraded:((j=at)===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)})}var elliptic={};const name="elliptic",version="6.5.5",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny ",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$c={};(function(_){var a=_,$=bnExports$1,j=minimalisticAssert,et=utils$R;a.assert=j,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function tt(st,ot,ut){var dt=new Array(Math.max(st.bitLength(),ut)+1),mt;for(mt=0;mt(xt>>1)-1?Pt=(xt>>1)-Tt:Pt=Tt,Ct.isubn(Pt)):Pt=0,dt[mt]=Pt,Ct.iushrn(1)}return dt}a.getNAF=tt;function rt(st,ot){var ut=[[],[]];st=st.clone(),ot=ot.clone();for(var dt=0,mt=0,xt;st.cmpn(-dt)>0||ot.cmpn(-mt)>0;){var Ct=st.andln(3)+dt&3,Pt=ot.andln(3)+mt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var Tt;Ct&1?(xt=st.andln(7)+dt&7,(xt===3||xt===5)&&Pt===2?Tt=-Ct:Tt=Ct):Tt=0,ut[0].push(Tt);var kt;Pt&1?(xt=ot.andln(7)+mt&7,(xt===3||xt===5)&&Ct===2?kt=-Pt:kt=Pt):kt=0,ut[1].push(kt),2*dt===Tt+1&&(dt=1-dt),2*mt===kt+1&&(mt=1-mt),st.iushrn(1),ot.iushrn(1)}return ut}a.getJSF=rt;function nt(st,ot,ut){var dt="_"+ot;st.prototype[ot]=function(){return this[dt]!==void 0?this[dt]:this[dt]=ut.call(this)}}a.cachedProperty=nt;function it(st){return typeof st=="string"?a.toArray(st,"hex"):st}a.parseBytes=it;function at(st){return new $(st,"hex","le")}a.intFromLE=at})(utils$c);var curve={},BN$7=bnExports$1,utils$b=utils$c,getNAF=utils$b.getNAF,getJSF=utils$b.getJSF,assert$8=utils$b.assert;function BaseCurve(_,a){this.type=_,this.p=new BN$7(a.p,16),this.red=a.prime?BN$7.red(a.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=a.n&&new BN$7(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var $=this.n&&this.p.div(this.n);!$||$.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base=BaseCurve;BaseCurve.prototype.point=function _(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function _(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function _(a,$){assert$8(a.precomputed);var j=a._getDoubles(),et=getNAF($,1,this._bitLength),tt=(1<=nt;at--)it=(it<<1)+et[at];rt.push(it)}for(var st=this.jpoint(null,null,null),ot=this.jpoint(null,null,null),ut=tt;ut>0;ut--){for(nt=0;nt=0;it--){for(var at=0;it>=0&&rt[it]===0;it--)at++;if(it>=0&&at++,nt=nt.dblp(at),it<0)break;var st=rt[it];assert$8(st!==0),a.type==="affine"?st>0?nt=nt.mixedAdd(tt[st-1>>1]):nt=nt.mixedAdd(tt[-st-1>>1].neg()):st>0?nt=nt.add(tt[st-1>>1]):nt=nt.add(tt[-st-1>>1].neg())}return a.type==="affine"?nt.toP():nt};BaseCurve.prototype._wnafMulAdd=function _(a,$,j,et,tt){var rt=this._wnafT1,nt=this._wnafT2,it=this._wnafT3,at=0,st,ot,ut;for(st=0;st=1;st-=2){var mt=st-1,xt=st;if(rt[mt]!==1||rt[xt]!==1){it[mt]=getNAF(j[mt],rt[mt],this._bitLength),it[xt]=getNAF(j[xt],rt[xt],this._bitLength),at=Math.max(it[mt].length,at),at=Math.max(it[xt].length,at);continue}var Ct=[$[mt],null,null,$[xt]];$[mt].y.cmp($[xt].y)===0?(Ct[1]=$[mt].add($[xt]),Ct[2]=$[mt].toJ().mixedAdd($[xt].neg())):$[mt].y.cmp($[xt].y.redNeg())===0?(Ct[1]=$[mt].toJ().mixedAdd($[xt]),Ct[2]=$[mt].add($[xt].neg())):(Ct[1]=$[mt].toJ().mixedAdd($[xt]),Ct[2]=$[mt].toJ().mixedAdd($[xt].neg()));var Pt=[-3,-1,-5,-7,0,7,5,1,3],Tt=getJSF(j[mt],j[xt]);for(at=Math.max(Tt[0].length,at),it[mt]=new Array(at),it[xt]=new Array(at),ot=0;ot=0;st--){for(var jt=0;st>=0;){var Mt=!0;for(ot=0;ot=0&&jt++,Nt=Nt.dblp(jt),st<0)break;for(ot=0;ot0?ut=nt[ot][Dt-1>>1]:Dt<0&&(ut=nt[ot][-Dt-1>>1].neg()),ut.type==="affine"?Nt=Nt.mixedAdd(ut):Nt=Nt.add(ut))}}for(st=0;st=Math.ceil((a.bitLength()+1)/$.step):!1};BasePoint.prototype._getDoubles=function _(a,$){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var j=[this],et=this,tt=0;tt<$;tt+=a){for(var rt=0;rt=0&&(dt=at,mt=st),ot.negative&&(ot=ot.neg(),ut=ut.neg()),dt.negative&&(dt=dt.neg(),mt=mt.neg()),[{a:ot,b:ut},{a:dt,b:mt}]};ShortCurve.prototype._endoSplit=function _(a){var $=this.endo.basis,j=$[0],et=$[1],tt=et.b.mul(a).divRound(this.n),rt=j.b.neg().mul(a).divRound(this.n),nt=tt.mul(j.a),it=rt.mul(et.a),at=tt.mul(j.b),st=rt.mul(et.b),ot=a.sub(nt).sub(it),ut=at.add(st).neg();return{k1:ot,k2:ut}};ShortCurve.prototype.pointFromX=function _(a,$){a=new BN$6(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=j.redSqrt();if(et.redSqr().redSub(j).cmp(this.zero)!==0)throw new Error("invalid point");var tt=et.fromRed().isOdd();return($&&!tt||!$&&tt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve.prototype.validate=function _(a){if(a.inf)return!0;var $=a.x,j=a.y,et=this.a.redMul($),tt=$.redSqr().redMul($).redIAdd(et).redIAdd(this.b);return j.redSqr().redISub(tt).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function _(a,$,j){for(var et=this._endoWnafT1,tt=this._endoWnafT2,rt=0;rt":""};Point$2.prototype.isInfinity=function _(){return this.inf};Point$2.prototype.add=function _(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var $=this.y.redSub(a.y);$.cmpn(0)!==0&&($=$.redMul(this.x.redSub(a.x).redInvm()));var j=$.redSqr().redISub(this.x).redISub(a.x),et=$.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$2.prototype.dbl=function _(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var $=this.curve.a,j=this.x.redSqr(),et=a.redInvm(),tt=j.redAdd(j).redIAdd(j).redIAdd($).redMul(et),rt=tt.redSqr().redISub(this.x.redAdd(this.x)),nt=tt.redMul(this.x.redSub(rt)).redISub(this.y);return this.curve.point(rt,nt)};Point$2.prototype.getX=function _(){return this.x.fromRed()};Point$2.prototype.getY=function _(){return this.y.fromRed()};Point$2.prototype.mul=function _(a){return a=new BN$6(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$2.prototype.mulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt):this.curve._wnafMulAdd(1,et,tt,2)};Point$2.prototype.jmulAdd=function _(a,$,j){var et=[this,$],tt=[a,j];return this.curve.endo?this.curve._endoWnafMulAdd(et,tt,!0):this.curve._wnafMulAdd(1,et,tt,2,!0)};Point$2.prototype.eq=function _(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$2.prototype.neg=function _(a){if(this.inf)return this;var $=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var j=this.precomputed,et=function(tt){return tt.neg()};$.precomputed={naf:j.naf&&{wnd:j.naf.wnd,points:j.naf.points.map(et)},doubles:j.doubles&&{step:j.doubles.step,points:j.doubles.points.map(et)}}}return $};Point$2.prototype.toJ=function _(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint(_,a,$,j){Base$2.BasePoint.call(this,_,"jacobian"),a===null&&$===null&&j===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(a,16),this.y=new BN$6($,16),this.z=new BN$6(j,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits$2(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function _(a,$,j){return new JPoint(this,a,$,j)};JPoint.prototype.toP=function _(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),$=a.redSqr(),j=this.x.redMul($),et=this.y.redMul($).redMul(a);return this.curve.point(j,et)};JPoint.prototype.neg=function _(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function _(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var $=a.z.redSqr(),j=this.z.redSqr(),et=this.x.redMul($),tt=a.x.redMul(j),rt=this.y.redMul($.redMul(a.z)),nt=a.y.redMul(j.redMul(this.z)),it=et.redSub(tt),at=rt.redSub(nt);if(it.cmpn(0)===0)return at.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var st=it.redSqr(),ot=st.redMul(it),ut=et.redMul(st),dt=at.redSqr().redIAdd(ot).redISub(ut).redISub(ut),mt=at.redMul(ut.redISub(dt)).redISub(rt.redMul(ot)),xt=this.z.redMul(a.z).redMul(it);return this.curve.jpoint(dt,mt,xt)};JPoint.prototype.mixedAdd=function _(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var $=this.z.redSqr(),j=this.x,et=a.x.redMul($),tt=this.y,rt=a.y.redMul($).redMul(this.z),nt=j.redSub(et),it=tt.redSub(rt);if(nt.cmpn(0)===0)return it.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var at=nt.redSqr(),st=at.redMul(nt),ot=j.redMul(at),ut=it.redSqr().redIAdd(st).redISub(ot).redISub(ot),dt=it.redMul(ot.redISub(ut)).redISub(tt.redMul(st)),mt=this.z.redMul(nt);return this.curve.jpoint(ut,dt,mt)};JPoint.prototype.dblp=function _(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var $;if(this.curve.zeroA||this.curve.threeA){var j=this;for($=0;$=0)return!1;if(j.redIAdd(tt),this.x.cmp(j)===0)return!0}};JPoint.prototype.inspect=function _(){return this.isInfinity()?"":""};JPoint.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};var BN$5=bnExports$1,inherits$1=inherits_browserExports,Base$1=base,utils$9=utils$c;function MontCurve(_){Base$1.call(this,"mont",_),this.a=new BN$5(_.a,16).toRed(this.red),this.b=new BN$5(_.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$1(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function _(a){var $=a.normalize().x,j=$.redSqr(),et=j.redMul($).redAdd(j.redMul(this.a)).redAdd($),tt=et.redSqrt();return tt.redSqr().cmp(et)===0};function Point$1(_,a,$){Base$1.BasePoint.call(this,_,"projective"),a===null&&$===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(a,16),this.z=new BN$5($,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$1(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function _(a,$){return this.point(utils$9.toArray(a,$),1)};MontCurve.prototype.point=function _(a,$){return new Point$1(this,a,$)};MontCurve.prototype.pointFromJSON=function _(a){return Point$1.fromJSON(this,a)};Point$1.prototype.precompute=function _(){};Point$1.prototype._encode=function _(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function _(a,$){return new Point$1(a,$[0],$[1]||a.one)};Point$1.prototype.inspect=function _(){return this.isInfinity()?"":""};Point$1.prototype.isInfinity=function _(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function _(){var a=this.x.redAdd(this.z),$=a.redSqr(),j=this.x.redSub(this.z),et=j.redSqr(),tt=$.redSub(et),rt=$.redMul(et),nt=tt.redMul(et.redAdd(this.curve.a24.redMul(tt)));return this.curve.point(rt,nt)};Point$1.prototype.add=function _(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function _(a,$){var j=this.x.redAdd(this.z),et=this.x.redSub(this.z),tt=a.x.redAdd(a.z),rt=a.x.redSub(a.z),nt=rt.redMul(j),it=tt.redMul(et),at=$.z.redMul(nt.redAdd(it).redSqr()),st=$.x.redMul(nt.redISub(it).redSqr());return this.curve.point(at,st)};Point$1.prototype.mul=function _(a){for(var $=a.clone(),j=this,et=this.curve.point(null,null),tt=this,rt=[];$.cmpn(0)!==0;$.iushrn(1))rt.push($.andln(1));for(var nt=rt.length-1;nt>=0;nt--)rt[nt]===0?(j=j.diffAdd(et,tt),et=et.dbl()):(et=j.diffAdd(et,tt),j=j.dbl());return et};Point$1.prototype.mulAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function _(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function _(a){return this.getX().cmp(a.getX())===0};Point$1.prototype.normalize=function _(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};var utils$8=utils$c,BN$4=bnExports$1,inherits=inherits_browserExports,Base=base,assert$6=utils$8.assert;function EdwardsCurve(_){this.twisted=(_.a|0)!==1,this.mOneA=this.twisted&&(_.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",_),this.a=new BN$4(_.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(_.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(_.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$6(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(_.c|0)===1}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function _(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve.prototype._mulC=function _(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve.prototype.jpoint=function _(a,$,j,et){return this.point(a,$,j,et)};EdwardsCurve.prototype.pointFromX=function _(a,$){a=new BN$4(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=this.c2.redSub(this.a.redMul(j)),tt=this.one.redSub(this.c2.redMul(this.d).redMul(j)),rt=et.redMul(tt.redInvm()),nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");var it=nt.fromRed().isOdd();return($&&!it||!$&&it)&&(nt=nt.redNeg()),this.point(a,nt)};EdwardsCurve.prototype.pointFromY=function _(a,$){a=new BN$4(a,16),a.red||(a=a.toRed(this.red));var j=a.redSqr(),et=j.redSub(this.c2),tt=j.redMul(this.d).redMul(this.c2).redSub(this.a),rt=et.redMul(tt.redInvm());if(rt.cmp(this.zero)===0){if($)throw new Error("invalid point");return this.point(this.zero,a)}var nt=rt.redSqrt();if(nt.redSqr().redSub(rt).cmp(this.zero)!==0)throw new Error("invalid point");return nt.fromRed().isOdd()!==$&&(nt=nt.redNeg()),this.point(nt,a)};EdwardsCurve.prototype.validate=function _(a){if(a.isInfinity())return!0;a.normalize();var $=a.x.redSqr(),j=a.y.redSqr(),et=$.redMul(this.a).redAdd(j),tt=this.c2.redMul(this.one.redAdd(this.d.redMul($).redMul(j)));return et.cmp(tt)===0};function Point(_,a,$,j,et){Base.BasePoint.call(this,_,"projective"),a===null&&$===null&&j===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$4(a,16),this.y=new BN$4($,16),this.z=j?new BN$4(j,16):this.curve.one,this.t=et&&new BN$4(et,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function _(a){return Point.fromJSON(this,a)};EdwardsCurve.prototype.point=function _(a,$,j,et){return new Point(this,a,$,j,et)};Point.fromJSON=function _(a,$){return new Point(a,$[0],$[1],$[2])};Point.prototype.inspect=function _(){return this.isInfinity()?"":""};Point.prototype.isInfinity=function _(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function _(){var a=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr();j=j.redIAdd(j);var et=this.curve._mulA(a),tt=this.x.redAdd(this.y).redSqr().redISub(a).redISub($),rt=et.redAdd($),nt=rt.redSub(j),it=et.redSub($),at=tt.redMul(nt),st=rt.redMul(it),ot=tt.redMul(it),ut=nt.redMul(rt);return this.curve.point(at,st,ut,ot)};Point.prototype._projDbl=function _(){var a=this.x.redAdd(this.y).redSqr(),$=this.x.redSqr(),j=this.y.redSqr(),et,tt,rt,nt,it,at;if(this.curve.twisted){nt=this.curve._mulA($);var st=nt.redAdd(j);this.zOne?(et=a.redSub($).redSub(j).redMul(st.redSub(this.curve.two)),tt=st.redMul(nt.redSub(j)),rt=st.redSqr().redSub(st).redSub(st)):(it=this.z.redSqr(),at=st.redSub(it).redISub(it),et=a.redSub($).redISub(j).redMul(at),tt=st.redMul(nt.redSub(j)),rt=st.redMul(at))}else nt=$.redAdd(j),it=this.curve._mulC(this.z).redSqr(),at=nt.redSub(it).redSub(it),et=this.curve._mulC(a.redISub(nt)).redMul(at),tt=this.curve._mulC(nt).redMul($.redISub(j)),rt=nt.redMul(at);return this.curve.point(et,tt,rt)};Point.prototype.dbl=function _(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function _(a){var $=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),j=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),tt=this.z.redMul(a.z.redAdd(a.z)),rt=j.redSub($),nt=tt.redSub(et),it=tt.redAdd(et),at=j.redAdd($),st=rt.redMul(nt),ot=it.redMul(at),ut=rt.redMul(at),dt=nt.redMul(it);return this.curve.point(st,ot,dt,ut)};Point.prototype._projAdd=function _(a){var $=this.z.redMul(a.z),j=$.redSqr(),et=this.x.redMul(a.x),tt=this.y.redMul(a.y),rt=this.curve.d.redMul(et).redMul(tt),nt=j.redSub(rt),it=j.redAdd(rt),at=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(tt),st=$.redMul(nt).redMul(at),ot,ut;return this.curve.twisted?(ot=$.redMul(it).redMul(tt.redSub(this.curve._mulA(et))),ut=nt.redMul(it)):(ot=$.redMul(it).redMul(tt.redSub(et)),ut=this.curve._mulC(nt).redMul(it)),this.curve.point(st,ot,ut)};Point.prototype.add=function _(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point.prototype.mul=function _(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point.prototype.mulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!1)};Point.prototype.jmulAdd=function _(a,$,j){return this.curve._wnafMulAdd(1,[this,$],[a,j],2,!0)};Point.prototype.normalize=function _(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function _(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function _(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function _(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function _(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point.prototype.eqXToP=function _(a){var $=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp($)===0)return!0;for(var j=a.clone(),et=this.curve.redN.redMul(this.z);;){if(j.iadd(this.curve.n),j.cmp(this.curve.p)>=0)return!1;if($.redIAdd(et),this.x.cmp($)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(_){var a=_;a.base=base,a.short=short,a.mont=mont,a.edwards=edwards})(curve);var curves$2={},secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1}(function(_){var a=_,$=hash$8,j=curve,et=utils$c,tt=et.assert;function rt(at){at.type==="short"?this.curve=new j.short(at):at.type==="edwards"?this.curve=new j.edwards(at):this.curve=new j.mont(at),this.g=this.curve.g,this.n=this.curve.n,this.hash=at.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=rt;function nt(at,st){Object.defineProperty(a,at,{configurable:!0,enumerable:!0,get:function(){var ot=new rt(st);return Object.defineProperty(a,at,{configurable:!0,enumerable:!0,value:ot}),ot}})}nt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:$.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),nt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:$.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),nt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:$.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),nt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:$.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),nt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:$.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),nt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["9"]}),nt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:$.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var it;try{it=requireSecp256k1()}catch{it=void 0}nt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:$.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",it]})})(curves$2);var BN$3=bnExports$1,utils$7=utils$c,assert$5=utils$7.assert;function KeyPair$3(_,a){this.ec=_,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function _(a,$,j){return $ instanceof KeyPair$3?$:new KeyPair$3(a,{pub:$,pubEnc:j})};KeyPair$3.fromPrivate=function _(a,$,j){return $ instanceof KeyPair$3?$:new KeyPair$3(a,{priv:$,privEnc:j})};KeyPair$3.prototype.validate=function _(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$3.prototype.getPublic=function _(a,$){return typeof a=="string"&&($=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),$?this.pub.encode($,a):this.pub};KeyPair$3.prototype.getPrivate=function _(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$3.prototype._importPrivate=function _(a,$){this.priv=new BN$3(a,$||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$3.prototype._importPublic=function _(a,$){if(a.x||a.y){this.ec.curve.type==="mont"?assert$5(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$5(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,$)};KeyPair$3.prototype.derive=function _(a){return a.validate()||assert$5(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$3.prototype.sign=function _(a,$,j){return this.ec.sign(a,this,$,j)};KeyPair$3.prototype.verify=function _(a,$){return this.ec.verify(a,$,this)};KeyPair$3.prototype.inspect=function _(){return""};var BN$2=bnExports$1,utils$6=utils$c,assert$4=utils$6.assert;function Signature$3(_,a){if(_ instanceof Signature$3)return _;this._importDER(_,a)||(assert$4(_.r&&_.s,"Signature without r or s"),this.r=new BN$2(_.r,16),this.s=new BN$2(_.s,16),_.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=_.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(_,a){var $=_[a.place++];if(!($&128))return $;var j=$&15;if(j===0||j>4)return!1;for(var et=0,tt=0,rt=a.place;tt>>=0;return et<=127?!1:(a.place=rt,et)}function rmPadding(_){for(var a=0,$=_.length-1;!_[a]&&!(_[a+1]&128)&&a<$;)a++;return a===0?_:_.slice(a)}Signature$3.prototype._importDER=function _(a,$){a=utils$6.toArray(a,$);var j=new Position;if(a[j.place++]!==48)return!1;var et=getLength(a,j);if(et===!1||et+j.place!==a.length||a[j.place++]!==2)return!1;var tt=getLength(a,j);if(tt===!1)return!1;var rt=a.slice(j.place,tt+j.place);if(j.place+=tt,a[j.place++]!==2)return!1;var nt=getLength(a,j);if(nt===!1||a.length!==nt+j.place)return!1;var it=a.slice(j.place,nt+j.place);if(rt[0]===0)if(rt[1]&128)rt=rt.slice(1);else return!1;if(it[0]===0)if(it[1]&128)it=it.slice(1);else return!1;return this.r=new BN$2(rt),this.s=new BN$2(it),this.recoveryParam=null,!0};function constructLength(_,a){if(a<128){_.push(a);return}var $=1+(Math.log(a)/Math.LN2>>>3);for(_.push($|128);--$;)_.push(a>>>($<<3)&255);_.push(a)}Signature$3.prototype.toDER=function _(a){var $=this.r.toArray(),j=this.s.toArray();for($[0]&128&&($=[0].concat($)),j[0]&128&&(j=[0].concat(j)),$=rmPadding($),j=rmPadding(j);!j[0]&&!(j[1]&128);)j=j.slice(1);var et=[2];constructLength(et,$.length),et=et.concat($),et.push(2),constructLength(et,j.length);var tt=et.concat(j),rt=[48];return constructLength(rt,tt.length),rt=rt.concat(tt),utils$6.encode(rt,a)};var BN$1=bnExports$1,HmacDRBG=hmacDrbg,utils$5=utils$c,curves$1=curves$2,rand=requireBrorand(),assert$3=utils$5.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC(_){if(!(this instanceof EC))return new EC(_);typeof _=="string"&&(assert$3(Object.prototype.hasOwnProperty.call(curves$1,_),"Unknown curve "+_),_=curves$1[_]),_ instanceof curves$1.PresetCurve&&(_={curve:_}),this.curve=_.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=_.curve.g,this.g.precompute(_.curve.n.bitLength()+1),this.hash=_.hash||_.curve.hash}var ec$1=EC;EC.prototype.keyPair=function _(a){return new KeyPair$2(this,a)};EC.prototype.keyFromPrivate=function _(a,$){return KeyPair$2.fromPrivate(this,a,$)};EC.prototype.keyFromPublic=function _(a,$){return KeyPair$2.fromPublic(this,a,$)};EC.prototype.genKeyPair=function _(a){a||(a={});for(var $=new HmacDRBG({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),j=this.n.byteLength(),et=this.n.sub(new BN$1(2));;){var tt=new BN$1($.generate(j));if(!(tt.cmp(et)>0))return tt.iaddn(1),this.keyFromPrivate(tt)}};EC.prototype._truncateToN=function _(a,$){var j=a.byteLength()*8-this.n.bitLength();return j>0&&(a=a.ushrn(j)),!$&&a.cmp(this.n)>=0?a.sub(this.n):a};EC.prototype.sign=function _(a,$,j,et){typeof j=="object"&&(et=j,j=null),et||(et={}),$=this.keyFromPrivate($,j),a=this._truncateToN(new BN$1(a,16));for(var tt=this.n.byteLength(),rt=$.getPrivate().toArray("be",tt),nt=a.toArray("be",tt),it=new HmacDRBG({hash:this.hash,entropy:rt,nonce:nt,pers:et.pers,persEnc:et.persEnc||"utf8"}),at=this.n.sub(new BN$1(1)),st=0;;st++){var ot=et.k?et.k(st):new BN$1(it.generate(this.n.byteLength()));if(ot=this._truncateToN(ot,!0),!(ot.cmpn(1)<=0||ot.cmp(at)>=0)){var ut=this.g.mul(ot);if(!ut.isInfinity()){var dt=ut.getX(),mt=dt.umod(this.n);if(mt.cmpn(0)!==0){var xt=ot.invm(this.n).mul(mt.mul($.getPrivate()).iadd(a));if(xt=xt.umod(this.n),xt.cmpn(0)!==0){var Ct=(ut.getY().isOdd()?1:0)|(dt.cmp(mt)!==0?2:0);return et.canonical&&xt.cmp(this.nh)>0&&(xt=this.n.sub(xt),Ct^=1),new Signature$2({r:mt,s:xt,recoveryParam:Ct})}}}}}};EC.prototype.verify=function _(a,$,j,et){a=this._truncateToN(new BN$1(a,16)),j=this.keyFromPublic(j,et),$=new Signature$2($,"hex");var tt=$.r,rt=$.s;if(tt.cmpn(1)<0||tt.cmp(this.n)>=0||rt.cmpn(1)<0||rt.cmp(this.n)>=0)return!1;var nt=rt.invm(this.n),it=nt.mul(a).umod(this.n),at=nt.mul(tt).umod(this.n),st;return this.curve._maxwellTrick?(st=this.g.jmulAdd(it,j.getPublic(),at),st.isInfinity()?!1:st.eqXToP(tt)):(st=this.g.mulAdd(it,j.getPublic(),at),st.isInfinity()?!1:st.getX().umod(this.n).cmp(tt)===0)};EC.prototype.recoverPubKey=function(_,a,$,j){assert$3((3&$)===$,"The recovery param is more than two bits"),a=new Signature$2(a,j);var et=this.n,tt=new BN$1(_),rt=a.r,nt=a.s,it=$&1,at=$>>1;if(rt.cmp(this.curve.p.umod(this.curve.n))>=0&&at)throw new Error("Unable to find sencond key candinate");at?rt=this.curve.pointFromX(rt.add(this.curve.n),it):rt=this.curve.pointFromX(rt,it);var st=a.r.invm(et),ot=et.sub(tt).mul(st).umod(et),ut=nt.mul(st).umod(et);return this.g.mulAdd(ot,rt,ut)};EC.prototype.getKeyRecoveryParam=function(_,a,$,j){if(a=new Signature$2(a,j),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var tt;try{tt=this.recoverPubKey(_,a,et)}catch{continue}if(tt.eq($))return et}throw new Error("Unable to find valid recovery factor")};var utils$4=utils$c,assert$2=utils$4.assert,parseBytes$2=utils$4.parseBytes,cachedProperty$1=utils$4.cachedProperty;function KeyPair$1(_,a){this.eddsa=_,this._secret=parseBytes$2(a.secret),_.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$2(a.pub)}KeyPair$1.fromPublic=function _(a,$){return $ instanceof KeyPair$1?$:new KeyPair$1(a,{pub:$})};KeyPair$1.fromSecret=function _(a,$){return $ instanceof KeyPair$1?$:new KeyPair$1(a,{secret:$})};KeyPair$1.prototype.secret=function _(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function _(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function _(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function _(){var a=this.eddsa,$=this.hash(),j=a.encodingLength-1,et=$.slice(0,a.encodingLength);return et[0]&=248,et[j]&=127,et[j]|=64,et});cachedProperty$1(KeyPair$1,"priv",function _(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function _(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function _(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function _(a){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$1.prototype.verify=function _(a,$){return this.eddsa.verify(a,$,this)};KeyPair$1.prototype.getSecret=function _(a){return assert$2(this._secret,"KeyPair is public only"),utils$4.encode(this.secret(),a)};KeyPair$1.prototype.getPublic=function _(a){return utils$4.encode(this.pubBytes(),a)};var key=KeyPair$1,BN=bnExports$1,utils$3=utils$c,assert$1=utils$3.assert,cachedProperty=utils$3.cachedProperty,parseBytes$1=utils$3.parseBytes;function Signature$1(_,a){this.eddsa=_,typeof a!="object"&&(a=parseBytes$1(a)),Array.isArray(a)&&(a={R:a.slice(0,_.encodingLength),S:a.slice(_.encodingLength)}),assert$1(a.R&&a.S,"Signature without R or S"),_.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty(Signature$1,"S",function _(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function _(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function _(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function _(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function _(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function _(){return utils$3.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash=hash$8,curves=curves$2,utils$2=utils$c,assert=utils$2.assert,parseBytes=utils$2.parseBytes,KeyPair=key,Signature=signature;function EDDSA(_){if(assert(_==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(_);_=curves[_].curve,this.curve=_,this.g=_.g,this.g.precompute(_.n.bitLength()+1),this.pointClass=_.point().constructor,this.encodingLength=Math.ceil(_.n.bitLength()/8),this.hash=hash.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function _(a,$){a=parseBytes(a);var j=this.keyFromSecret($),et=this.hashInt(j.messagePrefix(),a),tt=this.g.mul(et),rt=this.encodePoint(tt),nt=this.hashInt(rt,j.pubBytes(),a).mul(j.priv()),it=et.add(nt).umod(this.curve.n);return this.makeSignature({R:tt,S:it,Rencoded:rt})};EDDSA.prototype.verify=function _(a,$,j){a=parseBytes(a),$=this.makeSignature($);var et=this.keyFromPublic(j),tt=this.hashInt($.Rencoded(),et.pubBytes(),a),rt=this.g.mul($.S()),nt=$.R().add(et.pub().mul(tt));return nt.eq(rt)};EDDSA.prototype.hashInt=function _(){for(var a=this.hash(),$=0;$_.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:at}=nt,st=at||{},{instanceParams:ot,hashParams:{access_token:ut,id_token:dt}}=st,mt=_objectWithoutProperties(st.hashParams,_excluded$2);if(it){log.error(nt),et(new Error(`Error: ${it}. Info: ${JSON.stringify(nt.data||{})}`));return}nt.data&&ot.verifier===this.verifier&&(log.info(nt.data),!this.redirectToOpener&&tt&&await tt.postMessage({success:!0}),j(_objectSpread2(_objectSpread2({accessToken:ut,idToken:dt||""},mt),{},{state:ot})))}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 at=it.data;at.channel===`redirect_channel_${this.nonce}`&&(window.removeEventListener("message",nt),rt(at),$.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),at=await get$2(`${padUrlString(it)}${nt}`,{headers:{Authorization:`Bearer ${j}`}}),{picture:st,name:ot,email:ut}=at;return{email:ut,name:ot,profileImage:st,verifierId:getVerifierId(at,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:at,email:st,picture:ot}=it;return{profileImage:ot,name:at,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),at=await get$2(`${padUrlString(it)}${nt}`,{headers:{Authorization:`Bearer ${j}`}}),{picture:st,name:ot,email:ut}=at;return{email:ut,name:ot,profileImage:st,verifierId:getVerifierId(at,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:at,email:st,picture:ot}=it;return{profileImage:ot,name:at,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:at,name:st,email:ot}=it;return{email:ot,name:st,profileImage:at,verifierId:getVerifierId(it,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}catch(nt){log.error(nt);const it=o($),{name:at,email:st,picture:ot}=it;return{profileImage:ot,name:at,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:at,hashParams:{access_token:st,id_token:ot}}=it,ut=_objectWithoutProperties(it.hashParams,_excluded$1);if(rt){log.error(tt.error),$(new Error(rt));return}tt.data&&at.verifier===this.verifier&&(log.info(tt.data),a(_objectSpread2(_objectSpread2({accessToken:st,idToken:ot||""},ut),{},{state:at})))}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,at){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=at,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,at,st,ot,ut,dt,mt;if(et==="true"){log.debug("extraParamsPassed is true, using extraParams passed through hashParams");try{({verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:at,publicKey:st,challenge:ot,rpOrigin:ut,credId:dt,transports:mt}=JSON.parse(base64url.decode(tt)))}catch(xt){log.warn("unable to parse extraParams",xt),{verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:at,publicKey:st,challenge:ot,rpOrigin:ut,credId:dt,transports:mt}=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:at,publicKey:st,challenge:ot,rpOrigin:ut,credId:dt,transports:mt}=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:at,publicKey:st,challenge:ot,rpOrigin:ut,credId:dt,transports:mt}}}}const createHandler=_=>{let{clientId:a,redirect_uri:$,typeOfLogin:j,verifier:et,jwtParams:tt,redirectToOpener:rt,uxMode:nt,customState:it,registerOnly:at}=_;if(!et||!j||!a)throw new Error("Invalid params");const{domain:st,login_hint:ot,id_token:ut,access_token:dt}=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||!ot)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||dt)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,at);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:at=!1,popupFeatures:st,storageServerUrl:ot="https://broadcast-server.tor.us",sentry:ut,enableOneKey:dt=!1,web3AuthClientId:mt,metadataUrl:xt="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),!mt)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 Ct=new URL($);this.config={baseUrl:padUrlString(Ct),get redirect_uri(){return`${this.baseUrl}${rt}`},redirectToOpener:tt,uxMode:it,locationReplaceOnRedirect:at,popupFeatures:st};const Pt=new Torus({network:j,clientId:mt,enableOneKey:dt,legacyMetadataHost:xt});Torus.setAPIKey(nt),this.torus=Pt,this.nodeDetailManager=new NodeDetailManager({network:j}),et?log.enableAll():log.disableAll(),this.storageHelper=new StorageHelper(ot),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:at}=a;if(log.info("Verifier: ",$),!this.isInitialized)throw new Error("Not initialized yet");if(at&&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:at});let ot;if(rt&&nt){const{error:mt,hashParameters:xt,instanceParameters:Ct}=handleRedirectParameters(rt,nt);if(mt)throw new Error(mt);const{access_token:Pt,id_token:Tt}=xt,kt=_objectWithoutProperties(xt,_excluded);ot=_objectSpread2(_objectSpread2({accessToken:Pt,idToken:Tt},kt),{},{state:Ct})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_LOGIN,args:a},st.nonce),ot=await st.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const ut=await st.getUserInfo(ot);if(at){const mt=this.sentryHandler.startTransaction({name:SENTRY_TXNS.FETCH_NODE_DETAILS}),xt=await this.nodeDetailManager.getNodeDetails({verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(mt);const Ct=this.sentryHandler.startTransaction({name:SENTRY_TXNS.PUB_ADDRESS_LOOKUP}),Pt=await this.torus.getPublicAddress(xt.torusNodeEndpoints,xt.torusNodePub,{verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(Ct);const Tt={userInfo:_objectSpread2(_objectSpread2({},ut),ot)};return _objectSpread2(_objectSpread2(_objectSpread2({},Tt),Pt),{},{finalKeyData:_objectSpread2(_objectSpread2({},Pt.finalKeyData),{},{privKey:void 0}),oAuthKeyData:_objectSpread2(_objectSpread2({},Pt.finalKeyData),{},{privKey:void 0}),metadata:_objectSpread2(_objectSpread2({},Pt.metadata),{},{nonce:void 0}),sessionData:void 0})}const dt=await this.getTorusKey($,ut.verifierId,{verifier_id:ut.verifierId},ot.idToken||ot.accessToken,ut.extraVerifierParams);return _objectSpread2(_objectSpread2({},dt),{},{userInfo:_objectSpread2(_objectSpread2({},ut),ot)})}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 xt of et){const{clientId:Ct,typeOfLogin:Pt,verifier:Tt,jwtParams:kt,hash:Lt,queryParameters:Nt,customState:zt}=xt,jt=createHandler({typeOfLogin:Pt,clientId:Ct,verifier:Tt,redirect_uri:this.config.redirect_uri,redirectToOpener:this.config.redirectToOpener,jwtParams:kt,uxMode:this.config.uxMode,customState:zt});let Mt;if(Lt&&Nt){const{error:Dt,hashParameters:Ft,instanceParameters:Bt}=handleRedirectParameters(Lt,Nt);if(Dt)throw new Error(Dt);const{access_token:yt,id_token:bt}=Ft,ct=_objectWithoutProperties(Ft,_excluded2);Mt=_objectSpread2(_objectSpread2({accessToken:yt,idToken:bt},ct),{},{state:Bt})}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),Mt=await jt.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;tt.push(jt.getUserInfo(Mt)),rt.push(Mt)}const it=(await Promise.all(tt)).map(xt=>_objectSpread2(_objectSpread2({},xt),{},{aggregateVerifier:j})),at={verify_params:[],sub_verifier_ids:[],verifier_id:""},st=[];let ot="",ut={};for(let xt=0;xt_objectSpread2(_objectSpread2({},xt),rt[Ct]))})}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:at,customState:st}=$,ot=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&&at){const{error:Mt,hashParameters:Dt,instanceParameters:Ft}=handleRedirectParameters(it,at);if(Mt)throw new Error(Mt);const{access_token:Bt,id_token:yt}=Dt,bt=_objectWithoutProperties(Dt,_excluded3);ut=_objectSpread2(_objectSpread2({accessToken:Bt,idToken:yt},bt),{},{state:Ft})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN,args:a},ot.nonce),ut=await ot.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const dt=await ot.getUserInfo(ut),mt=this.getTorusKey(rt,dt.verifierId,{verifier_id:dt.verifierId},ut.idToken||ut.accessToken,dt.extraVerifierParams),{verifierIdentifier:xt,subVerifierDetailsArray:Ct}=j,Pt={verify_params:[],sub_verifier_ids:[],verifier_id:""},Tt=[];let kt="";for(let Mt=0;Mt0&&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((xt,Ct)=>{tt[Ct]=xt}),a){const xt=window.location.origin+window.location.pathname;window.history.replaceState(_objectSpread2(_objectSpread2({},window.history.state),{},{as:xt,url:xt}),"",xt)}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:at}=nt;log.info(at,"instanceId");const st=await this.storageHelper.retrieveLoginDetails(at),{args:ot,method:ut}=st,dt=_objectWithoutProperties(st,_excluded4);if(log.info(ot,ut),$&&this.storageHelper.clearLoginDetailsStorage(at),rt)return{error:rt,state:nt||{},method:ut,result:{},hashParameters:it,args:ot};let mt;try{if(ut===TORUS_METHOD.TRIGGER_LOGIN){const xt=ot;xt.hash=et,xt.queryParameters=tt,mt=await this.triggerLogin(xt)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN){const xt=ot;xt.subVerifierDetailsArray.forEach(Ct=>{Ct.hash=et,Ct.queryParameters=tt}),mt=await this.triggerAggregateLogin(xt)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN){const xt=ot;xt.singleLogin.hash=et,xt.singleLogin.queryParameters=tt,mt=await this.triggerHybridAggregateLogin(xt)}}catch(xt){return log.error(xt),_objectSpread2({error:`Could not get result from torus nodes + ${(xt==null?void 0:xt.message)||""}`,state:nt||{},method:ut,result:{},hashParameters:it,args:ot},dt)}return _objectSpread2(mt?{method:ut,result:mt,state:nt||{},hashParameters:it,args:ot}:{error:"Unsupported method type",state:nt||{},method:ut,result:{},hashParameters:it,args:ot},dt)}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,at]=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:()=>at(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:at}}=rt;let st=useSelectedNetwork();tt&&(st=tt);const ot=useGetSecretKey(),ut=useToast(),{isLoading:dt,handleAsyncAction:mt}=useAsyncActionHandler(),xt=dt||$,Ct=async({password:Lt})=>mt(async()=>{const Nt=await ot(_,Lt);return a(await makeToolkit({type:"mnemonic",secretKey:Nt,network:st}))}),Pt=async({password:Lt})=>mt(async()=>{const Nt=await ot(_,Lt);return a(await makeToolkit({type:"secret_key",secretKey:Nt,network:st}))}),Tt=async()=>mt(async()=>{const{secretKey:Lt}=await forIDP(_.idp).getCredentials();return a(await makeToolkit({type:"social",secretKey:Lt,network:st}))}),kt=async()=>mt(async()=>(ut({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}))),Lt=>({description:`${Lt.message} Please connect your ledger, open Tezos app and try submitting transaction again`,status:"error"})).finally(()=>ut.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:j||!at,isLoading:xt,onClick:nt(_.type==="mnemonic"?Ct:Pt),size:"lg",type:"submit",children:et||"Submit Transaction"})]})});case"social":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:xt,onClick:Tt,size:"lg",children:et||"Sign with social"});case"ledger":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:xt,onClick:kt,size:"lg",children:et||"Sign with Ledger"})}},SignPayloadRequestModal=({request:_})=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),j=useGetImplicitAccount()(_.sourceAddress),et=useToast(),tt=useRemovePeerBySenderId(),rt=()=>{tt(_.senderId),WalletClient.respond({id:_.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.ABORTED_ERROR})},nt=async it=>{const at=await it.signer.sign(_.payload),st={type:BeaconMessageType.SignPayloadResponse,id:_.id,signingType:_.signingType,signature:at.prefixSig};await WalletClient.respond(st),et({description:"Successfully submitted Beacon operation",status:"success"}),a()};return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalHeader,{marginBottom:"32px",textAlign:"center",children:"Connect with pairing request"}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:rt}),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:nt,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})]})]}),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();return{isSigning:$,onSign:async nt=>j(async()=>{const{opHash:it}=await executeOperations(_,nt),at={type:BeaconMessageType.OperationResponse,id:a.id,transactionHash:it};return await WalletClient.respond(at),et(jsxRuntimeExports.jsx(SuccessStep,{hash:it}))},it=>({description:`Failed to confirm Beacon operation: ${it.message}`})),network:tt(a.network.type)}},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:_,fee:a,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(_,$),{signer:rt}=_,nt=_.operations.length;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,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:$.operationDetails})})]})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"16px",children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:rt.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:nt})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:a})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:rt,text:headerText(_.type,"batch")})})]})})},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:_,fee:a,message:$})=>{const{amount:j,contract:et,entrypoint:tt,args:rt}=_.operations[0],{isSigning:nt,onSign:it,network:at}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:a})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:et}),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:tt,values:rt}})})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:nt,network:at,onSubmit:it,signer:_.signer,text:headerText(_.type,"single")})})]})})},DelegationSignPage=({operation:_,fee:a,message:$})=>{const{recipient:j}=_.operations[0],{isSigning:et,onSign:tt,network:rt}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,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:a})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:j})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:et,network:rt,onSubmit:tt,signer:_.signer,text:headerText(_.type,"single")})})]})})},OriginationOperationSignPage=({operation:_,fee:a,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(_,$),{code:rt,storage:nt}=_.operations[0];return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalHeader,{marginBottom:"24px",children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",children:"Operation Request"}),jsxRuntimeExports.jsxs(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:[$.appMetadata.name," is requesting permission to sign this operation."]}),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($.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:$.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:$.appMetadata.name})]}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:a})}),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: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:"Storage"}),jsxRuntimeExports.jsx(AccordionIcon,{})]}),jsxRuntimeExports.jsx(AccordionPanel,{overflowY:"auto",maxHeight:"300px",children:jsxRuntimeExports.jsx(JsValueWrap,{value:nt})})]})})]}),jsxRuntimeExports.jsx(ModalFooter,{padding:"16px 0 0 0",children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:_.signer,text:headerText(_.type,"single")})})]})},TezSignPage=({operation:_,fee:a,message:$})=>{const{amount:j,recipient:et}=_.operations[0],{isSigning:tt,onSign:rt,network:nt}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:a})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:_.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:et})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:tt,network:nt,onSubmit:rt,signer:_.signer,text:headerText(_.type,"single")})})]})})},UndelegationSignPage=({operation:_,fee:a,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(_,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,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:a})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:_.signer,text:headerText(_.type,"single")})})]})})},BeaconSignPage=({operation:_,fee:a,message:$})=>{switch(_.operations[0].type){case"tez":return jsxRuntimeExports.jsx(TezSignPage,{fee:a,message:$,operation:_});case"contract_call":return jsxRuntimeExports.jsx(ContractCallSignPage,{fee:a,message:$,operation:_});case"delegation":return jsxRuntimeExports.jsx(DelegationSignPage,{fee:a,message:$,operation:_});case"undelegation":return jsxRuntimeExports.jsx(UndelegationSignPage,{fee:a,message:$,operation:_});case"contract_origination":return jsxRuntimeExports.jsx(OriginationOperationSignPage,{fee:a,message:$,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 at=toAccountOperations(tt.operationDetails,it),st=await estimate(at,nt);at.operations.length===1?rt=jsxRuntimeExports.jsx(BeaconSignPage,{fee:st,message:tt,operation:at}):rt=jsxRuntimeExports.jsx(BatchSignPage,{fee:st,message:tt,operation:at});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,at,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=(at=$.locale)==null?void 0:at.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,ot=>ot.test(rt)):findKey(nt,ot=>ot.test(rt));let at;at=_.valueCallback?_.valueCallback(it):it,at=$.valueCallback?$.valueCallback(at):at;const st=a.slice(rt.length);return{value:at,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,ot,ut,dt;const $=toDate(_),j=$.getFullYear(),et=getDefaultOptions(),tt=(a==null?void 0:a.firstWeekContainsDate)??((ot=(st=a==null?void 0:a.locale)==null?void 0:st.options)==null?void 0:ot.firstWeekContainsDate)??et.firstWeekContainsDate??((dt=(ut=et.locale)==null?void 0:ut.options)==null?void 0:dt.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 at=startOfWeek(it,a);return $.getTime()>=nt.getTime()?j+1:$.getTime()>=at.getTime()?j:j-1}function startOfWeekYear(_,a){var nt,it,at,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=(at=$.locale)==null?void 0:at.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,ot,ut,dt,mt,xt,Ct,Pt;const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=($==null?void 0:$.firstWeekContainsDate)??((ot=(st=$==null?void 0:$.locale)==null?void 0:st.options)==null?void 0:ot.firstWeekContainsDate)??j.firstWeekContainsDate??((dt=(ut=j.locale)==null?void 0:ut.options)==null?void 0:dt.firstWeekContainsDate)??1,rt=($==null?void 0:$.weekStartsOn)??((xt=(mt=$==null?void 0:$.locale)==null?void 0:mt.options)==null?void 0:xt.weekStartsOn)??j.weekStartsOn??((Pt=(Ct=j.locale)==null?void 0:Ct.options)==null?void 0:Pt.weekStartsOn)??0,nt=toDate(_);if(!isValid(nt))throw new RangeError("Invalid time value");let it=a.match(longFormattingTokensRegExp).map(Tt=>{const kt=Tt[0];if(kt==="p"||kt==="P"){const Lt=longFormatters[kt];return Lt(Tt,et.formatLong)}return Tt}).join("").match(formattingTokensRegExp).map(Tt=>{if(Tt==="''")return{isToken:!1,value:"'"};const kt=Tt[0];if(kt==="'")return{isToken:!1,value:cleanEscapedString(Tt)};if(formatters[kt])return{isToken:!0,value:Tt};if(kt.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+kt+"`");return{isToken:!1,value:Tt}});et.localize.preprocessor&&(it=et.localize.preprocessor(nt,it));const at={firstWeekContainsDate:tt,weekStartsOn:rt,locale:et};return it.map(Tt=>{if(!Tt.isToken)return Tt.value;const kt=Tt.value;(!($!=null&&$.useAdditionalWeekYearTokens)&&isProtectedWeekYearToken(kt)||!($!=null&&$.useAdditionalDayOfYearTokens)&&isProtectedDayOfYearToken(kt))&&warnOrThrowProtectedError(kt,a,String(_));const Lt=formatters[kt[0]];return Lt(nt,kt,et.localize,at)}).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,at;rt>0?(it=toDate(a),at=toDate(_)):(it=toDate(_),at=toDate(a));const st=differenceInSeconds(at,it),ot=(getTimezoneOffsetInMilliseconds(at)-getTimezoneOffsetInMilliseconds(it))/1e3,ut=Math.round((st-ot)/60);let dt;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:at})=>({...it,lastLevel:at}));_(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 at=$||et||rt||it,st=Math.max(a,j,tt,nt);reactExports.useEffect(()=>{_(assetsActions.setIsLoading(at)),!at&&st&&_(assetsActions.setLastTimeUpdated(fromUnixTime(Math.round(st/1e3)).toUTCString()))},[_,at,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 at=new URL(nt).searchParams.get("data");at?$.current(at):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 Pt=>{isValidContractPkh(Pt.pkh)?await a(async()=>{const Tt=await getNetworksForContracts(tt,[Pt.pkh]);if(!Tt.has(Pt.pkh))throw new Error(`Network not found for contract ${Pt.pkh}`);$(contactsActions.upsert({...Pt,network:Tt.get(Pt.pkh)}))}):$(contactsActions.upsert({...Pt,network:void 0})),et(),ut()},{handleSubmit:it,formState:{isValid:at,errors:st},register:ot,reset:ut}=useForm({mode:"onBlur",defaultValues:_}),dt=({name:Pt,pkh:Tt})=>{nt({name:Pt.trim(),pkh:Tt})},mt=reactExports.useRef(ut);reactExports.useEffect(()=>{j&&mt.current(_)},[j,_]);const xt=useValidateNewContactPkh(),Ct=useValidateName(_==null?void 0:_.name);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(dt),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",...ot("name",{required:"Name is required",validate:Ct}),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",...ot("pkh",{required:"Address is required",validate:rt?()=>!0:xt}),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:!at,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}},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}}},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,et]=reactExports.useState(!1),tt=useGetImplicitAccount(),[rt,nt]=reactExports.useState(_),[it,at]=reactExports.useState(a),st=useSelectedNetwork(),ot=useClearBatch(),{isLoading:ut,handleAsyncAction:dt,handleAsyncActionUnsafe:mt}=useAsyncActionHandler(),{openWith:xt}=reactExports.useContext(DynamicModalContext),Ct=useForm({mode:"onBlur",defaultValues:{signer:it.signer.address.pkh,sender:it.sender.address.pkh}}),Pt=Ct.watch("signer"),Tt=async Lt=>mt(async()=>{const Nt={...it,signer:tt(Lt)};nt(await estimate(it,st)),at(Nt),et(!1)},{isClosable:!0,duration:null}).catch(()=>et(!0)),kt=async Lt=>dt(async()=>{const Nt=await executeOperations(it,Lt);return $==="batch"&&ot(it.sender),await xt(jsxRuntimeExports.jsx(SuccessStep,{hash:Nt.opHash})),Nt});return{fee:rt,estimationFailed:j,operations:it,isLoading:ut,form:Ct,signer:tt(Pt),reEstimate:Tt,onSign:kt}},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,SignPage$6=_=>{const{mode:a,operations:$,fee:j}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:at,reEstimate:st,onSign:ot}=useSignPageHelpers(j,$,a),{amount:ut,recipient:dt}=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(TezTile,{mutezAmount:ut}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:tt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"To "}),jsxRuntimeExports.jsx(AddressTile,{address:dt}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ot,signer:at,text:headerText(tt.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 at=rt(it);return tt(jsxRuntimeExports.jsx(_,{data:a,fee:await estimate(at,nt),goBack:()=>tt(jsxRuntimeExports.jsx($,{...j,form:it})),mode:"single",operations:at}))}},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:at},register:st,handleSubmit:ot}=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:!!at.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})]}),at.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:at.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!at.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!a.sender,label:"From"}),at.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:at.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!at.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),at.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:at.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ot(tt),onSingleSubmit:ot(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 ot=setTimeout(()=>et(!1),2e3),ut=setTimeout(()=>rt(!1),3500);return()=>{clearTimeout(ot),clearTimeout(ut)}},[$]),nt||$===null)return null;const it=()=>{_(assetsActions.refetch())},at=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",at&&`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(xt){return typeof xt=="string"?new RegExp("^"+xt+"$","i"):xt}function it(xt,Ct){return xt===Ct?Ct:xt===xt.toLowerCase()?Ct.toLowerCase():xt===xt.toUpperCase()?Ct.toUpperCase():xt[0]===xt[0].toUpperCase()?Ct.charAt(0).toUpperCase()+Ct.substr(1).toLowerCase():Ct.toLowerCase()}function at(xt,Ct){return xt.replace(/\$(\d{1,2})/g,function(Pt,Tt){return Ct[Tt]||""})}function st(xt,Ct){return xt.replace(Ct[0],function(Pt,Tt){var kt=at(Ct[1],arguments);return it(Pt===""?xt[Tt-1]:Pt,kt)})}function ot(xt,Ct,Pt){if(!xt.length||et.hasOwnProperty(xt))return Ct;for(var Tt=Pt.length;Tt--;){var kt=Pt[Tt];if(kt[0].test(Ct))return st(Ct,kt)}return Ct}function ut(xt,Ct,Pt){return function(Tt){var kt=Tt.toLowerCase();return Ct.hasOwnProperty(kt)?it(Tt,kt):xt.hasOwnProperty(kt)?it(Tt,xt[kt]):ot(kt,Tt,Pt)}}function dt(xt,Ct,Pt,Tt){return function(kt){var Lt=kt.toLowerCase();return Ct.hasOwnProperty(Lt)?!0:xt.hasOwnProperty(Lt)?!1:ot(Lt,Lt,Pt)===Lt}}function mt(xt,Ct,Pt){var Tt=Ct===1?mt.singular(xt):mt.plural(xt);return(Pt?Ct+" ":"")+Tt}return mt.plural=ut(rt,tt,$),mt.isPlural=dt(rt,tt,$),mt.singular=ut(tt,rt,j),mt.isSingular=dt(tt,rt,j),mt.addPluralRule=function(xt,Ct){$.push([nt(xt),Ct])},mt.addSingularRule=function(xt,Ct){j.push([nt(xt),Ct])},mt.addUncountableRule=function(xt){if(typeof xt=="string"){et[xt.toLowerCase()]=!0;return}mt.addPluralRule(xt,"$0"),mt.addSingularRule(xt,"$0")},mt.addIrregularRule=function(xt,Ct){Ct=Ct.toLowerCase(),xt=xt.toLowerCase(),rt[xt]=Ct,tt[Ct]=xt},[["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(xt){return mt.addIrregularRule(xt[0],xt[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(xt){return mt.addPluralRule(xt[0],xt[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(xt){return mt.addSingularRule(xt[0],xt[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(mt.addUncountableRule),mt})})(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:at}=useDisclosure$1(),[st,ot]=reactExports.useState(!1),ut=async()=>{await navigator.clipboard.writeText(et.pkh),nt(),setTimeout(it,1e3)},dt=reactExports.useRef(null);useOutsideClick$1({ref:dt,handler:()=>{ot(!1)}});let mt,xt,Ct;return at?(mt=colors.green,xt=colors.gray[300],Ct="white"):st?(mt=colors.gray[450],xt=colors.gray[400],Ct=colors.gray[200]):(mt=colors.gray[500],xt=colors.gray[450],Ct=colors.gray[300]),jsxRuntimeExports.jsx(Box,{maxWidth:"max-content","data-testid":"address-pill",...$,children:jsxRuntimeExports.jsxs(Flex,{ref:dt,alignItems:"center",background:mt,borderRadius:"full",onMouseEnter:()=>{ot(!0)},onMouseLeave:()=>{ot(!1)},paddingX:"4px",children:[rt&&jsxRuntimeExports.jsx(LeftIcon,{marginLeft:"4px",stroke:xt,addressKind:tt,"data-testid":"address-pill-left-icon"}),jsxRuntimeExports.jsxs(Popover,{autoFocus:!1,isOpen:at,onOpen:ut,children:[jsxRuntimeExports.jsx(PopoverTrigger,{children:jsxRuntimeExports.jsx(Button,{height:"24px",_focus:{boxShadow:"none"},onClick:Pt=>Pt.stopPropagation(),variant:"unstyled",children:jsxRuntimeExports.jsx(AddressPillText,{color:Ct,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(),at=sortedByLastUpdate(it(rt));return jsxRuntimeExports.jsxs(Box,{zIndex:2,background:accountIconGradient({left:"-10px",top:"-10px",account:_,radius:at.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:" "})})]})}),at.length>0&&jsxRuntimeExports.jsxs(Flex,{flexDirection:"column","data-testid":"nfts-list",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Flex,{marginY:"21px",children:at.slice(0,MAX_NFT_COUNT).map((st,ot)=>{const ut=getIPFSurl(thumbnailUri(st));return ot===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:ot>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:_,fee:a,transactionCount:$,signer:j})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:subTitle(j),title:_}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:j.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:a})]})]})]}),SignPage$5=({initialOperations:_,initialFee:a})=>{const{fee:$,operations:j,estimationFailed:et,isLoading:tt,signer:rt,form:nt,reEstimate:it,onSign:at}=useSignPageHelpers(a,_,"batch"),st=headerText(j.type,"batch");return jsxRuntimeExports.jsx(FormProvider,{...nt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{fee:$,signer:rt,title:st,transactionCount:j.operations.length}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:tt,operationType:j.type,reEstimate:it,sender:j.sender}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:et,isLoading:tt,onSubmit:at,signer:rt,text:st})})]})})})},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:at,handleAsyncAction:st}=useAsyncActionHandler(),ot=()=>st(async()=>{it([]);try{const dt=await estimate(_,rt);return it(a.map(mt=>SUCCESSFUL_ESTIMATION_RESULT)),tt(jsxRuntimeExports.jsx(SignPage$5,{initialFee:dt,initialOperations:_}))}catch(dt){if(dt instanceof TezosOperationError){const mt=dt.operationsWithResults;mt.length>a.length&&mt.shift(),it(mt)}throw dt}}),ut=jsxRuntimeExports.jsx(RightHeader,{isLoading:at,onSubmit:ot,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((dt,mt)=>{const xt=nt.at(mt);return jsxRuntimeExports.jsxs(Box,{"data-testid":"operation",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:xt?"80px":"50px",children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(OperationView,{operation:dt})}),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:dt})}),jsxRuntimeExports.jsx(OperationEstimationStatus,{estimationResult:xt})]}),jsxRuntimeExports.jsxs(Flex,{alignSelf:"flex-end",children:[jsxRuntimeExports.jsx(Text,{alignSelf:"flex-end",color:colors.gray[450],size:"sm",children:prettyOperationType(dt)}),jsxRuntimeExports.jsx(IconButton,{width:"24px",marginLeft:"12px",borderRadius:"full","aria-label":"Remove",icon:jsxRuntimeExports.jsx(TrashIcon,{stroke:colors.gray[300]}),onClick:()=>et($,mt),size:"xs",variant:"circle"})]})]})]}),mt=this._config.preview;if(tt)j.postMessage({results:mt,workerId:it.WORKER_ID,finished:dt});else if(jt(this._config.chunk)&&!Ft){if(this._config.chunk(mt,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);mt=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(mt.data),this._completeResults.errors=this._completeResults.errors.concat(mt.errors),this._completeResults.meta=mt.meta),this._completed||!dt||!jt(this._config.complete)||mt&&mt.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),dt||mt&&mt.meta.paused||this._nextChunk(),mt}this._halted=!0},this._sendError=function(Dt){jt(this._config.error)?this._config.error(Dt):tt&&this._config.error&&j.postMessage({workerId:it.WORKER_ID,error:Dt,finished:!1})}}function at(Mt){var Dt;(Mt=Mt||{}).chunkSize||(Mt.chunkSize=it.RemoteChunkSize),st.call(this,Mt),this._nextChunk=et?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(Ft){this._input=Ft,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(Dt=new XMLHttpRequest,this._config.withCredentials&&(Dt.withCredentials=this._config.withCredentials),et||(Dt.onload=Ut(this._chunkLoaded,this),Dt.onerror=Ut(this._chunkError,this)),Dt.open(this._config.downloadRequestBody?"POST":"GET",this._input,!et),this._config.downloadRequestHeaders){var Ft=this._config.downloadRequestHeaders;for(var Bt in Ft)Dt.setRequestHeader(Bt,Ft[Bt])}if(this._config.chunkSize){var yt=this._start+this._config.chunkSize-1;Dt.setRequestHeader("Range","bytes="+this._start+"-"+yt)}try{Dt.send(this._config.downloadRequestBody)}catch(mt){this._chunkError(mt.message)}et&&Dt.status===0&&this._chunkError()}},this._chunkLoaded=function(){Dt.readyState===4&&(Dt.status<200||400<=Dt.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:Dt.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(Ft){var Bt=Ft.getResponseHeader("Content-Range");return Bt===null?-1:parseInt(Bt.substring(Bt.lastIndexOf("/")+1))}(Dt),this.parseChunk(Dt.responseText)))},this._chunkError=function(Ft){var Bt=Dt.statusText||Ft;this._sendError(new Error(Bt))}}function ut(Mt){var Dt,Ft;(Mt=Mt||{}).chunkSize||(Mt.chunkSize=it.LocalChunkSize),st.call(this,Mt);var Bt=typeof FileReader<"u";this.stream=function(yt){this._input=yt,Ft=yt.slice||yt.webkitSlice||yt.mozSlice,Bt?((Dt=new FileReader).onload=Ut(this._chunkLoaded,this),Dt.onerror=Ut(this._chunkError,this)):Dt=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(yt.target.result)},this._chunkError=function(){this._sendError(Dt.error)}}function ht(Mt){var Dt;st.call(this,Mt=Mt||{}),this.stream=function(Ft){return Dt=Ft,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var Ft,Bt=this._config.chunkSize;return Bt?(Ft=Dt.substring(0,Bt),Dt=Dt.substring(Bt)):(Ft=Dt,Dt=""),this._finished=!Dt,this.parseChunk(Ft)}}}function bt(Mt){st.call(this,Mt=Mt||{});var Dt=[],Ft=!0,Bt=!1;this.pause=function(){st.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){st.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(yt){this._input=yt,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){Bt&&Dt.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),Dt.length?this.parseChunk(Dt.shift()):Ft=!0},this._streamData=Ut(function(yt){try{Dt.push(typeof yt=="string"?yt:yt.toString(this._config.encoding)),Ft&&(Ft=!1,this._checkIsFinished(),this.parseChunk(Dt.shift()))}catch(mt){this._streamError(mt)}},this),this._streamError=Ut(function(yt){this._streamCleanUp(),this._sendError(yt)},this),this._streamEnd=Ut(function(){this._streamCleanUp(),Bt=!0,this._streamData("")},this),this._streamCleanUp=Ut(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function Et(Mt){var Dt,Ft,Bt,yt=Math.pow(2,53),mt=-yt,ct=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,dt=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,vt=this,St=0,Rt=0,$t=!1,xt=!1,At=[],wt={data:[],errors:[],meta:{}};if(jt(Mt.step)){var Ot=Mt.step;Mt.step=function(Jt){if(wt=Jt,ir())nr();else{if(nr(),wt.data.length===0)return;St+=Jt.data.length,Mt.preview&&St>Mt.preview?Ft.abort():(wt.data=wt.data[0],Ot(wt,vt))}}}function tr(Jt){return Mt.skipEmptyLines==="greedy"?Jt.join("").trim()==="":Jt.length===1&&Jt[0].length===0}function nr(){return wt&&Bt&&(Kt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+it.DefaultDelimiter+"'"),Bt=!1),Mt.skipEmptyLines&&(wt.data=wt.data.filter(function(Jt){return!tr(Jt)})),ir()&&function(){if(!wt)return;function Jt(qt,Qt){jt(Mt.transformHeader)&&(qt=Mt.transformHeader(qt,Qt)),At.push(qt)}if(Array.isArray(wt.data[0])){for(var Ht=0;ir()&&Ht=At.length?"__parsed_extra":At[dr]),Mt.transform&&(kr=Mt.transform(kr,pr)),kr=Wt(pr,kr),pr==="__parsed_extra"?(xr[pr]=xr[pr]||[],xr[pr].push(kr)):xr[pr]=kr}return Mt.header&&(dr>At.length?Kt("FieldMismatch","TooManyFields","Too many fields: expected "+At.length+" fields but parsed "+dr,Rt+Qt):dr=this._config.preview;if(tt)j.postMessage({results:bt,workerId:it.WORKER_ID,finished:ht});else if(jt(this._config.chunk)&&!Ft){if(this._config.chunk(bt,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);bt=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(bt.data),this._completeResults.errors=this._completeResults.errors.concat(bt.errors),this._completeResults.meta=bt.meta),this._completed||!ht||!jt(this._config.complete)||bt&&bt.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),ht||bt&&bt.meta.paused||this._nextChunk(),bt}this._halted=!0},this._sendError=function(Dt){jt(this._config.error)?this._config.error(Dt):tt&&this._config.error&&j.postMessage({workerId:it.WORKER_ID,error:Dt,finished:!1})}}function ot(Mt){var Dt;(Mt=Mt||{}).chunkSize||(Mt.chunkSize=it.RemoteChunkSize),st.call(this,Mt),this._nextChunk=et?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(Ft){this._input=Ft,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(Dt=new XMLHttpRequest,this._config.withCredentials&&(Dt.withCredentials=this._config.withCredentials),et||(Dt.onload=zt(this._chunkLoaded,this),Dt.onerror=zt(this._chunkError,this)),Dt.open(this._config.downloadRequestBody?"POST":"GET",this._input,!et),this._config.downloadRequestHeaders){var Ft=this._config.downloadRequestHeaders;for(var Bt in Ft)Dt.setRequestHeader(Bt,Ft[Bt])}if(this._config.chunkSize){var yt=this._start+this._config.chunkSize-1;Dt.setRequestHeader("Range","bytes="+this._start+"-"+yt)}try{Dt.send(this._config.downloadRequestBody)}catch(bt){this._chunkError(bt.message)}et&&Dt.status===0&&this._chunkError()}},this._chunkLoaded=function(){Dt.readyState===4&&(Dt.status<200||400<=Dt.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:Dt.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(Ft){var Bt=Ft.getResponseHeader("Content-Range");return Bt===null?-1:parseInt(Bt.substring(Bt.lastIndexOf("/")+1))}(Dt),this.parseChunk(Dt.responseText)))},this._chunkError=function(Ft){var Bt=Dt.statusText||Ft;this._sendError(new Error(Bt))}}function ut(Mt){var Dt,Ft;(Mt=Mt||{}).chunkSize||(Mt.chunkSize=it.LocalChunkSize),st.call(this,Mt);var Bt=typeof FileReader<"u";this.stream=function(yt){this._input=yt,Ft=yt.slice||yt.webkitSlice||yt.mozSlice,Bt?((Dt=new FileReader).onload=zt(this._chunkLoaded,this),Dt.onerror=zt(this._chunkError,this)):Dt=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(yt.target.result)},this._chunkError=function(){this._sendError(Dt.error)}}function dt(Mt){var Dt;st.call(this,Mt=Mt||{}),this.stream=function(Ft){return Dt=Ft,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var Ft,Bt=this._config.chunkSize;return Bt?(Ft=Dt.substring(0,Bt),Dt=Dt.substring(Bt)):(Ft=Dt,Dt=""),this._finished=!Dt,this.parseChunk(Ft)}}}function mt(Mt){st.call(this,Mt=Mt||{});var Dt=[],Ft=!0,Bt=!1;this.pause=function(){st.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){st.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(yt){this._input=yt,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){Bt&&Dt.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),Dt.length?this.parseChunk(Dt.shift()):Ft=!0},this._streamData=zt(function(yt){try{Dt.push(typeof yt=="string"?yt:yt.toString(this._config.encoding)),Ft&&(Ft=!1,this._checkIsFinished(),this.parseChunk(Dt.shift()))}catch(bt){this._streamError(bt)}},this),this._streamError=zt(function(yt){this._streamCleanUp(),this._sendError(yt)},this),this._streamEnd=zt(function(){this._streamCleanUp(),Bt=!0,this._streamData("")},this),this._streamCleanUp=zt(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function xt(Mt){var Dt,Ft,Bt,yt=Math.pow(2,53),bt=-yt,ct=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,ht=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,vt=this,St=0,Rt=0,$t=!1,Et=!1,At=[],wt={data:[],errors:[],meta:{}};if(jt(Mt.step)){var Ot=Mt.step;Mt.step=function(Jt){if(wt=Jt,ir())nr();else{if(nr(),wt.data.length===0)return;St+=Jt.data.length,Mt.preview&&St>Mt.preview?Ft.abort():(wt.data=wt.data[0],Ot(wt,vt))}}}function tr(Jt){return Mt.skipEmptyLines==="greedy"?Jt.join("").trim()==="":Jt.length===1&&Jt[0].length===0}function nr(){return wt&&Bt&&(Kt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+it.DefaultDelimiter+"'"),Bt=!1),Mt.skipEmptyLines&&(wt.data=wt.data.filter(function(Jt){return!tr(Jt)})),ir()&&function(){if(!wt)return;function Jt(Vt,Qt){jt(Mt.transformHeader)&&(Vt=Mt.transformHeader(Vt,Qt)),At.push(Vt)}if(Array.isArray(wt.data[0])){for(var Ht=0;ir()&&Ht=At.length?"__parsed_extra":At[dr]),Mt.transform&&(Ir=Mt.transform(Ir,pr)),Ir=Wt(pr,Ir),pr==="__parsed_extra"?(xr[pr]=xr[pr]||[],xr[pr].push(Ir)):xr[pr]=Ir}return Mt.header&&(dr>At.length?Kt("FieldMismatch","TooManyFields","Too many fields: expected "+At.length+" fields but parsed "+dr,Rt+Qt):dr=lr.length/2?`\r -`:"\r"}(Jt,Qt)),Bt=!1,Mt.delimiter)jt(Mt.delimiter)&&(Mt.delimiter=Mt.delimiter(Jt),wt.meta.delimiter=Mt.delimiter);else{var dr=function(pr,kr,Ir,lr,fr){var Er,$r,Pr,Rr;fr=fr||[","," ","|",";",it.RECORD_SEP,it.UNIT_SEP];for(var Ar=0;Ar=ct)return Gt(!0)}else for(Or=St,St++;;){if((Or=$t.indexOf(Dt,Or+1))===-1)return At||Kt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Wt.length,index:St}),Zt();if(Or===wt-1)return Zt($t.substring(St,Or).replace(Ar,Dt));if(Dt!==vt||$t[Or+1]!==vt){if(Dt===vt||Or===0||$t[Or-1]!==vt){Pr!==-1&&Pr=ct)return Gt(!0);break}Kt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Wt.length,index:St}),Or++}}else Or++}return Zt();function Yt(br){Wt.push(br),Ht=St}function er(br){var wr=0;if(br!==-1){var Sr=$t.substring(Or+1,br);Sr&&Sr.trim()===""&&(wr=Sr.length)}return wr}function Zt(br){return At||(br===void 0&&(br=$t.substring(St)),Jt.push(br),St=wt,Yt(Jt),ir&&ar()),Gt()}function Vt(br){St=br,Yt(Jt),Jt=[],Rr=$t.indexOf(Bt,St)}function Gt(br){return{data:Wt,errors:Kt,meta:{delimiter:Ft,linebreak:Bt,aborted:Rt,truncated:!!br,cursor:Ht+(xt||0)}}}function ar(){mt(Gt()),Wt=[],Kt=[]}},this.abort=function(){Rt=!0},this.getCharIndex=function(){return St}}function Tt(Mt){var Dt=Mt.data,Ft=rt[Dt.workerId],Bt=!1;if(Dt.error)Ft.userError(Dt.error,Dt.file);else if(Dt.results&&Dt.results.data){var yt={abort:function(){Bt=!0,It(Dt.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:Lt,resume:Lt};if(jt(Ft.userStep)){for(var mt=0;mt{const j=a.filter(ht=>ht.length>0),et=j.length;if(et<2||4{const _=useSelectedNetwork(),a=useToast(),$=useGetToken(),j=useAppDispatch(),et=useGetOwnedAccount(),tt=useGetBestSignerForAccount(),{onClose:rt}=reactExports.useContext(DynamicModalContext),{isLoading:nt,handleAsyncAction:it}=useAsyncActionHandler(),ot=useForm({mode:"onBlur"}),{handleSubmit:st,formState:{isValid:at,errors:ut}}=ot,ht=async({file:bt,sender:Et})=>it(async()=>{const Ct=et(Et),Pt=await new Promise(It=>{Papa.parse(bt[0],{skipEmptyLines:!0,complete:It})});if(Pt.errors.length>0)throw new Error("Error loading csv file: "+Pt.errors.map(It=>It.message).join(", "));const Tt=[];for(let It=0;It{const{openWith:_}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Button,{onClick:()=>_(jsxRuntimeExports.jsx(CSVFileUploadForm,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",size:"sm",children:"Load CSV file"}),jsxRuntimeExports.jsx(FileArrowDownIcon,{stroke:"currentcolor"})]})},FilterController=({batchPending:_})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"24px",marginBottom:"24px",children:[jsxRuntimeExports.jsxs(Heading,{flex:1,color:colors.orangeL,size:"sm",children:[_," Pending"]}),jsxRuntimeExports.jsx(CSVFileUploader,{}),jsxRuntimeExports.jsx(ExternalLink,{marginLeft:"8px",href:"https://github.com/trilitech/umami-v2/wiki/Batch-file-specification",children:jsxRuntimeExports.jsxs(Button,{paddingRight:"0",variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",size:"sm",children:"See file specs"}),jsxRuntimeExports.jsx(ExternalLinkIcon,{stroke:"currentcolor"})]})})]}),BatchPage=()=>{const _=useBatches();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Batch"}),jsxRuntimeExports.jsx(FilterController,{batchPending:_.length}),jsxRuntimeExports.jsx(Box,{overflowY:"auto",minHeight:"80%",children:_.length>0?_.map(a=>jsxRuntimeExports.jsx(BatchView,{operations:a},a.sender.address.pkh)):jsxRuntimeExports.jsx(NoItems,{description:"There are no batch transactions to show...",size:"lg",title:"No batches to show"})})]})},ClickableCard=({onClick:_,children:a,isSelected:$,...j})=>jsxRuntimeExports.jsx(Card,{justifyContent:"center",height:"66px",marginBottom:"10px",padding:"24px",border:"1px solid",borderColor:$?` ${colors.orangeL}`:"transparent",borderRadius:"lg",_hover:{border:`1px solid ${colors.gray[500]}`,bg:colors.gray[800]},cursor:_?"pointer":void 0,backgroundColor:colors.gray[900],onClick:_,...j,children:jsxRuntimeExports.jsx(CardBody,{padding:0,children:a})}),SettingsCardWithDrawerIcon=({left:_,isSelected:a,onClick:$})=>jsxRuntimeExports.jsx(ClickableCard,{isSelected:a,onClick:$,children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",height:"100%",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",width:"100%",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:_}),jsxRuntimeExports.jsx(ChevronRightIcon,{})]})})}),HelpView=()=>jsxRuntimeExports.jsxs(Grid,{gridGap:"1",gridTemplateRows:"0fr 1fr 1fr",gridTemplateColumns:"1fr 1fr",gridTemplateAreas:` +`);var St=0,Rt=!1;this.parse=function($t,Et,At){if(typeof $t!="string")throw new Error("Input must be a string");var wt=$t.length,Ot=Ft.length,tr=Bt.length,nr=yt.length,ir=jt(bt),Wt=[],Kt=[],Jt=[],Ht=St=0;if(!$t)return Gt();if(Mt.header&&!Et){var Vt=$t.split(Bt)[0].split(Ft),Qt=[],dr={},xr=!1;for(var pr in Vt){var Ir=Vt[pr];jt(Mt.transformHeader)&&(Ir=Mt.transformHeader(Ir,pr));var kr=Ir,lr=dr[Ir]||0;for(0=ct)return Gt(!0)}else for(Or=St,St++;;){if((Or=$t.indexOf(Dt,Or+1))===-1)return At||Kt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Wt.length,index:St}),Zt();if(Or===wt-1)return Zt($t.substring(St,Or).replace(Ar,Dt));if(Dt!==vt||$t[Or+1]!==vt){if(Dt===vt||Or===0||$t[Or-1]!==vt){Pr!==-1&&Pr=ct)return Gt(!0);break}Kt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Wt.length,index:St}),Or++}}else Or++}return Zt();function Yt(vr){Wt.push(vr),Ht=St}function er(vr){var wr=0;if(vr!==-1){var Sr=$t.substring(Or+1,vr);Sr&&Sr.trim()===""&&(wr=Sr.length)}return wr}function Zt(vr){return At||(vr===void 0&&(vr=$t.substring(St)),Jt.push(vr),St=wt,Yt(Jt),ir&&or()),Gt()}function qt(vr){St=vr,Yt(Jt),Jt=[],Rr=$t.indexOf(Bt,St)}function Gt(vr){return{data:Wt,errors:Kt,meta:{delimiter:Ft,linebreak:Bt,aborted:Rt,truncated:!!vr,cursor:Ht+(Et||0)}}}function or(){bt(Gt()),Wt=[],Kt=[]}},this.abort=function(){Rt=!0},this.getCharIndex=function(){return St}}function Tt(Mt){var Dt=Mt.data,Ft=rt[Dt.workerId],Bt=!1;if(Dt.error)Ft.userError(Dt.error,Dt.file);else if(Dt.results&&Dt.results.data){var yt={abort:function(){Bt=!0,kt(Dt.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:Lt,resume:Lt};if(jt(Ft.userStep)){for(var bt=0;bt{const j=a.filter(dt=>dt.length>0),et=j.length;if(et<2||4{const _=useSelectedNetwork(),a=useToast(),$=useGetToken(),j=useAppDispatch(),et=useGetOwnedAccount(),tt=useGetBestSignerForAccount(),{onClose:rt}=reactExports.useContext(DynamicModalContext),{isLoading:nt,handleAsyncAction:it}=useAsyncActionHandler(),at=useForm({mode:"onBlur"}),{handleSubmit:st,formState:{isValid:ot,errors:ut}}=at,dt=async({file:mt,sender:xt})=>it(async()=>{const Ct=et(xt),Pt=await new Promise(kt=>{Papa.parse(mt[0],{skipEmptyLines:!0,complete:kt})});if(Pt.errors.length>0)throw new Error("Error loading csv file: "+Pt.errors.map(kt=>kt.message).join(", "));const Tt=[];for(let kt=0;kt{const{openWith:_}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Button,{onClick:()=>_(jsxRuntimeExports.jsx(CSVFileUploadForm,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",size:"sm",children:"Load CSV file"}),jsxRuntimeExports.jsx(FileArrowDownIcon,{stroke:"currentcolor"})]})},FilterController=({batchPending:_})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"24px",marginBottom:"24px",children:[jsxRuntimeExports.jsxs(Heading,{flex:1,color:colors.orangeL,size:"sm",children:[_," Pending"]}),jsxRuntimeExports.jsx(CSVFileUploader,{}),jsxRuntimeExports.jsx(ExternalLink,{marginLeft:"8px",href:"https://github.com/trilitech/umami-v2/wiki/Batch-file-specification",children:jsxRuntimeExports.jsxs(Button,{paddingRight:"0",variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",size:"sm",children:"See file specs"}),jsxRuntimeExports.jsx(ExternalLinkIcon,{stroke:"currentcolor"})]})})]}),BatchPage=()=>{const _=useBatches();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Batch"}),jsxRuntimeExports.jsx(FilterController,{batchPending:_.length}),jsxRuntimeExports.jsx(Box,{overflowY:"auto",minHeight:"80%",children:_.length>0?_.map(a=>jsxRuntimeExports.jsx(BatchView,{operations:a},a.sender.address.pkh)):jsxRuntimeExports.jsx(NoItems,{description:"There are no batch transactions to show...",size:"lg",title:"No batches to show"})})]})},ClickableCard=({onClick:_,children:a,isSelected:$,...j})=>jsxRuntimeExports.jsx(Card,{justifyContent:"center",height:"66px",marginBottom:"10px",padding:"24px",border:"1px solid",borderColor:$?` ${colors.orangeL}`:"transparent",borderRadius:"lg",_hover:{border:`1px solid ${colors.gray[500]}`,bg:colors.gray[800]},cursor:_?"pointer":void 0,backgroundColor:colors.gray[900],onClick:_,...j,children:jsxRuntimeExports.jsx(CardBody,{padding:0,children:a})}),SettingsCardWithDrawerIcon=({left:_,isSelected:a,onClick:$})=>jsxRuntimeExports.jsx(ClickableCard,{isSelected:a,onClick:$,children:jsxRuntimeExports.jsx(Flex,{alignItems:"center",height:"100%",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",width:"100%",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:_}),jsxRuntimeExports.jsx(ChevronRightIcon,{})]})})}),HelpView=()=>jsxRuntimeExports.jsxs(Grid,{gridGap:"1",gridTemplateRows:"0fr 1fr 1fr",gridTemplateColumns:"1fr 1fr",gridTemplateAreas:` "header header" "main main" "main main" - `,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}},OnboardWithEmailButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("email",_);return jsxRuntimeExports.jsx(IconButton,{color:"black",_hover:{color:"white",background:colors.gray[600]},"aria-label":"Email SSO","data-testid":"login-button-email",icon:jsxRuntimeExports.jsx(EmailIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})},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",_hover:{color:"white",background:colors.gray[600]},"aria-label":"Twitter SSO","data-testid":"login-button-twitter",icon:jsxRuntimeExports.jsx(TwitterIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})};var define_import_meta_env_default={BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const IS_DEV=define_import_meta_env_default.DEBUG,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.jsx(Button,{width:"100%",onClick:$=>_({type:"fakeAccount"}),size:"lg",variant:"tertiary",children:"Add a Fake Account"}),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(OnboardWithEmailButton,{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:at})=>{switch(a.type){case"ledger":return _($?{type:"restoreLedger",account:{...a,derivationPath:normalizeDerivationPath(at)}}:{type:"restoreLedger",account:{...a,derivationPathTemplate:normalizeDerivationPath(st)}});case"mnemonic":{if($){const ut=await deriveSecretKey(a.mnemonic,at,"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 at=await new RpcClient(GHOSTNET.rpcUrl).getManagerKey(nt),ut=typeof at=="string"?at:at.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(),at=JSON.parse(st);if(at.recoveryPhrases&&at.derivationPaths)await rt(at,it);else if(at["persist:accounts"])await restoreV2BackupFile(at,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:at}=await getPk(ot);$(a.derivationPathTemplate,ot,st,at,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"})]})})},mnemonic1="glory city income swallow act garment novel fringe bread chaos club dolphin when live penalty mirror donate razor dad eyebrow powder trumpet bunker wine",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(),at=!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)}),...$}),at&&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(bt=>(bt>ht&&lodashExports.range(ht,Math.max(...mnemonicSizes)).forEach(Et=>{j(`word${Et}`,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((bt,Et)=>{j(`word${Et}`,bt)}),et()}),at=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:$(at),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 bt=>{bt.preventDefault();const Et=await navigator.clipboard.readText();return st(Et)},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&&jsxRuntimeExports.jsx(Button,{width:"100%",onClick:()=>st(mnemonic1),size:"lg",children:"Enter test mnemonic (Dev only)"})]})})})})})},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:at})=>j(async()=>{try{const ht=await(await InMemorySigner.fromSecretKey(st.trim(),at)).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 at=`${ot.index}`,ut=tt[at];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:at,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&&jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",onClick:it,size:"lg",children:"Bypass (Dev only)"})]})})})})},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,at="Remove All Accounts";let ut,ht="Remove All";const bt=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 ${bt}?`:ut=`Are you sure you want to remove all of your ${bt}?`;const Et=()=>rt(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ht,description:ut,onSubmit:()=>{tt?it(j.seedFingerPrint):et||ot(j.type),nt()},title:at})),Ct=()=>{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?Ct:void 0,onRemove:Et})]}),a.map(Pt=>jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(AccountTile,{account:Pt,balance:$[Pt.address.pkh]})},Pt.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,fee:rt,data:{threshold:nt,signers:it,name:ot}}=_,{fee:st,operations:at,estimationFailed:ut,isLoading:ht,form:bt,reEstimate:Et,signer:Ct,onSign:Pt}=useSignPageHelpers(rt,tt,et),Tt=$||ht,It=Lt=>j(async()=>{const Nt=await Pt(Lt);if(!Nt)throw new Error("An error occurred during contract origination");const Ut=(await Nt.getOriginatedContractAddresses())[0];a(multisigActions.addMultisigLabel({pkh:Ut,label:ot}))});return jsxRuntimeExports.jsx(FormProvider,{...bt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,description:"Please review the details and then continue to submit contract.",operationsType:at.type,signer:Ct,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:ot}),jsxRuntimeExports.jsx(FormLabel,{children:"Approvers"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",gap:"12px",marginBottom:"12px","data-testid":"approvers",children:it.map(Lt=>jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Lt.val),"data-testid":`approver-${Lt.val}`},Lt.val))}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Threshold,{signersAmount:it.length,threshold:nt})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",marginBottom:"12px",children:jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"signer",isLoading:Tt,keepValid:!0,label:"Creation Fee Payer",onUpdate:Et})}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(SignPageFee,{fee:st})})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:ut,isLoading:Tt,onSubmit:It,signer:Ct,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:at}=et,ut=useFieldArray({control:nt,name:"signers",rules:{minLength:1}}),ht=at("signers").length,bt=useOpenSignPageFormAction({SignPage:SignTransactionFormPage,signPageExtraData:at(),FormPage:SelectApproversFormPage,defaultFormPageProps:_,toOperation:toOperation$4}),{onFormSubmitActionHandlers:[Et],isLoading:Ct}=useHandleOnSubmitFormActions([bt]);return jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalBackButton,{onClick:a}),jsxRuntimeExports.jsxs("form",{onSubmit:ot(Et),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((Pt,Tt)=>{var jt;const It=tt.signers&&tt.signers[Tt],Lt=`${Tt===0?"Select ":""}${ordinal$1(Tt+1)} approver`,Nt=ht>1?"short":"default",Ut=Nt==="short"?"368px":"100%";return jsxRuntimeExports.jsxs(FormControl,{display:"inline-block",width:Ut,marginBottom:"8px","data-testid":`signer-input-${Tt}`,isInvalid:!!It,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!0,inputName:`signers.${Tt}.val`,label:Lt,size:Nt,style:{width:Ut},validate:Mt=>{if(!isValidImplicitPkh(Mt))return"Signer must be valid TZ address";const Dt=st("signers").map(Ft=>Ft.val);if(Dt.length>new Set(Dt).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-${Tt}`,icon:jsxRuntimeExports.jsx(TrashIcon,{width:"12px",height:"14px",stroke:colors.gray[300]}),isRound:!0,onClick:()=>ut.remove(Tt),size:"xs",variant:"tertiary"}),It&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":`signer-${Tt}-error`,children:(jt=It.val)==null?void 0:jt.message})]},Pt.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:Ct,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:at})=>it(jsxRuntimeExports.jsx(SelectApproversFormPage,{form:{name:at.trim()},goBack:()=>it(jsxRuntimeExports.jsx(NameMultisigFormPage,{name:at})),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}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:at}=useSignPageHelpers(j,$,a),ut=tt.operations[0].recipient;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(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:ot.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:et})})}),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(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:at,signer:ot,text:headerText(tt.type,a)})})]})})})},FormPage$3=_=>{var at;const a=(at=_.form)==null?void 0:at.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}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:ot,reEstimate:st,onSign:at}=useSignPageHelpers(j,$,a);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(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:ot.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:at,signer:ot,text:headerText(tt.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:_,fee:a,operation:$,actionType:j,transactionCount:et})=>{const{handleAsyncAction:tt}=useAsyncActionHandler(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=ot=>tt(async()=>{const{opHash:st}=await executeOperations($,ot);return rt(jsxRuntimeExports.jsx(SuccessStep,{hash:st}))},{title:`Failed ${j}`}),it=`${lodashExports.capitalize(j)} transaction`;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{fee:a,signer:_,title:it,transactionCount:et}),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),at=_===0,ut=()=>nt(async()=>{if(!st)throw new Error("Can't approve or execute with an account you don't own");const bt=at?"execute":"approve",Et=makeAccountOperations(st,st,[makeMultisigApproveOrExecuteOperation(a.address,bt,$.id)]),Ct=await estimate(Et,ot);let Pt;try{Pt=parseRawMichelson($.rawActions,a).length}catch{Pt=1}return it(jsxRuntimeExports.jsx(SignPage$2,{actionType:bt,fee:Ct,operation:Et,signer:st,transactionCount:Pt}))}),ht=getMultisigSignerState({approvals:$.approvals,signerAddress:j,operationIsExecutable:at,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 at,ut;const j=a.amount,et=useGetOperationDestination((at=a.from)==null?void 0:at.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:at}=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 Et;const bt=(Et=lodashExports.maxBy(ht.flat(),"id"))==null?void 0:Et.id;return bt?{lastId:bt,sort:"asc"}:{}},select:({pages:ut})=>filterDuplicatedTokenTransfers([[...ut[0]].sort((ht,bt)=>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(at=>at.label),ot=tt.items.map(at=>at.label),st=Object.values(rt).map(at=>at.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:at})=>{a(renameAccount(_,at)),$()},{handleSubmit:et,formState:{isValid:tt,errors:rt},register:nt,reset:it}=useForm({mode:"onBlur",defaultValues:{name:_.label}}),ot=({name:at})=>{j({name:at.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,at]=reactExports.useState(null),{handleAsyncAction:ut}=useAsyncActionHandler();return reactExports.useEffect(()=>{ut(async()=>{const ht=await getLastDelegation(rt.address.pkh,ot);ht&&at(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]",at="[object Date]",ut="[object Error]",ht="[object Function]",bt="[object GeneratorFunction]",Et="[object Map]",Ct="[object Number]",Pt="[object Null]",Tt="[object Object]",It="[object Promise]",Lt="[object Proxy]",Nt="[object RegExp]",Ut="[object Set]",jt="[object String]",Mt="[object Symbol]",Dt="[object Undefined]",Ft="[object WeakMap]",Bt="[object ArrayBuffer]",yt="[object DataView]",mt="[object Float32Array]",ct="[object Float64Array]",dt="[object Int8Array]",vt="[object Int16Array]",St="[object Int32Array]",Rt="[object Uint8Array]",$t="[object Uint8ClampedArray]",xt="[object Uint16Array]",At="[object Uint32Array]",wt=/[\\^$.*+?()[\]{}|]/g,Ot=/^\[object .+?Constructor\]$/,tr=/^(?:0|[1-9]\d*)$/,nr={};nr[mt]=nr[ct]=nr[dt]=nr[vt]=nr[St]=nr[Rt]=nr[$t]=nr[xt]=nr[At]=!0,nr[nt]=nr[it]=nr[Bt]=nr[st]=nr[yt]=nr[at]=nr[ut]=nr[ht]=nr[Et]=nr[Ct]=nr[Tt]=nr[Nt]=nr[Ut]=nr[jt]=nr[Ft]=!1;var ir=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Wt=typeof self=="object"&&self&&self.Object===Object&&self,Kt=ir||Wt||Function("return this")(),Jt=a&&!a.nodeType&&a,Ht=Jt&&!0&&_&&!_.nodeType&&_,qt=Ht&&Ht.exports===Jt,Qt=qt&&ir.process,dr=function(){try{return Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),xr=dr&&dr.isTypedArray;function pr(_r,Xt){for(var cr=-1,gr=_r==null?0:_r.length,Dr=0,rn=[];++cr-1}function ps(_r,Xt){var cr=this.__data__,gr=wo(cr,_r);return gr<0?(++this.size,cr.push([_r,Xt])):cr[gr][1]=Xt,this}yn.prototype.clear=En,yn.prototype.delete=ds,yn.prototype.get=fs,yn.prototype.has=hs,yn.prototype.set=ps;function Vn(_r){var Xt=-1,cr=_r==null?0:_r.length;for(this.clear();++XtPn))return!1;var _n=rn.get(_r);if(_n&&rn.get(Xt))return _n==Xt;var Nn=-1,Fn=!0,ts=cr&tt?new es:void 0;for(rn.set(_r,Xt),rn.set(Xt,_r);++Nn-1&&_r%1==0&&_r-1&&_r%1==0&&_r<=rt}function Bo(_r){var Xt=typeof _r;return _r!=null&&(Xt=="object"||Xt=="function")}function To(_r){return _r!=null&&typeof _r=="object"}var No=xr?fr(xr):xl;function Xl(_r){return Ao(_r)?yl(_r):El(_r)}function rs(){return[]}function Xn(){return!1}_.exports=Ts})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports,qrcode={exports:{}};(function(_,a){var $=function(){var j=function(Nt,Ut){var jt=236,Mt=17,Dt=Nt,Ft=tt[Ut],Bt=null,yt=0,mt=null,ct=[],dt={},vt=function(Kt,Jt){yt=Dt*4+17,Bt=function(Ht){for(var qt=new Array(Ht),Qt=0;Qt=7&&At(Kt),mt==null&&(mt=nr(Dt,Ft,ct)),Ot(mt,Jt)},St=function(Kt,Jt){for(var Ht=-1;Ht<=7;Ht+=1)if(!(Kt+Ht<=-1||yt<=Kt+Ht))for(var qt=-1;qt<=7;qt+=1)Jt+qt<=-1||yt<=Jt+qt||(0<=Ht&&Ht<=6&&(qt==0||qt==6)||0<=qt&&qt<=6&&(Ht==0||Ht==6)||2<=Ht&&Ht<=4&&2<=qt&&qt<=4?Bt[Kt+Ht][Jt+qt]=!0:Bt[Kt+Ht][Jt+qt]=!1)},Rt=function(){for(var Kt=0,Jt=0,Ht=0;Ht<8;Ht+=1){vt(!0,Ht);var qt=nt.getLostPoint(dt);(Ht==0||Kt>qt)&&(Kt=qt,Jt=Ht)}return Jt},$t=function(){for(var Kt=8;Kt>Ht&1)==1;Bt[Math.floor(Ht/3)][Ht%3+yt-8-3]=qt}for(var Ht=0;Ht<18;Ht+=1){var qt=!Kt&&(Jt>>Ht&1)==1;Bt[Ht%3+yt-8-3][Math.floor(Ht/3)]=qt}},wt=function(Kt,Jt){for(var Ht=Ft<<3|Jt,qt=nt.getBCHTypeInfo(Ht),Qt=0;Qt<15;Qt+=1){var dr=!Kt&&(qt>>Qt&1)==1;Qt<6?Bt[Qt][8]=dr:Qt<8?Bt[Qt+1][8]=dr:Bt[yt-15+Qt][8]=dr}for(var Qt=0;Qt<15;Qt+=1){var dr=!Kt&&(qt>>Qt&1)==1;Qt<8?Bt[8][yt-Qt-1]=dr:Qt<9?Bt[8][15-Qt-1+1]=dr:Bt[8][15-Qt-1]=dr}Bt[yt-8][8]=!Kt},Ot=function(Kt,Jt){for(var Ht=-1,qt=yt-1,Qt=7,dr=0,xr=nt.getMaskFunction(Jt),pr=yt-1;pr>0;pr-=2)for(pr==6&&(pr-=1);;){for(var kr=0;kr<2;kr+=1)if(Bt[qt][pr-kr]==null){var Ir=!1;dr>>Qt&1)==1);var lr=xr(qt,pr-kr);lr&&(Ir=!Ir),Bt[qt][pr-kr]=Ir,Qt-=1,Qt==-1&&(dr+=1,Qt=7)}if(qt+=Ht,qt<0||yt<=qt){qt-=Ht,Ht=-Ht;break}}},tr=function(Kt,Jt){for(var Ht=0,qt=0,Qt=0,dr=new Array(Jt.length),xr=new Array(Jt.length),pr=0;pr=0?$r.getAt(Pr):0}}for(var Rr=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(Mt,8);return tr(Qt,qt)};dt.addData=function(Kt,Jt){Jt=Jt||"Byte";var Ht=null;switch(Jt){case"Numeric":Ht=ut(Kt);break;case"Alphanumeric":Ht=ht(Kt);break;case"Byte":Ht=bt(Kt);break;case"Kanji":Ht=Et(Kt);break;default:throw"mode:"+Jt}ct.push(Ht),mt=null},dt.isDark=function(Kt,Jt){if(Kt<0||yt<=Kt||Jt<0||yt<=Jt)throw Kt+","+Jt;return Bt[Kt][Jt]},dt.getModuleCount=function(){return yt},dt.make=function(){if(Dt<1){for(var Kt=1;Kt<40;Kt++){for(var Jt=st.getRSBlocks(Kt,Ft),Ht=at(),qt=0;qt"u"?Kt*4:Jt;var Ht="";Ht+='
";for(var Qt=0;Qt';Ht+=""}return Ht+="",Ht+="
",Ht},dt.createSvgTag=function(Kt,Jt,Ht,qt){var Qt={};typeof arguments[0]=="object"&&(Qt=arguments[0],Kt=Qt.cellSize,Jt=Qt.margin,Ht=Qt.alt,qt=Qt.title),Kt=Kt||2,Jt=typeof Jt>"u"?Kt*4:Jt,Ht=typeof Ht=="string"?{text:Ht}:Ht||{},Ht.text=Ht.text||null,Ht.id=Ht.text?Ht.id||"qrcode-description":null,qt=typeof qt=="string"?{text:qt}:qt||{},qt.text=qt.text||null,qt.id=qt.text?qt.id||"qrcode-title":null;var dr=dt.getModuleCount()*Kt+Jt*2,xr,pr,kr,Ir,lr="",fr;for(fr="l"+Kt+",0 0,"+Kt+" -"+Kt+",0 0,-"+Kt+"z ",lr+=''+ir(qt.text)+"":"",lr+=Ht.text?''+ir(Ht.text)+"":"",lr+='',lr+='"u"?Kt*4:Jt;var Ht=dt.getModuleCount()*Kt+Jt*2,qt=Jt,Qt=Ht-Jt;return Lt(Ht,Ht,function(dr,xr){if(qt<=dr&&dr"u"?Kt*4:Jt;var qt=dt.getModuleCount()*Kt+Jt*2,Qt="";return Qt+="",Qt};var ir=function(Kt){for(var Jt="",Ht=0;Ht":Jt+=">";break;case"&":Jt+="&";break;case'"':Jt+=""";break;default:Jt+=qt;break}}return Jt},Wt=function(Kt){var Jt=1;Kt=typeof Kt>"u"?Jt*2:Kt;var Ht=dt.getModuleCount()*Jt+Kt*2,qt=Kt,Qt=Ht-Kt,dr,xr,pr,kr,Ir,lr={"██":"█","█ ":"▀"," █":"▄"," ":" "},fr={"██":"▀","█ ":"▀"," █":" "," ":" "},Er="";for(dr=0;dr=Qt?fr[Ir]:lr[Ir];Er+=` -`}return Ht%2&&Kt>0?Er.substring(0,Er.length-Ht-1)+Array(Ht+1).join("▀"):Er.substring(0,Er.length-1)};return dt.createASCII=function(Kt,Jt){if(Kt=Kt||1,Kt<2)return Wt(Jt);Kt-=1,Jt=typeof Jt>"u"?Kt*2:Jt;var Ht=dt.getModuleCount()*Kt+Jt*2,qt=Jt,Qt=Ht-Jt,dr,xr,pr,kr,Ir=Array(Kt+1).join("██"),lr=Array(Kt+1).join(" "),fr="",Er="";for(dr=0;dr>>8),Ft.push(mt&255)):Ft.push(Mt)}}return Ft}};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 Nt=[[],[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]],Ut=1335,jt=7973,Mt=21522,Dt={},Ft=function(Bt){for(var yt=0;Bt!=0;)yt+=1,Bt>>>=1;return yt};return Dt.getBCHTypeInfo=function(Bt){for(var yt=Bt<<10;Ft(yt)-Ft(Ut)>=0;)yt^=Ut<=0;)yt^=jt<5&&(mt+=3+vt-5)}for(var ct=0;ct=256;)Dt-=255;return Nt[Dt]},Mt}();function ot(Nt,Ut){if(typeof Nt.length>"u")throw Nt.length+"/"+Ut;var jt=function(){for(var Dt=0;Dt"u")throw"bad rs block @ typeNumber:"+Dt+"/errorCorrectionLevel:"+Ft;for(var yt=Bt.length/3,mt=[],ct=0;ct>>7-Mt%8&1)==1},jt.put=function(Mt,Dt){for(var Ft=0;Ft>>Dt-Ft-1&1)==1)},jt.getLengthInBits=function(){return Ut},jt.putBit=function(Mt){var Dt=Math.floor(Ut/8);Nt.length<=Dt&&Nt.push(0),Mt&&(Nt[Dt]|=128>>>Ut%8),Ut+=1},jt},ut=function(Nt){var Ut=et.MODE_NUMBER,jt=Nt,Mt={};Mt.getMode=function(){return Ut},Mt.getLength=function(Bt){return jt.length},Mt.write=function(Bt){for(var yt=jt,mt=0;mt+2>>8&255)*192+(mt&255),Ft.put(mt,13),yt+=2}if(yt>>8)},Ut.writeBytes=function(jt,Mt,Dt){Mt=Mt||0,Dt=Dt||jt.length;for(var Ft=0;Ft0&&(jt+=","),jt+=Nt[Mt];return jt+="]",jt},Ut},Pt=function(){var Nt=0,Ut=0,jt=0,Mt="",Dt={},Ft=function(yt){Mt+=String.fromCharCode(Bt(yt&63))},Bt=function(yt){if(!(yt<0)){if(yt<26)return 65+yt;if(yt<52)return 97+(yt-26);if(yt<62)return 48+(yt-52);if(yt==62)return 43;if(yt==63)return 47}throw"n:"+yt};return Dt.writeByte=function(yt){for(Nt=Nt<<8|yt&255,Ut+=8,jt+=1;Ut>=6;)Ft(Nt>>>Ut-6),Ut-=6},Dt.flush=function(){if(Ut>0&&(Ft(Nt<<6-Ut),Nt=0,Ut=0),jt%3!=0)for(var yt=3-jt%3,mt=0;mt=Ut.length){if(Dt==0)return-1;throw"unexpected end of file./"+Dt}var yt=Ut.charAt(jt);if(jt+=1,yt=="=")return Dt=0,-1;if(yt.match(/^\s$/))continue;Mt=Mt<<6|Bt(yt.charCodeAt(0)),Dt+=6}var mt=Mt>>>Dt-8&255;return Dt-=8,mt};var Bt=function(yt){if(65<=yt&&yt<=90)return yt-65;if(97<=yt&&yt<=122)return yt-97+26;if(48<=yt&&yt<=57)return yt-48+52;if(yt==43)return 62;if(yt==47)return 63;throw"c:"+yt};return Ft},It=function(Nt,Ut){var jt=Nt,Mt=Ut,Dt=new Array(Nt*Ut),Ft={};Ft.setPixel=function(ct,dt,vt){Dt[dt*jt+ct]=vt},Ft.write=function(ct){ct.writeString("GIF87a"),ct.writeShort(jt),ct.writeShort(Mt),ct.writeByte(128),ct.writeByte(0),ct.writeByte(0),ct.writeByte(0),ct.writeByte(0),ct.writeByte(0),ct.writeByte(255),ct.writeByte(255),ct.writeByte(255),ct.writeString(","),ct.writeShort(0),ct.writeShort(0),ct.writeShort(jt),ct.writeShort(Mt),ct.writeByte(0);var dt=2,vt=yt(dt);ct.writeByte(dt);for(var St=0;vt.length-St>255;)ct.writeByte(255),ct.writeBytes(vt,St,255),St+=255;ct.writeByte(vt.length-St),ct.writeBytes(vt,St,vt.length-St),ct.writeByte(0),ct.writeString(";")};var Bt=function(ct){var dt=ct,vt=0,St=0,Rt={};return Rt.write=function($t,xt){if($t>>>xt)throw"length over";for(;vt+xt>=8;)dt.writeByte(255&($t<>>=8-vt,St=0,vt=0;St=$t<0&&dt.writeByte(St)},Rt},yt=function(ct){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)et.hasOwnProperty(tt)&&(j[tt]=et[tt])},_(a,$)};return function(a,$){_(a,$);function j(){this.constructor=a}a.prototype=$===null?Object.create($):(j.prototype=$.prototype,new j)}}();Object.defineProperty(dist,"__esModule",{value:!0});var QRCode_1=dist.QRCode=void 0,isEqual$1=lodash_isequalExports,qrGenerator=qrcodeExports,React=reactExports,ReactDOM=reactDomExports,QRCode=function(_){__extends(a,_);function a($){var j=_.call(this,$)||this;return j.canvas=React.createRef(),j}return a.utf16to8=function($){var j="",et,tt,rt=$.length;for(et=0;et=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(bt){return bt=Math.min(bt,tt/2),bt<0?0:bt});var st=nt[0]||0,at=nt[1]||0,ut=nt[2]||0,ht=nt[3]||0;ot.beginPath(),ot.moveTo(j+st,et),ot.lineTo(j+tt-at,et),at&&ot.quadraticCurveTo(j+tt,et,j+tt,et+at),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,at;typeof it!="number"&&!Array.isArray(it)?(st=it.outer||0,at=it.inner||0):(st=it,at=st);var ut,ht;typeof nt!="string"?(ut=nt.outer,ht=nt.inner):(ut=nt,ht=nt);var bt=tt*j+et,Et=rt*j+et,Ct=j*7;this.drawRoundedSquare(ot,Et,bt,Ct,ut,st,!1,$),Ct=j*3,bt+=j*2,Et+=j*2,this.drawRoundedSquare(ot,Et,bt,Ct,ht,at,!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,at=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),ht=this.transformPixelLengthIntoNumberOfCells(et,it)-1,bt=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=at-st&&j<=at+ht+st&&$>=ut-st&&$<=ut+bt+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 $=this.props,j=$.value,et=$.ecLevel,tt=$.enableCORS,rt=$.bgColor,nt=$.fgColor,it=$.logoImage,ot=$.logoOpacity,st=$.logoOnLoad,at=$.removeQrCodeBehindLogo,ut=$.qrStyle,ht=$.eyeRadius,bt=$.eyeColor,Et=$.logoPaddingStyle,Ct=+this.props.size,Pt=+this.props.quietZone,Tt=this.props.logoWidth?+this.props.logoWidth:0,It=this.props.logoHeight?+this.props.logoHeight:0,Lt=this.props.logoPadding?+this.props.logoPadding:0,Nt=qrGenerator(0,et);Nt.addData(a.utf16to8(j)),Nt.make();var Ut=ReactDOM.findDOMNode(this.canvas.current),jt=Ut.getContext("2d"),Mt=Ct+2*Pt,Dt=Nt.getModuleCount(),Ft=Ct/Dt,Bt=window.devicePixelRatio||1;Ut.height=Ut.width=Mt*Bt,jt.scale(Bt,Bt),jt.fillStyle=rt,jt.fillRect(0,0,Mt,Mt);var yt=Pt,mt=[{row:0,col:0},{row:0,col:Dt-7},{row:Dt-7,col:0}];if(jt.strokeStyle=nt,ut==="dots"){jt.fillStyle=nt;for(var ct=Ft/2,dt=0;dt0&&!Nt.isDark(dt-1,vt)&&vt>0&&!Nt.isDark(dt,vt-1)&&(St[0]=!0),dt>0&&!Nt.isDark(dt-1,vt)&&vt0&&!Nt.isDark(dt,vt-1)&&(St[3]=!0);var Rt=Math.ceil((vt+1)*Ft)-Math.floor(vt*Ft),$t=Math.ceil((dt+1)*Ft)-Math.floor(dt*Ft);jt.fillStyle=nt,jt.beginPath(),jt.arc(Math.round(vt*Ft)+ct+yt,Math.round(dt*Ft)+ct+yt,ct,0,2*Math.PI,!1),jt.closePath(),jt.fill(),St[0]||jt.fillRect(Math.round(vt*Ft)+yt,Math.round(dt*Ft)+yt,Rt/2,$t/2),St[1]||jt.fillRect(Math.round(vt*Ft)+yt+Math.floor(Rt/2),Math.round(dt*Ft)+yt,Rt/2,$t/2),St[2]||jt.fillRect(Math.round(vt*Ft)+yt+Math.floor(Rt/2),Math.round(dt*Ft)+yt+Math.floor($t/2),Rt/2,$t/2),St[3]||jt.fillRect(Math.round(vt*Ft)+yt,Math.round(dt*Ft)+yt+Math.floor($t/2),Rt/2,$t/2)}}else for(var dt=0;dt{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(_),at=sortedByLastUpdate(tt(_));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:ot,nfts:at,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 bt=tt[ht];if(bt.href===it&&(!ot||bt.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,bt)=>{ut.addEventListener("load",ht),ut.addEventListener("error",()=>bt(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(at=>at.resolve(st))};if(j){const st=window[j];window[j]=function(){st&&st(),ot(getGlobal($))}}tt(a,st=>{st?(requests[a].forEach(at=>at.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-CxgmswCk.js").then(_=>_.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-CAYDm4MY.js").then(_=>_.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-C1w4CmUB.js").then(_=>_.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-wTGJ9izo.js").then(_=>_.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-BS5pGh_M.js").then(_=>_.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-Dpc5YVG-.js").then(_=>_.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-Dh_p96TU.js").then(_=>_.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-MLiqQ3u5.js").then(_=>_.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-BcpEuM7C.js").then(_=>_.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-Dy1pFfJ_.js").then(_=>_.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-DLcBd-dE.js").then(_=>_.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-CJOVHMDM.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-Bh28IGlb.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-Dqy6JN7A.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),at=typeof it=="string"?this.references.wrapper:void 0;return import_react.default.createElement(it,{ref:at,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:$,fee:j,data:{nft:et}}=_,{fee:tt,operations:rt,estimationFailed:nt,isLoading:it,form:ot,signer:st,reEstimate:at,onSign:ut}=useSignPageHelpers(j,$,a),{recipient:ht}=rt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...ot,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:rt.type,signer:rt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:et})}),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:et.balance})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:tt})]}),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:[rt.operations[0].amount," out of ",et.balance]})})]}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:rt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:ht}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:it,operationType:rt.type,reEstimate:at,sender:rt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:nt,isLoading:it,onSubmit:ut,signer:st,text:headerText(rt.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:at}=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:at(tt),onSingleSubmit:at(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(),at=reactExports.useCallback(()=>{a(null),ot(),st("/home")},[ot,st]);reactExports.useEffect(()=>{const ht=bt=>{bt.key==="Escape"&&at()};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[at]);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:at,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(DrawerContent,{children:[rt&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(NFTDrawerBody,{nft:{...tt,owner:$},onCloseDrawer:at})}),!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:at})]}),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(at=>et.includes(at.address.pkh))),ot=lodashExports.differenceBy(_,nt,at=>at.address.pkh),st=nt.length===_.length;return reactExports.useEffect(()=>{j(at=>({...at,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:at=>{rt(!1),it(ut=>[...ut,at])}})]})}),jsxRuntimeExports.jsx(Wrap,{width:"100%",children:nt.map(at=>jsxRuntimeExports.jsx(AddressPill,{address:at.address,"data-testid":"account-pill",mode:{type:"removable",onRemove:()=>{rt(nt.length===1),it(ut=>ut.filter(ht=>ht.address.pkh!==at.address.pkh))}}},at.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 at=st===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:at?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:ot}),!at&&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(at=>at.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:at,newPassword:ut,newPasswordConfirmation:ht})=>{if(!(at===ut||ut!==ht))return et(async()=>{await j(changeMnemonicPassword({currentPassword:at,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:at=>ot("currentPassword")!==at||"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:at=>ot("newPassword")===at||"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:$,fee:j,data:{token:et}}=_,{fee:tt,operations:rt,estimationFailed:nt,isLoading:it,form:ot,signer:st,reEstimate:at,onSign:ut}=useSignPageHelpers(j,$,a),{amount:ht,recipient:bt}=rt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...ot,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:rt.type,signer:rt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TokenTile,{amount:ht,token:et}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(SignPageFee,{fee:tt})})}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:rt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:bt}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:it,operationType:rt.type,reEstimate:at,sender:rt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:nt,isLoading:it,onSubmit:ut,signer:st,text:headerText(rt.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:at}=nt,ut=tokenDecimals(a),ht=formatTokenAmount(a.balance,ut),bt=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:bt,type:"number",...st("prettyAmount",{required:"Amount is required",max:{value:ht.toString(),message:`Max amount is ${ht}`},validate:makeValidateDecimals(Number(ut))}),placeholder:bt}),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:at(tt),onSingleSubmit:at(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=bt;var et=rt($),tt=rt(j);function rt(Tt){return Tt&&Tt.__esModule?Tt:{default:Tt}}var nt=Object.assign||function(Tt){for(var It=1;It=0||Object.prototype.hasOwnProperty.call(Tt,Nt)&&(Lt[Nt]=Tt[Nt]);return Lt}function ot(Tt,It){if(!(Tt instanceof It))throw new TypeError("Cannot call a class as a function")}var st=function(){function Tt(It,Lt){for(var Nt=0;Nt0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return ht?Tt:Tt.capture}function Ct(Tt){if("touches"in Tt){var It=Tt.touches[0],Lt=It.pageX,Nt=It.pageY;return{x:Lt,y:Nt}}var Ut=Tt.screenX,jt=Tt.screenY;return{x:Ut,y:jt}}var Pt=function(Tt){ut(It,Tt);function It(){var Lt;ot(this,It);for(var Nt=arguments.length,Ut=Array(Nt),jt=0;jtUt&&this.props.onSwipeRight(1,Nt),this.movePosition.deltaY<-Ut?this.props.onSwipeUp(1,Nt):this.movePosition.deltaY>Ut&&this.props.onSwipeDown(1,Nt)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Nt){this.swiper=Nt,this.props.innerRef(Nt)}},{key:"render",value:function(){var Nt=this.props;Nt.tagName;var Ut=Nt.className,jt=Nt.style,Mt=Nt.children;Nt.allowMouseEvents,Nt.onSwipeUp,Nt.onSwipeDown,Nt.onSwipeLeft,Nt.onSwipeRight,Nt.onSwipeStart,Nt.onSwipeMove,Nt.onSwipeEnd,Nt.innerRef,Nt.tolerance;var Dt=it(Nt,["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:Ut,style:jt},Dt),Mt)}}]),It}($.Component);Pt.displayName="ReactSwipe",Pt.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},Pt.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=Pt})}(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:{}};/*! + `,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:at,pkh:st}=await getPublicKeyPairFromSk(nt);tt(at,st,it,_),$({description:`Successfully added ${it} account`,status:"success"}),a()},{title:"Social login failed"}),[_,$,et,tt,a]);return{isLoading:j,onboard:rt}},OnboardWithEmailButton=({onAuth:_})=>{const{isLoading:a,onboard:$}=useOnboardWithSocial("email",_);return jsxRuntimeExports.jsx(IconButton,{color:"black",_hover:{color:"white",background:colors.gray[600]},"aria-label":"Email SSO","data-testid":"login-button-email",icon:jsxRuntimeExports.jsx(EmailIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})},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",_hover:{color:"white",background:colors.gray[600]},"aria-label":"Twitter SSO","data-testid":"login-button-twitter",icon:jsxRuntimeExports.jsx(TwitterIcon,{fill:"currentColor"}),isLoading:a,onClick:$,variant:"socialLogin"})};var define_import_meta_env_default={BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const IS_DEV=define_import_meta_env_default.DEBUG,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.jsx(Button,{width:"100%",onClick:$=>_({type:"fakeAccount"}),size:"lg",variant:"tertiary",children:"Add a Fake Account"}),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(OnboardWithEmailButton,{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)}}),at=async({derivationPathTemplate:st,derivationPath:ot})=>{switch(a.type){case"ledger":return _($?{type:"restoreLedger",account:{...a,derivationPath:normalizeDerivationPath(ot)}}:{type:"restoreLedger",account:{...a,derivationPathTemplate:normalizeDerivationPath(st)}});case"mnemonic":{if($){const ut=await deriveSecretKey(a.mnemonic,ot,"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(at),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:at})=>{if(at&&at.length>0&&!["google","facebook","twitter","reddit","email"].includes(at))throw new Error("Invalid IDP");const ot=await new RpcClient(GHOSTNET.rpcUrl).getManagerKey(nt),ut=typeof ot=="string"?ot:ot.key;at?tt(ut,nt,it,at):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(),at=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:at}):jsxRuntimeExports.jsx(EnterAndConfirmPassword,{isLoading:rt,onSubmit:at})},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:at})=>tt(async()=>{const st=await at[0].text(),ot=JSON.parse(st);if(ot.recoveryPhrases&&ot.derivationPaths)await rt(ot,it);else if(ot["persist:accounts"])await restoreV2BackupFile(ot,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"}),at=a.derivationPathTemplate?makeDerivationPath(a.derivationPathTemplate,0):a.derivationPath,{pk:st,pkh:ot}=await getPk(at);$(a.derivationPathTemplate,at,st,ot,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,at)=>jsxRuntimeExports.jsx(ListItem,{children:it.content},at))}),jsxRuntimeExports.jsx(Button,{width:"100%",isLoading:et,onClick:nt,size:"lg",children:"Export Public Key"})]})})},mnemonic1="glory city income swallow act garment novel fringe bread chaos club dolphin when live penalty mirror donate razor dad eyebrow powder trumpet bunker wine",MnemonicAutocomplete=({inputName:_,validate:a,inputProps:$,listProps:j})=>{const[et,tt]=reactExports.useState(!0),{register:rt,setValue:nt,watch:it}=useFormContext(),at=it(_),st=wordlists.EN.filter(ut=>at&&ut.startsWith(at)).sort(),ot=!et&&st.length>0&&(st.length>1||st[0]!==at);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)}),...$}),ot&&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),at=ut=>{const dt=Number(ut);if(mnemonicSizes.includes(dt))return it(mt=>(mt>dt&&lodashExports.range(dt,Math.max(...mnemonicSizes)).forEach(xt=>{j(`word${xt}`,void 0)}),dt)),et()},st=ut=>rt(async()=>{const dt=ut.split(" ");if(!mnemonicSizes.includes(dt.length))throw new Error(`the mnemonic must be ${mnemonicSizes.join(", ")} words long`);return dt.slice(0,nt).forEach((mt,xt)=>{j(`word${xt}`,mt)}),et()}),ot=ut=>rt(async()=>{const dt=Object.values(ut).join(" ").trim();if(!validateMnemonic_1(dt))throw new Error(`Invalid Mnemonic: "${dt}"`);return _({type:"nameAccount",account:{type:"mnemonic",mnemonic:dt}}),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:$(ot),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=>at(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 dt=`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:dt,inputProps:{onPaste:async mt=>{mt.preventDefault();const xt=await navigator.clipboard.readText();return st(xt)},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&&jsxRuntimeExports.jsx(Button,{width:"100%",onClick:()=>st(mnemonic1),size:"lg",children:"Enter test mnemonic (Dev only)"})]})})})})})},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,at=async({secretKey:st,password:ot})=>j(async()=>{try{const dt=await(await InMemorySigner.fromSecretKey(st.trim(),ot)).secretKey();_({type:"nameAccount",account:{type:"secret_key",secretKey:dt}})}catch(ut){const dt=ut.message||"";throw dt.includes("Cannot read properties of null")?new Error("Key-password pair is invalid"):dt.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(at),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((at,st)=>{const ot=`${at.index}`,ut=tt[ot];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:at.index+1}),jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx(MnemonicAutocomplete,{inputName:ot,inputProps:{paddingLeft:"36px",size:"md"},listProps:{marginTop:"6px"},validate:dt=>{if(dt!==at.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&&jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"12px",onClick:it,size:"lg",children:"Bypass (Dev only)"})]})})})})},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()},at=()=>{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}),at()]})]}),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:at,password:st})=>tt(async()=>{await nt({fingerPrint:a,password:st,label:at.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:at=>it({name:$,password:at})}):jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:at=>j(at.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(),at=useRemoveNonMnemonic(),st=useImplicitAccounts().length===a.length,ot="Remove All Accounts";let ut,dt="Remove All";const mt=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.",dt="Remove & Off-board"):tt?ut=`Are you sure you want to remove all accounts derived from ${mt}?`:ut=`Are you sure you want to remove all of your ${mt}?`;const xt=()=>rt(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:dt,description:ut,onSubmit:()=>{tt?it(j.seedFingerPrint):et||at(j.type),nt()},title:ot})),Ct=()=>{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?Ct:void 0,onRemove:xt})]}),a.map(Pt=>jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(AccountTile,{account:Pt,balance:$[Pt.address.pkh]})},Pt.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,fee:rt,data:{threshold:nt,signers:it,name:at}}=_,{fee:st,operations:ot,estimationFailed:ut,isLoading:dt,form:mt,reEstimate:xt,signer:Ct,onSign:Pt}=useSignPageHelpers(rt,tt,et),Tt=$||dt,kt=Lt=>j(async()=>{const Nt=await Pt(Lt);if(!Nt)throw new Error("An error occurred during contract origination");const zt=(await Nt.getOriginatedContractAddresses())[0];a(multisigActions.addMultisigLabel({pkh:zt,label:at}))});return jsxRuntimeExports.jsx(FormProvider,{...mt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,description:"Please review the details and then continue to submit contract.",operationsType:ot.type,signer:Ct,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:at}),jsxRuntimeExports.jsx(FormLabel,{children:"Approvers"}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column",gap:"12px",marginBottom:"12px","data-testid":"approvers",children:it.map(Lt=>jsxRuntimeExports.jsx(AddressTile,{address:parsePkh(Lt.val),"data-testid":`approver-${Lt.val}`},Lt.val))}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(Threshold,{signersAmount:it.length,threshold:nt})}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(FormControl,{marginTop:"24px",marginBottom:"12px",children:jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!1,inputName:"signer",isLoading:Tt,keepValid:!0,label:"Creation Fee Payer",onUpdate:xt})}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(SignPageFee,{fee:st})})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:ut,isLoading:Tt,onSubmit:kt,signer:Ct,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:at,getValues:st,watch:ot}=et,ut=useFieldArray({control:nt,name:"signers",rules:{minLength:1}}),dt=ot("signers").length,mt=useOpenSignPageFormAction({SignPage:SignTransactionFormPage,signPageExtraData:ot(),FormPage:SelectApproversFormPage,defaultFormPageProps:_,toOperation:toOperation$4}),{onFormSubmitActionHandlers:[xt],isLoading:Ct}=useHandleOnSubmitFormActions([mt]);return jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalBackButton,{onClick:a}),jsxRuntimeExports.jsxs("form",{onSubmit:at(xt),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((Pt,Tt)=>{var jt;const kt=tt.signers&&tt.signers[Tt],Lt=`${Tt===0?"Select ":""}${ordinal$1(Tt+1)} approver`,Nt=dt>1?"short":"default",zt=Nt==="short"?"368px":"100%";return jsxRuntimeExports.jsxs(FormControl,{display:"inline-block",width:zt,marginBottom:"8px","data-testid":`signer-input-${Tt}`,isInvalid:!!kt,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!0,inputName:`signers.${Tt}.val`,label:Lt,size:Nt,style:{width:zt},validate:Mt=>{if(!isValidImplicitPkh(Mt))return"Signer must be valid TZ address";const Dt=st("signers").map(Ft=>Ft.val);if(Dt.length>new Set(Dt).size)return"Duplicate approver"}}),dt>1&&jsxRuntimeExports.jsx(IconButton,{position:"absolute",height:"24px",marginTop:"-36px",marginLeft:"374px",background:colors.gray[500],"aria-label":"Remove","data-testid":`remove-signer-${Tt}`,icon:jsxRuntimeExports.jsx(TrashIcon,{width:"12px",height:"14px",stroke:colors.gray[300]}),isRound:!0,onClick:()=>ut.remove(Tt),size:"xs",variant:"tertiary"}),kt&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":`signer-${Tt}-error`,children:(jt=kt.val)==null?void 0:jt.message})]},Pt.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:dt,message:`Max no. of approvals is ${dt}`},min:{value:1,message:"Min no. of approvals is 1"}})})})]}),jsxRuntimeExports.jsxs(Text,{display:"inline","data-testid":"max-signers",children:["out of ",dt]}),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:Ct,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),at=({name:ot})=>it(jsxRuntimeExports.jsx(SelectApproversFormPage,{form:{name:ot.trim()},goBack:()=>it(jsxRuntimeExports.jsx(NameMultisigFormPage,{name:ot})),sender:nt(rt)})),st=useValidateName();return jsxRuntimeExports.jsx(FormProvider,{...a,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:tt(at),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}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:at,reEstimate:st,onSign:ot}=useSignPageHelpers(j,$,a),ut=tt.operations[0].recipient;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(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:at.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:et})})}),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(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ot,signer:at,text:headerText(tt.type,a)})})]})})})},FormPage$3=_=>{var ot;const a=(ot=_.form)==null?void 0:ot.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:at},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:!!at.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!_.sender,label:"From"}),at.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:at.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px","data-testid":"baker",isInvalid:!!at.baker,children:[jsxRuntimeExports.jsx(BakersAutocomplete,{allowUnknown:!0,inputName:"baker",label:"Baker"}),at.baker&&jsxRuntimeExports.jsx(FormErrorMessage,{children:at.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}=_,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:at,reEstimate:st,onSign:ot}=useSignPageHelpers(j,$,a);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(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:at.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:et})}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:nt,operationType:tt.type,reEstimate:st,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:ot,signer:at,text:headerText(tt.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:at}=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:at(rt),onSingleSubmit:at(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:at}}=_,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:at},sender:st})),variant:"warning",children:"End Delegation"}),jsxRuntimeExports.jsx(Button,{flex:1,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$3,{form:{sender:it,baker:at},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,at=rt.args[1].args[1].int;return{type:"fa2",contract:$,sender:parsePkh(convertToPkh(tt)),recipient:parsePkh(convertToPkh(nt)),tokenId:it,amount:at}})})},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:_,fee:a,operation:$,actionType:j,transactionCount:et})=>{const{handleAsyncAction:tt}=useAsyncActionHandler(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=at=>tt(async()=>{const{opHash:st}=await executeOperations($,at);return rt(jsxRuntimeExports.jsx(SuccessStep,{hash:st}))},{title:`Failed ${j}`}),it=`${lodashExports.capitalize(j)} transaction`;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{fee:a,signer:_,title:it,transactionCount:et}),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),at=useSelectedNetwork(),st=tt(j.pkh),ot=_===0,ut=()=>nt(async()=>{if(!st)throw new Error("Can't approve or execute with an account you don't own");const mt=ot?"execute":"approve",xt=makeAccountOperations(st,st,[makeMultisigApproveOrExecuteOperation(a.address,mt,$.id)]),Ct=await estimate(xt,at);let Pt;try{Pt=parseRawMichelson($.rawActions,a).length}catch{Pt=1}return it(jsxRuntimeExports.jsx(SignPage$2,{actionType:mt,fee:Ct,operation:xt,signer:st,transactionCount:Pt}))}),dt=getMultisigSignerState({approvals:$.approvals,signerAddress:j,operationIsExecutable:ot,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:dt})})},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 ot,ut;const j=a.amount,et=useGetOperationDestination((ot=a.from)==null?void 0:ot.address,(ut=a.to)==null?void 0:ut.address),tt=$.type==="nft",rt=tokenPrettyAmount(j,$,{showSymbol:!0}),nt=operationColor(et),it=tt?"white":nt,at=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:[at,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:[at,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:at,fetchPreviousPage:st,error:ot}=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,dt)=>{var xt;const mt=(xt=lodashExports.maxBy(dt.flat(),"id"))==null?void 0:xt.id;return mt?{lastId:mt,sort:"asc"}:{}},select:({pages:ut})=>filterDuplicatedTokenTransfers([[...ut[0]].sort((dt,mt)=>dt.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:at}},fetchOperationsAndUpdateTokensInfo=async(_,a,$,j)=>{const et=await getCombinedOperations($.map(at=>at.address.pkh),a,j),tt=et.filter(at=>at.type==="transaction").map(at=>at.id),rt=await getRelatedTokenTransfers(tt,a),nt=et.filter(at=>at.type==="token_transfer"),it=[...rt,...nt];return _(assetsActions.updateTokenTransfers(it)),_(tokensActions.addTokens({network:a,tokens:it.map(at=>at.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(ot=>ot.label),at=tt.items.map(ot=>ot.label),st=Object.values(rt).map(ot=>ot.name);[it,at,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:ot})=>{a(renameAccount(_,ot)),$()},{handleSubmit:et,formState:{isValid:tt,errors:rt},register:nt,reset:it}=useForm({mode:"onBlur",defaultValues:{name:_.label}}),at=({name:ot})=>{j({name:ot.trim()}),it()},st=useValidateName(_.label);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:et(at),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:at,description:it,onSubmit:()=>{tt(_),$(),j("/")},title:nt}));break}const nt="Remove Account";let it="Are you sure you want to remove this account?",at="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.",at="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),at=useSelectedNetwork(),[st,ot]=reactExports.useState(null),{handleAsyncAction:ut}=useAsyncActionHandler();return reactExports.useEffect(()=>{ut(async()=>{const dt=await getLastDelegation(rt.address.pkh,at);dt&&ot(makeDelegation(dt))}).catch(lodashExports.noop)},[rt.address.pkh,ut,at]),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]",at="[object AsyncFunction]",st="[object Boolean]",ot="[object Date]",ut="[object Error]",dt="[object Function]",mt="[object GeneratorFunction]",xt="[object Map]",Ct="[object Number]",Pt="[object Null]",Tt="[object Object]",kt="[object Promise]",Lt="[object Proxy]",Nt="[object RegExp]",zt="[object Set]",jt="[object String]",Mt="[object Symbol]",Dt="[object Undefined]",Ft="[object WeakMap]",Bt="[object ArrayBuffer]",yt="[object DataView]",bt="[object Float32Array]",ct="[object Float64Array]",ht="[object Int8Array]",vt="[object Int16Array]",St="[object Int32Array]",Rt="[object Uint8Array]",$t="[object Uint8ClampedArray]",Et="[object Uint16Array]",At="[object Uint32Array]",wt=/[\\^$.*+?()[\]{}|]/g,Ot=/^\[object .+?Constructor\]$/,tr=/^(?:0|[1-9]\d*)$/,nr={};nr[bt]=nr[ct]=nr[ht]=nr[vt]=nr[St]=nr[Rt]=nr[$t]=nr[Et]=nr[At]=!0,nr[nt]=nr[it]=nr[Bt]=nr[st]=nr[yt]=nr[ot]=nr[ut]=nr[dt]=nr[xt]=nr[Ct]=nr[Tt]=nr[Nt]=nr[zt]=nr[jt]=nr[Ft]=!1;var ir=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Wt=typeof self=="object"&&self&&self.Object===Object&&self,Kt=ir||Wt||Function("return this")(),Jt=a&&!a.nodeType&&a,Ht=Jt&&!0&&_&&!_.nodeType&&_,Vt=Ht&&Ht.exports===Jt,Qt=Vt&&ir.process,dr=function(){try{return Qt&&Qt.binding&&Qt.binding("util")}catch{}}(),xr=dr&&dr.isTypedArray;function pr(_r,Xt){for(var cr=-1,gr=_r==null?0:_r.length,Dr=0,rn=[];++cr-1}function ps(_r,Xt){var cr=this.__data__,gr=bo(cr,_r);return gr<0?(++this.size,cr.push([_r,Xt])):cr[gr][1]=Xt,this}yn.prototype.clear=En,yn.prototype.delete=ds,yn.prototype.get=fs,yn.prototype.has=hs,yn.prototype.set=ps;function qn(_r){var Xt=-1,cr=_r==null?0:_r.length;for(this.clear();++XtPn))return!1;var _n=rn.get(_r);if(_n&&rn.get(Xt))return _n==Xt;var Nn=-1,Fn=!0,ts=cr&tt?new es:void 0;for(rn.set(_r,Xt),rn.set(Xt,_r);++Nn-1&&_r%1==0&&_r-1&&_r%1==0&&_r<=rt}function Io(_r){var Xt=typeof _r;return _r!=null&&(Xt=="object"||Xt=="function")}function So(_r){return _r!=null&&typeof _r=="object"}var ko=xr?fr(xr):xl;function Xl(_r){return wo(_r)?yl(_r):El(_r)}function rs(){return[]}function Xn(){return!1}_.exports=Ts})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports,qrcode={exports:{}};(function(_,a){var $=function(){var j=function(Nt,zt){var jt=236,Mt=17,Dt=Nt,Ft=tt[zt],Bt=null,yt=0,bt=null,ct=[],ht={},vt=function(Kt,Jt){yt=Dt*4+17,Bt=function(Ht){for(var Vt=new Array(Ht),Qt=0;Qt=7&&At(Kt),bt==null&&(bt=nr(Dt,Ft,ct)),Ot(bt,Jt)},St=function(Kt,Jt){for(var Ht=-1;Ht<=7;Ht+=1)if(!(Kt+Ht<=-1||yt<=Kt+Ht))for(var Vt=-1;Vt<=7;Vt+=1)Jt+Vt<=-1||yt<=Jt+Vt||(0<=Ht&&Ht<=6&&(Vt==0||Vt==6)||0<=Vt&&Vt<=6&&(Ht==0||Ht==6)||2<=Ht&&Ht<=4&&2<=Vt&&Vt<=4?Bt[Kt+Ht][Jt+Vt]=!0:Bt[Kt+Ht][Jt+Vt]=!1)},Rt=function(){for(var Kt=0,Jt=0,Ht=0;Ht<8;Ht+=1){vt(!0,Ht);var Vt=nt.getLostPoint(ht);(Ht==0||Kt>Vt)&&(Kt=Vt,Jt=Ht)}return Jt},$t=function(){for(var Kt=8;Kt>Ht&1)==1;Bt[Math.floor(Ht/3)][Ht%3+yt-8-3]=Vt}for(var Ht=0;Ht<18;Ht+=1){var Vt=!Kt&&(Jt>>Ht&1)==1;Bt[Ht%3+yt-8-3][Math.floor(Ht/3)]=Vt}},wt=function(Kt,Jt){for(var Ht=Ft<<3|Jt,Vt=nt.getBCHTypeInfo(Ht),Qt=0;Qt<15;Qt+=1){var dr=!Kt&&(Vt>>Qt&1)==1;Qt<6?Bt[Qt][8]=dr:Qt<8?Bt[Qt+1][8]=dr:Bt[yt-15+Qt][8]=dr}for(var Qt=0;Qt<15;Qt+=1){var dr=!Kt&&(Vt>>Qt&1)==1;Qt<8?Bt[8][yt-Qt-1]=dr:Qt<9?Bt[8][15-Qt-1+1]=dr:Bt[8][15-Qt-1]=dr}Bt[yt-8][8]=!Kt},Ot=function(Kt,Jt){for(var Ht=-1,Vt=yt-1,Qt=7,dr=0,xr=nt.getMaskFunction(Jt),pr=yt-1;pr>0;pr-=2)for(pr==6&&(pr-=1);;){for(var Ir=0;Ir<2;Ir+=1)if(Bt[Vt][pr-Ir]==null){var kr=!1;dr>>Qt&1)==1);var lr=xr(Vt,pr-Ir);lr&&(kr=!kr),Bt[Vt][pr-Ir]=kr,Qt-=1,Qt==-1&&(dr+=1,Qt=7)}if(Vt+=Ht,Vt<0||yt<=Vt){Vt-=Ht,Ht=-Ht;break}}},tr=function(Kt,Jt){for(var Ht=0,Vt=0,Qt=0,dr=new Array(Jt.length),xr=new Array(Jt.length),pr=0;pr=0?$r.getAt(Pr):0}}for(var Rr=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(Mt,8);return tr(Qt,Vt)};ht.addData=function(Kt,Jt){Jt=Jt||"Byte";var Ht=null;switch(Jt){case"Numeric":Ht=ut(Kt);break;case"Alphanumeric":Ht=dt(Kt);break;case"Byte":Ht=mt(Kt);break;case"Kanji":Ht=xt(Kt);break;default:throw"mode:"+Jt}ct.push(Ht),bt=null},ht.isDark=function(Kt,Jt){if(Kt<0||yt<=Kt||Jt<0||yt<=Jt)throw Kt+","+Jt;return Bt[Kt][Jt]},ht.getModuleCount=function(){return yt},ht.make=function(){if(Dt<1){for(var Kt=1;Kt<40;Kt++){for(var Jt=st.getRSBlocks(Kt,Ft),Ht=ot(),Vt=0;Vt"u"?Kt*4:Jt;var Ht="";Ht+='";for(var Qt=0;Qt';Ht+=""}return Ht+="",Ht+="
",Ht},ht.createSvgTag=function(Kt,Jt,Ht,Vt){var Qt={};typeof arguments[0]=="object"&&(Qt=arguments[0],Kt=Qt.cellSize,Jt=Qt.margin,Ht=Qt.alt,Vt=Qt.title),Kt=Kt||2,Jt=typeof Jt>"u"?Kt*4:Jt,Ht=typeof Ht=="string"?{text:Ht}:Ht||{},Ht.text=Ht.text||null,Ht.id=Ht.text?Ht.id||"qrcode-description":null,Vt=typeof Vt=="string"?{text:Vt}:Vt||{},Vt.text=Vt.text||null,Vt.id=Vt.text?Vt.id||"qrcode-title":null;var dr=ht.getModuleCount()*Kt+Jt*2,xr,pr,Ir,kr,lr="",fr;for(fr="l"+Kt+",0 0,"+Kt+" -"+Kt+",0 0,-"+Kt+"z ",lr+=''+ir(Vt.text)+"":"",lr+=Ht.text?''+ir(Ht.text)+"":"",lr+='',lr+='"u"?Kt*4:Jt;var Ht=ht.getModuleCount()*Kt+Jt*2,Vt=Jt,Qt=Ht-Jt;return Lt(Ht,Ht,function(dr,xr){if(Vt<=dr&&dr"u"?Kt*4:Jt;var Vt=ht.getModuleCount()*Kt+Jt*2,Qt="";return Qt+="",Qt};var ir=function(Kt){for(var Jt="",Ht=0;Ht":Jt+=">";break;case"&":Jt+="&";break;case'"':Jt+=""";break;default:Jt+=Vt;break}}return Jt},Wt=function(Kt){var Jt=1;Kt=typeof Kt>"u"?Jt*2:Kt;var Ht=ht.getModuleCount()*Jt+Kt*2,Vt=Kt,Qt=Ht-Kt,dr,xr,pr,Ir,kr,lr={"██":"█","█ ":"▀"," █":"▄"," ":" "},fr={"██":"▀","█ ":"▀"," █":" "," ":" "},Er="";for(dr=0;dr=Qt?fr[kr]:lr[kr];Er+=` +`}return Ht%2&&Kt>0?Er.substring(0,Er.length-Ht-1)+Array(Ht+1).join("▀"):Er.substring(0,Er.length-1)};return ht.createASCII=function(Kt,Jt){if(Kt=Kt||1,Kt<2)return Wt(Jt);Kt-=1,Jt=typeof Jt>"u"?Kt*2:Jt;var Ht=ht.getModuleCount()*Kt+Jt*2,Vt=Jt,Qt=Ht-Jt,dr,xr,pr,Ir,kr=Array(Kt+1).join("██"),lr=Array(Kt+1).join(" "),fr="",Er="";for(dr=0;dr>>8),Ft.push(bt&255)):Ft.push(Mt)}}return Ft}};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 Nt=[[],[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]],zt=1335,jt=7973,Mt=21522,Dt={},Ft=function(Bt){for(var yt=0;Bt!=0;)yt+=1,Bt>>>=1;return yt};return Dt.getBCHTypeInfo=function(Bt){for(var yt=Bt<<10;Ft(yt)-Ft(zt)>=0;)yt^=zt<=0;)yt^=jt<5&&(bt+=3+vt-5)}for(var ct=0;ct=256;)Dt-=255;return Nt[Dt]},Mt}();function at(Nt,zt){if(typeof Nt.length>"u")throw Nt.length+"/"+zt;var jt=function(){for(var Dt=0;Dt"u")throw"bad rs block @ typeNumber:"+Dt+"/errorCorrectionLevel:"+Ft;for(var yt=Bt.length/3,bt=[],ct=0;ct>>7-Mt%8&1)==1},jt.put=function(Mt,Dt){for(var Ft=0;Ft>>Dt-Ft-1&1)==1)},jt.getLengthInBits=function(){return zt},jt.putBit=function(Mt){var Dt=Math.floor(zt/8);Nt.length<=Dt&&Nt.push(0),Mt&&(Nt[Dt]|=128>>>zt%8),zt+=1},jt},ut=function(Nt){var zt=et.MODE_NUMBER,jt=Nt,Mt={};Mt.getMode=function(){return zt},Mt.getLength=function(Bt){return jt.length},Mt.write=function(Bt){for(var yt=jt,bt=0;bt+2>>8&255)*192+(bt&255),Ft.put(bt,13),yt+=2}if(yt>>8)},zt.writeBytes=function(jt,Mt,Dt){Mt=Mt||0,Dt=Dt||jt.length;for(var Ft=0;Ft0&&(jt+=","),jt+=Nt[Mt];return jt+="]",jt},zt},Pt=function(){var Nt=0,zt=0,jt=0,Mt="",Dt={},Ft=function(yt){Mt+=String.fromCharCode(Bt(yt&63))},Bt=function(yt){if(!(yt<0)){if(yt<26)return 65+yt;if(yt<52)return 97+(yt-26);if(yt<62)return 48+(yt-52);if(yt==62)return 43;if(yt==63)return 47}throw"n:"+yt};return Dt.writeByte=function(yt){for(Nt=Nt<<8|yt&255,zt+=8,jt+=1;zt>=6;)Ft(Nt>>>zt-6),zt-=6},Dt.flush=function(){if(zt>0&&(Ft(Nt<<6-zt),Nt=0,zt=0),jt%3!=0)for(var yt=3-jt%3,bt=0;bt=zt.length){if(Dt==0)return-1;throw"unexpected end of file./"+Dt}var yt=zt.charAt(jt);if(jt+=1,yt=="=")return Dt=0,-1;if(yt.match(/^\s$/))continue;Mt=Mt<<6|Bt(yt.charCodeAt(0)),Dt+=6}var bt=Mt>>>Dt-8&255;return Dt-=8,bt};var Bt=function(yt){if(65<=yt&&yt<=90)return yt-65;if(97<=yt&&yt<=122)return yt-97+26;if(48<=yt&&yt<=57)return yt-48+52;if(yt==43)return 62;if(yt==47)return 63;throw"c:"+yt};return Ft},kt=function(Nt,zt){var jt=Nt,Mt=zt,Dt=new Array(Nt*zt),Ft={};Ft.setPixel=function(ct,ht,vt){Dt[ht*jt+ct]=vt},Ft.write=function(ct){ct.writeString("GIF87a"),ct.writeShort(jt),ct.writeShort(Mt),ct.writeByte(128),ct.writeByte(0),ct.writeByte(0),ct.writeByte(0),ct.writeByte(0),ct.writeByte(0),ct.writeByte(255),ct.writeByte(255),ct.writeByte(255),ct.writeString(","),ct.writeShort(0),ct.writeShort(0),ct.writeShort(jt),ct.writeShort(Mt),ct.writeByte(0);var ht=2,vt=yt(ht);ct.writeByte(ht);for(var St=0;vt.length-St>255;)ct.writeByte(255),ct.writeBytes(vt,St,255),St+=255;ct.writeByte(vt.length-St),ct.writeBytes(vt,St,vt.length-St),ct.writeByte(0),ct.writeString(";")};var Bt=function(ct){var ht=ct,vt=0,St=0,Rt={};return Rt.write=function($t,Et){if($t>>>Et)throw"length over";for(;vt+Et>=8;)ht.writeByte(255&($t<>>=8-vt,St=0,vt=0;St=$t<0&&ht.writeByte(St)},Rt},yt=function(ct){for(var ht=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)et.hasOwnProperty(tt)&&(j[tt]=et[tt])},_(a,$)};return function(a,$){_(a,$);function j(){this.constructor=a}a.prototype=$===null?Object.create($):(j.prototype=$.prototype,new j)}}();Object.defineProperty(dist,"__esModule",{value:!0});var QRCode_1=dist.QRCode=void 0,isEqual$1=lodash_isequalExports,qrGenerator=qrcodeExports,React=reactExports,ReactDOM=reactDomExports,QRCode=function(_){__extends(a,_);function a($){var j=_.call(this,$)||this;return j.canvas=React.createRef(),j}return a.utf16to8=function($){var j="",et,tt,rt=$.length;for(et=0;et=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,at){at.lineWidth=$,at.fillStyle=rt,at.strokeStyle=rt,et+=$/2,j+=$/2,tt-=$,Array.isArray(nt)||(nt=[nt,nt,nt,nt]),nt=nt.map(function(mt){return mt=Math.min(mt,tt/2),mt<0?0:mt});var st=nt[0]||0,ot=nt[1]||0,ut=nt[2]||0,dt=nt[3]||0;at.beginPath(),at.moveTo(j+st,et),at.lineTo(j+tt-ot,et),ot&&at.quadraticCurveTo(j+tt,et,j+tt,et+ot),at.lineTo(j+tt,et+tt-ut),ut&&at.quadraticCurveTo(j+tt,et+tt,j+tt-ut,et+tt),at.lineTo(j+dt,et+tt),dt&&at.quadraticCurveTo(j,et+tt,j,et+tt-dt),at.lineTo(j,et+st),st&&at.quadraticCurveTo(j,et,j+st,et),at.closePath(),at.stroke(),it&&at.fill()},a.prototype.drawPositioningPattern=function($,j,et,tt,rt,nt,it){it===void 0&&(it=[0,0,0,0]);var at=Math.ceil(j),st,ot;typeof it!="number"&&!Array.isArray(it)?(st=it.outer||0,ot=it.inner||0):(st=it,ot=st);var ut,dt;typeof nt!="string"?(ut=nt.outer,dt=nt.inner):(ut=nt,dt=nt);var mt=tt*j+et,xt=rt*j+et,Ct=j*7;this.drawRoundedSquare(at,xt,mt,Ct,ut,st,!1,$),Ct=j*3,mt+=j*2,xt+=j*2,this.drawRoundedSquare(at,xt,mt,Ct,dt,ot,!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,at){if(at){var st=2,ot=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),dt=this.transformPixelLengthIntoNumberOfCells(et,it)-1,mt=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=ot-st&&j<=ot+dt+st&&$>=ut-st&&$<=ut+mt+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 $=this.props,j=$.value,et=$.ecLevel,tt=$.enableCORS,rt=$.bgColor,nt=$.fgColor,it=$.logoImage,at=$.logoOpacity,st=$.logoOnLoad,ot=$.removeQrCodeBehindLogo,ut=$.qrStyle,dt=$.eyeRadius,mt=$.eyeColor,xt=$.logoPaddingStyle,Ct=+this.props.size,Pt=+this.props.quietZone,Tt=this.props.logoWidth?+this.props.logoWidth:0,kt=this.props.logoHeight?+this.props.logoHeight:0,Lt=this.props.logoPadding?+this.props.logoPadding:0,Nt=qrGenerator(0,et);Nt.addData(a.utf16to8(j)),Nt.make();var zt=ReactDOM.findDOMNode(this.canvas.current),jt=zt.getContext("2d"),Mt=Ct+2*Pt,Dt=Nt.getModuleCount(),Ft=Ct/Dt,Bt=window.devicePixelRatio||1;zt.height=zt.width=Mt*Bt,jt.scale(Bt,Bt),jt.fillStyle=rt,jt.fillRect(0,0,Mt,Mt);var yt=Pt,bt=[{row:0,col:0},{row:0,col:Dt-7},{row:Dt-7,col:0}];if(jt.strokeStyle=nt,ut==="dots"){jt.fillStyle=nt;for(var ct=Ft/2,ht=0;ht0&&!Nt.isDark(ht-1,vt)&&vt>0&&!Nt.isDark(ht,vt-1)&&(St[0]=!0),ht>0&&!Nt.isDark(ht-1,vt)&&vt0&&!Nt.isDark(ht,vt-1)&&(St[3]=!0);var Rt=Math.ceil((vt+1)*Ft)-Math.floor(vt*Ft),$t=Math.ceil((ht+1)*Ft)-Math.floor(ht*Ft);jt.fillStyle=nt,jt.beginPath(),jt.arc(Math.round(vt*Ft)+ct+yt,Math.round(ht*Ft)+ct+yt,ct,0,2*Math.PI,!1),jt.closePath(),jt.fill(),St[0]||jt.fillRect(Math.round(vt*Ft)+yt,Math.round(ht*Ft)+yt,Rt/2,$t/2),St[1]||jt.fillRect(Math.round(vt*Ft)+yt+Math.floor(Rt/2),Math.round(ht*Ft)+yt,Rt/2,$t/2),St[2]||jt.fillRect(Math.round(vt*Ft)+yt+Math.floor(Rt/2),Math.round(ht*Ft)+yt+Math.floor($t/2),Rt/2,$t/2),St[3]||jt.fillRect(Math.round(vt*Ft)+yt,Math.round(ht*Ft)+yt+Math.floor($t/2),Rt/2,$t/2)}}else for(var ht=0;ht{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=$(_),at=j(_),st=et(_),ot=sortedByLastUpdate(tt(_));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:at,nfts:ot,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 at=it.endsWith(".css"),st=at?'[rel="stylesheet"]':"";if(!!j)for(let dt=tt.length-1;dt>=0;dt--){const mt=tt[dt];if(mt.href===it&&(!at||mt.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${it}"]${st}`))return;const ut=document.createElement("link");if(ut.rel=at?"stylesheet":scriptRel,at||(ut.as="script",ut.crossOrigin=""),ut.href=it,nt&&ut.setAttribute("nonce",nt),document.head.appendChild(ut),at)return new Promise((dt,mt)=>{ut.addEventListener("load",dt),ut.addEventListener("error",()=>mt(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 at=st=>{requests[a].forEach(ot=>ot.resolve(st))};if(j){const st=window[j];window[j]=function(){st&&st(),at(getGlobal($))}}tt(a,st=>{st?(requests[a].forEach(ot=>ot.reject(st)),requests[a]=null):j||at(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-rN4jOR1J.js").then(_=>_.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-DyFw8PPp.js").then(_=>_.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-OM6omvoU.js").then(_=>_.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-BMhgBc2q.js").then(_=>_.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-DXJhKi1H.js").then(_=>_.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-EfsHeeCs.js").then(_=>_.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-Bl5F6sjb.js").then(_=>_.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-T6QqMvoo.js").then(_=>_.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-CteX4E3j.js").then(_=>_.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-BcC5g1Wh.js").then(_=>_.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-CsuXaKoc.js").then(_=>_.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-Kwks3p2E.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-l0jhCgoe.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:at,disableDeferredLoading:st}=this.props;if(!(0,import_react_fast_compare$1.default)(a.url,$)){if(this.isLoading&&!at.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-jzdirRGw.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:at}=this.state,st=this.getAttributes(j),ot=typeof it=="string"?this.references.wrapper:void 0;return import_react.default.createElement(it,{ref:ot,style:{...et,width:tt,height:rt},...st},import_react.default.createElement(UniversalSuspense,{fallback:nt},at?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:$,fee:j,data:{nft:et}}=_,{fee:tt,operations:rt,estimationFailed:nt,isLoading:it,form:at,signer:st,reEstimate:ot,onSign:ut}=useSignPageHelpers(j,$,a),{recipient:dt}=rt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...at,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:rt.type,signer:rt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(Flex,{marginBottom:"12px",children:jsxRuntimeExports.jsx(SendNFTRecapTile,{nft:et})}),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:et.balance})]}),jsxRuntimeExports.jsx(SignPageFee,{fee:tt})]}),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:[rt.operations[0].amount," out of ",et.balance]})})]}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:rt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:dt}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:it,operationType:rt.type,reEstimate:ot,sender:rt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:nt,isLoading:it,onSubmit:ut,signer:st,text:headerText(rt.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:at},register:st,handleSubmit:ot}=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:!!at.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]})]})]})}),at.quantity&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"quantity-error",children:at.quantity.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!at.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),at.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:at.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!at.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),at.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:at.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ot(tt),onSingleSubmit:ot(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(dt=>fullId(dt)===j),rt=!!tt,{isOpen:nt,onOpen:it,onClose:at}=useDisclosure$1({defaultIsOpen:rt}),st=useNavigate(),ot=reactExports.useCallback(()=>{a(null),at(),st("/home")},[at,st]);reactExports.useEffect(()=>{const dt=mt=>{mt.key==="Escape"&&ot()};return document.addEventListener("keydown",dt),()=>document.removeEventListener("keydown",dt)},[ot]);const ut=reactExports.useMemo(()=>({selectedAccount:_,selectAccount:dt=>{a(dt),it()}}),[_,it]);return jsxRuntimeExports.jsxs(SelectedAccountContext.Provider,{value:ut,children:[jsxRuntimeExports.jsx(AccountsList,{}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:nt,onClose:ot,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(DrawerContent,{children:[rt&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(NFTDrawerBody,{nft:{...tt,owner:$},onCloseDrawer:ot})}),!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:ot})]}),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(ot=>et.includes(ot.address.pkh))),at=lodashExports.differenceBy(_,nt,ot=>ot.address.pkh),st=nt.length===_.length;return reactExports.useEffect(()=>{j(ot=>({...ot,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:at,onSelect:ot=>{rt(!1),it(ut=>[...ut,ot])}})]})}),jsxRuntimeExports.jsx(Wrap,{width:"100%",children:nt.map(ot=>jsxRuntimeExports.jsx(AddressPill,{address:ot.address,"data-testid":"account-pill",mode:{type:"removable",onRemove:()=>{rt(nt.length===1),it(ut=>ut.filter(dt=>dt.address.pkh!==ot.address.pkh))}}},ot.address.pkh))})]})}},NFTsView=()=>{const _=useAllNfts(),{accountsFilter:a,selectedAccounts:$}=useAccountsFilter(),[j,et]=reactExports.useState(void 0);reactExports.useEffect(()=>{const it=at=>{at.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=at=>{if(nt.current||!et||tt)return;const st=at.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((at,st)=>{const ot=st===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:ot?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:at}),!ot&&jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Divider,{marginTop:"20px"})})]},at.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:_}),at=st=>{j(networksActions.upsertNetwork(st)),$()};return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(at),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(ot=>ot.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:at}=a,st=async({currentPassword:ot,newPassword:ut,newPasswordConfirmation:dt})=>{if(!(ot===ut||ut!==dt))return et(async()=>{await j(changeMnemonicPassword({currentPassword:ot,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:ot=>at("currentPassword")!==ot||"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:ot=>at("newPassword")===ot||"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:$,fee:j,data:{token:et}}=_,{fee:tt,operations:rt,estimationFailed:nt,isLoading:it,form:at,signer:st,reEstimate:ot,onSign:ut}=useSignPageHelpers(j,$,a),{amount:dt,recipient:mt}=rt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...at,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{..._,operationsType:rt.type,signer:rt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TokenTile,{amount:dt,token:et}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",marginBottom:"24px",paddingX:"4px",children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(SignPageFee,{fee:tt})})}),jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{marginBottom:"24px",address:rt.sender.address}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:mt}),jsxRuntimeExports.jsx(OperationSignerSelector,{isLoading:it,operationType:rt.type,reEstimate:ot,sender:rt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:nt,isLoading:it,onSubmit:ut,signer:st,text:headerText(rt.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:at},register:st,handleSubmit:ot}=nt,ut=tokenDecimals(a),dt=formatTokenAmount(a.balance,ut),mt=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:!!at.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:mt,type:"number",...st("prettyAmount",{required:"Amount is required",max:{value:dt.toString(),message:`Max amount is ${dt}`},validate:makeValidateDecimals(Number(ut))}),placeholder:mt}),jsxRuntimeExports.jsx(InputRightElement,{paddingRight:"12px","data-testid":"token-symbol",children:tokenSymbolSafe(a)})]}),at.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:at.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!at.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),at.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:at.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!at.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),at.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:at.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ot(tt),onSingleSubmit:ot(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=mt;var et=rt($),tt=rt(j);function rt(Tt){return Tt&&Tt.__esModule?Tt:{default:Tt}}var nt=Object.assign||function(Tt){for(var kt=1;kt=0||Object.prototype.hasOwnProperty.call(Tt,Nt)&&(Lt[Nt]=Tt[Nt]);return Lt}function at(Tt,kt){if(!(Tt instanceof kt))throw new TypeError("Cannot call a class as a function")}var st=function(){function Tt(kt,Lt){for(var Nt=0;Nt0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return dt?Tt:Tt.capture}function Ct(Tt){if("touches"in Tt){var kt=Tt.touches[0],Lt=kt.pageX,Nt=kt.pageY;return{x:Lt,y:Nt}}var zt=Tt.screenX,jt=Tt.screenY;return{x:zt,y:jt}}var Pt=function(Tt){ut(kt,Tt);function kt(){var Lt;at(this,kt);for(var Nt=arguments.length,zt=Array(Nt),jt=0;jtzt&&this.props.onSwipeRight(1,Nt),this.movePosition.deltaY<-zt?this.props.onSwipeUp(1,Nt):this.movePosition.deltaY>zt&&this.props.onSwipeDown(1,Nt)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Nt){this.swiper=Nt,this.props.innerRef(Nt)}},{key:"render",value:function(){var Nt=this.props;Nt.tagName;var zt=Nt.className,jt=Nt.style,Mt=Nt.children;Nt.allowMouseEvents,Nt.onSwipeUp,Nt.onSwipeDown,Nt.onSwipeLeft,Nt.onSwipeRight,Nt.onSwipeStart,Nt.onSwipeMove,Nt.onSwipeEnd,Nt.innerRef,Nt.tolerance;var Dt=it(Nt,["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:zt,style:jt},Dt),Mt)}}]),kt}($.Component);Pt.displayName="ReactSwipe",Pt.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},Pt.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=Pt})}(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 -*/(function(_){(function(){var a={}.hasOwnProperty;function $(){for(var j=[],et=0;et"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function _getPrototypeOf$1(_){return _getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf$1(_)}function _defineProperty$2(_,a,$){return a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}var isKeyboardEvent$1=function _(a){return a.hasOwnProperty("key")},Thumbs=function(_){_inherits$1($,_);var a=_createSuper$1($);function $(j){var et;return _classCallCheck$1(this,$),et=a.call(this,j),_defineProperty$2(_assertThisInitialized$1(et),"itemsWrapperRef",void 0),_defineProperty$2(_assertThisInitialized$1(et),"itemsListRef",void 0),_defineProperty$2(_assertThisInitialized$1(et),"thumbsRef",void 0),_defineProperty$2(_assertThisInitialized$1(et),"setItemsWrapperRef",function(tt){et.itemsWrapperRef=tt}),_defineProperty$2(_assertThisInitialized$1(et),"setItemsListRef",function(tt){et.itemsListRef=tt}),_defineProperty$2(_assertThisInitialized$1(et),"setThumbsRef",function(tt,rt){et.thumbsRef||(et.thumbsRef=[]),et.thumbsRef[rt]=tt}),_defineProperty$2(_assertThisInitialized$1(et),"updateSizes",function(){if(!(!et.props.children||!et.itemsWrapperRef||!et.thumbsRef)){var tt=_react$3.Children.count(et.props.children),rt=et.itemsWrapperRef.clientWidth,nt=et.props.thumbWidth?et.props.thumbWidth:(0,_dimensions.outerWidth)(et.thumbsRef[0]),it=Math.floor(rt/nt),ot=it0&&(rt=0),ot===at&&rt<0&&(rt=0);var ut=et.itemsWrapperRef.clientWidth,ht=ot+100/(ut/rt);return et.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(bt){et.itemsListRef.style[bt]=(0,_CSSTranslate$2.default)(ht,"%",et.props.axis)}),!0}),_defineProperty$2(_assertThisInitialized$1(et),"slideRight",function(tt){et.moveTo(et.state.firstItem-(typeof tt=="number"?tt:1))}),_defineProperty$2(_assertThisInitialized$1(et),"slideLeft",function(tt){et.moveTo(et.state.firstItem+(typeof tt=="number"?tt:1))}),_defineProperty$2(_assertThisInitialized$1(et),"moveTo",function(tt){tt=tt<0?0:tt,tt=tt>=et.state.lastPosition?et.state.lastPosition:tt,et.setState({firstItem:tt})}),et.state={selectedItem:j.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},et}return _createClass$1($,[{key:"componentDidMount",value:function(){this.setupThumbs()}},{key:"componentDidUpdate",value:function(et){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==et.children&&this.updateSizes()}},{key:"componentWillUnmount",value:function(){this.destroyThumbs()}},{key:"setupThumbs",value:function(){(0,_window$1.default)().addEventListener("resize",this.updateSizes),(0,_window$1.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.updateSizes()}},{key:"destroyThumbs",value:function(){(0,_window$1.default)().removeEventListener("resize",this.updateSizes),(0,_window$1.default)().removeEventListener("DOMContentLoaded",this.updateSizes)}},{key:"getFirstItem",value:function(et){var tt=et;return et>=this.state.lastPosition&&(tt=this.state.lastPosition),et1,rt=this.state.showArrows&&this.state.firstItem>0,nt=this.state.showArrows&&this.state.firstItemrt);if(nt)return tt<0?a.centerMode&&a.centerSlidePercentage&&a.axis==="horizontal"?j.itemListStyle=(0,_utils$1.setPosition)(-(rt+2)*a.centerSlidePercentage-(100-a.centerSlidePercentage)/2,a.axis):j.itemListStyle=(0,_utils$1.setPosition)(-(rt+2)*100,a.axis):tt>rt&&(j.itemListStyle=(0,_utils$1.setPosition)(0,a.axis)),j;var it=(0,_utils$1.getPosition)(et,a),ot=(0,_CSSTranslate.default)(it,"%",a.axis),st=a.transitionTime+"ms";return j.itemListStyle={WebkitTransform:ot,msTransform:ot,OTransform:ot,transform:ot},$.swiping||(j.itemListStyle=_objectSpread$1(_objectSpread$1({},j.itemListStyle),{},{WebkitTransitionDuration:st,MozTransitionDuration:st,OTransitionDuration:st,transitionDuration:st,msTransitionDuration:st})),j};animations.slideAnimationHandler=slideAnimationHandler;var slideSwipeAnimationHandler=function _(a,$,j,et){var tt={},rt=$.axis==="horizontal",nt=_react$1.Children.count($.children),it=0,ot=(0,_utils$1.getPosition)(j.selectedItem,$),st=$.infiniteLoop?(0,_utils$1.getPosition)(nt-1,$)-100:(0,_utils$1.getPosition)(nt-1,$),at=rt?a.x:a.y,ut=at;ot===it&&at>0&&(ut=0),ot===st&&at<0&&(ut=0);var ht=ot+100/(j.itemSize/ut),bt=Math.abs(at)>$.swipeScrollTolerance;return $.infiniteLoop&&bt&&(j.selectedItem===0&&ht>-100?ht-=nt*100:j.selectedItem===nt-1&&ht<-nt*100&&(ht+=nt*100)),(!$.preventMovementUntilSwipeScrollTolerance||bt||j.swipeMovementStarted)&&(j.swipeMovementStarted||et({swipeMovementStarted:!0}),tt.itemListStyle=(0,_utils$1.setPosition)(ht,$.axis)),bt&&!j.cancelClick&&et({cancelClick:!0}),tt};animations.slideSwipeAnimationHandler=slideSwipeAnimationHandler;var slideStopSwipingHandler=function _(a,$){var j=(0,_utils$1.getPosition)($.selectedItem,a),et=(0,_utils$1.setPosition)(j,a.axis);return{itemListStyle:et}};animations.slideStopSwipingHandler=slideStopSwipingHandler;var fadeAnimationHandler=function _(a,$){var j=a.transitionTime+"ms",et="ease-in-out",tt={position:"absolute",display:"block",zIndex:-2,minHeight:"100%",opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:et,msTransitionTimingFunction:et,MozTransitionTimingFunction:et,WebkitTransitionTimingFunction:et,OTransitionTimingFunction:et};return $.swiping||(tt=_objectSpread$1(_objectSpread$1({},tt),{},{WebkitTransitionDuration:j,MozTransitionDuration:j,OTransitionDuration:j,transitionDuration:j,msTransitionDuration:j})),{slideStyle:tt,selectedStyle:_objectSpread$1(_objectSpread$1({},tt),{},{opacity:1,position:"relative"}),prevStyle:_objectSpread$1({},tt)}};animations.fadeAnimationHandler=fadeAnimationHandler;Object.defineProperty(Carousel$1,"__esModule",{value:!0});Carousel$1.default=void 0;var _react=_interopRequireWildcard(reactExports),_reactEasySwipe=_interopRequireDefault(lib),_cssClasses=_interopRequireDefault(cssClasses),_Thumbs=_interopRequireDefault(Thumbs$1),_document=_interopRequireDefault(document$1),_window=_interopRequireDefault(window$1),_utils=utils,_animations=animations;function _interopRequireDefault(_){return _&&_.__esModule?_:{default:_}}function _getRequireWildcardCache(){if(typeof WeakMap!="function")return null;var _=new WeakMap;return _getRequireWildcardCache=function(){return _},_}function _interopRequireWildcard(_){if(_&&_.__esModule)return _;if(_===null||_typeof(_)!=="object"&&typeof _!="function")return{default:_};var a=_getRequireWildcardCache();if(a&&a.has(_))return a.get(_);var $={},j=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var et in _)if(Object.prototype.hasOwnProperty.call(_,et)){var tt=j?Object.getOwnPropertyDescriptor(_,et):null;tt&&(tt.get||tt.set)?Object.defineProperty($,et,tt):$[et]=_[et]}return $.default=_,a&&a.set(_,$),$}function _typeof(_){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function($){return typeof $}:_typeof=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof(_)}function _extends(){return _extends=Object.assign||function(_){for(var a=1;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function _getPrototypeOf(_){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf(_)}function _defineProperty(_,a,$){return a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}var Carousel=function(_){_inherits($,_);var a=_createSuper($);function $(j){var et;_classCallCheck(this,$),et=a.call(this,j),_defineProperty(_assertThisInitialized(et),"thumbsRef",void 0),_defineProperty(_assertThisInitialized(et),"carouselWrapperRef",void 0),_defineProperty(_assertThisInitialized(et),"listRef",void 0),_defineProperty(_assertThisInitialized(et),"itemsRef",void 0),_defineProperty(_assertThisInitialized(et),"timer",void 0),_defineProperty(_assertThisInitialized(et),"animationHandler",void 0),_defineProperty(_assertThisInitialized(et),"setThumbsRef",function(rt){et.thumbsRef=rt}),_defineProperty(_assertThisInitialized(et),"setCarouselWrapperRef",function(rt){et.carouselWrapperRef=rt}),_defineProperty(_assertThisInitialized(et),"setListRef",function(rt){et.listRef=rt}),_defineProperty(_assertThisInitialized(et),"setItemsRef",function(rt,nt){et.itemsRef||(et.itemsRef=[]),et.itemsRef[nt]=rt}),_defineProperty(_assertThisInitialized(et),"autoPlay",function(){_react.Children.count(et.props.children)<=1||(et.clearAutoPlay(),et.props.autoPlay&&(et.timer=setTimeout(function(){et.increment()},et.props.interval)))}),_defineProperty(_assertThisInitialized(et),"clearAutoPlay",function(){et.timer&&clearTimeout(et.timer)}),_defineProperty(_assertThisInitialized(et),"resetAutoPlay",function(){et.clearAutoPlay(),et.autoPlay()}),_defineProperty(_assertThisInitialized(et),"stopOnHover",function(){et.setState({isMouseEntered:!0},et.clearAutoPlay)}),_defineProperty(_assertThisInitialized(et),"startOnLeave",function(){et.setState({isMouseEntered:!1},et.autoPlay)}),_defineProperty(_assertThisInitialized(et),"isFocusWithinTheCarousel",function(){return et.carouselWrapperRef?!!((0,_document.default)().activeElement===et.carouselWrapperRef||et.carouselWrapperRef.contains((0,_document.default)().activeElement)):!1}),_defineProperty(_assertThisInitialized(et),"navigateWithKeyboard",function(rt){if(et.isFocusWithinTheCarousel()){var nt=et.props.axis,it=nt==="horizontal",ot={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},st=it?ot.ArrowRight:ot.ArrowDown,at=it?ot.ArrowLeft:ot.ArrowUp;st===rt.keyCode?et.increment():at===rt.keyCode&&et.decrement()}}),_defineProperty(_assertThisInitialized(et),"updateSizes",function(){if(!(!et.state.initialized||!et.itemsRef||et.itemsRef.length===0)){var rt=et.props.axis==="horizontal",nt=et.itemsRef[0];if(nt){var it=rt?nt.clientWidth:nt.clientHeight;et.setState({itemSize:it}),et.thumbsRef&&et.thumbsRef.updateSizes()}}}),_defineProperty(_assertThisInitialized(et),"setMountState",function(){et.setState({hasMount:!0}),et.updateSizes()}),_defineProperty(_assertThisInitialized(et),"handleClickItem",function(rt,nt){if(_react.Children.count(et.props.children)!==0){if(et.state.cancelClick){et.setState({cancelClick:!1});return}et.props.onClickItem(rt,nt),rt!==et.state.selectedItem&&et.setState({selectedItem:rt})}}),_defineProperty(_assertThisInitialized(et),"handleOnChange",function(rt,nt){_react.Children.count(et.props.children)<=1||et.props.onChange(rt,nt)}),_defineProperty(_assertThisInitialized(et),"handleClickThumb",function(rt,nt){et.props.onClickThumb(rt,nt),et.moveTo(rt)}),_defineProperty(_assertThisInitialized(et),"onSwipeStart",function(rt){et.setState({swiping:!0}),et.props.onSwipeStart(rt)}),_defineProperty(_assertThisInitialized(et),"onSwipeEnd",function(rt){et.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),et.props.onSwipeEnd(rt),et.clearAutoPlay(),et.state.autoPlay&&et.autoPlay()}),_defineProperty(_assertThisInitialized(et),"onSwipeMove",function(rt,nt){et.props.onSwipeMove(nt);var it=et.props.swipeAnimationHandler(rt,et.props,et.state,et.setState.bind(_assertThisInitialized(et)));return et.setState(_objectSpread({},it)),!!Object.keys(it).length}),_defineProperty(_assertThisInitialized(et),"decrement",function(){var rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;et.moveTo(et.state.selectedItem-(typeof rt=="number"?rt:1))}),_defineProperty(_assertThisInitialized(et),"increment",function(){var rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;et.moveTo(et.state.selectedItem+(typeof rt=="number"?rt:1))}),_defineProperty(_assertThisInitialized(et),"moveTo",function(rt){if(typeof rt=="number"){var nt=_react.Children.count(et.props.children)-1;rt<0&&(rt=et.props.infiniteLoop?nt:0),rt>nt&&(rt=et.props.infiniteLoop?0:nt),et.selectItem({selectedItem:rt}),et.state.autoPlay&&et.state.isMouseEntered===!1&&et.resetAutoPlay()}}),_defineProperty(_assertThisInitialized(et),"onClickNext",function(){et.increment(1)}),_defineProperty(_assertThisInitialized(et),"onClickPrev",function(){et.decrement(1)}),_defineProperty(_assertThisInitialized(et),"onSwipeForward",function(){et.increment(1),et.props.emulateTouch&&et.setState({cancelClick:!0})}),_defineProperty(_assertThisInitialized(et),"onSwipeBackwards",function(){et.decrement(1),et.props.emulateTouch&&et.setState({cancelClick:!0})}),_defineProperty(_assertThisInitialized(et),"changeItem",function(rt){return function(nt){(!(0,_utils.isKeyboardEvent)(nt)||nt.key==="Enter")&&et.moveTo(rt)}}),_defineProperty(_assertThisInitialized(et),"selectItem",function(rt){et.setState(_objectSpread({previousItem:et.state.selectedItem},rt),function(){et.setState(et.animationHandler(et.props,et.state))}),et.handleOnChange(rt.selectedItem,_react.Children.toArray(et.props.children)[rt.selectedItem])}),_defineProperty(_assertThisInitialized(et),"getInitialImage",function(){var rt=et.props.selectedItem,nt=et.itemsRef&&et.itemsRef[rt],it=nt&&nt.getElementsByTagName("img")||[];return it[0]}),_defineProperty(_assertThisInitialized(et),"getVariableItemHeight",function(rt){var nt=et.itemsRef&&et.itemsRef[rt];if(et.state.hasMount&&nt&&nt.children.length){var it=nt.children[0].getElementsByTagName("img")||[];if(it.length>0){var ot=it[0];if(!ot.complete){var st=function ht(){et.forceUpdate(),ot.removeEventListener("load",ht)};ot.addEventListener("load",st)}}var at=it[0]||nt.children[0],ut=at.clientHeight;return ut>0?ut:null}return null});var tt={initialized:!1,previousItem:j.selectedItem,selectedItem:j.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:j.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return et.animationHandler=typeof j.animationHandler=="function"&&j.animationHandler||j.animationHandler==="fade"&&_animations.fadeAnimationHandler||_animations.slideAnimationHandler,et.state=_objectSpread(_objectSpread({},tt),et.animationHandler(j,tt)),et}return _createClass($,[{key:"componentDidMount",value:function(){this.props.children&&this.setupCarousel()}},{key:"componentDidUpdate",value:function(et,tt){!et.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!et.autoFocus&&this.props.autoFocus&&this.forceFocus(),tt.swiping&&!this.state.swiping&&this.setState(_objectSpread({},this.props.stopSwipingHandler(this.props,this.state))),(et.selectedItem!==this.props.selectedItem||et.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),et.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:"componentWillUnmount",value:function(){this.destroyCarousel()}},{key:"setupCarousel",value:function(){var et=this;this.bindEvents(),this.state.autoPlay&&_react.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var tt=et.getInitialImage();tt&&!tt.complete?tt.addEventListener("load",et.setMountState):et.setMountState()})}},{key:"destroyCarousel",value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:"setupAutoPlay",value:function(){this.autoPlay();var et=this.carouselWrapperRef;this.props.stopOnHover&&et&&(et.addEventListener("mouseenter",this.stopOnHover),et.addEventListener("mouseleave",this.startOnLeave))}},{key:"destroyAutoPlay",value:function(){this.clearAutoPlay();var et=this.carouselWrapperRef;this.props.stopOnHover&&et&&(et.removeEventListener("mouseenter",this.stopOnHover),et.removeEventListener("mouseleave",this.startOnLeave))}},{key:"bindEvents",value:function(){(0,_window.default)().addEventListener("resize",this.updateSizes),(0,_window.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.props.useKeyboardArrows&&(0,_document.default)().addEventListener("keydown",this.navigateWithKeyboard)}},{key:"unbindEvents",value:function(){(0,_window.default)().removeEventListener("resize",this.updateSizes),(0,_window.default)().removeEventListener("DOMContentLoaded",this.updateSizes);var et=this.getInitialImage();et&&et.removeEventListener("load",this.setMountState),this.props.useKeyboardArrows&&(0,_document.default)().removeEventListener("keydown",this.navigateWithKeyboard)}},{key:"forceFocus",value:function(){var et;(et=this.carouselWrapperRef)===null||et===void 0||et.focus()}},{key:"renderItems",value:function(et){var tt=this;return this.props.children?_react.Children.map(this.props.children,function(rt,nt){var it=nt===tt.state.selectedItem,ot=nt===tt.state.previousItem,st=it&&tt.state.selectedStyle||ot&&tt.state.prevStyle||tt.state.slideStyle||{};tt.props.centerMode&&tt.props.axis==="horizontal"&&(st=_objectSpread(_objectSpread({},st),{},{minWidth:tt.props.centerSlidePercentage+"%"})),tt.state.swiping&&tt.state.swipeMovementStarted&&(st=_objectSpread(_objectSpread({},st),{},{pointerEvents:"none"}));var at={ref:function(ht){return tt.setItemsRef(ht,nt)},key:"itemKey"+nt+(et?"clone":""),className:_cssClasses.default.ITEM(!0,nt===tt.state.selectedItem,nt===tt.state.previousItem),onClick:tt.handleClickItem.bind(tt,nt,rt),style:st};return _react.default.createElement("li",at,tt.props.renderItem(rt,{isSelected:nt===tt.state.selectedItem,isPrevious:nt===tt.state.previousItem}))}):[]}},{key:"renderControls",value:function(){var et=this,tt=this.props,rt=tt.showIndicators,nt=tt.labels,it=tt.renderIndicator,ot=tt.children;return rt?_react.default.createElement("ul",{className:"control-dots"},_react.Children.map(ot,function(st,at){return it&&it(et.changeItem(at),at===et.state.selectedItem,at,nt.item)})):null}},{key:"renderStatus",value:function(){return this.props.showStatus?_react.default.createElement("p",{className:"carousel-status"},this.props.statusFormatter(this.state.selectedItem+1,_react.Children.count(this.props.children))):null}},{key:"renderThumbs",value:function(){return!this.props.showThumbs||!this.props.children||_react.Children.count(this.props.children)===0?null:_react.default.createElement(_Thumbs.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:"render",value:function(){var et=this;if(!this.props.children||_react.Children.count(this.props.children)===0)return null;var tt=this.props.swipeable&&_react.Children.count(this.props.children)>1,rt=this.props.axis==="horizontal",nt=this.props.showArrows&&_react.Children.count(this.props.children)>1,it=nt&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,ot=nt&&(this.state.selectedItem<_react.Children.count(this.props.children)-1||this.props.infiniteLoop)||!1,st=this.renderItems(!0),at=st.shift(),ut=st.pop(),ht={className:_cssClasses.default.SLIDER(!0,this.state.swiping),onSwipeMove:this.onSwipeMove,onSwipeStart:this.onSwipeStart,onSwipeEnd:this.onSwipeEnd,style:this.state.itemListStyle,tolerance:this.props.swipeScrollTolerance},bt={};if(rt){if(ht.onSwipeLeft=this.onSwipeForward,ht.onSwipeRight=this.onSwipeBackwards,this.props.dynamicHeight){var Et=this.getVariableItemHeight(this.state.selectedItem);bt.height=Et||"auto"}}else ht.onSwipeUp=this.props.verticalSwipe==="natural"?this.onSwipeBackwards:this.onSwipeForward,ht.onSwipeDown=this.props.verticalSwipe==="natural"?this.onSwipeForward:this.onSwipeBackwards,ht.style=_objectSpread(_objectSpread({},ht.style),{},{height:this.state.itemSize}),bt.height=this.state.itemSize;return _react.default.createElement("div",{"aria-label":this.props.ariaLabel,className:_cssClasses.default.ROOT(this.props.className),ref:this.setCarouselWrapperRef,tabIndex:this.props.useKeyboardArrows?0:void 0},_react.default.createElement("div",{className:_cssClasses.default.CAROUSEL(!0),style:{width:this.props.width}},this.renderControls(),this.props.renderArrowPrev(this.onClickPrev,it,this.props.labels.leftArrow),_react.default.createElement("div",{className:_cssClasses.default.WRAPPER(!0,this.props.axis),style:bt},tt?_react.default.createElement(_reactEasySwipe.default,_extends({tagName:"ul",innerRef:this.setListRef},ht,{allowMouseEvents:this.props.emulateTouch}),this.props.infiniteLoop&&ut,this.renderItems(),this.props.infiniteLoop&&at):_react.default.createElement("ul",{className:_cssClasses.default.SLIDER(!0,this.state.swiping),ref:function(Pt){return et.setListRef(Pt)},style:this.state.itemListStyle||{}},this.props.infiniteLoop&&ut,this.renderItems(),this.props.infiniteLoop&&at)),this.props.renderArrowNext(this.onClickNext,ot,this.props.labels.rightArrow),this.renderStatus()),this.renderThumbs())}}]),$}(_react.default.Component);Carousel$1.default=Carousel;_defineProperty(Carousel,"displayName","Carousel");_defineProperty(Carousel,"defaultProps",{ariaLabel:void 0,axis:"horizontal",centerSlidePercentage:80,interval:3e3,labels:{leftArrow:"previous slide / item",rightArrow:"next slide / item",item:"slide item"},onClickItem:_utils.noop,onClickThumb:_utils.noop,onChange:_utils.noop,onSwipeStart:function _(){},onSwipeEnd:function _(){},onSwipeMove:function _(){return!1},preventMovementUntilSwipeScrollTolerance:!1,renderArrowPrev:function _(a,$,j){return _react.default.createElement("button",{type:"button","aria-label":j,className:_cssClasses.default.ARROW_PREV(!$),onClick:a})},renderArrowNext:function _(a,$,j){return _react.default.createElement("button",{type:"button","aria-label":j,className:_cssClasses.default.ARROW_NEXT(!$),onClick:a})},renderIndicator:function _(a,$,j,et){return _react.default.createElement("li",{className:_cssClasses.default.DOT($),onClick:a,onKeyDown:a,value:j,key:j,role:"button",tabIndex:0,"aria-label":"".concat(et," ").concat(j+1)})},renderItem:function _(a){return a},renderThumbs:function _(a){var $=_react.Children.map(a,function(j){var et=j;if(j.type!=="img"&&(et=_react.Children.toArray(j.props.children).find(function(tt){return tt.type==="img"})),!!et)return et});return $.filter(function(j){return j}).length===0?(console.warn("No images found! Can't build the thumb list without images. If you don't need thumbs, set showThumbs={false} in the Carousel. Note that it's not possible to get images rendered inside custom components. More info at https://github.com/leandrowd/react-responsive-carousel/blob/master/TROUBLESHOOTING.md"),[]):$},statusFormatter:_utils.defaultStatusFormatter,selectedItem:0,showArrows:!0,showIndicators:!0,showStatus:!0,showThumbs:!0,stopOnHover:!0,swipeScrollTolerance:5,swipeable:!0,transitionTime:350,verticalSwipe:"standard",width:"100%",animationHandler:"slide",swipeAnimationHandler:_animations.slideSwipeAnimationHandler,stopSwipingHandler:_animations.slideStopSwipingHandler});var types={};(function(_){Object.defineProperty(_,"__esModule",{value:!0}),Object.defineProperty(_,"Carousel",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(_,"CarouselProps",{enumerable:!0,get:function(){return $.CarouselProps}}),Object.defineProperty(_,"Thumbs",{enumerable:!0,get:function(){return j.default}});var a=et(Carousel$1),$=types,j=et(Thumbs$1);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}})(js);const Slider=({children:_})=>{const a={background:colors.gray[400],width:"10px",height:"10px",display:"inline-block",margin:"0 4px 60px 4px",borderRadius:"5px"};return jsxRuntimeExports.jsx(Box,{backgroundImage:"linear-gradient(180deg, rgba(18, 18, 18, 0.00) 36.43%, rgba(18, 18, 18, 0.50) 53.65%, #121212 76.24%)",borderRightRadius:"30px",backgroundColor:"#323131",children:jsxRuntimeExports.jsx(js.Carousel,{autoPlay:!0,dynamicHeight:!1,infiniteLoop:!0,interval:5e3,renderIndicator:($,j,et)=>j?jsxRuntimeExports.jsx("li",{style:{...a,background:"#00C39A",width:"24px"}}):jsxRuntimeExports.jsx("li",{onClick:$,onKeyDown:$,role:"button",style:a,tabIndex:0,value:et},et),showArrows:!1,showStatus:!1,showThumbs:!1,transitionTime:1e3,children:_})})},SlideItem=({item:_})=>jsxRuntimeExports.jsx(Box,{height:"730px",paddingTop:"500px",paddingBottom:"35px",backgroundImage:_.image,backgroundSize:"cover",backgroundRepeat:"no-repeat","data-testid":`slide-${_.id}`,children:jsxRuntimeExports.jsxs(Center,{flexDirection:"column",paddingBottom:"50px",children:[jsxRuntimeExports.jsx(CircleIcon,{icon:_.icon,size:"58px"}),jsxRuntimeExports.jsx(Text,{width:"400px",margin:"16px 50px 0 50px",children:_.text})]})}),SliderItems=[{id:1,text:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{as:"span",fontWeight:600,size:"md",children:"Streamline asset management: "}),jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"one mnemonic, multiple accounts, full control."})]}),icon:jsxRuntimeExports.jsx(SlidersIcon,{}),image:AccountsImage},{id:2,text:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"Enhance security with "}),jsxRuntimeExports.jsx(Text,{as:"span",fontWeight:600,size:"md",children:"Multi-sig"}),jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:", requiring multiple signatures for transaction executions."})]}),icon:jsxRuntimeExports.jsx(KeyIcon,{width:"32px",height:"32px",strokeWidth:"0.9"}),image:MultisigImage},{id:3,text:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"Utilize the "}),jsxRuntimeExports.jsx(Text,{as:"span",fontWeight:600,size:"md",children:"Batch "}),jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"feature to bundle transactions, improving efficiency and reducing costs."})]}),icon:jsxRuntimeExports.jsx(BatchIcon,{width:"32px",height:"32px",strokeWidth:"0.9"}),image:BatchImage}],WelcomeScreen=()=>{const[_,a]=reactExports.useState(!0),{onOpen:$,modalElement:j}=useOnboardingModal(()=>a(!0)),et=()=>{a(!1),$()};return jsxRuntimeExports.jsxs(Center,{height:"100vh",padding:"60px",backgroundImage:BackgroundImage,backgroundSize:"cover",children:[_&&jsxRuntimeExports.jsxs(SimpleGrid,{borderRadius:"30px",boxShadow:"0px 0px 30px rgba(0, 0, 0, 0.30)",columns:[1,1,2],children:[jsxRuntimeExports.jsx(Center,{width:"100%",maxWidth:"660px",background:colors.gray[800],borderLeftRadius:"30px",children:jsxRuntimeExports.jsxs(VStack,{maxWidth:"400px",padding:"32px",spacing:"0",children:[jsxRuntimeExports.jsx(MakiLogo,{width:"48px",height:"48px",marginBottom:"24px"}),jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"3xl",children:"Welcome to Umami"}),jsxRuntimeExports.jsx(Divider,{maxWidth:"400px",marginBottom:"16px"}),jsxRuntimeExports.jsx(Text,{marginBottom:"32px",color:colors.gray[450],children:"A powerful Tezos wallet"}),jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"24px",onClick:et,size:"lg",children:"Get started"}),jsxRuntimeExports.jsx(AppVersion,{fontSize:"13px"})]})}),jsxRuntimeExports.jsx(Box,{maxWidth:"660px",children:jsxRuntimeExports.jsx(Slider,{children:SliderItems.map(tt=>jsxRuntimeExports.jsx(SlideItem,{item:tt},tt.id))})})]}),j]})},Router=()=>(useDeeplinkHandler(),useImplicitAccounts().length>0?jsxRuntimeExports.jsx(LoggedInRouterWithPolling,{}):jsxRuntimeExports.jsx(LoggedOutRouter,{})),LoggedInRouterWithPolling=()=>{useDataPolling();const _=useDynamicModal();return jsxRuntimeExports.jsx(HashRouter,{children:jsxRuntimeExports.jsx(DynamicModalContext.Provider,{value:_,children:jsxRuntimeExports.jsxs(BeaconProvider,{children:[jsxRuntimeExports.jsx(AnnouncementBanner,{}),jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(HomeView,{})),path:"/home"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(HomeView,{})),path:"/home/:ownerPkh/:nftId"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(NFTsView,{})),path:"/nfts"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(OperationsView,{})),path:"/operations"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(TokensPage,{})),path:"/tokens"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(AddressBookView,{})),path:"/address-book"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(SettingsView,{})),path:"/settings"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(HelpView,{})),path:"/help"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(BatchPage,{})),path:"/batch"}),jsxRuntimeExports.jsx(Route,{element:jsxRuntimeExports.jsx(Navigate,{to:"/home"}),path:"/*"})]}),_.content]})})})},LoggedOutRouter=()=>{const _=useResetConnections();return reactExports.useEffect(()=>{WalletClient.destroy().then(_).catch(lodashExports.noop)},[_]),jsxRuntimeExports.jsx(HashRouter,{children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{element:jsxRuntimeExports.jsx(Navigate,{to:"/welcome"}),path:"/*"}),jsxRuntimeExports.jsx(Route,{element:jsxRuntimeExports.jsx(WelcomeScreen,{}),path:"/welcome"})]})})},logError=(_,a)=>{const $={...getErrorContext(_),stacktrace:String(a.componentStack)};store.dispatch(errorsSlice.actions.add($))};Object.defineProperty(window,"reduxStore",{value:store});const root=client.createRoot(document.getElementById("root"));root.render(jsxRuntimeExports.jsx(React$2.StrictMode,{children:jsxRuntimeExports.jsx(UmamiTheme,{children:jsxRuntimeExports.jsx(ReduxStore,{children:jsxRuntimeExports.jsx(PersistGate,{loading:null,persistor,children:jsxRuntimeExports.jsx(ErrorBoundary,{fallback:jsxRuntimeExports.jsx(ErrorPage,{}),onError:logError,children:jsxRuntimeExports.jsx(ReactQueryProvider,{children:jsxRuntimeExports.jsx(Router,{})})})})})})}));export{__vitePreload as _,getDefaultExportFromCjs$1 as g,patterns as p,reactExports as r,utils$1 as u}; +*/(function(_){(function(){var a={}.hasOwnProperty;function $(){for(var j=[],et=0;et"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function _getPrototypeOf$1(_){return _getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf$1(_)}function _defineProperty$2(_,a,$){return a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}var isKeyboardEvent$1=function _(a){return a.hasOwnProperty("key")},Thumbs=function(_){_inherits$1($,_);var a=_createSuper$1($);function $(j){var et;return _classCallCheck$1(this,$),et=a.call(this,j),_defineProperty$2(_assertThisInitialized$1(et),"itemsWrapperRef",void 0),_defineProperty$2(_assertThisInitialized$1(et),"itemsListRef",void 0),_defineProperty$2(_assertThisInitialized$1(et),"thumbsRef",void 0),_defineProperty$2(_assertThisInitialized$1(et),"setItemsWrapperRef",function(tt){et.itemsWrapperRef=tt}),_defineProperty$2(_assertThisInitialized$1(et),"setItemsListRef",function(tt){et.itemsListRef=tt}),_defineProperty$2(_assertThisInitialized$1(et),"setThumbsRef",function(tt,rt){et.thumbsRef||(et.thumbsRef=[]),et.thumbsRef[rt]=tt}),_defineProperty$2(_assertThisInitialized$1(et),"updateSizes",function(){if(!(!et.props.children||!et.itemsWrapperRef||!et.thumbsRef)){var tt=_react$3.Children.count(et.props.children),rt=et.itemsWrapperRef.clientWidth,nt=et.props.thumbWidth?et.props.thumbWidth:(0,_dimensions.outerWidth)(et.thumbsRef[0]),it=Math.floor(rt/nt),at=it0&&(rt=0),at===ot&&rt<0&&(rt=0);var ut=et.itemsWrapperRef.clientWidth,dt=at+100/(ut/rt);return et.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(mt){et.itemsListRef.style[mt]=(0,_CSSTranslate$2.default)(dt,"%",et.props.axis)}),!0}),_defineProperty$2(_assertThisInitialized$1(et),"slideRight",function(tt){et.moveTo(et.state.firstItem-(typeof tt=="number"?tt:1))}),_defineProperty$2(_assertThisInitialized$1(et),"slideLeft",function(tt){et.moveTo(et.state.firstItem+(typeof tt=="number"?tt:1))}),_defineProperty$2(_assertThisInitialized$1(et),"moveTo",function(tt){tt=tt<0?0:tt,tt=tt>=et.state.lastPosition?et.state.lastPosition:tt,et.setState({firstItem:tt})}),et.state={selectedItem:j.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},et}return _createClass$1($,[{key:"componentDidMount",value:function(){this.setupThumbs()}},{key:"componentDidUpdate",value:function(et){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==et.children&&this.updateSizes()}},{key:"componentWillUnmount",value:function(){this.destroyThumbs()}},{key:"setupThumbs",value:function(){(0,_window$1.default)().addEventListener("resize",this.updateSizes),(0,_window$1.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.updateSizes()}},{key:"destroyThumbs",value:function(){(0,_window$1.default)().removeEventListener("resize",this.updateSizes),(0,_window$1.default)().removeEventListener("DOMContentLoaded",this.updateSizes)}},{key:"getFirstItem",value:function(et){var tt=et;return et>=this.state.lastPosition&&(tt=this.state.lastPosition),et1,rt=this.state.showArrows&&this.state.firstItem>0,nt=this.state.showArrows&&this.state.firstItemrt);if(nt)return tt<0?a.centerMode&&a.centerSlidePercentage&&a.axis==="horizontal"?j.itemListStyle=(0,_utils$1.setPosition)(-(rt+2)*a.centerSlidePercentage-(100-a.centerSlidePercentage)/2,a.axis):j.itemListStyle=(0,_utils$1.setPosition)(-(rt+2)*100,a.axis):tt>rt&&(j.itemListStyle=(0,_utils$1.setPosition)(0,a.axis)),j;var it=(0,_utils$1.getPosition)(et,a),at=(0,_CSSTranslate.default)(it,"%",a.axis),st=a.transitionTime+"ms";return j.itemListStyle={WebkitTransform:at,msTransform:at,OTransform:at,transform:at},$.swiping||(j.itemListStyle=_objectSpread$1(_objectSpread$1({},j.itemListStyle),{},{WebkitTransitionDuration:st,MozTransitionDuration:st,OTransitionDuration:st,transitionDuration:st,msTransitionDuration:st})),j};animations.slideAnimationHandler=slideAnimationHandler;var slideSwipeAnimationHandler=function _(a,$,j,et){var tt={},rt=$.axis==="horizontal",nt=_react$1.Children.count($.children),it=0,at=(0,_utils$1.getPosition)(j.selectedItem,$),st=$.infiniteLoop?(0,_utils$1.getPosition)(nt-1,$)-100:(0,_utils$1.getPosition)(nt-1,$),ot=rt?a.x:a.y,ut=ot;at===it&&ot>0&&(ut=0),at===st&&ot<0&&(ut=0);var dt=at+100/(j.itemSize/ut),mt=Math.abs(ot)>$.swipeScrollTolerance;return $.infiniteLoop&&mt&&(j.selectedItem===0&&dt>-100?dt-=nt*100:j.selectedItem===nt-1&&dt<-nt*100&&(dt+=nt*100)),(!$.preventMovementUntilSwipeScrollTolerance||mt||j.swipeMovementStarted)&&(j.swipeMovementStarted||et({swipeMovementStarted:!0}),tt.itemListStyle=(0,_utils$1.setPosition)(dt,$.axis)),mt&&!j.cancelClick&&et({cancelClick:!0}),tt};animations.slideSwipeAnimationHandler=slideSwipeAnimationHandler;var slideStopSwipingHandler=function _(a,$){var j=(0,_utils$1.getPosition)($.selectedItem,a),et=(0,_utils$1.setPosition)(j,a.axis);return{itemListStyle:et}};animations.slideStopSwipingHandler=slideStopSwipingHandler;var fadeAnimationHandler=function _(a,$){var j=a.transitionTime+"ms",et="ease-in-out",tt={position:"absolute",display:"block",zIndex:-2,minHeight:"100%",opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:et,msTransitionTimingFunction:et,MozTransitionTimingFunction:et,WebkitTransitionTimingFunction:et,OTransitionTimingFunction:et};return $.swiping||(tt=_objectSpread$1(_objectSpread$1({},tt),{},{WebkitTransitionDuration:j,MozTransitionDuration:j,OTransitionDuration:j,transitionDuration:j,msTransitionDuration:j})),{slideStyle:tt,selectedStyle:_objectSpread$1(_objectSpread$1({},tt),{},{opacity:1,position:"relative"}),prevStyle:_objectSpread$1({},tt)}};animations.fadeAnimationHandler=fadeAnimationHandler;Object.defineProperty(Carousel$1,"__esModule",{value:!0});Carousel$1.default=void 0;var _react=_interopRequireWildcard(reactExports),_reactEasySwipe=_interopRequireDefault(lib),_cssClasses=_interopRequireDefault(cssClasses),_Thumbs=_interopRequireDefault(Thumbs$1),_document=_interopRequireDefault(document$1),_window=_interopRequireDefault(window$1),_utils=utils,_animations=animations;function _interopRequireDefault(_){return _&&_.__esModule?_:{default:_}}function _getRequireWildcardCache(){if(typeof WeakMap!="function")return null;var _=new WeakMap;return _getRequireWildcardCache=function(){return _},_}function _interopRequireWildcard(_){if(_&&_.__esModule)return _;if(_===null||_typeof(_)!=="object"&&typeof _!="function")return{default:_};var a=_getRequireWildcardCache();if(a&&a.has(_))return a.get(_);var $={},j=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var et in _)if(Object.prototype.hasOwnProperty.call(_,et)){var tt=j?Object.getOwnPropertyDescriptor(_,et):null;tt&&(tt.get||tt.set)?Object.defineProperty($,et,tt):$[et]=_[et]}return $.default=_,a&&a.set(_,$),$}function _typeof(_){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function($){return typeof $}:_typeof=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},_typeof(_)}function _extends(){return _extends=Object.assign||function(_){for(var a=1;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function _getPrototypeOf(_){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf(_)}function _defineProperty(_,a,$){return a in _?Object.defineProperty(_,a,{value:$,enumerable:!0,configurable:!0,writable:!0}):_[a]=$,_}var Carousel=function(_){_inherits($,_);var a=_createSuper($);function $(j){var et;_classCallCheck(this,$),et=a.call(this,j),_defineProperty(_assertThisInitialized(et),"thumbsRef",void 0),_defineProperty(_assertThisInitialized(et),"carouselWrapperRef",void 0),_defineProperty(_assertThisInitialized(et),"listRef",void 0),_defineProperty(_assertThisInitialized(et),"itemsRef",void 0),_defineProperty(_assertThisInitialized(et),"timer",void 0),_defineProperty(_assertThisInitialized(et),"animationHandler",void 0),_defineProperty(_assertThisInitialized(et),"setThumbsRef",function(rt){et.thumbsRef=rt}),_defineProperty(_assertThisInitialized(et),"setCarouselWrapperRef",function(rt){et.carouselWrapperRef=rt}),_defineProperty(_assertThisInitialized(et),"setListRef",function(rt){et.listRef=rt}),_defineProperty(_assertThisInitialized(et),"setItemsRef",function(rt,nt){et.itemsRef||(et.itemsRef=[]),et.itemsRef[nt]=rt}),_defineProperty(_assertThisInitialized(et),"autoPlay",function(){_react.Children.count(et.props.children)<=1||(et.clearAutoPlay(),et.props.autoPlay&&(et.timer=setTimeout(function(){et.increment()},et.props.interval)))}),_defineProperty(_assertThisInitialized(et),"clearAutoPlay",function(){et.timer&&clearTimeout(et.timer)}),_defineProperty(_assertThisInitialized(et),"resetAutoPlay",function(){et.clearAutoPlay(),et.autoPlay()}),_defineProperty(_assertThisInitialized(et),"stopOnHover",function(){et.setState({isMouseEntered:!0},et.clearAutoPlay)}),_defineProperty(_assertThisInitialized(et),"startOnLeave",function(){et.setState({isMouseEntered:!1},et.autoPlay)}),_defineProperty(_assertThisInitialized(et),"isFocusWithinTheCarousel",function(){return et.carouselWrapperRef?!!((0,_document.default)().activeElement===et.carouselWrapperRef||et.carouselWrapperRef.contains((0,_document.default)().activeElement)):!1}),_defineProperty(_assertThisInitialized(et),"navigateWithKeyboard",function(rt){if(et.isFocusWithinTheCarousel()){var nt=et.props.axis,it=nt==="horizontal",at={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},st=it?at.ArrowRight:at.ArrowDown,ot=it?at.ArrowLeft:at.ArrowUp;st===rt.keyCode?et.increment():ot===rt.keyCode&&et.decrement()}}),_defineProperty(_assertThisInitialized(et),"updateSizes",function(){if(!(!et.state.initialized||!et.itemsRef||et.itemsRef.length===0)){var rt=et.props.axis==="horizontal",nt=et.itemsRef[0];if(nt){var it=rt?nt.clientWidth:nt.clientHeight;et.setState({itemSize:it}),et.thumbsRef&&et.thumbsRef.updateSizes()}}}),_defineProperty(_assertThisInitialized(et),"setMountState",function(){et.setState({hasMount:!0}),et.updateSizes()}),_defineProperty(_assertThisInitialized(et),"handleClickItem",function(rt,nt){if(_react.Children.count(et.props.children)!==0){if(et.state.cancelClick){et.setState({cancelClick:!1});return}et.props.onClickItem(rt,nt),rt!==et.state.selectedItem&&et.setState({selectedItem:rt})}}),_defineProperty(_assertThisInitialized(et),"handleOnChange",function(rt,nt){_react.Children.count(et.props.children)<=1||et.props.onChange(rt,nt)}),_defineProperty(_assertThisInitialized(et),"handleClickThumb",function(rt,nt){et.props.onClickThumb(rt,nt),et.moveTo(rt)}),_defineProperty(_assertThisInitialized(et),"onSwipeStart",function(rt){et.setState({swiping:!0}),et.props.onSwipeStart(rt)}),_defineProperty(_assertThisInitialized(et),"onSwipeEnd",function(rt){et.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),et.props.onSwipeEnd(rt),et.clearAutoPlay(),et.state.autoPlay&&et.autoPlay()}),_defineProperty(_assertThisInitialized(et),"onSwipeMove",function(rt,nt){et.props.onSwipeMove(nt);var it=et.props.swipeAnimationHandler(rt,et.props,et.state,et.setState.bind(_assertThisInitialized(et)));return et.setState(_objectSpread({},it)),!!Object.keys(it).length}),_defineProperty(_assertThisInitialized(et),"decrement",function(){var rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;et.moveTo(et.state.selectedItem-(typeof rt=="number"?rt:1))}),_defineProperty(_assertThisInitialized(et),"increment",function(){var rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;et.moveTo(et.state.selectedItem+(typeof rt=="number"?rt:1))}),_defineProperty(_assertThisInitialized(et),"moveTo",function(rt){if(typeof rt=="number"){var nt=_react.Children.count(et.props.children)-1;rt<0&&(rt=et.props.infiniteLoop?nt:0),rt>nt&&(rt=et.props.infiniteLoop?0:nt),et.selectItem({selectedItem:rt}),et.state.autoPlay&&et.state.isMouseEntered===!1&&et.resetAutoPlay()}}),_defineProperty(_assertThisInitialized(et),"onClickNext",function(){et.increment(1)}),_defineProperty(_assertThisInitialized(et),"onClickPrev",function(){et.decrement(1)}),_defineProperty(_assertThisInitialized(et),"onSwipeForward",function(){et.increment(1),et.props.emulateTouch&&et.setState({cancelClick:!0})}),_defineProperty(_assertThisInitialized(et),"onSwipeBackwards",function(){et.decrement(1),et.props.emulateTouch&&et.setState({cancelClick:!0})}),_defineProperty(_assertThisInitialized(et),"changeItem",function(rt){return function(nt){(!(0,_utils.isKeyboardEvent)(nt)||nt.key==="Enter")&&et.moveTo(rt)}}),_defineProperty(_assertThisInitialized(et),"selectItem",function(rt){et.setState(_objectSpread({previousItem:et.state.selectedItem},rt),function(){et.setState(et.animationHandler(et.props,et.state))}),et.handleOnChange(rt.selectedItem,_react.Children.toArray(et.props.children)[rt.selectedItem])}),_defineProperty(_assertThisInitialized(et),"getInitialImage",function(){var rt=et.props.selectedItem,nt=et.itemsRef&&et.itemsRef[rt],it=nt&&nt.getElementsByTagName("img")||[];return it[0]}),_defineProperty(_assertThisInitialized(et),"getVariableItemHeight",function(rt){var nt=et.itemsRef&&et.itemsRef[rt];if(et.state.hasMount&&nt&&nt.children.length){var it=nt.children[0].getElementsByTagName("img")||[];if(it.length>0){var at=it[0];if(!at.complete){var st=function dt(){et.forceUpdate(),at.removeEventListener("load",dt)};at.addEventListener("load",st)}}var ot=it[0]||nt.children[0],ut=ot.clientHeight;return ut>0?ut:null}return null});var tt={initialized:!1,previousItem:j.selectedItem,selectedItem:j.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:j.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return et.animationHandler=typeof j.animationHandler=="function"&&j.animationHandler||j.animationHandler==="fade"&&_animations.fadeAnimationHandler||_animations.slideAnimationHandler,et.state=_objectSpread(_objectSpread({},tt),et.animationHandler(j,tt)),et}return _createClass($,[{key:"componentDidMount",value:function(){this.props.children&&this.setupCarousel()}},{key:"componentDidUpdate",value:function(et,tt){!et.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!et.autoFocus&&this.props.autoFocus&&this.forceFocus(),tt.swiping&&!this.state.swiping&&this.setState(_objectSpread({},this.props.stopSwipingHandler(this.props,this.state))),(et.selectedItem!==this.props.selectedItem||et.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),et.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:"componentWillUnmount",value:function(){this.destroyCarousel()}},{key:"setupCarousel",value:function(){var et=this;this.bindEvents(),this.state.autoPlay&&_react.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var tt=et.getInitialImage();tt&&!tt.complete?tt.addEventListener("load",et.setMountState):et.setMountState()})}},{key:"destroyCarousel",value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:"setupAutoPlay",value:function(){this.autoPlay();var et=this.carouselWrapperRef;this.props.stopOnHover&&et&&(et.addEventListener("mouseenter",this.stopOnHover),et.addEventListener("mouseleave",this.startOnLeave))}},{key:"destroyAutoPlay",value:function(){this.clearAutoPlay();var et=this.carouselWrapperRef;this.props.stopOnHover&&et&&(et.removeEventListener("mouseenter",this.stopOnHover),et.removeEventListener("mouseleave",this.startOnLeave))}},{key:"bindEvents",value:function(){(0,_window.default)().addEventListener("resize",this.updateSizes),(0,_window.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.props.useKeyboardArrows&&(0,_document.default)().addEventListener("keydown",this.navigateWithKeyboard)}},{key:"unbindEvents",value:function(){(0,_window.default)().removeEventListener("resize",this.updateSizes),(0,_window.default)().removeEventListener("DOMContentLoaded",this.updateSizes);var et=this.getInitialImage();et&&et.removeEventListener("load",this.setMountState),this.props.useKeyboardArrows&&(0,_document.default)().removeEventListener("keydown",this.navigateWithKeyboard)}},{key:"forceFocus",value:function(){var et;(et=this.carouselWrapperRef)===null||et===void 0||et.focus()}},{key:"renderItems",value:function(et){var tt=this;return this.props.children?_react.Children.map(this.props.children,function(rt,nt){var it=nt===tt.state.selectedItem,at=nt===tt.state.previousItem,st=it&&tt.state.selectedStyle||at&&tt.state.prevStyle||tt.state.slideStyle||{};tt.props.centerMode&&tt.props.axis==="horizontal"&&(st=_objectSpread(_objectSpread({},st),{},{minWidth:tt.props.centerSlidePercentage+"%"})),tt.state.swiping&&tt.state.swipeMovementStarted&&(st=_objectSpread(_objectSpread({},st),{},{pointerEvents:"none"}));var ot={ref:function(dt){return tt.setItemsRef(dt,nt)},key:"itemKey"+nt+(et?"clone":""),className:_cssClasses.default.ITEM(!0,nt===tt.state.selectedItem,nt===tt.state.previousItem),onClick:tt.handleClickItem.bind(tt,nt,rt),style:st};return _react.default.createElement("li",ot,tt.props.renderItem(rt,{isSelected:nt===tt.state.selectedItem,isPrevious:nt===tt.state.previousItem}))}):[]}},{key:"renderControls",value:function(){var et=this,tt=this.props,rt=tt.showIndicators,nt=tt.labels,it=tt.renderIndicator,at=tt.children;return rt?_react.default.createElement("ul",{className:"control-dots"},_react.Children.map(at,function(st,ot){return it&&it(et.changeItem(ot),ot===et.state.selectedItem,ot,nt.item)})):null}},{key:"renderStatus",value:function(){return this.props.showStatus?_react.default.createElement("p",{className:"carousel-status"},this.props.statusFormatter(this.state.selectedItem+1,_react.Children.count(this.props.children))):null}},{key:"renderThumbs",value:function(){return!this.props.showThumbs||!this.props.children||_react.Children.count(this.props.children)===0?null:_react.default.createElement(_Thumbs.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:"render",value:function(){var et=this;if(!this.props.children||_react.Children.count(this.props.children)===0)return null;var tt=this.props.swipeable&&_react.Children.count(this.props.children)>1,rt=this.props.axis==="horizontal",nt=this.props.showArrows&&_react.Children.count(this.props.children)>1,it=nt&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,at=nt&&(this.state.selectedItem<_react.Children.count(this.props.children)-1||this.props.infiniteLoop)||!1,st=this.renderItems(!0),ot=st.shift(),ut=st.pop(),dt={className:_cssClasses.default.SLIDER(!0,this.state.swiping),onSwipeMove:this.onSwipeMove,onSwipeStart:this.onSwipeStart,onSwipeEnd:this.onSwipeEnd,style:this.state.itemListStyle,tolerance:this.props.swipeScrollTolerance},mt={};if(rt){if(dt.onSwipeLeft=this.onSwipeForward,dt.onSwipeRight=this.onSwipeBackwards,this.props.dynamicHeight){var xt=this.getVariableItemHeight(this.state.selectedItem);mt.height=xt||"auto"}}else dt.onSwipeUp=this.props.verticalSwipe==="natural"?this.onSwipeBackwards:this.onSwipeForward,dt.onSwipeDown=this.props.verticalSwipe==="natural"?this.onSwipeForward:this.onSwipeBackwards,dt.style=_objectSpread(_objectSpread({},dt.style),{},{height:this.state.itemSize}),mt.height=this.state.itemSize;return _react.default.createElement("div",{"aria-label":this.props.ariaLabel,className:_cssClasses.default.ROOT(this.props.className),ref:this.setCarouselWrapperRef,tabIndex:this.props.useKeyboardArrows?0:void 0},_react.default.createElement("div",{className:_cssClasses.default.CAROUSEL(!0),style:{width:this.props.width}},this.renderControls(),this.props.renderArrowPrev(this.onClickPrev,it,this.props.labels.leftArrow),_react.default.createElement("div",{className:_cssClasses.default.WRAPPER(!0,this.props.axis),style:mt},tt?_react.default.createElement(_reactEasySwipe.default,_extends({tagName:"ul",innerRef:this.setListRef},dt,{allowMouseEvents:this.props.emulateTouch}),this.props.infiniteLoop&&ut,this.renderItems(),this.props.infiniteLoop&&ot):_react.default.createElement("ul",{className:_cssClasses.default.SLIDER(!0,this.state.swiping),ref:function(Pt){return et.setListRef(Pt)},style:this.state.itemListStyle||{}},this.props.infiniteLoop&&ut,this.renderItems(),this.props.infiniteLoop&&ot)),this.props.renderArrowNext(this.onClickNext,at,this.props.labels.rightArrow),this.renderStatus()),this.renderThumbs())}}]),$}(_react.default.Component);Carousel$1.default=Carousel;_defineProperty(Carousel,"displayName","Carousel");_defineProperty(Carousel,"defaultProps",{ariaLabel:void 0,axis:"horizontal",centerSlidePercentage:80,interval:3e3,labels:{leftArrow:"previous slide / item",rightArrow:"next slide / item",item:"slide item"},onClickItem:_utils.noop,onClickThumb:_utils.noop,onChange:_utils.noop,onSwipeStart:function _(){},onSwipeEnd:function _(){},onSwipeMove:function _(){return!1},preventMovementUntilSwipeScrollTolerance:!1,renderArrowPrev:function _(a,$,j){return _react.default.createElement("button",{type:"button","aria-label":j,className:_cssClasses.default.ARROW_PREV(!$),onClick:a})},renderArrowNext:function _(a,$,j){return _react.default.createElement("button",{type:"button","aria-label":j,className:_cssClasses.default.ARROW_NEXT(!$),onClick:a})},renderIndicator:function _(a,$,j,et){return _react.default.createElement("li",{className:_cssClasses.default.DOT($),onClick:a,onKeyDown:a,value:j,key:j,role:"button",tabIndex:0,"aria-label":"".concat(et," ").concat(j+1)})},renderItem:function _(a){return a},renderThumbs:function _(a){var $=_react.Children.map(a,function(j){var et=j;if(j.type!=="img"&&(et=_react.Children.toArray(j.props.children).find(function(tt){return tt.type==="img"})),!!et)return et});return $.filter(function(j){return j}).length===0?(console.warn("No images found! Can't build the thumb list without images. If you don't need thumbs, set showThumbs={false} in the Carousel. Note that it's not possible to get images rendered inside custom components. More info at https://github.com/leandrowd/react-responsive-carousel/blob/master/TROUBLESHOOTING.md"),[]):$},statusFormatter:_utils.defaultStatusFormatter,selectedItem:0,showArrows:!0,showIndicators:!0,showStatus:!0,showThumbs:!0,stopOnHover:!0,swipeScrollTolerance:5,swipeable:!0,transitionTime:350,verticalSwipe:"standard",width:"100%",animationHandler:"slide",swipeAnimationHandler:_animations.slideSwipeAnimationHandler,stopSwipingHandler:_animations.slideStopSwipingHandler});var types={};(function(_){Object.defineProperty(_,"__esModule",{value:!0}),Object.defineProperty(_,"Carousel",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(_,"CarouselProps",{enumerable:!0,get:function(){return $.CarouselProps}}),Object.defineProperty(_,"Thumbs",{enumerable:!0,get:function(){return j.default}});var a=et(Carousel$1),$=types,j=et(Thumbs$1);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}})(js);const Slider=({children:_})=>{const a={background:colors.gray[400],width:"10px",height:"10px",display:"inline-block",margin:"0 4px 60px 4px",borderRadius:"5px"};return jsxRuntimeExports.jsx(Box,{backgroundImage:"linear-gradient(180deg, rgba(18, 18, 18, 0.00) 36.43%, rgba(18, 18, 18, 0.50) 53.65%, #121212 76.24%)",borderRightRadius:"30px",backgroundColor:"#323131",children:jsxRuntimeExports.jsx(js.Carousel,{autoPlay:!0,dynamicHeight:!1,infiniteLoop:!0,interval:5e3,renderIndicator:($,j,et)=>j?jsxRuntimeExports.jsx("li",{style:{...a,background:"#00C39A",width:"24px"}}):jsxRuntimeExports.jsx("li",{onClick:$,onKeyDown:$,role:"button",style:a,tabIndex:0,value:et},et),showArrows:!1,showStatus:!1,showThumbs:!1,transitionTime:1e3,children:_})})},SlideItem=({item:_})=>jsxRuntimeExports.jsx(Box,{height:"730px",paddingTop:"500px",paddingBottom:"35px",backgroundImage:_.image,backgroundSize:"cover",backgroundRepeat:"no-repeat","data-testid":`slide-${_.id}`,children:jsxRuntimeExports.jsxs(Center,{flexDirection:"column",paddingBottom:"50px",children:[jsxRuntimeExports.jsx(CircleIcon,{icon:_.icon,size:"58px"}),jsxRuntimeExports.jsx(Text,{width:"400px",margin:"16px 50px 0 50px",children:_.text})]})}),SliderItems=[{id:1,text:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{as:"span",fontWeight:600,size:"md",children:"Streamline asset management: "}),jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"one mnemonic, multiple accounts, full control."})]}),icon:jsxRuntimeExports.jsx(SlidersIcon,{}),image:AccountsImage},{id:2,text:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"Enhance security with "}),jsxRuntimeExports.jsx(Text,{as:"span",fontWeight:600,size:"md",children:"Multi-sig"}),jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:", requiring multiple signatures for transaction executions."})]}),icon:jsxRuntimeExports.jsx(KeyIcon,{width:"32px",height:"32px",strokeWidth:"0.9"}),image:MultisigImage},{id:3,text:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"Utilize the "}),jsxRuntimeExports.jsx(Text,{as:"span",fontWeight:600,size:"md",children:"Batch "}),jsxRuntimeExports.jsx(Text,{as:"span",size:"md",children:"feature to bundle transactions, improving efficiency and reducing costs."})]}),icon:jsxRuntimeExports.jsx(BatchIcon,{width:"32px",height:"32px",strokeWidth:"0.9"}),image:BatchImage}],WelcomeScreen=()=>{const[_,a]=reactExports.useState(!0),{onOpen:$,modalElement:j}=useOnboardingModal(()=>a(!0)),et=()=>{a(!1),$()};return jsxRuntimeExports.jsxs(Center,{height:"100vh",padding:"60px",backgroundImage:BackgroundImage,backgroundSize:"cover",children:[_&&jsxRuntimeExports.jsxs(SimpleGrid,{borderRadius:"30px",boxShadow:"0px 0px 30px rgba(0, 0, 0, 0.30)",columns:[1,1,2],children:[jsxRuntimeExports.jsx(Center,{width:"100%",maxWidth:"660px",background:colors.gray[800],borderLeftRadius:"30px",children:jsxRuntimeExports.jsxs(VStack,{maxWidth:"400px",padding:"32px",spacing:"0",children:[jsxRuntimeExports.jsx(MakiLogo,{width:"48px",height:"48px",marginBottom:"24px"}),jsxRuntimeExports.jsx(Heading,{marginBottom:"16px",size:"3xl",children:"Welcome to Umami"}),jsxRuntimeExports.jsx(Divider,{maxWidth:"400px",marginBottom:"16px"}),jsxRuntimeExports.jsx(Text,{marginBottom:"32px",color:colors.gray[450],children:"A powerful Tezos wallet"}),jsxRuntimeExports.jsx(Button,{width:"100%",marginBottom:"24px",onClick:et,size:"lg",children:"Get started"}),jsxRuntimeExports.jsx(AppVersion,{fontSize:"13px"})]})}),jsxRuntimeExports.jsx(Box,{maxWidth:"660px",children:jsxRuntimeExports.jsx(Slider,{children:SliderItems.map(tt=>jsxRuntimeExports.jsx(SlideItem,{item:tt},tt.id))})})]}),j]})},Router=()=>(useDeeplinkHandler(),useImplicitAccounts().length>0?jsxRuntimeExports.jsx(LoggedInRouterWithPolling,{}):jsxRuntimeExports.jsx(LoggedOutRouter,{})),LoggedInRouterWithPolling=()=>{useDataPolling();const _=useDynamicModal();return jsxRuntimeExports.jsx(HashRouter,{children:jsxRuntimeExports.jsx(DynamicModalContext.Provider,{value:_,children:jsxRuntimeExports.jsxs(BeaconProvider,{children:[jsxRuntimeExports.jsx(AnnouncementBanner,{}),jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(HomeView,{})),path:"/home"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(HomeView,{})),path:"/home/:ownerPkh/:nftId"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(NFTsView,{})),path:"/nfts"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(OperationsView,{})),path:"/operations"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(TokensPage,{})),path:"/tokens"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(AddressBookView,{})),path:"/address-book"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(SettingsView,{})),path:"/settings"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(HelpView,{})),path:"/help"}),jsxRuntimeExports.jsx(Route,{element:withSideMenu(jsxRuntimeExports.jsx(BatchPage,{})),path:"/batch"}),jsxRuntimeExports.jsx(Route,{element:jsxRuntimeExports.jsx(Navigate,{to:"/home"}),path:"/*"})]}),_.content]})})})},LoggedOutRouter=()=>{const _=useResetConnections();return reactExports.useEffect(()=>{WalletClient.destroy().then(_).catch(lodashExports.noop)},[_]),jsxRuntimeExports.jsx(HashRouter,{children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{element:jsxRuntimeExports.jsx(Navigate,{to:"/welcome"}),path:"/*"}),jsxRuntimeExports.jsx(Route,{element:jsxRuntimeExports.jsx(WelcomeScreen,{}),path:"/welcome"})]})})},logError=(_,a)=>{const $={...getErrorContext(_),stacktrace:String(a.componentStack)};store.dispatch(errorsSlice.actions.add($))};Object.defineProperty(window,"reduxStore",{value:store});const root=client.createRoot(document.getElementById("root"));root.render(jsxRuntimeExports.jsx(React$2.StrictMode,{children:jsxRuntimeExports.jsx(UmamiTheme,{children:jsxRuntimeExports.jsx(ReduxStore,{children:jsxRuntimeExports.jsx(PersistGate,{loading:null,persistor,children:jsxRuntimeExports.jsx(ErrorBoundary,{fallback:jsxRuntimeExports.jsx(ErrorPage,{}),onError:logError,children:jsxRuntimeExports.jsx(ReactQueryProvider,{children:jsxRuntimeExports.jsx(Router,{})})})})})})}));export{__vitePreload as _,getDefaultExportFromCjs$1 as g,patterns as p,reactExports as r,utils$1 as u}; diff --git a/index.html b/index.html index 8674038043..5f6d82c988 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ --> Umami - +